162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
462306a36Sopenharmony_ci *		      Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
562306a36Sopenharmony_ci * Copyright (c) 2002, 2003 Tuukka Toivonen
662306a36Sopenharmony_ci * Copyright (c) 2008 Erik Andrén
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * P/N 861037:      Sensor HDCS1000        ASIC STV0600
962306a36Sopenharmony_ci * P/N 861050-0010: Sensor HDCS1000        ASIC STV0600
1062306a36Sopenharmony_ci * P/N 861050-0020: Sensor Photobit PB100  ASIC STV0600-1 - QuickCam Express
1162306a36Sopenharmony_ci * P/N 861055:      Sensor ST VV6410       ASIC STV0610   - LEGO cam
1262306a36Sopenharmony_ci * P/N 861075-0040: Sensor HDCS1000        ASIC
1362306a36Sopenharmony_ci * P/N 961179-0700: Sensor ST VV6410       ASIC STV0602   - Dexxa WebCam USB
1462306a36Sopenharmony_ci * P/N 861040-0000: Sensor ST VV6410       ASIC STV0610   - QuickCam Web
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#ifndef STV06XX_PB0100_H_
1862306a36Sopenharmony_ci#define STV06XX_PB0100_H_
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#include "stv06xx_sensor.h"
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* mode priv field flags */
2362306a36Sopenharmony_ci#define PB0100_CROP_TO_VGA	0x01
2462306a36Sopenharmony_ci#define PB0100_SUBSAMPLE	0x02
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* I2C Registers */
2762306a36Sopenharmony_ci#define PB_IDENT		0x00	/* Chip Version */
2862306a36Sopenharmony_ci#define PB_RSTART		0x01	/* Row Window Start */
2962306a36Sopenharmony_ci#define PB_CSTART		0x02	/* Column Window Start */
3062306a36Sopenharmony_ci#define PB_RWSIZE		0x03	/* Row Window Size */
3162306a36Sopenharmony_ci#define PB_CWSIZE		0x04	/* Column  Window Size */
3262306a36Sopenharmony_ci#define PB_CFILLIN		0x05	/* Column Fill-In */
3362306a36Sopenharmony_ci#define PB_VBL			0x06	/* Vertical Blank Count */
3462306a36Sopenharmony_ci#define PB_CONTROL		0x07	/* Control Mode */
3562306a36Sopenharmony_ci#define PB_FINTTIME		0x08	/* Integration Time/Frame Unit Count */
3662306a36Sopenharmony_ci#define PB_RINTTIME		0x09	/* Integration Time/Row Unit Count */
3762306a36Sopenharmony_ci#define PB_ROWSPEED		0x0a	/* Row Speed Control */
3862306a36Sopenharmony_ci#define PB_ABORTFRAME		0x0b	/* Abort Frame */
3962306a36Sopenharmony_ci#define PB_R12			0x0c	/* Reserved */
4062306a36Sopenharmony_ci#define PB_RESET		0x0d	/* Reset */
4162306a36Sopenharmony_ci#define PB_EXPGAIN		0x0e	/* Exposure Gain Command */
4262306a36Sopenharmony_ci#define PB_R15			0x0f	/* Expose0 */
4362306a36Sopenharmony_ci#define PB_R16			0x10	/* Expose1 */
4462306a36Sopenharmony_ci#define PB_R17			0x11	/* Expose2 */
4562306a36Sopenharmony_ci#define PB_R18			0x12	/* Low0_DAC */
4662306a36Sopenharmony_ci#define PB_R19			0x13	/* Low1_DAC */
4762306a36Sopenharmony_ci#define PB_R20			0x14	/* Low2_DAC */
4862306a36Sopenharmony_ci#define PB_R21			0x15	/* Threshold11 */
4962306a36Sopenharmony_ci#define PB_R22			0x16	/* Threshold0x */
5062306a36Sopenharmony_ci#define PB_UPDATEINT		0x17	/* Update Interval */
5162306a36Sopenharmony_ci#define PB_R24			0x18	/* High_DAC */
5262306a36Sopenharmony_ci#define PB_R25			0x19	/* Trans0H */
5362306a36Sopenharmony_ci#define PB_R26			0x1a	/* Trans1L */
5462306a36Sopenharmony_ci#define PB_R27			0x1b	/* Trans1H */
5562306a36Sopenharmony_ci#define PB_R28			0x1c	/* Trans2L */
5662306a36Sopenharmony_ci#define PB_R29			0x1d	/* Reserved */
5762306a36Sopenharmony_ci#define PB_R30			0x1e	/* Reserved */
5862306a36Sopenharmony_ci#define PB_R31			0x1f	/* Wait to Read */
5962306a36Sopenharmony_ci#define PB_PREADCTRL		0x20	/* Pixel Read Control Mode */
6062306a36Sopenharmony_ci#define PB_R33			0x21	/* IREF_VLN */
6162306a36Sopenharmony_ci#define PB_R34			0x22	/* IREF_VLP */
6262306a36Sopenharmony_ci#define PB_R35			0x23	/* IREF_VLN_INTEG */
6362306a36Sopenharmony_ci#define PB_R36			0x24	/* IREF_MASTER */
6462306a36Sopenharmony_ci#define PB_R37			0x25	/* IDACP */
6562306a36Sopenharmony_ci#define PB_R38			0x26	/* IDACN */
6662306a36Sopenharmony_ci#define PB_R39			0x27	/* DAC_Control_Reg */
6762306a36Sopenharmony_ci#define PB_R40			0x28	/* VCL */
6862306a36Sopenharmony_ci#define PB_R41			0x29	/* IREF_VLN_ADCIN */
6962306a36Sopenharmony_ci#define PB_R42			0x2a	/* Reserved */
7062306a36Sopenharmony_ci#define PB_G1GAIN		0x2b	/* Green 1 Gain */
7162306a36Sopenharmony_ci#define PB_BGAIN		0x2c	/* Blue Gain */
7262306a36Sopenharmony_ci#define PB_RGAIN		0x2d	/* Red Gain */
7362306a36Sopenharmony_ci#define PB_G2GAIN		0x2e	/* Green 2 Gain */
7462306a36Sopenharmony_ci#define PB_R47			0x2f	/* Dark Row Address */
7562306a36Sopenharmony_ci#define PB_R48			0x30	/* Dark Row Options */
7662306a36Sopenharmony_ci#define PB_R49			0x31	/* Reserved */
7762306a36Sopenharmony_ci#define PB_R50			0x32	/* Image Test Data */
7862306a36Sopenharmony_ci#define PB_ADCMAXGAIN		0x33	/* Maximum Gain */
7962306a36Sopenharmony_ci#define PB_ADCMINGAIN		0x34	/* Minimum Gain */
8062306a36Sopenharmony_ci#define PB_ADCGLOBALGAIN	0x35	/* Global Gain */
8162306a36Sopenharmony_ci#define PB_R54			0x36	/* Maximum Frame */
8262306a36Sopenharmony_ci#define PB_R55			0x37	/* Minimum Frame */
8362306a36Sopenharmony_ci#define PB_R56			0x38	/* Reserved */
8462306a36Sopenharmony_ci#define PB_VOFFSET		0x39	/* VOFFSET */
8562306a36Sopenharmony_ci#define PB_R58			0x3a	/* Snap-Shot Sequence Trigger */
8662306a36Sopenharmony_ci#define PB_ADCGAINH		0x3b	/* VREF_HI */
8762306a36Sopenharmony_ci#define PB_ADCGAINL		0x3c	/* VREF_LO */
8862306a36Sopenharmony_ci#define PB_R61			0x3d	/* Reserved */
8962306a36Sopenharmony_ci#define PB_R62			0x3e	/* Reserved */
9062306a36Sopenharmony_ci#define PB_R63			0x3f	/* Reserved */
9162306a36Sopenharmony_ci#define PB_R64			0x40	/* Red/Blue Gain */
9262306a36Sopenharmony_ci#define PB_R65			0x41	/* Green 2/Green 1 Gain */
9362306a36Sopenharmony_ci#define PB_R66			0x42	/* VREF_HI/LO */
9462306a36Sopenharmony_ci#define PB_R67			0x43	/* Integration Time/Row Unit Count */
9562306a36Sopenharmony_ci#define PB_R240			0xf0	/* ADC Test */
9662306a36Sopenharmony_ci#define PB_R241			0xf1    /* Chip Enable */
9762306a36Sopenharmony_ci#define PB_R242			0xf2	/* Reserved */
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_cistatic int pb0100_probe(struct sd *sd);
10062306a36Sopenharmony_cistatic int pb0100_start(struct sd *sd);
10162306a36Sopenharmony_cistatic int pb0100_init(struct sd *sd);
10262306a36Sopenharmony_cistatic int pb0100_init_controls(struct sd *sd);
10362306a36Sopenharmony_cistatic int pb0100_stop(struct sd *sd);
10462306a36Sopenharmony_cistatic int pb0100_dump(struct sd *sd);
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/* V4L2 controls supported by the driver */
10762306a36Sopenharmony_cistatic int pb0100_set_gain(struct gspca_dev *gspca_dev, __s32 val);
10862306a36Sopenharmony_cistatic int pb0100_set_red_balance(struct gspca_dev *gspca_dev, __s32 val);
10962306a36Sopenharmony_cistatic int pb0100_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val);
11062306a36Sopenharmony_cistatic int pb0100_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
11162306a36Sopenharmony_cistatic int pb0100_set_autogain(struct gspca_dev *gspca_dev, __s32 val);
11262306a36Sopenharmony_cistatic int pb0100_set_autogain_target(struct gspca_dev *gspca_dev, __s32 val);
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ciconst struct stv06xx_sensor stv06xx_sensor_pb0100 = {
11562306a36Sopenharmony_ci	.name = "PB-0100",
11662306a36Sopenharmony_ci	.i2c_flush = 1,
11762306a36Sopenharmony_ci	.i2c_addr = 0xba,
11862306a36Sopenharmony_ci	.i2c_len = 2,
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci	.min_packet_size = { 635, 847 },
12162306a36Sopenharmony_ci	.max_packet_size = { 847, 923 },
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci	.init = pb0100_init,
12462306a36Sopenharmony_ci	.init_controls = pb0100_init_controls,
12562306a36Sopenharmony_ci	.probe = pb0100_probe,
12662306a36Sopenharmony_ci	.start = pb0100_start,
12762306a36Sopenharmony_ci	.stop = pb0100_stop,
12862306a36Sopenharmony_ci	.dump = pb0100_dump,
12962306a36Sopenharmony_ci};
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#endif
132