linux/drivers/media/platform/microchip/microchip-csi2dc.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Microchip CSI2 Demux Controller (CSI2DC) driver
 *
 * Copyright (C) 2018 Microchip Technology, Inc.
 *
 * Author: Eugen Hristev <[email protected]>
 *
 */

#include <linux/clk.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/videodev2.h>

#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>

/* Global configuration register */
#define CSI2DC_GCFG

/* MIPI sensor pixel clock is free running */
#define CSI2DC_GCFG_MIPIFRN
/* GPIO parallel interface selection */
#define CSI2DC_GCFG_GPIOSEL
/* Output waveform inter-line minimum delay */
#define CSI2DC_GCFG_HLC(v)
#define CSI2DC_GCFG_HLC_MASK
/* SAMA7G5 requires a HLC delay of 15 */
#define SAMA7G5_HLC

/* Global control register */
#define CSI2DC_GCTLR
#define CSI2DC_GCTLR_SWRST

/* Global status register */
#define CSI2DC_GS

/* SSP interrupt status register */
#define CSI2DC_SSPIS
/* Pipe update register */
#define CSI2DC_PU
/* Video pipe attributes update */
#define CSI2DC_PU_VP

/* Pipe update status register */
#define CSI2DC_PUS

/* Video pipeline Interrupt Status Register */
#define CSI2DC_VPISR

/* Video pipeline enable register */
#define CSI2DC_VPE
#define CSI2DC_VPE_ENABLE

/* Video pipeline configuration register */
#define CSI2DC_VPCFG
/* Data type */
#define CSI2DC_VPCFG_DT(v)
#define CSI2DC_VPCFG_DT_MASK
/* Virtual channel identifier */
#define CSI2DC_VPCFG_VC(v)
#define CSI2DC_VPCFG_VC_MASK
/* Decompression enable */
#define CSI2DC_VPCFG_DE
/* Decoder mode */
#define CSI2DC_VPCFG_DM(v)
#define CSI2DC_VPCFG_DM_DECODER8TO12
/* Decoder predictor 2 selection */
#define CSI2DC_VPCFG_DP2
/* Recommended memory storage */
#define CSI2DC_VPCFG_RMS
/* Post adjustment */
#define CSI2DC_VPCFG_PA

/* Video pipeline column register */
#define CSI2DC_VPCOL
/* Column number */
#define CSI2DC_VPCOL_COL(v)
#define CSI2DC_VPCOL_COL_MASK

/* Video pipeline row register */
#define CSI2DC_VPROW
/* Row number */
#define CSI2DC_VPROW_ROW(v)
#define CSI2DC_VPROW_ROW_MASK

/* Version register */
#define CSI2DC_VERSION

/* register read/write helpers */
#define csi2dc_readl(st, reg)
#define csi2dc_writel(st, reg, val)

/* supported RAW data types */
#define CSI2DC_DT_RAW6
#define CSI2DC_DT_RAW7
#define CSI2DC_DT_RAW8
#define CSI2DC_DT_RAW10
#define CSI2DC_DT_RAW12
#define CSI2DC_DT_RAW14
/* YUV data types */
#define CSI2DC_DT_YUV422_8B

/*
 * struct csi2dc_format - CSI2DC format type struct
 * @mbus_code:		Media bus code for the format
 * @dt:			Data type constant for this format
 */
struct csi2dc_format {};

static const struct csi2dc_format csi2dc_formats[] =;

enum mipi_csi_pads {};

/*
 * struct csi2dc_device - CSI2DC device driver data/config struct
 * @base:		Register map base address
 * @csi2dc_sd:		v4l2 subdevice for the csi2dc device
 *			This is the subdevice that the csi2dc device itself
 *			registers in v4l2 subsystem
 * @dev:		struct device for this csi2dc device
 * @pclk:		Peripheral clock reference
 *			Input clock that clocks the hardware block internal
 *			logic
 * @scck:		Sensor Controller clock reference
 *			Input clock that is used to generate the pixel clock
 * @format:		Current saved format used in g/s fmt
 * @cur_fmt:		Current state format
 * @try_fmt:		Try format that is being tried
 * @pads:		Media entity pads for the csi2dc subdevice
 * @clk_gated:		Whether the clock is gated or free running
 * @video_pipe:		Whether video pipeline is configured
 * @parallel_mode:	The underlying subdevice is connected on a parallel bus
 * @vc:			Current set virtual channel
 * @notifier:		Async notifier that is used to bound the underlying
 *			subdevice to the csi2dc subdevice
 * @input_sd:		Reference to the underlying subdevice bound to the
 *			csi2dc subdevice
 * @remote_pad:		Pad number of the underlying subdevice that is linked
 *			to the csi2dc subdevice sink pad.
 */
struct csi2dc_device {};

static inline struct csi2dc_device *
csi2dc_sd_to_csi2dc_device(struct v4l2_subdev *csi2dc_sd)
{}

static int csi2dc_enum_mbus_code(struct v4l2_subdev *csi2dc_sd,
				 struct v4l2_subdev_state *sd_state,
				 struct v4l2_subdev_mbus_code_enum *code)
{}

static int csi2dc_get_fmt(struct v4l2_subdev *csi2dc_sd,
			  struct v4l2_subdev_state *sd_state,
			  struct v4l2_subdev_format *format)
{}

static int csi2dc_set_fmt(struct v4l2_subdev *csi2dc_sd,
			  struct v4l2_subdev_state *sd_state,
			  struct v4l2_subdev_format *req_fmt)
{}

static int csi2dc_power(struct csi2dc_device *csi2dc, int on)
{}

static int csi2dc_get_mbus_config(struct csi2dc_device *csi2dc)
{}

static void csi2dc_vp_update(struct csi2dc_device *csi2dc)
{}

static int csi2dc_s_stream(struct v4l2_subdev *csi2dc_sd, int enable)
{}

static int csi2dc_init_state(struct v4l2_subdev *csi2dc_sd,
			     struct v4l2_subdev_state *sd_state)
{}

static const struct media_entity_operations csi2dc_entity_ops =;

static const struct v4l2_subdev_pad_ops csi2dc_pad_ops =;

static const struct v4l2_subdev_video_ops csi2dc_video_ops =;

static const struct v4l2_subdev_ops csi2dc_subdev_ops =;

static const struct v4l2_subdev_internal_ops csi2dc_internal_ops =;

static int csi2dc_async_bound(struct v4l2_async_notifier *notifier,
			      struct v4l2_subdev *subdev,
			      struct v4l2_async_connection *asd)
{}

static const struct v4l2_async_notifier_operations csi2dc_async_ops =;

static int csi2dc_prepare_notifier(struct csi2dc_device *csi2dc,
				   struct fwnode_handle *input_fwnode)
{}

static int csi2dc_of_parse(struct csi2dc_device *csi2dc,
			   struct device_node *of_node)
{}

static void csi2dc_default_format(struct csi2dc_device *csi2dc)
{}

static int csi2dc_probe(struct platform_device *pdev)
{}

static void csi2dc_remove(struct platform_device *pdev)
{}

static int __maybe_unused csi2dc_runtime_suspend(struct device *dev)
{}

static int __maybe_unused csi2dc_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops csi2dc_dev_pm_ops =;

static const struct of_device_id csi2dc_of_match[] =;

MODULE_DEVICE_TABLE(of, csi2dc_of_match);

static struct platform_driver csi2dc_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();