18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
48c2ecf20Sopenharmony_ci *		      Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
58c2ecf20Sopenharmony_ci * Copyright (c) 2002, 2003 Tuukka Toivonen
68c2ecf20Sopenharmony_ci * Copyright (c) 2008 Erik Andrén
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * P/N 861037:      Sensor HDCS1000        ASIC STV0600
98c2ecf20Sopenharmony_ci * P/N 861050-0010: Sensor HDCS1000        ASIC STV0600
108c2ecf20Sopenharmony_ci * P/N 861050-0020: Sensor Photobit PB100  ASIC STV0600-1 - QuickCam Express
118c2ecf20Sopenharmony_ci * P/N 861055:      Sensor ST VV6410       ASIC STV0610   - LEGO cam
128c2ecf20Sopenharmony_ci * P/N 861075-0040: Sensor HDCS1000        ASIC
138c2ecf20Sopenharmony_ci * P/N 961179-0700: Sensor ST VV6410       ASIC STV0602   - Dexxa WebCam USB
148c2ecf20Sopenharmony_ci * P/N 861040-0000: Sensor ST VV6410       ASIC STV0610   - QuickCam Web
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef STV06XX_PB0100_H_
188c2ecf20Sopenharmony_ci#define STV06XX_PB0100_H_
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include "stv06xx_sensor.h"
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* mode priv field flags */
238c2ecf20Sopenharmony_ci#define PB0100_CROP_TO_VGA	0x01
248c2ecf20Sopenharmony_ci#define PB0100_SUBSAMPLE	0x02
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* I2C Registers */
278c2ecf20Sopenharmony_ci#define PB_IDENT		0x00	/* Chip Version */
288c2ecf20Sopenharmony_ci#define PB_RSTART		0x01	/* Row Window Start */
298c2ecf20Sopenharmony_ci#define PB_CSTART		0x02	/* Column Window Start */
308c2ecf20Sopenharmony_ci#define PB_RWSIZE		0x03	/* Row Window Size */
318c2ecf20Sopenharmony_ci#define PB_CWSIZE		0x04	/* Column  Window Size */
328c2ecf20Sopenharmony_ci#define PB_CFILLIN		0x05	/* Column Fill-In */
338c2ecf20Sopenharmony_ci#define PB_VBL			0x06	/* Vertical Blank Count */
348c2ecf20Sopenharmony_ci#define PB_CONTROL		0x07	/* Control Mode */
358c2ecf20Sopenharmony_ci#define PB_FINTTIME		0x08	/* Integration Time/Frame Unit Count */
368c2ecf20Sopenharmony_ci#define PB_RINTTIME		0x09	/* Integration Time/Row Unit Count */
378c2ecf20Sopenharmony_ci#define PB_ROWSPEED		0x0a	/* Row Speed Control */
388c2ecf20Sopenharmony_ci#define PB_ABORTFRAME		0x0b	/* Abort Frame */
398c2ecf20Sopenharmony_ci#define PB_R12			0x0c	/* Reserved */
408c2ecf20Sopenharmony_ci#define PB_RESET		0x0d	/* Reset */
418c2ecf20Sopenharmony_ci#define PB_EXPGAIN		0x0e	/* Exposure Gain Command */
428c2ecf20Sopenharmony_ci#define PB_R15			0x0f	/* Expose0 */
438c2ecf20Sopenharmony_ci#define PB_R16			0x10	/* Expose1 */
448c2ecf20Sopenharmony_ci#define PB_R17			0x11	/* Expose2 */
458c2ecf20Sopenharmony_ci#define PB_R18			0x12	/* Low0_DAC */
468c2ecf20Sopenharmony_ci#define PB_R19			0x13	/* Low1_DAC */
478c2ecf20Sopenharmony_ci#define PB_R20			0x14	/* Low2_DAC */
488c2ecf20Sopenharmony_ci#define PB_R21			0x15	/* Threshold11 */
498c2ecf20Sopenharmony_ci#define PB_R22			0x16	/* Threshold0x */
508c2ecf20Sopenharmony_ci#define PB_UPDATEINT		0x17	/* Update Interval */
518c2ecf20Sopenharmony_ci#define PB_R24			0x18	/* High_DAC */
528c2ecf20Sopenharmony_ci#define PB_R25			0x19	/* Trans0H */
538c2ecf20Sopenharmony_ci#define PB_R26			0x1a	/* Trans1L */
548c2ecf20Sopenharmony_ci#define PB_R27			0x1b	/* Trans1H */
558c2ecf20Sopenharmony_ci#define PB_R28			0x1c	/* Trans2L */
568c2ecf20Sopenharmony_ci#define PB_R29			0x1d	/* Reserved */
578c2ecf20Sopenharmony_ci#define PB_R30			0x1e	/* Reserved */
588c2ecf20Sopenharmony_ci#define PB_R31			0x1f	/* Wait to Read */
598c2ecf20Sopenharmony_ci#define PB_PREADCTRL		0x20	/* Pixel Read Control Mode */
608c2ecf20Sopenharmony_ci#define PB_R33			0x21	/* IREF_VLN */
618c2ecf20Sopenharmony_ci#define PB_R34			0x22	/* IREF_VLP */
628c2ecf20Sopenharmony_ci#define PB_R35			0x23	/* IREF_VLN_INTEG */
638c2ecf20Sopenharmony_ci#define PB_R36			0x24	/* IREF_MASTER */
648c2ecf20Sopenharmony_ci#define PB_R37			0x25	/* IDACP */
658c2ecf20Sopenharmony_ci#define PB_R38			0x26	/* IDACN */
668c2ecf20Sopenharmony_ci#define PB_R39			0x27	/* DAC_Control_Reg */
678c2ecf20Sopenharmony_ci#define PB_R40			0x28	/* VCL */
688c2ecf20Sopenharmony_ci#define PB_R41			0x29	/* IREF_VLN_ADCIN */
698c2ecf20Sopenharmony_ci#define PB_R42			0x2a	/* Reserved */
708c2ecf20Sopenharmony_ci#define PB_G1GAIN		0x2b	/* Green 1 Gain */
718c2ecf20Sopenharmony_ci#define PB_BGAIN		0x2c	/* Blue Gain */
728c2ecf20Sopenharmony_ci#define PB_RGAIN		0x2d	/* Red Gain */
738c2ecf20Sopenharmony_ci#define PB_G2GAIN		0x2e	/* Green 2 Gain */
748c2ecf20Sopenharmony_ci#define PB_R47			0x2f	/* Dark Row Address */
758c2ecf20Sopenharmony_ci#define PB_R48			0x30	/* Dark Row Options */
768c2ecf20Sopenharmony_ci#define PB_R49			0x31	/* Reserved */
778c2ecf20Sopenharmony_ci#define PB_R50			0x32	/* Image Test Data */
788c2ecf20Sopenharmony_ci#define PB_ADCMAXGAIN		0x33	/* Maximum Gain */
798c2ecf20Sopenharmony_ci#define PB_ADCMINGAIN		0x34	/* Minimum Gain */
808c2ecf20Sopenharmony_ci#define PB_ADCGLOBALGAIN	0x35	/* Global Gain */
818c2ecf20Sopenharmony_ci#define PB_R54			0x36	/* Maximum Frame */
828c2ecf20Sopenharmony_ci#define PB_R55			0x37	/* Minimum Frame */
838c2ecf20Sopenharmony_ci#define PB_R56			0x38	/* Reserved */
848c2ecf20Sopenharmony_ci#define PB_VOFFSET		0x39	/* VOFFSET */
858c2ecf20Sopenharmony_ci#define PB_R58			0x3a	/* Snap-Shot Sequence Trigger */
868c2ecf20Sopenharmony_ci#define PB_ADCGAINH		0x3b	/* VREF_HI */
878c2ecf20Sopenharmony_ci#define PB_ADCGAINL		0x3c	/* VREF_LO */
888c2ecf20Sopenharmony_ci#define PB_R61			0x3d	/* Reserved */
898c2ecf20Sopenharmony_ci#define PB_R62			0x3e	/* Reserved */
908c2ecf20Sopenharmony_ci#define PB_R63			0x3f	/* Reserved */
918c2ecf20Sopenharmony_ci#define PB_R64			0x40	/* Red/Blue Gain */
928c2ecf20Sopenharmony_ci#define PB_R65			0x41	/* Green 2/Green 1 Gain */
938c2ecf20Sopenharmony_ci#define PB_R66			0x42	/* VREF_HI/LO */
948c2ecf20Sopenharmony_ci#define PB_R67			0x43	/* Integration Time/Row Unit Count */
958c2ecf20Sopenharmony_ci#define PB_R240			0xf0	/* ADC Test */
968c2ecf20Sopenharmony_ci#define PB_R241			0xf1    /* Chip Enable */
978c2ecf20Sopenharmony_ci#define PB_R242			0xf2	/* Reserved */
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cistatic int pb0100_probe(struct sd *sd);
1008c2ecf20Sopenharmony_cistatic int pb0100_start(struct sd *sd);
1018c2ecf20Sopenharmony_cistatic int pb0100_init(struct sd *sd);
1028c2ecf20Sopenharmony_cistatic int pb0100_init_controls(struct sd *sd);
1038c2ecf20Sopenharmony_cistatic int pb0100_stop(struct sd *sd);
1048c2ecf20Sopenharmony_cistatic int pb0100_dump(struct sd *sd);
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* V4L2 controls supported by the driver */
1078c2ecf20Sopenharmony_cistatic int pb0100_set_gain(struct gspca_dev *gspca_dev, __s32 val);
1088c2ecf20Sopenharmony_cistatic int pb0100_set_red_balance(struct gspca_dev *gspca_dev, __s32 val);
1098c2ecf20Sopenharmony_cistatic int pb0100_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val);
1108c2ecf20Sopenharmony_cistatic int pb0100_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
1118c2ecf20Sopenharmony_cistatic int pb0100_set_autogain(struct gspca_dev *gspca_dev, __s32 val);
1128c2ecf20Sopenharmony_cistatic int pb0100_set_autogain_target(struct gspca_dev *gspca_dev, __s32 val);
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ciconst struct stv06xx_sensor stv06xx_sensor_pb0100 = {
1158c2ecf20Sopenharmony_ci	.name = "PB-0100",
1168c2ecf20Sopenharmony_ci	.i2c_flush = 1,
1178c2ecf20Sopenharmony_ci	.i2c_addr = 0xba,
1188c2ecf20Sopenharmony_ci	.i2c_len = 2,
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci	.min_packet_size = { 635, 847 },
1218c2ecf20Sopenharmony_ci	.max_packet_size = { 847, 923 },
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci	.init = pb0100_init,
1248c2ecf20Sopenharmony_ci	.init_controls = pb0100_init_controls,
1258c2ecf20Sopenharmony_ci	.probe = pb0100_probe,
1268c2ecf20Sopenharmony_ci	.start = pb0100_start,
1278c2ecf20Sopenharmony_ci	.stop = pb0100_stop,
1288c2ecf20Sopenharmony_ci	.dump = pb0100_dump,
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#endif
132