#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/ioctl.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-vmalloc.h>
#define RCAR_DRIF_SITMDR1 …
#define RCAR_DRIF_SITMDR2 …
#define RCAR_DRIF_SITMDR3 …
#define RCAR_DRIF_SIRMDR1 …
#define RCAR_DRIF_SIRMDR2 …
#define RCAR_DRIF_SIRMDR3 …
#define RCAR_DRIF_SICTR …
#define RCAR_DRIF_SIFCTR …
#define RCAR_DRIF_SISTR …
#define RCAR_DRIF_SIIER …
#define RCAR_DRIF_SIRFDR …
#define RCAR_DRIF_RFOVF …
#define RCAR_DRIF_RFUDF …
#define RCAR_DRIF_RFSERR …
#define RCAR_DRIF_REOF …
#define RCAR_DRIF_RDREQ …
#define RCAR_DRIF_RFFUL …
#define RCAR_DRIF_SIRMDR1_SYNCMD_FRAME …
#define RCAR_DRIF_SIRMDR1_SYNCMD_LR …
#define RCAR_DRIF_SIRMDR1_SYNCAC_POL_HIGH …
#define RCAR_DRIF_SIRMDR1_SYNCAC_POL_LOW …
#define RCAR_DRIF_SIRMDR1_MSB_FIRST …
#define RCAR_DRIF_SIRMDR1_LSB_FIRST …
#define RCAR_DRIF_SIRMDR1_DTDL_0 …
#define RCAR_DRIF_SIRMDR1_DTDL_1 …
#define RCAR_DRIF_SIRMDR1_DTDL_2 …
#define RCAR_DRIF_SIRMDR1_DTDL_0PT5 …
#define RCAR_DRIF_SIRMDR1_DTDL_1PT5 …
#define RCAR_DRIF_SIRMDR1_SYNCDL_0 …
#define RCAR_DRIF_SIRMDR1_SYNCDL_1 …
#define RCAR_DRIF_SIRMDR1_SYNCDL_2 …
#define RCAR_DRIF_SIRMDR1_SYNCDL_3 …
#define RCAR_DRIF_SIRMDR1_SYNCDL_0PT5 …
#define RCAR_DRIF_SIRMDR1_SYNCDL_1PT5 …
#define RCAR_DRIF_MDR_GRPCNT(n) …
#define RCAR_DRIF_MDR_BITLEN(n) …
#define RCAR_DRIF_MDR_WDCNT(n) …
#define RCAR_DRIF_SITMDR1_PCON …
#define RCAR_DRIF_SICTR_RX_RISING_EDGE …
#define RCAR_DRIF_SICTR_RX_EN …
#define RCAR_DRIF_SICTR_RESET …
#define RCAR_DRIF_NUM_HWBUFS …
#define RCAR_DRIF_MAX_DEVS …
#define RCAR_DRIF_DEFAULT_NUM_HWBUFS …
#define RCAR_DRIF_DEFAULT_HWBUF_SIZE …
#define RCAR_DRIF_MAX_CHANNEL …
#define RCAR_SDR_BUFFER_SIZE …
#define RCAR_DRIF_BUF_DONE …
#define RCAR_DRIF_BUF_OVERFLOW …
#define to_rcar_drif_buf_pair(sdr, ch_num, idx) …
#define for_each_rcar_drif_channel(ch, ch_mask) …
#define rdrif_dbg(sdr, fmt, arg...) …
#define rdrif_err(sdr, fmt, arg...) …
struct rcar_drif_format { … };
static const struct rcar_drif_format formats[] = …;
struct rcar_drif_frame_buf { … };
struct rcar_drif_graph_ep { … };
struct rcar_drif_hwbuf { … };
struct rcar_drif { … };
struct rcar_drif_sdr { … };
static void rcar_drif_write(struct rcar_drif *ch, u32 offset, u32 data)
{ … }
static u32 rcar_drif_read(struct rcar_drif *ch, u32 offset)
{ … }
static void rcar_drif_release_dmachannels(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_alloc_dmachannels(struct rcar_drif_sdr *sdr)
{ … }
static void rcar_drif_release_queued_bufs(struct rcar_drif_sdr *sdr,
enum vb2_buffer_state state)
{ … }
static inline void rcar_drif_set_mdr1(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_set_format(struct rcar_drif_sdr *sdr)
{ … }
static void rcar_drif_release_buf(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_request_buf(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_queue_setup(struct vb2_queue *vq,
unsigned int *num_buffers, unsigned int *num_planes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static void rcar_drif_buf_queue(struct vb2_buffer *vb)
{ … }
static struct rcar_drif_frame_buf *
rcar_drif_get_fbuf(struct rcar_drif_sdr *sdr)
{ … }
static inline bool rcar_drif_bufs_done(struct rcar_drif_hwbuf **buf)
{ … }
static inline bool rcar_drif_bufs_overflow(struct rcar_drif_hwbuf **buf)
{ … }
static inline void rcar_drif_bufs_clear(struct rcar_drif_hwbuf **buf,
unsigned int bit)
{ … }
static void rcar_drif_channel_complete(struct rcar_drif *ch, u32 idx)
{ … }
static void rcar_drif_dma_complete(void *dma_async_param)
{ … }
static int rcar_drif_qbuf(struct rcar_drif *ch)
{ … }
static int rcar_drif_enable_rx(struct rcar_drif_sdr *sdr)
{ … }
static void rcar_drif_disable_rx(struct rcar_drif_sdr *sdr)
{ … }
static void rcar_drif_stop_channel(struct rcar_drif *ch)
{ … }
static void rcar_drif_stop(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_start_channel(struct rcar_drif *ch)
{ … }
static int rcar_drif_start(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_start_streaming(struct vb2_queue *vq, unsigned int count)
{ … }
static void rcar_drif_stop_streaming(struct vb2_queue *vq)
{ … }
static const struct vb2_ops rcar_drif_vb2_ops = …;
static int rcar_drif_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{ … }
static int rcar_drif_set_default_format(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_enum_fmt_sdr_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int rcar_drif_s_fmt_sdr_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int rcar_drif_try_fmt_sdr_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int rcar_drif_enum_freq_bands(struct file *file, void *priv,
struct v4l2_frequency_band *band)
{ … }
static int rcar_drif_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{ … }
static int rcar_drif_s_frequency(struct file *file, void *priv,
const struct v4l2_frequency *f)
{ … }
static int rcar_drif_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *vt)
{ … }
static int rcar_drif_s_tuner(struct file *file, void *priv,
const struct v4l2_tuner *vt)
{ … }
static const struct v4l2_ioctl_ops rcar_drif_ioctl_ops = …;
static const struct v4l2_file_operations rcar_drif_fops = …;
static int rcar_drif_sdr_register(struct rcar_drif_sdr *sdr)
{ … }
static void rcar_drif_sdr_unregister(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_connection *asd)
{ … }
static void rcar_drif_notify_unbind(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_connection *asd)
{ … }
static int rcar_drif_notify_complete(struct v4l2_async_notifier *notifier)
{ … }
static const struct v4l2_async_notifier_operations rcar_drif_notify_ops = …;
static void rcar_drif_get_ep_properties(struct rcar_drif_sdr *sdr,
struct fwnode_handle *fwnode)
{ … }
static int rcar_drif_parse_subdevs(struct rcar_drif_sdr *sdr)
{ … }
static bool rcar_drif_primary_bond(struct platform_device *pdev)
{ … }
static struct device_node *rcar_drif_bond_enabled(struct platform_device *p)
{ … }
static int rcar_drif_bond_available(struct rcar_drif_sdr *sdr,
struct device_node *np)
{ … }
static int rcar_drif_sdr_probe(struct rcar_drif_sdr *sdr)
{ … }
static void rcar_drif_sdr_remove(struct rcar_drif_sdr *sdr)
{ … }
static int rcar_drif_probe(struct platform_device *pdev)
{ … }
static void rcar_drif_remove(struct platform_device *pdev)
{ … }
static int __maybe_unused rcar_drif_suspend(struct device *dev)
{ … }
static int __maybe_unused rcar_drif_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(rcar_drif_pm_ops, rcar_drif_suspend,
rcar_drif_resume);
static const struct of_device_id rcar_drif_of_table[] = …;
MODULE_DEVICE_TABLE(of, rcar_drif_of_table);
#define RCAR_DRIF_DRV_NAME …
static struct platform_driver rcar_drif_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_ALIAS(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;