linux/drivers/media/i2c/max96717.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Maxim GMSL2 Serializer Driver
 *
 * Copyright (C) 2024 Collabora Ltd.
 */

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/fwnode.h>
#include <linux/gpio/driver.h>
#include <linux/i2c-mux.h>
#include <linux/i2c.h>
#include <linux/regmap.h>

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

#define MAX96717_DEVICE_ID
#define MAX96717F_DEVICE_ID
#define MAX96717_PORTS
#define MAX96717_PAD_SINK
#define MAX96717_PAD_SOURCE
#define MAX96717_CSI_NLANES

#define MAX96717_DEFAULT_CLKOUT_RATE

/* DEV */
#define MAX96717_REG3
#define MAX96717_RCLKSEL
#define RCLKSEL_REF_PLL
#define MAX96717_REG6
#define RCLKEN
#define MAX96717_DEV_ID
#define MAX96717_DEV_REV
#define MAX96717_DEV_REV_MASK

/* VID_TX Z */
#define MAX96717_VIDEO_TX0
#define MAX96717_VIDEO_AUTO_BPP
#define MAX96717_VIDEO_TX2
#define MAX96717_VIDEO_PCLKDET

/* VTX_Z */
#define MAX96717_VTX0
#define MAX96717_VTX1
#define MAX96717_PATTERN_CLK_FREQ
#define MAX96717_VTX_VS_DLY
#define MAX96717_VTX_VS_HIGH
#define MAX96717_VTX_VS_LOW
#define MAX96717_VTX_V2H
#define MAX96717_VTX_HS_HIGH
#define MAX96717_VTX_HS_LOW
#define MAX96717_VTX_HS_CNT
#define MAX96717_VTX_V2D
#define MAX96717_VTX_DE_HIGH
#define MAX96717_VTX_DE_LOW
#define MAX96717_VTX_DE_CNT
#define MAX96717_VTX29
#define MAX96717_VTX_MODE
#define MAX96717_VTX_GRAD_INC
#define MAX96717_VTX_CHKB_COLOR_A
#define MAX96717_VTX_CHKB_COLOR_B
#define MAX96717_VTX_CHKB_RPT_CNT_A
#define MAX96717_VTX_CHKB_RPT_CNT_B
#define MAX96717_VTX_CHKB_ALT

/* GPIO */
#define MAX96717_NUM_GPIO
#define MAX96717_GPIO_REG_A(gpio)
#define MAX96717_GPIO_OUT
#define MAX96717_GPIO_IN
#define MAX96717_GPIO_RX_EN
#define MAX96717_GPIO_TX_EN
#define MAX96717_GPIO_OUT_DIS

/* FRONTTOP */
/* MAX96717 only have CSI port 'B' */
#define MAX96717_FRONTOP0
#define MAX96717_START_PORT_B

/* MIPI_RX */
#define MAX96717_MIPI_RX1
#define MAX96717_MIPI_LANES_CNT
#define MAX96717_MIPI_RX2
#define MAX96717_PHY2_LANES_MAP
#define MAX96717_MIPI_RX3
#define MAX96717_PHY1_LANES_MAP
#define MAX96717_MIPI_RX4
#define MAX96717_PHY1_LANES_POL
#define MAX96717_MIPI_RX5
#define MAX96717_PHY2_LANES_POL

/* MIPI_RX_EXT */
#define MAX96717_MIPI_RX_EXT11
#define MAX96717_TUN_MODE

/* REF_VTG */
#define REF_VTG0
#define REFGEN_PREDEF_EN
#define REFGEN_PREDEF_FREQ_MASK
#define REFGEN_PREDEF_FREQ_ALT
#define REFGEN_RST
#define REFGEN_EN

/* MISC */
#define PIO_SLEW_1

enum max96717_vpg_mode {};

struct max96717_priv {};

static inline struct max96717_priv *sd_to_max96717(struct v4l2_subdev *sd)
{}

static inline struct max96717_priv *clk_hw_to_max96717(struct clk_hw *hw)
{}

static int max96717_i2c_mux_select(struct i2c_mux_core *mux, u32 chan)
{}

static int max96717_i2c_mux_init(struct max96717_priv *priv)
{}

static inline int max96717_start_csi(struct max96717_priv *priv, bool start)
{}

static int max96717_apply_patgen_timing(struct max96717_priv *priv,
					struct v4l2_subdev_state *state)
{}

static int max96717_apply_patgen(struct max96717_priv *priv,
				 struct v4l2_subdev_state *state)
{}

static int max96717_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const char * const max96717_test_pattern[] =;

static const struct v4l2_ctrl_ops max96717_ctrl_ops =;

static int max96717_gpiochip_get(struct gpio_chip *gpiochip,
				 unsigned int offset)
{}

static void max96717_gpiochip_set(struct gpio_chip *gpiochip,
				  unsigned int offset, int value)
{}

static int max96717_gpio_get_direction(struct gpio_chip *gpiochip,
				       unsigned int offset)
{}

static int max96717_gpio_direction_out(struct gpio_chip *gpiochip,
				       unsigned int offset, int value)
{}

static int max96717_gpio_direction_in(struct gpio_chip *gpiochip,
				      unsigned int offset)
{}

static int max96717_gpiochip_probe(struct max96717_priv *priv)
{}

static int _max96717_set_routing(struct v4l2_subdev *sd,
				 struct v4l2_subdev_state *state,
				 struct v4l2_subdev_krouting *routing)
{}

static int max96717_set_routing(struct v4l2_subdev *sd,
				struct v4l2_subdev_state *state,
				enum v4l2_subdev_format_whence which,
				struct v4l2_subdev_krouting *routing)
{}

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

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

static bool max96717_pipe_pclkdet(struct max96717_priv *priv)
{}

static int max96717_log_status(struct v4l2_subdev *sd)
{}

static int max96717_enable_streams(struct v4l2_subdev *sd,
				   struct v4l2_subdev_state *state, u32 pad,
				   u64 streams_mask)
{}

static int max96717_disable_streams(struct v4l2_subdev *sd,
				    struct v4l2_subdev_state *state, u32 pad,
				    u64 streams_mask)
{}

static const struct v4l2_subdev_pad_ops max96717_pad_ops =;

static const struct v4l2_subdev_core_ops max96717_subdev_core_ops =;

static const struct v4l2_subdev_internal_ops max96717_internal_ops =;

static const struct v4l2_subdev_ops max96717_subdev_ops =;

static const struct media_entity_operations max96717_entity_ops =;

static int max96717_notify_bound(struct v4l2_async_notifier *notifier,
				 struct v4l2_subdev *source_subdev,
				 struct v4l2_async_connection *asd)
{}

static const struct v4l2_async_notifier_operations max96717_notify_ops =;

static int max96717_v4l2_notifier_register(struct max96717_priv *priv)
{}

static int max96717_subdev_init(struct max96717_priv *priv)
{}

static void max96717_subdev_uninit(struct max96717_priv *priv)
{}

struct max96717_pll_predef_freq {};

static const struct max96717_pll_predef_freq max96717_predef_freqs[] =;

static unsigned long
max96717_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{}

static unsigned int max96717_clk_find_best_index(struct max96717_priv *priv,
						 unsigned long rate)
{}

static long max96717_clk_round_rate(struct clk_hw *hw, unsigned long rate,
				    unsigned long *parent_rate)
{}

static int max96717_clk_set_rate(struct clk_hw *hw, unsigned long rate,
				 unsigned long parent_rate)
{}

static int max96717_clk_prepare(struct clk_hw *hw)
{}

static void max96717_clk_unprepare(struct clk_hw *hw)
{}

static const struct clk_ops max96717_clk_ops =;

static int max96717_register_clkout(struct max96717_priv *priv)
{}

static int max96717_init_csi_lanes(struct max96717_priv *priv)
{}

static int max96717_hw_init(struct max96717_priv *priv)
{}

static int max96717_parse_dt(struct max96717_priv *priv)
{}

static int max96717_probe(struct i2c_client *client)
{}

static void max96717_remove(struct i2c_client *client)
{}

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

static struct i2c_driver max96717_i2c_driver =;

module_i2c_driver();

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