#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/videodev2.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-rect.h>
#include <media/videobuf2-dma-contig.h>
#define DRV_NAME …
#define DCMI_CR …
#define DCMI_SR …
#define DCMI_RIS …
#define DCMI_IER …
#define DCMI_MIS …
#define DCMI_ICR …
#define DCMI_ESCR …
#define DCMI_ESUR …
#define DCMI_CWSTRT …
#define DCMI_CWSIZE …
#define DCMI_DR …
#define DCMI_IDR …
#define CR_CAPTURE …
#define CR_CM …
#define CR_CROP …
#define CR_JPEG …
#define CR_ESS …
#define CR_PCKPOL …
#define CR_HSPOL …
#define CR_VSPOL …
#define CR_FCRC_0 …
#define CR_FCRC_1 …
#define CR_EDM_0 …
#define CR_EDM_1 …
#define CR_ENABLE …
#define SR_HSYNC …
#define SR_VSYNC …
#define SR_FNE …
#define IT_FRAME …
#define IT_OVR …
#define IT_ERR …
#define IT_VSYNC …
#define IT_LINE …
enum state { … };
#define MIN_WIDTH …
#define MAX_WIDTH …
#define MIN_HEIGHT …
#define MAX_HEIGHT …
#define TIMEOUT_MS …
#define OVERRUN_ERROR_THRESHOLD …
struct dcmi_format { … };
struct dcmi_framesize { … };
struct dcmi_buf { … };
struct stm32_dcmi { … };
static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n)
{ … }
static inline u32 reg_read(void __iomem *base, u32 reg)
{ … }
static inline void reg_write(void __iomem *base, u32 reg, u32 val)
{ … }
static inline void reg_set(void __iomem *base, u32 reg, u32 mask)
{ … }
static inline void reg_clear(void __iomem *base, u32 reg, u32 mask)
{ … }
static int dcmi_start_capture(struct stm32_dcmi *dcmi, struct dcmi_buf *buf);
static void dcmi_buffer_done(struct stm32_dcmi *dcmi,
struct dcmi_buf *buf,
size_t bytesused,
int err)
{ … }
static int dcmi_restart_capture(struct stm32_dcmi *dcmi)
{ … }
static void dcmi_dma_callback(void *param)
{ … }
static int dcmi_start_dma(struct stm32_dcmi *dcmi,
struct dcmi_buf *buf)
{ … }
static int dcmi_start_capture(struct stm32_dcmi *dcmi, struct dcmi_buf *buf)
{ … }
static void dcmi_set_crop(struct stm32_dcmi *dcmi)
{ … }
static void dcmi_process_jpeg(struct stm32_dcmi *dcmi)
{ … }
static irqreturn_t dcmi_irq_thread(int irq, void *arg)
{ … }
static irqreturn_t dcmi_irq_callback(int irq, void *arg)
{ … }
static int dcmi_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers,
unsigned int *nplanes,
unsigned int sizes[],
struct device *alloc_devs[])
{ … }
static int dcmi_buf_init(struct vb2_buffer *vb)
{ … }
static int dcmi_buf_prepare(struct vb2_buffer *vb)
{ … }
static void dcmi_buf_queue(struct vb2_buffer *vb)
{ … }
static struct media_entity *dcmi_find_source(struct stm32_dcmi *dcmi)
{ … }
static int dcmi_pipeline_s_fmt(struct stm32_dcmi *dcmi,
struct v4l2_subdev_format *format)
{ … }
static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)
{ … }
static void dcmi_stop_streaming(struct vb2_queue *vq)
{ … }
static const struct vb2_ops dcmi_video_qops = …;
static int dcmi_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *fmt)
{ … }
static const struct dcmi_format *find_format_by_fourcc(struct stm32_dcmi *dcmi,
unsigned int fourcc)
{ … }
static void __find_outer_frame_size(struct stm32_dcmi *dcmi,
struct v4l2_pix_format *pix,
struct dcmi_framesize *framesize)
{ … }
static int dcmi_try_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f,
const struct dcmi_format **sd_format,
struct dcmi_framesize *sd_framesize)
{ … }
static int dcmi_set_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f)
{ … }
static int dcmi_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int dcmi_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int dcmi_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int dcmi_get_sensor_format(struct stm32_dcmi *dcmi,
struct v4l2_pix_format *pix)
{ … }
static int dcmi_set_sensor_format(struct stm32_dcmi *dcmi,
struct v4l2_pix_format *pix)
{ … }
static int dcmi_get_sensor_bounds(struct stm32_dcmi *dcmi,
struct v4l2_rect *r)
{ … }
static int dcmi_g_selection(struct file *file, void *fh,
struct v4l2_selection *s)
{ … }
static int dcmi_s_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{ … }
static int dcmi_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int dcmi_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{ … }
static int dcmi_g_input(struct file *file, void *priv, unsigned int *i)
{ … }
static int dcmi_s_input(struct file *file, void *priv, unsigned int i)
{ … }
static int dcmi_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{ … }
static int dcmi_g_parm(struct file *file, void *priv,
struct v4l2_streamparm *p)
{ … }
static int dcmi_s_parm(struct file *file, void *priv,
struct v4l2_streamparm *p)
{ … }
static int dcmi_enum_frameintervals(struct file *file, void *fh,
struct v4l2_frmivalenum *fival)
{ … }
static const struct of_device_id stm32_dcmi_of_match[] = …;
MODULE_DEVICE_TABLE(of, stm32_dcmi_of_match);
static int dcmi_open(struct file *file)
{ … }
static int dcmi_release(struct file *file)
{ … }
static const struct v4l2_ioctl_ops dcmi_ioctl_ops = …;
static const struct v4l2_file_operations dcmi_fops = …;
static int dcmi_set_default_fmt(struct stm32_dcmi *dcmi)
{ … }
static const struct dcmi_format dcmi_formats[] = …;
static int dcmi_formats_init(struct stm32_dcmi *dcmi)
{ … }
static int dcmi_framesizes_init(struct stm32_dcmi *dcmi)
{ … }
static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)
{ … }
static void dcmi_graph_notify_unbind(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *sd,
struct v4l2_async_connection *asd)
{ … }
static int dcmi_graph_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_connection *asd)
{ … }
static const struct v4l2_async_notifier_operations dcmi_graph_notify_ops = …;
static int dcmi_graph_init(struct stm32_dcmi *dcmi)
{ … }
static int dcmi_probe(struct platform_device *pdev)
{ … }
static void dcmi_remove(struct platform_device *pdev)
{ … }
static __maybe_unused int dcmi_runtime_suspend(struct device *dev)
{ … }
static __maybe_unused int dcmi_runtime_resume(struct device *dev)
{ … }
static __maybe_unused int dcmi_suspend(struct device *dev)
{ … }
static __maybe_unused int dcmi_resume(struct device *dev)
{ … }
static const struct dev_pm_ops dcmi_pm_ops = …;
static struct platform_driver stm32_dcmi_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;