linux/drivers/media/i2c/ks0127.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Video Capture Driver (Video for Linux 1/2)
 * for the Matrox Marvel G200,G400 and Rainbow Runner-G series
 *
 * This module is an interface to the KS0127 video decoder chip.
 *
 * Copyright (C) 1999  Ryan Drake <[email protected]>
 *
 *****************************************************************************
 *
 * Modified and extended by
 *	Mike Bernson <[email protected]>
 *	Gerard v.d. Horst
 *	Leon van Stuivenberg <[email protected]>
 *	Gernot Ziegler <[email protected]>
 *
 * Version History:
 * V1.0 Ryan Drake	   Initial version by Ryan Drake
 * V1.1 Gerard v.d. Horst  Added some debugoutput, reset the video-standard
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/videodev2.h>
#include <linux/slab.h>
#include <media/v4l2-device.h>
#include "ks0127.h"

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

/* Addresses */
#define I2C_KS0127_ADDON
#define I2C_KS0127_ONBOARD


/* ks0127 control registers */
#define KS_STAT
#define KS_CMDA
#define KS_CMDB
#define KS_CMDC
#define KS_CMDD
#define KS_HAVB
#define KS_HAVE
#define KS_HS1B
#define KS_HS1E
#define KS_HS2B
#define KS_HS2E
#define KS_AGC
#define KS_HXTRA
#define KS_CDEM
#define KS_PORTAB
#define KS_LUMA
#define KS_CON
#define KS_BRT
#define KS_CHROMA
#define KS_CHROMB
#define KS_DEMOD
#define KS_SAT
#define KS_HUE
#define KS_VERTIA
#define KS_VERTIB
#define KS_VERTIC
#define KS_HSCLL
#define KS_HSCLH
#define KS_VSCLL
#define KS_VSCLH
#define KS_OFMTA
#define KS_OFMTB
#define KS_VBICTL
#define KS_CCDAT2
#define KS_CCDAT1
#define KS_VBIL30
#define KS_VBIL74
#define KS_VBIL118
#define KS_VBIL1512
#define KS_TTFRAM
#define KS_TESTA
#define KS_UVOFFH
#define KS_UVOFFL
#define KS_UGAIN
#define KS_VGAIN
#define KS_VAVB
#define KS_VAVE
#define KS_CTRACK
#define KS_POLCTL
#define KS_REFCOD
#define KS_INVALY
#define KS_INVALU
#define KS_INVALV
#define KS_UNUSEY
#define KS_UNUSEU
#define KS_UNUSEV
#define KS_USRSAV
#define KS_USREAV
#define KS_SHS1A
#define KS_SHS1B
#define KS_SHS1C
#define KS_CMDE
#define KS_VSDEL
#define KS_CMDF
#define KS_GAMMA0
#define KS_GAMMA1
#define KS_GAMMA2
#define KS_GAMMA3
#define KS_GAMMA4
#define KS_GAMMA5
#define KS_GAMMA6
#define KS_GAMMA7
#define KS_GAMMA8
#define KS_GAMMA9
#define KS_GAMMA10
#define KS_GAMMA11
#define KS_GAMMA12
#define KS_GAMMA13
#define KS_GAMMA14
#define KS_GAMMA15
#define KS_GAMMA16
#define KS_GAMMA17
#define KS_GAMMA18
#define KS_GAMMA19
#define KS_GAMMA20
#define KS_GAMMA21
#define KS_GAMMA22
#define KS_GAMMA23
#define KS_GAMMA24
#define KS_GAMMA25
#define KS_GAMMA26
#define KS_GAMMA27
#define KS_GAMMA28
#define KS_GAMMA29
#define KS_GAMMA30
#define KS_GAMMA31
#define KS_GAMMAD0
#define KS_GAMMAD1
#define KS_GAMMAD2
#define KS_GAMMAD3
#define KS_GAMMAD4
#define KS_GAMMAD5
#define KS_GAMMAD6
#define KS_GAMMAD7
#define KS_GAMMAD8
#define KS_GAMMAD9
#define KS_GAMMAD10
#define KS_GAMMAD11
#define KS_GAMMAD12
#define KS_GAMMAD13
#define KS_GAMMAD14
#define KS_GAMMAD15
#define KS_GAMMAD16
#define KS_GAMMAD17
#define KS_GAMMAD18
#define KS_GAMMAD19
#define KS_GAMMAD20
#define KS_GAMMAD21
#define KS_GAMMAD22
#define KS_GAMMAD23
#define KS_GAMMAD24
#define KS_GAMMAD25
#define KS_GAMMAD26
#define KS_GAMMAD27
#define KS_GAMMAD28
#define KS_GAMMAD29
#define KS_GAMMAD30
#define KS_GAMMAD31


/****************************************************************************
* mga_dev : represents one ks0127 chip.
****************************************************************************/

struct ks0127 {};

static inline struct ks0127 *to_ks0127(struct v4l2_subdev *sd)
{}


static int debug; /* insmod parameter */

module_param(debug, int, 0);
MODULE_PARM_DESC();

static u8 reg_defaults[64];

static void init_reg_defaults(void)
{}


/* We need to manually read because of a bug in the KS0127 chip.
 *
 * An explanation from [email protected]:
 *
 * During I2C reads, the KS0127 only samples for a stop condition
 * during the place where the acknowledge bit should be. Any standard
 * I2C implementation (correctly) throws in another clock transition
 * at the 9th bit, and the KS0127 will not recognize the stop condition
 * and will continue to clock out data.
 *
 * So we have to do the read ourself.  Big deal.
 *	   workaround in i2c-algo-bit
 */


static u8 ks0127_read(struct v4l2_subdev *sd, u8 reg)
{}


static void ks0127_write(struct v4l2_subdev *sd, u8 reg, u8 val)
{}


/* generic bit-twiddling */
static void ks0127_and_or(struct v4l2_subdev *sd, u8 reg, u8 and_v, u8 or_v)
{}



/****************************************************************************
* ks0127 private api
****************************************************************************/
static void ks0127_init(struct v4l2_subdev *sd)
{}

static int ks0127_s_routing(struct v4l2_subdev *sd,
			    u32 input, u32 output, u32 config)
{}

static int ks0127_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
{}

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

static int ks0127_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd)
{}

static int ks0127_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
{}

static int ks0127_g_input_status(struct v4l2_subdev *sd, u32 *status)
{}

/* ----------------------------------------------------------------------- */

static const struct v4l2_subdev_video_ops ks0127_video_ops =;

static const struct v4l2_subdev_ops ks0127_ops =;

/* ----------------------------------------------------------------------- */


static int ks0127_probe(struct i2c_client *client)
{}

static void ks0127_remove(struct i2c_client *client)
{}

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

static struct i2c_driver ks0127_driver =;

module_i2c_driver();