linux/drivers/media/platform/samsung/exynos4-is/mipi-csis.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Samsung S5P/EXYNOS SoC series MIPI-CSI receiver driver
 *
 * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
 * Author: Sylwester Nawrocki <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/memory.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/videodev2.h>
#include <media/drv-intf/exynos-fimc.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>

#include "mipi-csis.h"

static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC();

/* Register map definition */

/* CSIS global control */
#define S5PCSIS_CTRL
#define S5PCSIS_CTRL_DPDN_DEFAULT
#define S5PCSIS_CTRL_DPDN_SWAP
#define S5PCSIS_CTRL_ALIGN_32BIT
#define S5PCSIS_CTRL_UPDATE_SHADOW
#define S5PCSIS_CTRL_WCLK_EXTCLK
#define S5PCSIS_CTRL_RESET
#define S5PCSIS_CTRL_ENABLE

/* D-PHY control */
#define S5PCSIS_DPHYCTRL
#define S5PCSIS_DPHYCTRL_HSS_MASK
#define S5PCSIS_DPHYCTRL_ENABLE

#define S5PCSIS_CONFIG
#define S5PCSIS_CFG_FMT_YCBCR422_8BIT
#define S5PCSIS_CFG_FMT_RAW8
#define S5PCSIS_CFG_FMT_RAW10
#define S5PCSIS_CFG_FMT_RAW12
/* User defined formats, x = 1...4 */
#define S5PCSIS_CFG_FMT_USER(x)
#define S5PCSIS_CFG_FMT_MASK
#define S5PCSIS_CFG_NR_LANE_MASK

/* Interrupt mask */
#define S5PCSIS_INTMSK
#define S5PCSIS_INTMSK_EVEN_BEFORE
#define S5PCSIS_INTMSK_EVEN_AFTER
#define S5PCSIS_INTMSK_ODD_BEFORE
#define S5PCSIS_INTMSK_ODD_AFTER
#define S5PCSIS_INTMSK_FRAME_START
#define S5PCSIS_INTMSK_FRAME_END
#define S5PCSIS_INTMSK_ERR_SOT_HS
#define S5PCSIS_INTMSK_ERR_LOST_FS
#define S5PCSIS_INTMSK_ERR_LOST_FE
#define S5PCSIS_INTMSK_ERR_OVER
#define S5PCSIS_INTMSK_ERR_ECC
#define S5PCSIS_INTMSK_ERR_CRC
#define S5PCSIS_INTMSK_ERR_UNKNOWN
#define S5PCSIS_INTMSK_EXYNOS4_EN_ALL
#define S5PCSIS_INTMSK_EXYNOS5_EN_ALL

/* Interrupt source */
#define S5PCSIS_INTSRC
#define S5PCSIS_INTSRC_EVEN_BEFORE
#define S5PCSIS_INTSRC_EVEN_AFTER
#define S5PCSIS_INTSRC_EVEN
#define S5PCSIS_INTSRC_ODD_BEFORE
#define S5PCSIS_INTSRC_ODD_AFTER
#define S5PCSIS_INTSRC_ODD
#define S5PCSIS_INTSRC_NON_IMAGE_DATA
#define S5PCSIS_INTSRC_FRAME_START
#define S5PCSIS_INTSRC_FRAME_END
#define S5PCSIS_INTSRC_ERR_SOT_HS
#define S5PCSIS_INTSRC_ERR_LOST_FS
#define S5PCSIS_INTSRC_ERR_LOST_FE
#define S5PCSIS_INTSRC_ERR_OVER
#define S5PCSIS_INTSRC_ERR_ECC
#define S5PCSIS_INTSRC_ERR_CRC
#define S5PCSIS_INTSRC_ERR_UNKNOWN
#define S5PCSIS_INTSRC_ERRORS

/* Pixel resolution */
#define S5PCSIS_RESOL
#define CSIS_MAX_PIX_WIDTH
#define CSIS_MAX_PIX_HEIGHT

/* Non-image packet data buffers */
#define S5PCSIS_PKTDATA_ODD
#define S5PCSIS_PKTDATA_EVEN
#define S5PCSIS_PKTDATA_SIZE

enum {};

static char *csi_clock_name[] =;
#define NUM_CSIS_CLOCKS
#define DEFAULT_SCLK_CSIS_FREQ

static const char * const csis_supply_name[] =;
#define CSIS_NUM_SUPPLIES

enum {};

struct s5pcsis_event {};

static const struct s5pcsis_event s5pcsis_events[] =;
#define S5PCSIS_NUM_EVENTS

struct csis_pktbuf {};

struct csis_drvdata {};

/**
 * struct csis_state - the driver's internal state data structure
 * @lock: mutex serializing the subdev and power management operations,
 *        protecting @format and @flags members
 * @pads: CSIS pads array
 * @sd: v4l2_subdev associated with CSIS device instance
 * @index: the hardware instance index
 * @pdev: CSIS platform device
 * @phy: pointer to the CSIS generic PHY
 * @regs: mmapped I/O registers memory
 * @supplies: CSIS regulator supplies
 * @clock: CSIS clocks
 * @irq: requested s5p-mipi-csis irq number
 * @interrupt_mask: interrupt mask of the all used interrupts
 * @flags: the state variable for power and streaming control
 * @clk_frequency: device bus clock frequency
 * @hs_settle: HS-RX settle time
 * @num_lanes: number of MIPI-CSI data lanes used
 * @max_num_lanes: maximum number of MIPI-CSI data lanes supported
 * @wclk_ext: CSI wrapper clock: 0 - bus clock, 1 - external SCLK_CAM
 * @csis_fmt: current CSIS pixel format
 * @format: common media bus format for the source and sink pad
 * @slock: spinlock protecting structure members below
 * @pkt_buf: the frame embedded (non-image) data buffer
 * @events: MIPI-CSIS event (error) counters
 */
struct csis_state {};

/**
 * struct csis_pix_format - CSIS pixel format description
 * @pix_width_alignment: horizontal pixel alignment, width will be
 *                       multiple of 2^pix_width_alignment
 * @code: corresponding media bus code
 * @fmt_reg: S5PCSIS_CONFIG register value
 * @data_alignment: MIPI-CSI data alignment in bits
 */
struct csis_pix_format {};

static const struct csis_pix_format s5pcsis_formats[] =;

#define s5pcsis_write(__csis, __r, __v)
#define s5pcsis_read(__csis, __r)

static struct csis_state *sd_to_csis_state(struct v4l2_subdev *sdev)
{}

static const struct csis_pix_format *find_csis_format(
	struct v4l2_mbus_framefmt *mf)
{}

static void s5pcsis_enable_interrupts(struct csis_state *state, bool on)
{}

static void s5pcsis_reset(struct csis_state *state)
{}

static void s5pcsis_system_enable(struct csis_state *state, int on)
{}

/* Called with the state.lock mutex held */
static void __s5pcsis_set_format(struct csis_state *state)
{}

static void s5pcsis_set_hsync_settle(struct csis_state *state, int settle)
{}

static void s5pcsis_set_params(struct csis_state *state)
{}

static void s5pcsis_clk_put(struct csis_state *state)
{}

static int s5pcsis_clk_get(struct csis_state *state)
{}

static void dump_regs(struct csis_state *state, const char *label)
{}

static void s5pcsis_start_stream(struct csis_state *state)
{}

static void s5pcsis_stop_stream(struct csis_state *state)
{}

static void s5pcsis_clear_counters(struct csis_state *state)
{}

static void s5pcsis_log_counters(struct csis_state *state, bool non_errors)
{}

/*
 * V4L2 subdev operations
 */
static int s5pcsis_s_power(struct v4l2_subdev *sd, int on)
{}

static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable)
{}

static int s5pcsis_enum_mbus_code(struct v4l2_subdev *sd,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_mbus_code_enum *code)
{}

static struct csis_pix_format const *s5pcsis_try_format(
	struct v4l2_mbus_framefmt *mf)
{}

static struct v4l2_mbus_framefmt *__s5pcsis_get_format(
		struct csis_state *state, struct v4l2_subdev_state *sd_state,
		enum v4l2_subdev_format_whence which)
{}

static int s5pcsis_set_fmt(struct v4l2_subdev *sd,
			   struct v4l2_subdev_state *sd_state,
			   struct v4l2_subdev_format *fmt)
{}

static int s5pcsis_get_fmt(struct v4l2_subdev *sd,
			   struct v4l2_subdev_state *sd_state,
			   struct v4l2_subdev_format *fmt)
{}

static int s5pcsis_s_rx_buffer(struct v4l2_subdev *sd, void *buf,
			       unsigned int *size)
{}

static int s5pcsis_log_status(struct v4l2_subdev *sd)
{}

static const struct v4l2_subdev_core_ops s5pcsis_core_ops =;

static const struct v4l2_subdev_pad_ops s5pcsis_pad_ops =;

static const struct v4l2_subdev_video_ops s5pcsis_video_ops =;

static const struct v4l2_subdev_ops s5pcsis_subdev_ops =;

static irqreturn_t s5pcsis_irq_handler(int irq, void *dev_id)
{}

static int s5pcsis_parse_dt(struct platform_device *pdev,
			    struct csis_state *state)
{}

static int s5pcsis_pm_resume(struct device *dev, bool runtime);
static const struct of_device_id s5pcsis_of_match[];

static int s5pcsis_probe(struct platform_device *pdev)
{}

static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
{}

static int s5pcsis_pm_resume(struct device *dev, bool runtime)
{}

#ifdef CONFIG_PM_SLEEP
static int s5pcsis_suspend(struct device *dev)
{}

static int s5pcsis_resume(struct device *dev)
{}
#endif

#ifdef CONFIG_PM
static int s5pcsis_runtime_suspend(struct device *dev)
{}

static int s5pcsis_runtime_resume(struct device *dev)
{}
#endif

static void s5pcsis_remove(struct platform_device *pdev)
{}

static const struct dev_pm_ops s5pcsis_pm_ops =;

static const struct csis_drvdata exynos4_csis_drvdata =;

static const struct csis_drvdata exynos5_csis_drvdata =;

static const struct of_device_id s5pcsis_of_match[] =;
MODULE_DEVICE_TABLE(of, s5pcsis_of_match);

static struct platform_driver s5pcsis_driver =;

module_platform_driver();

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