linux/drivers/media/i2c/et8ek8/et8ek8_driver.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * et8ek8_driver.c
 *
 * Copyright (C) 2008 Nokia Corporation
 *
 * Contact: Sakari Ailus <[email protected]>
 *          Tuukka Toivonen <[email protected]>
 *          Pavel Machek <[email protected]>
 *
 * Based on code from Toni Leinonen <[email protected]>.
 *
 * This driver is based on the Micron MT9T012 camera imager driver
 * (C) Texas Instruments.
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/sort.h>
#include <linux/v4l2-mediabus.h>

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

#include "et8ek8_reg.h"

#define ET8EK8_NAME
#define ET8EK8_PRIV_MEM_SIZE
#define ET8EK8_MAX_MSG

struct et8ek8_sensor {};

#define to_et8ek8_sensor(sd)

enum et8ek8_versions {};

/*
 * This table describes what should be written to the sensor register
 * for each gain value. The gain(index in the table) is in terms of
 * 0.1EV, i.e. 10 indexes in the table give 2 time more gain [0] in
 * the *analog gain, [1] in the digital gain
 *
 * Analog gain [dB] = 20*log10(regvalue/32); 0x20..0x100
 */
static struct et8ek8_gain {} const et8ek8_gain_table[] =;

/* Register definitions */
#define REG_REVISION_NUMBER_L
#define REG_REVISION_NUMBER_H

#define PRIV_MEM_START_REG
#define PRIV_MEM_WIN_SIZE

#define ET8EK8_I2C_DELAY

#define USE_CRC

/*
 * Register access helpers
 *
 * Read a 8/16/32-bit i2c register.  The value is returned in 'val'.
 * Returns zero if successful, or non-zero otherwise.
 */
static int et8ek8_i2c_read_reg(struct i2c_client *client, u16 data_length,
			       u16 reg, u32 *val)
{}

static void et8ek8_i2c_create_msg(struct i2c_client *client, u16 len, u16 reg,
				  u32 val, struct i2c_msg *msg,
				  unsigned char *buf)
{}

/*
 * A buffered write method that puts the wanted register write
 * commands in smaller number of message lists and passes the lists to
 * the i2c framework
 */
static int et8ek8_i2c_buffered_write_regs(struct i2c_client *client,
					  const struct et8ek8_reg *wnext,
					  int cnt)
{}

/*
 * Write a list of registers to i2c device.
 *
 * The list of registers is terminated by ET8EK8_REG_TERM.
 * Returns zero if successful, or non-zero otherwise.
 */
static int et8ek8_i2c_write_regs(struct i2c_client *client,
				 const struct et8ek8_reg *regs)
{}

/*
 * Write to a 8/16-bit register.
 * Returns zero if successful, or non-zero otherwise.
 */
static int et8ek8_i2c_write_reg(struct i2c_client *client, u16 data_length,
				u16 reg, u32 val)
{}

static struct et8ek8_reglist *et8ek8_reglist_find_type(
		struct et8ek8_meta_reglist *meta,
		u16 type)
{}

static int et8ek8_i2c_reglist_find_write(struct i2c_client *client,
					 struct et8ek8_meta_reglist *meta,
					 u16 type)
{}

static struct et8ek8_reglist **et8ek8_reglist_first(
		struct et8ek8_meta_reglist *meta)
{}

static void et8ek8_reglist_to_mbus(const struct et8ek8_reglist *reglist,
				   struct v4l2_mbus_framefmt *fmt)
{}

static struct et8ek8_reglist *et8ek8_reglist_find_mode_fmt(
		struct et8ek8_meta_reglist *meta,
		struct v4l2_mbus_framefmt *fmt)
{}

#define TIMEPERFRAME_AVG_FPS(t)

static struct et8ek8_reglist *et8ek8_reglist_find_mode_ival(
		struct et8ek8_meta_reglist *meta,
		struct et8ek8_reglist *current_reglist,
		struct v4l2_fract *timeperframe)
{}

static int et8ek8_reglist_cmp(const void *a, const void *b)
{}

static int et8ek8_reglist_import(struct i2c_client *client,
				 struct et8ek8_meta_reglist *meta)
{}

/* Called to change the V4L2 gain control value. This function
 * rounds and clamps the given value and updates the V4L2 control value.
 * If power is on, also updates the sensor analog and digital gains.
 * gain is in 0.1 EV (exposure value) units.
 */
static int et8ek8_set_gain(struct et8ek8_sensor *sensor, s32 gain)
{}

static int et8ek8_set_test_pattern(struct et8ek8_sensor *sensor, s32 mode)
{}

/* -----------------------------------------------------------------------------
 * V4L2 controls
 */

static int et8ek8_set_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops et8ek8_ctrl_ops =;

static const char * const et8ek8_test_pattern_menu[] =;

static int et8ek8_init_controls(struct et8ek8_sensor *sensor)
{}

static void et8ek8_update_controls(struct et8ek8_sensor *sensor)
{}

static int et8ek8_configure(struct et8ek8_sensor *sensor)
{}

static int et8ek8_stream_on(struct et8ek8_sensor *sensor)
{}

static int et8ek8_stream_off(struct et8ek8_sensor *sensor)
{}

static int et8ek8_s_stream(struct v4l2_subdev *subdev, int streaming)
{}

/* --------------------------------------------------------------------------
 * V4L2 subdev operations
 */

static int et8ek8_power_off(struct et8ek8_sensor *sensor)
{}

static int et8ek8_power_on(struct et8ek8_sensor *sensor)
{}

/* --------------------------------------------------------------------------
 * V4L2 subdev video operations
 */
#define MAX_FMTS
static int et8ek8_enum_mbus_code(struct v4l2_subdev *subdev,
				 struct v4l2_subdev_state *sd_state,
				 struct v4l2_subdev_mbus_code_enum *code)
{}

static int et8ek8_enum_frame_size(struct v4l2_subdev *subdev,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_frame_size_enum *fse)
{}

static int et8ek8_enum_frame_ival(struct v4l2_subdev *subdev,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_frame_interval_enum *fie)
{}

static struct v4l2_mbus_framefmt *
__et8ek8_get_pad_format(struct et8ek8_sensor *sensor,
			struct v4l2_subdev_state *sd_state,
			unsigned int pad, enum v4l2_subdev_format_whence which)
{}

static int et8ek8_get_pad_format(struct v4l2_subdev *subdev,
				 struct v4l2_subdev_state *sd_state,
				 struct v4l2_subdev_format *fmt)
{}

static int et8ek8_set_pad_format(struct v4l2_subdev *subdev,
				 struct v4l2_subdev_state *sd_state,
				 struct v4l2_subdev_format *fmt)
{}

static int et8ek8_get_frame_interval(struct v4l2_subdev *subdev,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_frame_interval *fi)
{}

static int et8ek8_set_frame_interval(struct v4l2_subdev *subdev,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_frame_interval *fi)
{}

static int et8ek8_g_priv_mem(struct v4l2_subdev *subdev)
{}

static int et8ek8_dev_init(struct v4l2_subdev *subdev)
{}

/* --------------------------------------------------------------------------
 * sysfs attributes
 */
static ssize_t
priv_mem_show(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(priv_mem);

/* --------------------------------------------------------------------------
 * V4L2 subdev core operations
 */

static int
et8ek8_registered(struct v4l2_subdev *subdev)
{}

static int __et8ek8_set_power(struct et8ek8_sensor *sensor, bool on)
{}

static int et8ek8_set_power(struct v4l2_subdev *subdev, int on)
{}

static int et8ek8_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{}

static int et8ek8_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{}

static const struct v4l2_subdev_video_ops et8ek8_video_ops =;

static const struct v4l2_subdev_core_ops et8ek8_core_ops =;

static const struct v4l2_subdev_pad_ops et8ek8_pad_ops =;

static const struct v4l2_subdev_ops et8ek8_ops =;

static const struct v4l2_subdev_internal_ops et8ek8_internal_ops =;

/* --------------------------------------------------------------------------
 * I2C driver
 */
static int __maybe_unused et8ek8_suspend(struct device *dev)
{}

static int __maybe_unused et8ek8_resume(struct device *dev)
{}

static int et8ek8_probe(struct i2c_client *client)
{}

static void et8ek8_remove(struct i2c_client *client)
{}

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

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

static const struct dev_pm_ops et8ek8_pm_ops =;

static struct i2c_driver et8ek8_i2c_driver =;

module_i2c_driver();

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