linux/drivers/media/i2c/max9286.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Maxim MAX9286 GMSL Deserializer Driver
 *
 * Copyright (C) 2017-2019 Jacopo Mondi
 * Copyright (C) 2017-2019 Kieran Bingham
 * Copyright (C) 2017-2019 Laurent Pinchart
 * Copyright (C) 2017-2019 Niklas Söderlund
 * Copyright (C) 2016 Renesas Electronics Corporation
 * Copyright (C) 2015 Cogent Embedded, Inc.
 */

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/fwnode.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>

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

/* Register 0x00 */
#define MAX9286_MSTLINKSEL_AUTO
#define MAX9286_MSTLINKSEL(n)
#define MAX9286_EN_VS_GEN
#define MAX9286_LINKEN(n)
/* Register 0x01 */
#define MAX9286_FSYNCMODE_ECU
#define MAX9286_FSYNCMODE_EXT
#define MAX9286_FSYNCMODE_INT_OUT
#define MAX9286_FSYNCMODE_INT_HIZ
#define MAX9286_GPIEN
#define MAX9286_ENLMO_RSTFSYNC
#define MAX9286_FSYNCMETH_AUTO
#define MAX9286_FSYNCMETH_SEMI_AUTO
#define MAX9286_FSYNCMETH_MANUAL
#define MAX9286_REG_FSYNC_PERIOD_L
#define MAX9286_REG_FSYNC_PERIOD_M
#define MAX9286_REG_FSYNC_PERIOD_H
/* Register 0x0a */
#define MAX9286_FWDCCEN(n)
#define MAX9286_REVCCEN(n)
/* Register 0x0c */
#define MAX9286_HVEN
#define MAX9286_EDC_6BIT_HAMMING
#define MAX9286_EDC_6BIT_CRC
#define MAX9286_EDC_1BIT_PARITY
#define MAX9286_DESEL
#define MAX9286_INVVS
#define MAX9286_INVHS
#define MAX9286_HVSRC_D0
#define MAX9286_HVSRC_D14
#define MAX9286_HVSRC_D18
/* Register 0x0f */
#define MAX9286_0X0F_RESERVED
/* Register 0x12 */
#define MAX9286_CSILANECNT(n)
#define MAX9286_CSIDBL
#define MAX9286_DBL
#define MAX9286_DATATYPE_USER_8BIT
#define MAX9286_DATATYPE_USER_YUV_12BIT
#define MAX9286_DATATYPE_USER_24BIT
#define MAX9286_DATATYPE_RAW14
#define MAX9286_DATATYPE_RAW12
#define MAX9286_DATATYPE_RAW10
#define MAX9286_DATATYPE_RAW8
#define MAX9286_DATATYPE_YUV422_10BIT
#define MAX9286_DATATYPE_YUV422_8BIT
#define MAX9286_DATATYPE_RGB555
#define MAX9286_DATATYPE_RGB565
#define MAX9286_DATATYPE_RGB888
/* Register 0x15 */
#define MAX9286_CSI_IMAGE_TYP
#define MAX9286_VC(n)
#define MAX9286_VCTYPE
#define MAX9286_CSIOUTEN
#define MAX9286_SWP_ENDIAN
#define MAX9286_EN_CCBSYB_CLK_STR
#define MAX9286_EN_GPI_CCBSYB
/* Register 0x1b */
#define MAX9286_SWITCHIN(n)
#define MAX9286_ENEQ(n)
/* Register 0x1c */
#define MAX9286_HIGHIMM(n)
#define MAX9286_I2CSEL
#define MAX9286_HIBW
#define MAX9286_BWS
/* Register 0x27 */
#define MAX9286_LOCKED
/* Register 0x31 */
#define MAX9286_FSYNC_LOCKED
/* Register 0x34 */
#define MAX9286_I2CLOCACK
#define MAX9286_I2CSLVSH_1046NS_469NS
#define MAX9286_I2CSLVSH_938NS_352NS
#define MAX9286_I2CSLVSH_469NS_234NS
#define MAX9286_I2CSLVSH_352NS_117NS
#define MAX9286_I2CMSTBT_837KBPS
#define MAX9286_I2CMSTBT_533KBPS
#define MAX9286_I2CMSTBT_339KBPS
#define MAX9286_I2CMSTBT_173KBPS
#define MAX9286_I2CMSTBT_105KBPS
#define MAX9286_I2CMSTBT_84KBPS
#define MAX9286_I2CMSTBT_28KBPS
#define MAX9286_I2CMSTBT_8KBPS
#define MAX9286_I2CSLVTO_NONE
#define MAX9286_I2CSLVTO_1024US
#define MAX9286_I2CSLVTO_256US
#define MAX9286_I2CSLVTO_64US
/* Register 0x3b */
#define MAX9286_REV_TRF(n)
#define MAX9286_REV_AMP(n)
#define MAX9286_REV_AMP_X
#define MAX9286_REV_AMP_HIGH
/* Register 0x3f */
#define MAX9286_EN_REV_CFG
#define MAX9286_REV_FLEN(n)
/* Register 0x49 */
#define MAX9286_VIDEO_DETECT_MASK
/* Register 0x69 */
#define MAX9286_LFLTBMONMASKED
#define MAX9286_LOCKMONMASKED
#define MAX9286_AUTOCOMBACKEN
#define MAX9286_AUTOMASKEN
#define MAX9286_MASKLINK(n)

/*
 * The sink and source pads are created to match the OF graph port numbers so
 * that their indexes can be used interchangeably.
 */
#define MAX9286_NUM_GMSL
#define MAX9286_N_SINKS
#define MAX9286_N_PADS
#define MAX9286_SRC_PAD

struct max9286_format_info {};

struct max9286_i2c_speed {};

struct max9286_source {};

struct max9286_asd {};

static inline struct max9286_asd *
to_max9286_asd(struct v4l2_async_connection *asd)
{}

struct max9286_priv {};

static struct max9286_source *next_source(struct max9286_priv *priv,
					  struct max9286_source *source)
{}

#define for_each_source(priv, source)

#define to_index(priv, source)

static inline struct max9286_priv *sd_to_max9286(struct v4l2_subdev *sd)
{}

static const struct max9286_format_info max9286_formats[] =;

static const struct max9286_i2c_speed max9286_i2c_speeds[] =;

/* -----------------------------------------------------------------------------
 * I2C IO
 */

static int max9286_read(struct max9286_priv *priv, u8 reg)
{}

static int max9286_write(struct max9286_priv *priv, u8 reg, u8 val)
{}

/* -----------------------------------------------------------------------------
 * I2C Multiplexer
 */

static void max9286_i2c_mux_configure(struct max9286_priv *priv, u8 conf)
{}

static void max9286_i2c_mux_open(struct max9286_priv *priv)
{}

static void max9286_i2c_mux_close(struct max9286_priv *priv)
{}

static int max9286_i2c_mux_select(struct i2c_mux_core *muxc, u32 chan)
{}

static int max9286_i2c_mux_init(struct max9286_priv *priv)
{}

static void max9286_configure_i2c(struct max9286_priv *priv, bool localack)
{}

static void max9286_reverse_channel_setup(struct max9286_priv *priv,
					  unsigned int chan_amplitude)
{}

/*
 * max9286_check_video_links() - Make sure video links are detected and locked
 *
 * Performs safety checks on video link status. Make sure they are detected
 * and all enabled links are locked.
 *
 * Returns 0 for success, -EIO for errors.
 */
static int max9286_check_video_links(struct max9286_priv *priv)
{}

/*
 * max9286_check_config_link() - Detect and wait for configuration links
 *
 * Determine if the configuration channel is up and settled for a link.
 *
 * Returns 0 for success, -EIO for errors.
 */
static int max9286_check_config_link(struct max9286_priv *priv,
				     unsigned int source_mask)
{}

static void max9286_set_video_format(struct max9286_priv *priv,
				     const struct v4l2_mbus_framefmt *format)
{}

static void max9286_set_fsync_period(struct max9286_priv *priv,
				     struct v4l2_subdev_state *state)
{}

/* -----------------------------------------------------------------------------
 * V4L2 Subdev
 */

static int max9286_set_pixelrate(struct max9286_priv *priv)
{}

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

static void max9286_notify_unbind(struct v4l2_async_notifier *notifier,
				  struct v4l2_subdev *subdev,
				  struct v4l2_async_connection *asd)
{}

static const struct v4l2_async_notifier_operations max9286_notify_ops =;

static int max9286_v4l2_notifier_register(struct max9286_priv *priv)
{}

static void max9286_v4l2_notifier_unregister(struct max9286_priv *priv)
{}

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

static int max9286_get_frame_interval(struct v4l2_subdev *sd,
				      struct v4l2_subdev_state *sd_state,
				      struct v4l2_subdev_frame_interval *interval)
{}

static int max9286_set_frame_interval(struct v4l2_subdev *sd,
				      struct v4l2_subdev_state *sd_state,
				      struct v4l2_subdev_frame_interval *interval)
{}

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

static int max9286_set_fmt(struct v4l2_subdev *sd,
			   struct v4l2_subdev_state *state,
			   struct v4l2_subdev_format *format)
{}

static const struct v4l2_subdev_video_ops max9286_video_ops =;

static const struct v4l2_subdev_pad_ops max9286_pad_ops =;

static const struct v4l2_subdev_ops max9286_subdev_ops =;

static const struct v4l2_mbus_framefmt max9286_default_format =;

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

static const struct v4l2_subdev_internal_ops max9286_subdev_internal_ops =;

static const struct media_entity_operations max9286_media_ops =;

static int max9286_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops max9286_ctrl_ops =;

static int max9286_v4l2_register(struct max9286_priv *priv)
{}

static void max9286_v4l2_unregister(struct max9286_priv *priv)
{}

/* -----------------------------------------------------------------------------
 * Probe/Remove
 */

static int max9286_setup(struct max9286_priv *priv)
{}

static int max9286_gpio_set(struct max9286_priv *priv, unsigned int offset,
			    int value)
{}

static void max9286_gpiochip_set(struct gpio_chip *chip,
				 unsigned int offset, int value)
{}

static int max9286_gpiochip_get(struct gpio_chip *chip, unsigned int offset)
{}

static int max9286_register_gpio(struct max9286_priv *priv)
{}

static int max9286_parse_gpios(struct max9286_priv *priv)
{}

static int max9286_poc_power_on(struct max9286_priv *priv)
{}

static int max9286_poc_power_off(struct max9286_priv *priv)
{}

static int max9286_poc_enable(struct max9286_priv *priv, bool enable)
{}

static int max9286_init(struct max9286_priv *priv)
{}

static void max9286_cleanup_dt(struct max9286_priv *priv)
{}

static int max9286_parse_dt(struct max9286_priv *priv)
{}

static int max9286_get_poc_supplies(struct max9286_priv *priv)
{}

static int max9286_probe(struct i2c_client *client)
{}

static void max9286_remove(struct i2c_client *client)
{}

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

static struct i2c_driver max9286_i2c_driver =;

module_i2c_driver();

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