linux/drivers/media/i2c/ds90ub913.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for the Texas Instruments DS90UB913 video serializer
 *
 * Based on a driver from Luca Ceresoli <[email protected]>
 *
 * Copyright (c) 2019 Luca Ceresoli <[email protected]>
 * Copyright (c) 2023 Tomi Valkeinen <[email protected]>
 */

#include <linux/clk-provider.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/fwnode.h>
#include <linux/gpio/driver.h>
#include <linux/i2c-atr.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/regmap.h>

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

#define UB913_PAD_SINK
#define UB913_PAD_SOURCE

/*
 * UB913 has 4 gpios, but gpios 3 and 4 are reserved for external oscillator
 * mode. Thus we only support 2 gpios for now.
 */
#define UB913_NUM_GPIOS

#define UB913_REG_RESET_CTL
#define UB913_REG_RESET_CTL_DIGITAL_RESET_1
#define UB913_REG_RESET_CTL_DIGITAL_RESET_0

#define UB913_REG_GENERAL_CFG
#define UB913_REG_GENERAL_CFG_CRC_ERR_RESET
#define UB913_REG_GENERAL_CFG_PCLK_RISING

#define UB913_REG_MODE_SEL
#define UB913_REG_MODE_SEL_MODE_OVERRIDE
#define UB913_REG_MODE_SEL_MODE_UP_TO_DATE
#define UB913_REG_MODE_SEL_MODE_MASK

#define UB913_REG_CRC_ERRORS_LSB
#define UB913_REG_CRC_ERRORS_MSB

#define UB913_REG_GENERAL_STATUS

#define UB913_REG_GPIO_CFG(n)
#define UB913_REG_GPIO_CFG_ENABLE(n)
#define UB913_REG_GPIO_CFG_DIR_INPUT(n)
#define UB913_REG_GPIO_CFG_REMOTE_EN(n)
#define UB913_REG_GPIO_CFG_OUT_VAL(n)
#define UB913_REG_GPIO_CFG_MASK(n)

#define UB913_REG_SCL_HIGH_TIME
#define UB913_REG_SCL_LOW_TIME

#define UB913_REG_PLL_OVR

struct ub913_data {};

static inline struct ub913_data *sd_to_ub913(struct v4l2_subdev *sd)
{}

struct ub913_format_info {};

static const struct ub913_format_info ub913_formats[] =;

static const struct ub913_format_info *ub913_find_format(u32 incode)
{}

static int ub913_read(const struct ub913_data *priv, u8 reg, u8 *val)
{}

static int ub913_write(const struct ub913_data *priv, u8 reg, u8 val)
{}

/*
 * GPIO chip
 */
static int ub913_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
{}

static int ub913_gpio_direction_out(struct gpio_chip *gc, unsigned int offset,
				    int value)
{}

static void ub913_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{}

static int ub913_gpio_of_xlate(struct gpio_chip *gc,
			       const struct of_phandle_args *gpiospec,
			       u32 *flags)
{}

static int ub913_gpiochip_probe(struct ub913_data *priv)
{}

static void ub913_gpiochip_remove(struct ub913_data *priv)
{}

static const struct regmap_config ub913_regmap_config =;

/*
 * V4L2
 */

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

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

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

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

static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
				struct v4l2_mbus_frame_desc *fd)
{}

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

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

static int ub913_log_status(struct v4l2_subdev *sd)
{}

static const struct v4l2_subdev_core_ops ub913_subdev_core_ops =;

static const struct v4l2_subdev_pad_ops ub913_pad_ops =;

static const struct v4l2_subdev_ops ub913_subdev_ops =;

static const struct v4l2_subdev_internal_ops ub913_internal_ops =;

static const struct media_entity_operations ub913_entity_ops =;

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

static const struct v4l2_async_notifier_operations ub913_notify_ops =;

static int ub913_v4l2_notifier_register(struct ub913_data *priv)
{}

static void ub913_v4l2_nf_unregister(struct ub913_data *priv)
{}

static int ub913_register_clkout(struct ub913_data *priv)
{}

static int ub913_i2c_master_init(struct ub913_data *priv)
{}

static int ub913_add_i2c_adapter(struct ub913_data *priv)
{}

static int ub913_parse_dt(struct ub913_data *priv)
{}

static int ub913_hw_init(struct ub913_data *priv)
{}

static int ub913_subdev_init(struct ub913_data *priv)
{}

static void ub913_subdev_uninit(struct ub913_data *priv)
{}

static int ub913_probe(struct i2c_client *client)
{}

static void ub913_remove(struct i2c_client *client)
{}

static const struct i2c_device_id ub913_id[] =;
MODULE_DEVICE_TABLE(i2c, ub913_id);

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

static struct i2c_driver ds90ub913_driver =;
module_i2c_driver();

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