linux/drivers/media/usb/gspca/topro.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Topro TP6800/6810 webcam driver.
 *
 * Copyright (C) 2011 Jean-François Moine (http://moinejf.free.fr)
 * Copyright (C) 2009 Anders Blomdell ([email protected])
 * Copyright (C) 2008 Thomas Champagne ([email protected])
 */

#define pr_fmt(fmt)

#include "gspca.h"

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

static int force_sensor =;

/* JPEG header */
static const u8 jpeg_head[] =;

struct sd {};

enum bridges {};

enum sensors {};

static const struct v4l2_pix_format vga_mode[] =;

/*
 * JPEG quality
 * index: webcam compression
 * value: JPEG quality in %
 */
static const u8 jpeg_q[17] =;

#define BULK_OUT_SIZE
#if BULK_OUT_SIZE > USB_BUF_SZ
#error "USB buffer too small"
#endif

#define DEFAULT_FRAME_RATE

static const u8 rates[] =;
static const struct framerates framerates[] =;
static const u8 rates_6810[] =;
static const struct framerates framerates_6810[] =;

/*
 * webcam quality in %
 * the last value is the ultra fine quality
 */

/* TP6800 register offsets */
#define TP6800_R10_SIF_TYPE
#define TP6800_R11_SIF_CONTROL
#define TP6800_R12_SIF_ADDR_S
#define TP6800_R13_SIF_TX_DATA
#define TP6800_R14_SIF_RX_DATA
#define TP6800_R15_GPIO_PU
#define TP6800_R16_GPIO_PD
#define TP6800_R17_GPIO_IO
#define TP6800_R18_GPIO_DATA
#define TP6800_R19_SIF_ADDR_S2
#define TP6800_R1A_SIF_TX_DATA2
#define TP6800_R1B_SIF_RX_DATA2
#define TP6800_R21_ENDP_1_CTL
#define TP6800_R2F_TIMING_CFG
#define TP6800_R30_SENSOR_CFG
#define TP6800_R31_PIXEL_START
#define TP6800_R32_PIXEL_END_L
#define TP6800_R33_PIXEL_END_H
#define TP6800_R34_LINE_START
#define TP6800_R35_LINE_END_L
#define TP6800_R36_LINE_END_H
#define TP6800_R37_FRONT_DARK_ST
#define TP6800_R38_FRONT_DARK_END
#define TP6800_R39_REAR_DARK_ST_L
#define TP6800_R3A_REAR_DARK_ST_H
#define TP6800_R3B_REAR_DARK_END_L
#define TP6800_R3C_REAR_DARK_END_H
#define TP6800_R3D_HORIZ_DARK_LINE_L
#define TP6800_R3E_HORIZ_DARK_LINE_H
#define TP6800_R3F_FRAME_RATE
#define TP6800_R50
#define TP6800_R51
#define TP6800_R52
#define TP6800_R53
#define TP6800_R54_DARK_CFG
#define TP6800_R55_GAMMA_R
#define TP6800_R56_GAMMA_G
#define TP6800_R57_GAMMA_B
#define TP6800_R5C_EDGE_THRLD
#define TP6800_R5D_DEMOSAIC_CFG
#define TP6800_R78_FORMAT
#define TP6800_R79_QUALITY
#define TP6800_R7A_BLK_THRLD

/* CX0342 register offsets */

#define CX0342_SENSOR_ID
#define CX0342_VERSION_NO
#define CX0342_ORG_X_L
#define CX0342_ORG_X_H
#define CX0342_ORG_Y_L
#define CX0342_ORG_Y_H
#define CX0342_STOP_X_L
#define CX0342_STOP_X_H
#define CX0342_STOP_Y_L
#define CX0342_STOP_Y_H
#define CX0342_FRAME_WIDTH_L
#define CX0342_FRAME_WIDTH_H
#define CX0342_FRAME_HEIGH_L
#define CX0342_FRAME_HEIGH_H
#define CX0342_EXPO_LINE_L
#define CX0342_EXPO_LINE_H
#define CX0342_EXPO_CLK_L
#define CX0342_EXPO_CLK_H
#define CX0342_RAW_GRGAIN_L
#define CX0342_RAW_GRGAIN_H
#define CX0342_RAW_GBGAIN_L
#define CX0342_RAW_GBGAIN_H
#define CX0342_RAW_RGAIN_L
#define CX0342_RAW_RGAIN_H
#define CX0342_RAW_BGAIN_L
#define CX0342_RAW_BGAIN_H
#define CX0342_GLOBAL_GAIN
#define CX0342_SYS_CTRL_0
#define CX0342_SYS_CTRL_1
#define CX0342_SYS_CTRL_2
#define CX0342_BYPASS_MODE
#define CX0342_SYS_CTRL_3
#define CX0342_TIMING_EN
#define CX0342_OUTPUT_CTRL
#define CX0342_AUTO_ADC_CALIB
#define CX0342_SYS_CTRL_4
#define CX0342_ADCGN
#define CX0342_SLPCR
#define CX0342_SLPFN_LO
#define CX0342_ADC_CTL
#define CX0342_LVRST_BLBIAS
#define CX0342_VTHSEL
#define CX0342_RAMP_RIV
#define CX0342_LDOSEL
#define CX0342_CLOCK_GEN
#define CX0342_SOFT_RESET
#define CX0342_PLL
#define CX0342_DR_ENH_PULSE_OFFSET_L
#define CX0342_DR_ENH_PULSE_OFFSET_H
#define CX0342_DR_ENH_PULSE_POS_L
#define CX0342_DR_ENH_PULSE_POS_H
#define CX0342_DR_ENH_PULSE_WIDTH
#define CX0342_AS_CURRENT_CNT_L
#define CX0342_AS_CURRENT_CNT_H
#define CX0342_AS_PREVIOUS_CNT_L
#define CX0342_AS_PREVIOUS_CNT_H
#define CX0342_SPV_VALUE_L
#define CX0342_SPV_VALUE_H
#define CX0342_GPXLTHD_L
#define CX0342_GPXLTHD_H
#define CX0342_RBPXLTHD_L
#define CX0342_RBPXLTHD_H
#define CX0342_PLANETHD_L
#define CX0342_PLANETHD_H
#define CX0342_ROWDARK_TH
#define CX0342_ROWDARK_TOL
#define CX0342_RB_GAP_L
#define CX0342_RB_GAP_H
#define CX0342_G_GAP_L
#define CX0342_G_GAP_H
#define CX0342_AUTO_ROW_DARK
#define CX0342_MANUAL_DARK_VALUE
#define CX0342_GB_DARK_OFFSET
#define CX0342_GR_DARK_OFFSET
#define CX0342_RED_DARK_OFFSET
#define CX0342_BLUE_DARK_OFFSET
#define CX0342_DATA_SCALING_MULTI
#define CX0342_AUTOD_Q_FRAME
#define CX0342_AUTOD_ALLOW_VARI
#define CX0342_AUTO_DARK_VALUE_L
#define CX0342_AUTO_DARK_VALUE_H
#define CX0342_IO_CTRL_0
#define CX0342_IO_CTRL_1
#define CX0342_IO_CTRL_2
#define CX0342_IDLE_CTRL
#define CX0342_TEST_MODE
#define CX0342_FRAME_FIX_DATA_TEST
#define CX0342_FRAME_CNT_TEST
#define CX0342_RST_OVERFLOW_L
#define CX0342_RST_OVERFLOW_H
#define CX0342_RST_UNDERFLOW_L
#define CX0342_RST_UNDERFLOW_H
#define CX0342_DATA_OVERFLOW_L
#define CX0342_DATA_OVERFLOW_H
#define CX0342_DATA_UNDERFLOW_L
#define CX0342_DATA_UNDERFLOW_H
#define CX0342_CHANNEL_0_0_L_irst
#define CX0342_CHANNEL_0_0_H_irst
#define CX0342_CHANNEL_0_1_L_irst
#define CX0342_CHANNEL_0_1_H_irst
#define CX0342_CHANNEL_0_2_L_irst
#define CX0342_CHANNEL_0_2_H_irst
#define CX0342_CHANNEL_0_3_L_irst
#define CX0342_CHANNEL_0_3_H_irst
#define CX0342_CHANNEL_0_4_L_irst
#define CX0342_CHANNEL_0_4_H_irst
#define CX0342_CHANNEL_0_5_L_irst
#define CX0342_CHANNEL_0_5_H_irst
#define CX0342_CHANNEL_0_6_L_irst
#define CX0342_CHANNEL_0_6_H_irst
#define CX0342_CHANNEL_0_7_L_irst
#define CX0342_CHANNEL_0_7_H_irst
#define CX0342_CHANNEL_1_0_L_itx
#define CX0342_CHANNEL_1_0_H_itx
#define CX0342_CHANNEL_1_1_L_itx
#define CX0342_CHANNEL_1_1_H_itx
#define CX0342_CHANNEL_1_2_L_itx
#define CX0342_CHANNEL_1_2_H_itx
#define CX0342_CHANNEL_1_3_L_itx
#define CX0342_CHANNEL_1_3_H_itx
#define CX0342_CHANNEL_1_4_L_itx
#define CX0342_CHANNEL_1_4_H_itx
#define CX0342_CHANNEL_1_5_L_itx
#define CX0342_CHANNEL_1_5_H_itx
#define CX0342_CHANNEL_1_6_L_itx
#define CX0342_CHANNEL_1_6_H_itx
#define CX0342_CHANNEL_1_7_L_itx
#define CX0342_CHANNEL_1_7_H_itx
#define CX0342_CHANNEL_2_0_L_iwl
#define CX0342_CHANNEL_2_0_H_iwl
#define CX0342_CHANNEL_2_1_L_iwl
#define CX0342_CHANNEL_2_1_H_iwl
#define CX0342_CHANNEL_2_2_L_iwl
#define CX0342_CHANNEL_2_2_H_iwl
#define CX0342_CHANNEL_2_3_L_iwl
#define CX0342_CHANNEL_2_3_H_iwl
#define CX0342_CHANNEL_2_4_L_iwl
#define CX0342_CHANNEL_2_4_H_iwl
#define CX0342_CHANNEL_2_5_L_iwl
#define CX0342_CHANNEL_2_5_H_iwl
#define CX0342_CHANNEL_2_6_L_iwl
#define CX0342_CHANNEL_2_6_H_iwl
#define CX0342_CHANNEL_2_7_L_iwl
#define CX0342_CHANNEL_2_7_H_iwl
#define CX0342_CHANNEL_3_0_L_ensp
#define CX0342_CHANNEL_3_0_H_ensp
#define CX0342_CHANNEL_3_1_L_ensp
#define CX0342_CHANNEL_3_1_H_ensp
#define CX0342_CHANNEL_3_2_L_ensp
#define CX0342_CHANNEL_3_2_H_ensp
#define CX0342_CHANNEL_3_3_L_ensp
#define CX0342_CHANNEL_3_3_H_ensp
#define CX0342_CHANNEL_3_4_L_ensp
#define CX0342_CHANNEL_3_4_H_ensp
#define CX0342_CHANNEL_3_5_L_ensp
#define CX0342_CHANNEL_3_5_H_ensp
#define CX0342_CHANNEL_3_6_L_ensp
#define CX0342_CHANNEL_3_6_H_ensp
#define CX0342_CHANNEL_3_7_L_ensp
#define CX0342_CHANNEL_3_7_H_ensp
#define CX0342_CHANNEL_4_0_L_sela
#define CX0342_CHANNEL_4_0_H_sela
#define CX0342_CHANNEL_4_1_L_sela
#define CX0342_CHANNEL_4_1_H_sela
#define CX0342_CHANNEL_5_0_L_intla
#define CX0342_CHANNEL_5_0_H_intla
#define CX0342_CHANNEL_5_1_L_intla
#define CX0342_CHANNEL_5_1_H_intla
#define CX0342_CHANNEL_5_2_L_intla
#define CX0342_CHANNEL_5_2_H_intla
#define CX0342_CHANNEL_5_3_L_intla
#define CX0342_CHANNEL_5_3_H_intla
#define CX0342_CHANNEL_6_0_L_xa_sel_pos
#define CX0342_CHANNEL_6_0_H_xa_sel_pos
#define CX0342_CHANNEL_7_1_L_cds_pos
#define CX0342_CHANNEL_7_1_H_cds_pos
#define CX0342_SENSOR_HEIGHT_L
#define CX0342_SENSOR_HEIGHT_H
#define CX0342_SENSOR_WIDTH_L
#define CX0342_SENSOR_WIDTH_H
#define CX0342_VSYNC_HSYNC_READ

struct cmd {};

static const u8 DQT[17][130] =;

static const struct cmd tp6810_cx_init_common[] =;

static const struct cmd tp6810_ov_init_common[] =;

static const struct cmd tp6810_bridge_start[] =;

static const struct cmd tp6810_late_start[] =;

static const struct cmd cx0342_timing_seq[] =;

/* define the JPEG header */
static void jpeg_define(u8 *jpeg_hdr,
			int height,
			int width)
{}

/* set the JPEG quality for sensor soi763a */
static void jpeg_set_qual(u8 *jpeg_hdr,
			  int quality)
{}

static void reg_w(struct gspca_dev *gspca_dev, u8 index, u8 value)
{}

/* the returned value is in gspca_dev->usb_buf */
static void reg_r(struct gspca_dev *gspca_dev, u8 index)
{}

static void reg_w_buf(struct gspca_dev *gspca_dev,
			const struct cmd *p, int l)
{}

static int i2c_w(struct gspca_dev *gspca_dev, u8 index, u8 value)
{}

static void i2c_w_buf(struct gspca_dev *gspca_dev,
			const struct cmd *p, int l)
{}

static int i2c_r(struct gspca_dev *gspca_dev, u8 index, int len)
{}

static void bulk_w(struct gspca_dev *gspca_dev,
		  u8 tag,
		  const u8 *data,
		  int length)
{}

static int probe_6810(struct gspca_dev *gspca_dev)
{}

static void cx0342_6810_init(struct gspca_dev *gspca_dev)
{}

static void soi763a_6810_init(struct gspca_dev *gspca_dev)
{}

/* set the gain and exposure */
static void setexposure(struct gspca_dev *gspca_dev, s32 expo, s32 gain,
							s32 blue, s32 red)
{}

/* set the JPEG quantization tables */
static void set_dqt(struct gspca_dev *gspca_dev, u8 q)
{}

/* set the JPEG compression quality factor */
static void setquality(struct gspca_dev *gspca_dev, s32 q)
{}

static const u8 color_null[18] =;
static const u8 color_gain[NSENSORS][18] =;

static void setgamma(struct gspca_dev *gspca_dev, s32 gamma)
{}

static void setsharpness(struct gspca_dev *gspca_dev, s32 val)
{}

static void setautogain(struct gspca_dev *gspca_dev, s32 val)
{}

/* set the resolution for sensor cx0342 */
static void set_resolution(struct gspca_dev *gspca_dev)
{}

/* convert the frame rate to a tp68x0 value */
static int get_fr_idx(struct gspca_dev *gspca_dev)
{}

static void setframerate(struct gspca_dev *gspca_dev, s32 val)
{}

static void setrgain(struct gspca_dev *gspca_dev, s32 rgain)
{}

static int sd_setgain(struct gspca_dev *gspca_dev)
{}

static void setbgain(struct gspca_dev *gspca_dev, s32 bgain)
{}

/* this function is called at probe time */
static int sd_config(struct gspca_dev *gspca_dev,
		     const struct usb_device_id *id)
{}

/* this function is called at probe and resume time */
static int sd_init(struct gspca_dev *gspca_dev)
{}

/* This function is called before choosing the alt setting */
static int sd_isoc_init(struct gspca_dev *gspca_dev)
{}

static void set_led(struct gspca_dev *gspca_dev, int on)
{}

static void cx0342_6800_start(struct gspca_dev *gspca_dev)
{}

static void cx0342_6810_start(struct gspca_dev *gspca_dev)
{}

static void soi763a_6800_start(struct gspca_dev *gspca_dev)
{}

static void soi763a_6810_start(struct gspca_dev *gspca_dev)
{}

/* -- start the camera -- */
static int sd_start(struct gspca_dev *gspca_dev)
{}

static void sd_stopN(struct gspca_dev *gspca_dev)
{}

static void sd_pkt_scan(struct gspca_dev *gspca_dev,
			u8 *data,
			int len)
{}

static void sd_dq_callback(struct gspca_dev *gspca_dev)
{}

/* get stream parameters (framerate) */
static void sd_get_streamparm(struct gspca_dev *gspca_dev,
			     struct v4l2_streamparm *parm)
{}

/* set stream parameters (framerate) */
static void sd_set_streamparm(struct gspca_dev *gspca_dev,
			     struct v4l2_streamparm *parm)
{}

static int sd_set_jcomp(struct gspca_dev *gspca_dev,
			const struct v4l2_jpegcompression *jcomp)
{}

static int sd_get_jcomp(struct gspca_dev *gspca_dev,
			struct v4l2_jpegcompression *jcomp)
{}

static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops sd_ctrl_ops =;

static int sd_init_controls(struct gspca_dev *gspca_dev)
{}

static const struct sd_desc sd_desc =;

static const struct usb_device_id device_table[] =;

MODULE_DEVICE_TABLE(usb, device_table);

static int sd_probe(struct usb_interface *interface,
		    const struct usb_device_id *id)
{}

static struct usb_driver sd_driver =;

module_usb_driver();

module_param(force_sensor, int, 0644);
MODULE_PARM_DESC();