1*c942fddfSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 20c0d06caSMauro Carvalho Chehab /* 30c0d06caSMauro Carvalho Chehab * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher 40c0d06caSMauro Carvalho Chehab * Mark Cave-Ayland, Carlo E Prelz, Dick Streefland 50c0d06caSMauro Carvalho Chehab * Copyright (c) 2002, 2003 Tuukka Toivonen 60c0d06caSMauro Carvalho Chehab * Copyright (c) 2008 Erik Andrén 70c0d06caSMauro Carvalho Chehab * 80c0d06caSMauro Carvalho Chehab * P/N 861037: Sensor HDCS1000 ASIC STV0600 90c0d06caSMauro Carvalho Chehab * P/N 861050-0010: Sensor HDCS1000 ASIC STV0600 100c0d06caSMauro Carvalho Chehab * P/N 861050-0020: Sensor Photobit PB100 ASIC STV0600-1 - QuickCam Express 110c0d06caSMauro Carvalho Chehab * P/N 861055: Sensor ST VV6410 ASIC STV0610 - LEGO cam 120c0d06caSMauro Carvalho Chehab * P/N 861075-0040: Sensor HDCS1000 ASIC 130c0d06caSMauro Carvalho Chehab * P/N 961179-0700: Sensor ST VV6410 ASIC STV0602 - Dexxa WebCam USB 140c0d06caSMauro Carvalho Chehab * P/N 861040-0000: Sensor ST VV6410 ASIC STV0610 - QuickCam Web 150c0d06caSMauro Carvalho Chehab */ 160c0d06caSMauro Carvalho Chehab 170c0d06caSMauro Carvalho Chehab #ifndef STV06XX_PB0100_H_ 180c0d06caSMauro Carvalho Chehab #define STV06XX_PB0100_H_ 190c0d06caSMauro Carvalho Chehab 200c0d06caSMauro Carvalho Chehab #include "stv06xx_sensor.h" 210c0d06caSMauro Carvalho Chehab 220c0d06caSMauro Carvalho Chehab /* mode priv field flags */ 230c0d06caSMauro Carvalho Chehab #define PB0100_CROP_TO_VGA 0x01 240c0d06caSMauro Carvalho Chehab #define PB0100_SUBSAMPLE 0x02 250c0d06caSMauro Carvalho Chehab 260c0d06caSMauro Carvalho Chehab /* I2C Registers */ 270c0d06caSMauro Carvalho Chehab #define PB_IDENT 0x00 /* Chip Version */ 280c0d06caSMauro Carvalho Chehab #define PB_RSTART 0x01 /* Row Window Start */ 290c0d06caSMauro Carvalho Chehab #define PB_CSTART 0x02 /* Column Window Start */ 300c0d06caSMauro Carvalho Chehab #define PB_RWSIZE 0x03 /* Row Window Size */ 310c0d06caSMauro Carvalho Chehab #define PB_CWSIZE 0x04 /* Column Window Size */ 320c0d06caSMauro Carvalho Chehab #define PB_CFILLIN 0x05 /* Column Fill-In */ 330c0d06caSMauro Carvalho Chehab #define PB_VBL 0x06 /* Vertical Blank Count */ 340c0d06caSMauro Carvalho Chehab #define PB_CONTROL 0x07 /* Control Mode */ 350c0d06caSMauro Carvalho Chehab #define PB_FINTTIME 0x08 /* Integration Time/Frame Unit Count */ 360c0d06caSMauro Carvalho Chehab #define PB_RINTTIME 0x09 /* Integration Time/Row Unit Count */ 370c0d06caSMauro Carvalho Chehab #define PB_ROWSPEED 0x0a /* Row Speed Control */ 380c0d06caSMauro Carvalho Chehab #define PB_ABORTFRAME 0x0b /* Abort Frame */ 390c0d06caSMauro Carvalho Chehab #define PB_R12 0x0c /* Reserved */ 400c0d06caSMauro Carvalho Chehab #define PB_RESET 0x0d /* Reset */ 410c0d06caSMauro Carvalho Chehab #define PB_EXPGAIN 0x0e /* Exposure Gain Command */ 420c0d06caSMauro Carvalho Chehab #define PB_R15 0x0f /* Expose0 */ 430c0d06caSMauro Carvalho Chehab #define PB_R16 0x10 /* Expose1 */ 440c0d06caSMauro Carvalho Chehab #define PB_R17 0x11 /* Expose2 */ 450c0d06caSMauro Carvalho Chehab #define PB_R18 0x12 /* Low0_DAC */ 460c0d06caSMauro Carvalho Chehab #define PB_R19 0x13 /* Low1_DAC */ 470c0d06caSMauro Carvalho Chehab #define PB_R20 0x14 /* Low2_DAC */ 480c0d06caSMauro Carvalho Chehab #define PB_R21 0x15 /* Threshold11 */ 490c0d06caSMauro Carvalho Chehab #define PB_R22 0x16 /* Threshold0x */ 500c0d06caSMauro Carvalho Chehab #define PB_UPDATEINT 0x17 /* Update Interval */ 510c0d06caSMauro Carvalho Chehab #define PB_R24 0x18 /* High_DAC */ 520c0d06caSMauro Carvalho Chehab #define PB_R25 0x19 /* Trans0H */ 530c0d06caSMauro Carvalho Chehab #define PB_R26 0x1a /* Trans1L */ 540c0d06caSMauro Carvalho Chehab #define PB_R27 0x1b /* Trans1H */ 550c0d06caSMauro Carvalho Chehab #define PB_R28 0x1c /* Trans2L */ 560c0d06caSMauro Carvalho Chehab #define PB_R29 0x1d /* Reserved */ 570c0d06caSMauro Carvalho Chehab #define PB_R30 0x1e /* Reserved */ 580c0d06caSMauro Carvalho Chehab #define PB_R31 0x1f /* Wait to Read */ 590c0d06caSMauro Carvalho Chehab #define PB_PREADCTRL 0x20 /* Pixel Read Control Mode */ 600c0d06caSMauro Carvalho Chehab #define PB_R33 0x21 /* IREF_VLN */ 610c0d06caSMauro Carvalho Chehab #define PB_R34 0x22 /* IREF_VLP */ 620c0d06caSMauro Carvalho Chehab #define PB_R35 0x23 /* IREF_VLN_INTEG */ 630c0d06caSMauro Carvalho Chehab #define PB_R36 0x24 /* IREF_MASTER */ 640c0d06caSMauro Carvalho Chehab #define PB_R37 0x25 /* IDACP */ 650c0d06caSMauro Carvalho Chehab #define PB_R38 0x26 /* IDACN */ 660c0d06caSMauro Carvalho Chehab #define PB_R39 0x27 /* DAC_Control_Reg */ 670c0d06caSMauro Carvalho Chehab #define PB_R40 0x28 /* VCL */ 680c0d06caSMauro Carvalho Chehab #define PB_R41 0x29 /* IREF_VLN_ADCIN */ 690c0d06caSMauro Carvalho Chehab #define PB_R42 0x2a /* Reserved */ 700c0d06caSMauro Carvalho Chehab #define PB_G1GAIN 0x2b /* Green 1 Gain */ 710c0d06caSMauro Carvalho Chehab #define PB_BGAIN 0x2c /* Blue Gain */ 720c0d06caSMauro Carvalho Chehab #define PB_RGAIN 0x2d /* Red Gain */ 730c0d06caSMauro Carvalho Chehab #define PB_G2GAIN 0x2e /* Green 2 Gain */ 740c0d06caSMauro Carvalho Chehab #define PB_R47 0x2f /* Dark Row Address */ 750c0d06caSMauro Carvalho Chehab #define PB_R48 0x30 /* Dark Row Options */ 760c0d06caSMauro Carvalho Chehab #define PB_R49 0x31 /* Reserved */ 770c0d06caSMauro Carvalho Chehab #define PB_R50 0x32 /* Image Test Data */ 780c0d06caSMauro Carvalho Chehab #define PB_ADCMAXGAIN 0x33 /* Maximum Gain */ 790c0d06caSMauro Carvalho Chehab #define PB_ADCMINGAIN 0x34 /* Minimum Gain */ 800c0d06caSMauro Carvalho Chehab #define PB_ADCGLOBALGAIN 0x35 /* Global Gain */ 810c0d06caSMauro Carvalho Chehab #define PB_R54 0x36 /* Maximum Frame */ 820c0d06caSMauro Carvalho Chehab #define PB_R55 0x37 /* Minimum Frame */ 830c0d06caSMauro Carvalho Chehab #define PB_R56 0x38 /* Reserved */ 840c0d06caSMauro Carvalho Chehab #define PB_VOFFSET 0x39 /* VOFFSET */ 850c0d06caSMauro Carvalho Chehab #define PB_R58 0x3a /* Snap-Shot Sequence Trigger */ 860c0d06caSMauro Carvalho Chehab #define PB_ADCGAINH 0x3b /* VREF_HI */ 870c0d06caSMauro Carvalho Chehab #define PB_ADCGAINL 0x3c /* VREF_LO */ 880c0d06caSMauro Carvalho Chehab #define PB_R61 0x3d /* Reserved */ 890c0d06caSMauro Carvalho Chehab #define PB_R62 0x3e /* Reserved */ 900c0d06caSMauro Carvalho Chehab #define PB_R63 0x3f /* Reserved */ 910c0d06caSMauro Carvalho Chehab #define PB_R64 0x40 /* Red/Blue Gain */ 920c0d06caSMauro Carvalho Chehab #define PB_R65 0x41 /* Green 2/Green 1 Gain */ 930c0d06caSMauro Carvalho Chehab #define PB_R66 0x42 /* VREF_HI/LO */ 940c0d06caSMauro Carvalho Chehab #define PB_R67 0x43 /* Integration Time/Row Unit Count */ 950c0d06caSMauro Carvalho Chehab #define PB_R240 0xf0 /* ADC Test */ 960c0d06caSMauro Carvalho Chehab #define PB_R241 0xf1 /* Chip Enable */ 970c0d06caSMauro Carvalho Chehab #define PB_R242 0xf2 /* Reserved */ 980c0d06caSMauro Carvalho Chehab 990c0d06caSMauro Carvalho Chehab static int pb0100_probe(struct sd *sd); 1000c0d06caSMauro Carvalho Chehab static int pb0100_start(struct sd *sd); 1010c0d06caSMauro Carvalho Chehab static int pb0100_init(struct sd *sd); 1020c0d06caSMauro Carvalho Chehab static int pb0100_init_controls(struct sd *sd); 1030c0d06caSMauro Carvalho Chehab static int pb0100_stop(struct sd *sd); 1040c0d06caSMauro Carvalho Chehab static int pb0100_dump(struct sd *sd); 1050c0d06caSMauro Carvalho Chehab 1060c0d06caSMauro Carvalho Chehab /* V4L2 controls supported by the driver */ 1070c0d06caSMauro Carvalho Chehab static int pb0100_set_gain(struct gspca_dev *gspca_dev, __s32 val); 1080c0d06caSMauro Carvalho Chehab static int pb0100_set_red_balance(struct gspca_dev *gspca_dev, __s32 val); 1090c0d06caSMauro Carvalho Chehab static int pb0100_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val); 1100c0d06caSMauro Carvalho Chehab static int pb0100_set_exposure(struct gspca_dev *gspca_dev, __s32 val); 1110c0d06caSMauro Carvalho Chehab static int pb0100_set_autogain(struct gspca_dev *gspca_dev, __s32 val); 1120c0d06caSMauro Carvalho Chehab static int pb0100_set_autogain_target(struct gspca_dev *gspca_dev, __s32 val); 1130c0d06caSMauro Carvalho Chehab 1140c0d06caSMauro Carvalho Chehab const struct stv06xx_sensor stv06xx_sensor_pb0100 = { 1150c0d06caSMauro Carvalho Chehab .name = "PB-0100", 1160c0d06caSMauro Carvalho Chehab .i2c_flush = 1, 1170c0d06caSMauro Carvalho Chehab .i2c_addr = 0xba, 1180c0d06caSMauro Carvalho Chehab .i2c_len = 2, 1190c0d06caSMauro Carvalho Chehab 1200c0d06caSMauro Carvalho Chehab .min_packet_size = { 635, 847 }, 1210c0d06caSMauro Carvalho Chehab .max_packet_size = { 847, 923 }, 1220c0d06caSMauro Carvalho Chehab 1230c0d06caSMauro Carvalho Chehab .init = pb0100_init, 1240c0d06caSMauro Carvalho Chehab .init_controls = pb0100_init_controls, 1250c0d06caSMauro Carvalho Chehab .probe = pb0100_probe, 1260c0d06caSMauro Carvalho Chehab .start = pb0100_start, 1270c0d06caSMauro Carvalho Chehab .stop = pb0100_stop, 1280c0d06caSMauro Carvalho Chehab .dump = pb0100_dump, 1290c0d06caSMauro Carvalho Chehab }; 1300c0d06caSMauro Carvalho Chehab 1310c0d06caSMauro Carvalho Chehab #endif 132