linux/drivers/media/i2c/st-mipid02.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for ST MIPID02 CSI-2 to PARALLEL bridge
 *
 * Copyright (C) STMicroelectronics SA 2019
 * Authors: Mickael Guene <[email protected]>
 *          for STMicroelectronics.
 *
 *
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <media/mipi-csi2.h>
#include <media/v4l2-async.h>
#include <media/v4l2-cci.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>

#define MIPID02_CLK_LANE_WR_REG1
#define MIPID02_CLK_LANE_REG1
#define MIPID02_CLK_LANE_REG3
#define MIPID02_DATA_LANE0_REG1
#define MIPID02_DATA_LANE0_REG2
#define MIPID02_DATA_LANE1_REG1
#define MIPID02_DATA_LANE1_REG2
#define MIPID02_MODE_REG1
#define MIPID02_MODE_REG2
#define MIPID02_DATA_ID_RREG
#define MIPID02_DATA_SELECTION_CTRL
#define MIPID02_PIX_WIDTH_CTRL
#define MIPID02_PIX_WIDTH_CTRL_EMB

/* Bits definition for MIPID02_CLK_LANE_REG1 */
#define CLK_ENABLE
/* Bits definition for MIPID02_CLK_LANE_REG3 */
#define CLK_MIPI_CSI
/* Bits definition for MIPID02_DATA_LANE0_REG1 */
#define DATA_ENABLE
/* Bits definition for MIPID02_DATA_LANEx_REG2 */
#define DATA_MIPI_CSI
/* Bits definition for MIPID02_MODE_REG1 */
#define MODE_DATA_SWAP
#define MODE_NO_BYPASS
/* Bits definition for MIPID02_MODE_REG2 */
#define MODE_HSYNC_ACTIVE_HIGH
#define MODE_VSYNC_ACTIVE_HIGH
#define MODE_PCLK_SAMPLE_RISING
/* Bits definition for MIPID02_DATA_SELECTION_CTRL */
#define SELECTION_MANUAL_DATA
#define SELECTION_MANUAL_WIDTH

static const u32 mipid02_supported_fmt_codes[] =;

/* regulator supplies */
static const char * const mipid02_supply_name[] =;

#define MIPID02_NUM_SUPPLIES

#define MIPID02_SINK_0
#define MIPID02_SINK_1
#define MIPID02_SOURCE
#define MIPID02_PAD_NB

struct mipid02_dev {};

static int bpp_from_code(__u32 code)
{}

static u8 data_type_from_code(__u32 code)
{}

static __u32 get_fmt_code(__u32 code)
{}

static __u32 serial_to_parallel_code(__u32 serial)
{}

static inline struct mipid02_dev *to_mipid02_dev(struct v4l2_subdev *sd)
{}

static int mipid02_get_regulators(struct mipid02_dev *bridge)
{}

static void mipid02_apply_reset(struct mipid02_dev *bridge)
{}

static int mipid02_set_power_on(struct mipid02_dev *bridge)
{}

static void mipid02_set_power_off(struct mipid02_dev *bridge)
{}

static int mipid02_detect(struct mipid02_dev *bridge)
{}

/*
 * We need to know link frequency to setup clk_lane_reg1 timings. Link frequency
 * will be retrieve from connected device via v4l2_get_link_freq, bit per pixel
 * and number of lanes.
 */
static int mipid02_configure_from_rx_speed(struct mipid02_dev *bridge,
					   struct v4l2_mbus_framefmt *fmt)
{}

static int mipid02_configure_clk_lane(struct mipid02_dev *bridge)
{}

static int mipid02_configure_data0_lane(struct mipid02_dev *bridge, int nb,
					bool are_lanes_swap, bool *polarities)
{}

static int mipid02_configure_data1_lane(struct mipid02_dev *bridge, int nb,
					bool are_lanes_swap, bool *polarities)
{}

static int mipid02_configure_from_rx(struct mipid02_dev *bridge,
				     struct v4l2_mbus_framefmt *fmt)
{}

static int mipid02_configure_from_tx(struct mipid02_dev *bridge)
{}

static int mipid02_configure_from_code(struct mipid02_dev *bridge,
				       struct v4l2_mbus_framefmt *fmt)
{}

static int mipid02_stream_disable(struct mipid02_dev *bridge)
{}

static int mipid02_stream_enable(struct mipid02_dev *bridge)
{}

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

static const struct v4l2_mbus_framefmt default_fmt =;

static int mipid02_init_state(struct v4l2_subdev *sd,
			      struct v4l2_subdev_state *state)
{}

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

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

static const struct v4l2_subdev_video_ops mipid02_video_ops =;

static const struct v4l2_subdev_pad_ops mipid02_pad_ops =;

static const struct v4l2_subdev_ops mipid02_subdev_ops =;

static const struct v4l2_subdev_internal_ops mipid02_subdev_internal_ops =;

static const struct media_entity_operations mipid02_subdev_entity_ops =;

static int mipid02_async_bound(struct v4l2_async_notifier *notifier,
			       struct v4l2_subdev *s_subdev,
			       struct v4l2_async_connection *asd)
{}

static void mipid02_async_unbind(struct v4l2_async_notifier *notifier,
				 struct v4l2_subdev *s_subdev,
				 struct v4l2_async_connection *asd)
{}

static const struct v4l2_async_notifier_operations mipid02_notifier_ops =;

static int mipid02_parse_rx_ep(struct mipid02_dev *bridge)
{}

static int mipid02_parse_tx_ep(struct mipid02_dev *bridge)
{}

static int mipid02_probe(struct i2c_client *client)
{}

static void mipid02_remove(struct i2c_client *client)
{}

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

static struct i2c_driver mipid02_i2c_driver =;

module_i2c_driver();

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