#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mem2mem.h>
#include <media/videobuf2-dma-contig.h>
#include <uapi/linux/dw100.h>
#include "dw100_regs.h"
#define DRV_NAME …
#define DW100_MIN_W …
#define DW100_MIN_H …
#define DW100_MAX_W …
#define DW100_MAX_H …
#define DW100_ALIGN_W …
#define DW100_ALIGN_H …
#define DW100_BLOCK_SIZE …
#define DW100_DEF_W …
#define DW100_DEF_H …
#define DW100_DEF_LUT_W …
#define DW100_DEF_LUT_H …
#define DW100_MAX_CTRLS …
#define DW100_CTRL_DEWARPING_MAP …
enum { … };
enum { … };
struct dw100_device { … };
struct dw100_q_data { … };
struct dw100_ctx { … };
static const struct v4l2_frmsize_stepwise dw100_frmsize_stepwise = …;
static const struct dw100_fmt { … } formats[] = …;
static inline int to_dw100_fmt_type(enum v4l2_buf_type type)
{ … }
static const struct dw100_fmt *dw100_find_pixel_format(u32 pixel_format,
int fmt_type)
{ … }
static const struct dw100_fmt *dw100_find_format(struct v4l2_format *f)
{ … }
static inline u32 dw100_read(struct dw100_device *dw_dev, u32 reg)
{ … }
static inline void dw100_write(struct dw100_device *dw_dev, u32 reg, u32 val)
{ … }
static inline int dw100_dump_regs(struct seq_file *m)
{ … }
static inline struct dw100_ctx *dw100_file2ctx(struct file *file)
{ … }
static struct dw100_q_data *dw100_get_q_data(struct dw100_ctx *ctx,
enum v4l2_buf_type type)
{ … }
static u32 dw100_get_n_vertices_from_length(u32 length)
{ … }
static u16 dw100_map_convert_to_uq12_4(u32 a)
{ … }
static u32 dw100_map_format_coordinates(u16 xq, u16 yq)
{ … }
static u32 *dw100_get_user_map(struct dw100_ctx *ctx)
{ … }
static int dw100_create_mapping(struct dw100_ctx *ctx)
{ … }
static void dw100_destroy_mapping(struct dw100_ctx *ctx)
{ … }
static int dw100_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops dw100_ctrl_ops = …;
static void dw100_ctrl_dewarping_map_init(const struct v4l2_ctrl *ctrl,
u32 from_idx,
union v4l2_ctrl_ptr ptr)
{ … }
static const struct v4l2_ctrl_type_ops dw100_ctrl_type_ops = …;
static const struct v4l2_ctrl_config controls[] = …;
static int dw100_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static int dw100_buf_prepare(struct vb2_buffer *vb)
{ … }
static void dw100_buf_queue(struct vb2_buffer *vb)
{ … }
static void dw100_return_all_buffers(struct vb2_queue *q,
enum vb2_buffer_state state)
{ … }
static int dw100_start_streaming(struct vb2_queue *q, unsigned int count)
{ … }
static void dw100_stop_streaming(struct vb2_queue *q)
{ … }
static const struct vb2_ops dw100_qops = …;
static int dw100_m2m_queue_init(void *priv, struct vb2_queue *src_vq,
struct vb2_queue *dst_vq)
{ … }
static int dw100_open(struct file *file)
{ … }
static int dw100_release(struct file *file)
{ … }
static const struct v4l2_file_operations dw100_fops = …;
static int dw100_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int dw100_enum_fmt_vid(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int dw100_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{ … }
static int dw100_g_fmt_vid(struct file *file, void *priv, struct v4l2_format *f)
{ … }
static int dw100_try_fmt(struct file *file, struct v4l2_format *f)
{ … }
static int dw100_s_fmt(struct dw100_ctx *ctx, struct v4l2_format *f)
{ … }
static int dw100_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int dw100_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int dw100_try_fmt_vid_out(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int dw100_s_fmt_vid_out(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int dw100_g_selection(struct file *file, void *fh,
struct v4l2_selection *sel)
{ … }
static int dw100_s_selection(struct file *file, void *fh,
struct v4l2_selection *sel)
{ … }
static const struct v4l2_ioctl_ops dw100_ioctl_ops = …;
static void dw100_job_finish(struct dw100_device *dw_dev, bool with_error)
{ … }
static void dw100_hw_reset(struct dw100_device *dw_dev)
{ … }
static void _dw100_hw_set_master_bus_enable(struct dw100_device *dw_dev,
unsigned int enable)
{ … }
static void dw100_hw_master_bus_enable(struct dw100_device *dw_dev)
{ … }
static void dw100_hw_master_bus_disable(struct dw100_device *dw_dev)
{ … }
static void dw100_hw_dewarp_start(struct dw100_device *dw_dev)
{ … }
static void dw100_hw_init_ctrl(struct dw100_device *dw_dev)
{ … }
static void dw100_hw_set_pixel_boundary(struct dw100_device *dw_dev)
{ … }
static void dw100_hw_set_scale(struct dw100_device *dw_dev, u8 scale)
{ … }
static void dw100_hw_set_roi(struct dw100_device *dw_dev, u32 x, u32 y)
{ … }
static void dw100_hw_set_src_crop(struct dw100_device *dw_dev,
const struct dw100_q_data *src_q_data,
const struct dw100_q_data *dst_q_data)
{ … }
static void dw100_hw_set_source(struct dw100_device *dw_dev,
const struct dw100_q_data *q_data,
struct vb2_buffer *buffer)
{ … }
static void dw100_hw_set_destination(struct dw100_device *dw_dev,
const struct dw100_q_data *q_data,
const struct dw100_fmt *ifmt,
struct vb2_buffer *buffer)
{ … }
static void dw100_hw_set_mapping(struct dw100_device *dw_dev, dma_addr_t addr,
u32 width, u32 height)
{ … }
static void dw100_hw_clear_irq(struct dw100_device *dw_dev, unsigned int irq)
{ … }
static void dw100_hw_enable_irq(struct dw100_device *dw_dev)
{ … }
static void dw100_hw_disable_irq(struct dw100_device *dw_dev)
{ … }
static u32 dw_hw_get_pending_irqs(struct dw100_device *dw_dev)
{ … }
static irqreturn_t dw100_irq_handler(int irq, void *dev_id)
{ … }
static void dw100_start(struct dw100_ctx *ctx, struct vb2_v4l2_buffer *in_vb,
struct vb2_v4l2_buffer *out_vb)
{ … }
static void dw100_device_run(void *priv)
{ … }
static const struct v4l2_m2m_ops dw100_m2m_ops = …;
static struct video_device *dw100_init_video_device(struct dw100_device *dw_dev)
{ … }
static int dw100_dump_regs_show(struct seq_file *m, void *private)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
static void dw100_debugfs_init(struct dw100_device *dw_dev)
{ … }
static void dw100_debugfs_exit(struct dw100_device *dw_dev)
{ … }
static int dw100_probe(struct platform_device *pdev)
{ … }
static void dw100_remove(struct platform_device *pdev)
{ … }
static int __maybe_unused dw100_runtime_suspend(struct device *dev)
{ … }
static int __maybe_unused dw100_runtime_resume(struct device *dev)
{ … }
static const struct dev_pm_ops dw100_pm = …;
static const struct of_device_id dw100_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, dw100_dt_ids);
static struct platform_driver dw100_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;