Path: blob/master/drivers/media/video/gspca/spca501.c
17604 views
/*1* SPCA501 chip based cameras initialization data2*3* V4L2 by Jean-Francois Moine <http://moinejf.free.fr>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*19*/2021#define MODULE_NAME "spca501"2223#include "gspca.h"2425MODULE_AUTHOR("Michel Xhaard <[email protected]>");26MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");27MODULE_LICENSE("GPL");2829/* specific webcam descriptor */30struct sd {31struct gspca_dev gspca_dev; /* !! must be the first item */3233unsigned short contrast;34__u8 brightness;35__u8 colors;36__u8 blue_balance;37__u8 red_balance;3839char subtype;40#define Arowana300KCMOSCamera 041#define IntelCreateAndShare 142#define KodakDVC325 243#define MystFromOriUnknownCamera 344#define SmileIntlCamera 445#define ThreeComHomeConnectLite 546#define ViewQuestM318B 647};4849/* V4L2 controls supported by the driver */50static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);51static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);52static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);53static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);54static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);55static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);56static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val);57static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val);58static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val);59static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val);6061static const struct ctrl sd_ctrls[] = {62#define MY_BRIGHTNESS 063{64{65.id = V4L2_CID_BRIGHTNESS,66.type = V4L2_CTRL_TYPE_INTEGER,67.name = "Brightness",68.minimum = 0,69.maximum = 127,70.step = 1,71.default_value = 0,72},73.set = sd_setbrightness,74.get = sd_getbrightness,75},76#define MY_CONTRAST 177{78{79.id = V4L2_CID_CONTRAST,80.type = V4L2_CTRL_TYPE_INTEGER,81.name = "Contrast",82.minimum = 0,83.maximum = 64725,84.step = 1,85.default_value = 64725,86},87.set = sd_setcontrast,88.get = sd_getcontrast,89},90#define MY_COLOR 291{92{93.id = V4L2_CID_SATURATION,94.type = V4L2_CTRL_TYPE_INTEGER,95.name = "Color",96.minimum = 0,97.maximum = 63,98.step = 1,99.default_value = 20,100},101.set = sd_setcolors,102.get = sd_getcolors,103},104#define MY_BLUE_BALANCE 3105{106{107.id = V4L2_CID_BLUE_BALANCE,108.type = V4L2_CTRL_TYPE_INTEGER,109.name = "Blue Balance",110.minimum = 0,111.maximum = 127,112.step = 1,113.default_value = 0,114},115.set = sd_setblue_balance,116.get = sd_getblue_balance,117},118#define MY_RED_BALANCE 4119{120{121.id = V4L2_CID_RED_BALANCE,122.type = V4L2_CTRL_TYPE_INTEGER,123.name = "Red Balance",124.minimum = 0,125.maximum = 127,126.step = 1,127.default_value = 0,128},129.set = sd_setred_balance,130.get = sd_getred_balance,131},132};133134static const struct v4l2_pix_format vga_mode[] = {135{160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,136.bytesperline = 160,137.sizeimage = 160 * 120 * 3 / 2,138.colorspace = V4L2_COLORSPACE_SRGB,139.priv = 2},140{320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,141.bytesperline = 320,142.sizeimage = 320 * 240 * 3 / 2,143.colorspace = V4L2_COLORSPACE_SRGB,144.priv = 1},145{640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,146.bytesperline = 640,147.sizeimage = 640 * 480 * 3 / 2,148.colorspace = V4L2_COLORSPACE_SRGB,149.priv = 0},150};151152#define SPCA50X_REG_USB 0x2 /* spca505 501 */153/*154* Data to initialize a SPCA501. From a capture file provided by Bill Roehl155* With SPCA501 chip description156*/157#define CCDSP_SET /* set CCDSP parameters */158#define TG_SET /* set time generator set */159#undef DSPWIN_SET /* set DSP windows parameters */160#undef ALTER_GAMA /* Set alternate set to YUV transform coeffs. */161#define SPCA501_SNAPBIT 0x80162#define SPCA501_SNAPCTRL 0x10163/* Frame packet header offsets for the spca501 */164#define SPCA501_OFFSET_GPIO 1165#define SPCA501_OFFSET_TYPE 2166#define SPCA501_OFFSET_TURN3A 3167#define SPCA501_OFFSET_FRAMSEQ 4168#define SPCA501_OFFSET_COMPRESS 5169#define SPCA501_OFFSET_QUANT 6170#define SPCA501_OFFSET_QUANT2 7171#define SPCA501_OFFSET_DATA 8172173#define SPCA501_PROP_COMP_ENABLE(d) ((d) & 1)174#define SPCA501_PROP_SNAP(d) ((d) & 0x40)175#define SPCA501_PROP_SNAP_CTRL(d) ((d) & 0x10)176#define SPCA501_PROP_COMP_THRESH(d) (((d) & 0x0e) >> 1)177#define SPCA501_PROP_COMP_QUANT(d) (((d) & 0x70) >> 4)178179/* SPCA501 CCDSP control */180#define SPCA501_REG_CCDSP 0x01181/* SPCA501 control/status registers */182#define SPCA501_REG_CTLRL 0x02183184/* registers for color correction and YUV transformation */185#define SPCA501_A11 0x08186#define SPCA501_A12 0x09187#define SPCA501_A13 0x0A188#define SPCA501_A21 0x0B189#define SPCA501_A22 0x0C190#define SPCA501_A23 0x0D191#define SPCA501_A31 0x0E192#define SPCA501_A32 0x0F193#define SPCA501_A33 0x10194195/* Data for video camera initialization before capturing */196static const __u16 spca501_open_data[][3] = {197/* bmRequest,value,index */198199{0x2, 0x50, 0x00}, /* C/S enable soft reset */200{0x2, 0x40, 0x00}, /* C/S disable soft reset */201{0x2, 0x02, 0x05}, /* C/S general purpose I/O data */202{0x2, 0x03, 0x05}, /* C/S general purpose I/O data */203204#ifdef CCDSP_SET205{0x1, 0x38, 0x01}, /* CCDSP options */206{0x1, 0x05, 0x02}, /* CCDSP Optical black level for user settings */207{0x1, 0xC0, 0x03}, /* CCDSP Optical black settings */208209{0x1, 0x67, 0x07},210{0x1, 0x63, 0x3f}, /* CCDSP CCD gamma enable */211{0x1, 0x03, 0x56}, /* Add gamma correction */212213{0x1, 0xFF, 0x15}, /* CCDSP High luminance for white balance */214{0x1, 0x01, 0x16}, /* CCDSP Low luminance for white balance */215216/* Color correction and RGB-to-YUV transformation coefficients changing */217#ifdef ALTER_GAMA218{0x0, 0x00, 0x08}, /* A11 */219{0x0, 0x00, 0x09}, /* A12 */220{0x0, 0x90, 0x0A}, /* A13 */221{0x0, 0x12, 0x0B}, /* A21 */222{0x0, 0x00, 0x0C}, /* A22 */223{0x0, 0x00, 0x0D}, /* A23 */224{0x0, 0x00, 0x0E}, /* A31 */225{0x0, 0x02, 0x0F}, /* A32 */226{0x0, 0x00, 0x10}, /* A33 */227#else228{0x1, 0x2a, 0x08}, /* A11 0x31 */229{0x1, 0xf8, 0x09}, /* A12 f8 */230{0x1, 0xf8, 0x0A}, /* A13 f8 */231{0x1, 0xf8, 0x0B}, /* A21 f8 */232{0x1, 0x14, 0x0C}, /* A22 0x14 */233{0x1, 0xf8, 0x0D}, /* A23 f8 */234{0x1, 0xf8, 0x0E}, /* A31 f8 */235{0x1, 0xf8, 0x0F}, /* A32 f8 */236{0x1, 0x20, 0x10}, /* A33 0x20 */237#endif238{0x1, 0x00, 0x11}, /* R offset */239{0x1, 0x00, 0x12}, /* G offset */240{0x1, 0x00, 0x13}, /* B offset */241{0x1, 0x00, 0x14}, /* GB offset */242243#endif244245#ifdef TG_SET246/* Time generator manipulations */247{0x0, 0xfc, 0x0}, /* Set up high bits of shutter speed */248{0x0, 0x01, 0x1}, /* Set up low bits of shutter speed */249250{0x0, 0xe4, 0x04}, /* DCLK*2 clock phase adjustment */251{0x0, 0x08, 0x05}, /* ADCK phase adjustment, inv. ext. VB */252{0x0, 0x03, 0x06}, /* FR phase adjustment */253{0x0, 0x01, 0x07}, /* FCDS phase adjustment */254{0x0, 0x39, 0x08}, /* FS phase adjustment */255{0x0, 0x88, 0x0a}, /* FH1 phase and delay adjustment */256{0x0, 0x03, 0x0f}, /* pixel identification */257{0x0, 0x00, 0x11}, /* clock source selection (default) */258259/*VERY strange manipulations with260* select DMCLP or OBPX to be ADCLP output (0x0C)261* OPB always toggle or not (0x0D) but they allow262* us to set up brightness263*/264{0x0, 0x01, 0x0c},265{0x0, 0xe0, 0x0d},266/* Done */267#endif268269#ifdef DSPWIN_SET270{0x1, 0xa0, 0x01}, /* Setting image processing parameters */271{0x1, 0x1c, 0x17}, /* Changing Windows positions X1 */272{0x1, 0xe2, 0x19}, /* X2 */273{0x1, 0x1c, 0x1b}, /* X3 */274{0x1, 0xe2, 0x1d}, /* X4 */275{0x1, 0x5f, 0x1f}, /* X5 */276{0x1, 0x32, 0x20}, /* Y5 */277{0x1, 0x01, 0x10}, /* Changing A33 */278#endif279280{0x2, 0x204a, 0x07},/* Setting video compression & resolution 160x120 */281{0x2, 0x94, 0x06}, /* Setting video no compression */282{}283};284285/*286The SPCAxxx docs from Sunplus document these values287in tables, one table per register number. In the data288below, dmRequest is the register number, index is the Addr,289and value is a combination of Bit values.290Bit Value (hex)2910 012921 022932 042943 082954 102965 202976 402987 80299*/300301/* Data for chip initialization (set default values) */302static const __u16 spca501_init_data[][3] = {303/* Set all the values to powerup defaults */304/* bmRequest,value,index */305{0x0, 0xAA, 0x00},306{0x0, 0x02, 0x01},307{0x0, 0x01, 0x02},308{0x0, 0x02, 0x03},309{0x0, 0xCE, 0x04},310{0x0, 0x00, 0x05},311{0x0, 0x00, 0x06},312{0x0, 0x00, 0x07},313{0x0, 0x00, 0x08},314{0x0, 0x00, 0x09},315{0x0, 0x90, 0x0A},316{0x0, 0x12, 0x0B},317{0x0, 0x00, 0x0C},318{0x0, 0x00, 0x0D},319{0x0, 0x00, 0x0E},320{0x0, 0x02, 0x0F},321{0x0, 0x00, 0x10},322{0x0, 0x00, 0x11},323{0x0, 0x00, 0x12},324{0x0, 0x00, 0x13},325{0x0, 0x00, 0x14},326{0x0, 0x00, 0x15},327{0x0, 0x00, 0x16},328{0x0, 0x00, 0x17},329{0x0, 0x00, 0x18},330{0x0, 0x00, 0x19},331{0x0, 0x00, 0x1A},332{0x0, 0x00, 0x1B},333{0x0, 0x00, 0x1C},334{0x0, 0x00, 0x1D},335{0x0, 0x00, 0x1E},336{0x0, 0x00, 0x1F},337{0x0, 0x00, 0x20},338{0x0, 0x00, 0x21},339{0x0, 0x00, 0x22},340{0x0, 0x00, 0x23},341{0x0, 0x00, 0x24},342{0x0, 0x00, 0x25},343{0x0, 0x00, 0x26},344{0x0, 0x00, 0x27},345{0x0, 0x00, 0x28},346{0x0, 0x00, 0x29},347{0x0, 0x00, 0x2A},348{0x0, 0x00, 0x2B},349{0x0, 0x00, 0x2C},350{0x0, 0x00, 0x2D},351{0x0, 0x00, 0x2E},352{0x0, 0x00, 0x2F},353{0x0, 0x00, 0x30},354{0x0, 0x00, 0x31},355{0x0, 0x00, 0x32},356{0x0, 0x00, 0x33},357{0x0, 0x00, 0x34},358{0x0, 0x00, 0x35},359{0x0, 0x00, 0x36},360{0x0, 0x00, 0x37},361{0x0, 0x00, 0x38},362{0x0, 0x00, 0x39},363{0x0, 0x00, 0x3A},364{0x0, 0x00, 0x3B},365{0x0, 0x00, 0x3C},366{0x0, 0x00, 0x3D},367{0x0, 0x00, 0x3E},368{0x0, 0x00, 0x3F},369{0x0, 0x00, 0x40},370{0x0, 0x00, 0x41},371{0x0, 0x00, 0x42},372{0x0, 0x00, 0x43},373{0x0, 0x00, 0x44},374{0x0, 0x00, 0x45},375{0x0, 0x00, 0x46},376{0x0, 0x00, 0x47},377{0x0, 0x00, 0x48},378{0x0, 0x00, 0x49},379{0x0, 0x00, 0x4A},380{0x0, 0x00, 0x4B},381{0x0, 0x00, 0x4C},382{0x0, 0x00, 0x4D},383{0x0, 0x00, 0x4E},384{0x0, 0x00, 0x4F},385{0x0, 0x00, 0x50},386{0x0, 0x00, 0x51},387{0x0, 0x00, 0x52},388{0x0, 0x00, 0x53},389{0x0, 0x00, 0x54},390{0x0, 0x00, 0x55},391{0x0, 0x00, 0x56},392{0x0, 0x00, 0x57},393{0x0, 0x00, 0x58},394{0x0, 0x00, 0x59},395{0x0, 0x00, 0x5A},396{0x0, 0x00, 0x5B},397{0x0, 0x00, 0x5C},398{0x0, 0x00, 0x5D},399{0x0, 0x00, 0x5E},400{0x0, 0x00, 0x5F},401{0x0, 0x00, 0x60},402{0x0, 0x00, 0x61},403{0x0, 0x00, 0x62},404{0x0, 0x00, 0x63},405{0x0, 0x00, 0x64},406{0x0, 0x00, 0x65},407{0x0, 0x00, 0x66},408{0x0, 0x00, 0x67},409{0x0, 0x00, 0x68},410{0x0, 0x00, 0x69},411{0x0, 0x00, 0x6A},412{0x0, 0x00, 0x6B},413{0x0, 0x00, 0x6C},414{0x0, 0x00, 0x6D},415{0x0, 0x00, 0x6E},416{0x0, 0x00, 0x6F},417{0x0, 0x00, 0x70},418{0x0, 0x00, 0x71},419{0x0, 0x00, 0x72},420{0x0, 0x00, 0x73},421{0x0, 0x00, 0x74},422{0x0, 0x00, 0x75},423{0x0, 0x00, 0x76},424{0x0, 0x00, 0x77},425{0x0, 0x00, 0x78},426{0x0, 0x00, 0x79},427{0x0, 0x00, 0x7A},428{0x0, 0x00, 0x7B},429{0x0, 0x00, 0x7C},430{0x0, 0x00, 0x7D},431{0x0, 0x00, 0x7E},432{0x0, 0x00, 0x7F},433{0x0, 0x00, 0x80},434{0x0, 0x00, 0x81},435{0x0, 0x00, 0x82},436{0x0, 0x00, 0x83},437{0x0, 0x00, 0x84},438{0x0, 0x00, 0x85},439{0x0, 0x00, 0x86},440{0x0, 0x00, 0x87},441{0x0, 0x00, 0x88},442{0x0, 0x00, 0x89},443{0x0, 0x00, 0x8A},444{0x0, 0x00, 0x8B},445{0x0, 0x00, 0x8C},446{0x0, 0x00, 0x8D},447{0x0, 0x00, 0x8E},448{0x0, 0x00, 0x8F},449{0x0, 0x00, 0x90},450{0x0, 0x00, 0x91},451{0x0, 0x00, 0x92},452{0x0, 0x00, 0x93},453{0x0, 0x00, 0x94},454{0x0, 0x00, 0x95},455{0x0, 0x00, 0x96},456{0x0, 0x00, 0x97},457{0x0, 0x00, 0x98},458{0x0, 0x00, 0x99},459{0x0, 0x00, 0x9A},460{0x0, 0x00, 0x9B},461{0x0, 0x00, 0x9C},462{0x0, 0x00, 0x9D},463{0x0, 0x00, 0x9E},464{0x0, 0x00, 0x9F},465{0x0, 0x00, 0xA0},466{0x0, 0x00, 0xA1},467{0x0, 0x00, 0xA2},468{0x0, 0x00, 0xA3},469{0x0, 0x00, 0xA4},470{0x0, 0x00, 0xA5},471{0x0, 0x00, 0xA6},472{0x0, 0x00, 0xA7},473{0x0, 0x00, 0xA8},474{0x0, 0x00, 0xA9},475{0x0, 0x00, 0xAA},476{0x0, 0x00, 0xAB},477{0x0, 0x00, 0xAC},478{0x0, 0x00, 0xAD},479{0x0, 0x00, 0xAE},480{0x0, 0x00, 0xAF},481{0x0, 0x00, 0xB0},482{0x0, 0x00, 0xB1},483{0x0, 0x00, 0xB2},484{0x0, 0x00, 0xB3},485{0x0, 0x00, 0xB4},486{0x0, 0x00, 0xB5},487{0x0, 0x00, 0xB6},488{0x0, 0x00, 0xB7},489{0x0, 0x00, 0xB8},490{0x0, 0x00, 0xB9},491{0x0, 0x00, 0xBA},492{0x0, 0x00, 0xBB},493{0x0, 0x00, 0xBC},494{0x0, 0x00, 0xBD},495{0x0, 0x00, 0xBE},496{0x0, 0x00, 0xBF},497{0x0, 0x00, 0xC0},498{0x0, 0x00, 0xC1},499{0x0, 0x00, 0xC2},500{0x0, 0x00, 0xC3},501{0x0, 0x00, 0xC4},502{0x0, 0x00, 0xC5},503{0x0, 0x00, 0xC6},504{0x0, 0x00, 0xC7},505{0x0, 0x00, 0xC8},506{0x0, 0x00, 0xC9},507{0x0, 0x00, 0xCA},508{0x0, 0x00, 0xCB},509{0x0, 0x00, 0xCC},510{0x1, 0xF4, 0x00},511{0x1, 0x38, 0x01},512{0x1, 0x40, 0x02},513{0x1, 0x0A, 0x03},514{0x1, 0x40, 0x04},515{0x1, 0x40, 0x05},516{0x1, 0x40, 0x06},517{0x1, 0x67, 0x07},518{0x1, 0x31, 0x08},519{0x1, 0x00, 0x09},520{0x1, 0x00, 0x0A},521{0x1, 0x00, 0x0B},522{0x1, 0x14, 0x0C},523{0x1, 0x00, 0x0D},524{0x1, 0x00, 0x0E},525{0x1, 0x00, 0x0F},526{0x1, 0x1E, 0x10},527{0x1, 0x00, 0x11},528{0x1, 0x00, 0x12},529{0x1, 0x00, 0x13},530{0x1, 0x00, 0x14},531{0x1, 0xFF, 0x15},532{0x1, 0x01, 0x16},533{0x1, 0x32, 0x17},534{0x1, 0x23, 0x18},535{0x1, 0xCE, 0x19},536{0x1, 0x23, 0x1A},537{0x1, 0x32, 0x1B},538{0x1, 0x8D, 0x1C},539{0x1, 0xCE, 0x1D},540{0x1, 0x8D, 0x1E},541{0x1, 0x00, 0x1F},542{0x1, 0x00, 0x20},543{0x1, 0xFF, 0x3E},544{0x1, 0x02, 0x3F},545{0x1, 0x00, 0x40},546{0x1, 0x00, 0x41},547{0x1, 0x00, 0x42},548{0x1, 0x00, 0x43},549{0x1, 0x00, 0x44},550{0x1, 0x00, 0x45},551{0x1, 0x00, 0x46},552{0x1, 0x00, 0x47},553{0x1, 0x00, 0x48},554{0x1, 0x00, 0x49},555{0x1, 0x00, 0x4A},556{0x1, 0x00, 0x4B},557{0x1, 0x00, 0x4C},558{0x1, 0x00, 0x4D},559{0x1, 0x00, 0x4E},560{0x1, 0x00, 0x4F},561{0x1, 0x00, 0x50},562{0x1, 0x00, 0x51},563{0x1, 0x00, 0x52},564{0x1, 0x00, 0x53},565{0x1, 0x00, 0x54},566{0x1, 0x00, 0x55},567{0x1, 0x00, 0x56},568{0x1, 0x00, 0x57},569{0x1, 0x00, 0x58},570{0x1, 0x00, 0x59},571{0x1, 0x00, 0x5A},572{0x2, 0x03, 0x00},573{0x2, 0x00, 0x01},574{0x2, 0x00, 0x05},575{0x2, 0x00, 0x06},576{0x2, 0x00, 0x07},577{0x2, 0x00, 0x10},578{0x2, 0x00, 0x11},579/* Strange - looks like the 501 driver doesn't do anything580* at insert time except read the EEPROM581*/582{}583};584585/* Data for video camera init before capture.586* Capture and decoding by Colin Peart.587* This is is for the 3com HomeConnect Lite which is spca501a based.588*/589static const __u16 spca501_3com_open_data[][3] = {590/* bmRequest,value,index */591{0x2, 0x0050, 0x0000}, /* C/S Enable TG soft reset, timing mode=010 */592{0x2, 0x0043, 0x0000}, /* C/S Disable TG soft reset, timing mode=010 */593{0x2, 0x0002, 0x0005}, /* C/S GPIO */594{0x2, 0x0003, 0x0005}, /* C/S GPIO */595596#ifdef CCDSP_SET597{0x1, 0x0020, 0x0001}, /* CCDSP Options */598599{0x1, 0x0020, 0x0002}, /* CCDSP Black Level */600{0x1, 0x006e, 0x0007}, /* CCDSP Gamma options */601{0x1, 0x0090, 0x0015}, /* CCDSP Luminance Low */602{0x1, 0x00ff, 0x0016}, /* CCDSP Luminance High */603{0x1, 0x0003, 0x003F}, /* CCDSP Gamma correction toggle */604605#ifdef ALTER_GAMMA606{0x1, 0x0010, 0x0008}, /* CCDSP YUV A11 */607{0x1, 0x0000, 0x0009}, /* CCDSP YUV A12 */608{0x1, 0x0000, 0x000a}, /* CCDSP YUV A13 */609{0x1, 0x0000, 0x000b}, /* CCDSP YUV A21 */610{0x1, 0x0010, 0x000c}, /* CCDSP YUV A22 */611{0x1, 0x0000, 0x000d}, /* CCDSP YUV A23 */612{0x1, 0x0000, 0x000e}, /* CCDSP YUV A31 */613{0x1, 0x0000, 0x000f}, /* CCDSP YUV A32 */614{0x1, 0x0010, 0x0010}, /* CCDSP YUV A33 */615{0x1, 0x0000, 0x0011}, /* CCDSP R Offset */616{0x1, 0x0000, 0x0012}, /* CCDSP G Offset */617{0x1, 0x0001, 0x0013}, /* CCDSP B Offset */618{0x1, 0x0001, 0x0014}, /* CCDSP BG Offset */619{0x1, 0x003f, 0x00C1}, /* CCDSP Gamma Correction Enable */620#endif621#endif622623#ifdef TG_SET624{0x0, 0x00fc, 0x0000}, /* TG Shutter Speed High Bits */625{0x0, 0x0000, 0x0001}, /* TG Shutter Speed Low Bits */626{0x0, 0x00e4, 0x0004}, /* TG DCLK*2 Adjust */627{0x0, 0x0008, 0x0005}, /* TG ADCK Adjust */628{0x0, 0x0003, 0x0006}, /* TG FR Phase Adjust */629{0x0, 0x0001, 0x0007}, /* TG FCDS Phase Adjust */630{0x0, 0x0039, 0x0008}, /* TG FS Phase Adjust */631{0x0, 0x0088, 0x000a}, /* TG MH1 */632{0x0, 0x0003, 0x000f}, /* TG Pixel ID */633634/* Like below, unexplained toglleing */635{0x0, 0x0080, 0x000c},636{0x0, 0x0000, 0x000d},637{0x0, 0x0080, 0x000c},638{0x0, 0x0004, 0x000d},639{0x0, 0x0000, 0x000c},640{0x0, 0x0000, 0x000d},641{0x0, 0x0040, 0x000c},642{0x0, 0x0017, 0x000d},643{0x0, 0x00c0, 0x000c},644{0x0, 0x0000, 0x000d},645{0x0, 0x0080, 0x000c},646{0x0, 0x0006, 0x000d},647{0x0, 0x0080, 0x000c},648{0x0, 0x0004, 0x000d},649{0x0, 0x0002, 0x0003},650#endif651652#ifdef DSPWIN_SET653{0x1, 0x001c, 0x0017}, /* CCDSP W1 Start X */654{0x1, 0x00e2, 0x0019}, /* CCDSP W2 Start X */655{0x1, 0x001c, 0x001b}, /* CCDSP W3 Start X */656{0x1, 0x00e2, 0x001d}, /* CCDSP W4 Start X */657{0x1, 0x00aa, 0x001f}, /* CCDSP W5 Start X */658{0x1, 0x0070, 0x0020}, /* CCDSP W5 Start Y */659#endif660{0x0, 0x0001, 0x0010}, /* TG Start Clock */661662/* {0x2, 0x006a, 0x0001}, * C/S Enable ISOSYNCH Packet Engine */663{0x2, 0x0068, 0x0001}, /* C/S Diable ISOSYNCH Packet Engine */664{0x2, 0x0000, 0x0005},665{0x2, 0x0043, 0x0000}, /* C/S Set Timing Mode, Disable TG soft reset */666{0x2, 0x0043, 0x0000}, /* C/S Set Timing Mode, Disable TG soft reset */667{0x2, 0x0002, 0x0005}, /* C/S GPIO */668{0x2, 0x0003, 0x0005}, /* C/S GPIO */669670{0x2, 0x006a, 0x0001}, /* C/S Enable ISOSYNCH Packet Engine */671{}672};673674/*675* Data used to initialize a SPCA501C with HV7131B sensor.676* From a capture file taken with USBSnoop v 1.5677* I have a "SPCA501C pc camera chipset" manual by sunplus, but some678* of the value meanings are obscure or simply "reserved".679* to do list:680* 1) Understand what every value means681* 2) Understand why some values seem to appear more than once682* 3) Write a small comment for each line of the following arrays.683*/684static const __u16 spca501c_arowana_open_data[][3] = {685/* bmRequest,value,index */686{0x02, 0x0007, 0x0005},687{0x02, 0xa048, 0x0000},688{0x05, 0x0022, 0x0004},689{0x01, 0x0006, 0x0011},690{0x01, 0x00ff, 0x0012},691{0x01, 0x0014, 0x0013},692{0x01, 0x0000, 0x0014},693{0x01, 0x0042, 0x0051},694{0x01, 0x0040, 0x0052},695{0x01, 0x0051, 0x0053},696{0x01, 0x0040, 0x0054},697{0x01, 0x0000, 0x0055},698{0x00, 0x0025, 0x0000},699{0x00, 0x0026, 0x0000},700{0x00, 0x0001, 0x0000},701{0x00, 0x0027, 0x0000},702{0x00, 0x008a, 0x0000},703{}704};705706static const __u16 spca501c_arowana_init_data[][3] = {707/* bmRequest,value,index */708{0x02, 0x0007, 0x0005},709{0x02, 0xa048, 0x0000},710{0x05, 0x0022, 0x0004},711{0x01, 0x0006, 0x0011},712{0x01, 0x00ff, 0x0012},713{0x01, 0x0014, 0x0013},714{0x01, 0x0000, 0x0014},715{0x01, 0x0042, 0x0051},716{0x01, 0x0040, 0x0052},717{0x01, 0x0051, 0x0053},718{0x01, 0x0040, 0x0054},719{0x01, 0x0000, 0x0055},720{0x00, 0x0025, 0x0000},721{0x00, 0x0026, 0x0000},722{0x00, 0x0001, 0x0000},723{0x00, 0x0027, 0x0000},724{0x00, 0x008a, 0x0000},725{0x02, 0x0000, 0x0005},726{0x02, 0x0007, 0x0005},727{0x02, 0x2000, 0x0000},728{0x05, 0x0022, 0x0004},729{0x05, 0x0015, 0x0001},730{0x05, 0x00ea, 0x0000},731{0x05, 0x0021, 0x0001},732{0x05, 0x00d2, 0x0000},733{0x05, 0x0023, 0x0001},734{0x05, 0x0003, 0x0000},735{0x05, 0x0030, 0x0001},736{0x05, 0x002b, 0x0000},737{0x05, 0x0031, 0x0001},738{0x05, 0x0023, 0x0000},739{0x05, 0x0032, 0x0001},740{0x05, 0x0023, 0x0000},741{0x05, 0x0033, 0x0001},742{0x05, 0x0023, 0x0000},743{0x05, 0x0034, 0x0001},744{0x05, 0x0002, 0x0000},745{0x05, 0x0050, 0x0001},746{0x05, 0x0000, 0x0000},747{0x05, 0x0051, 0x0001},748{0x05, 0x0000, 0x0000},749{0x05, 0x0052, 0x0001},750{0x05, 0x0000, 0x0000},751{0x05, 0x0054, 0x0001},752{0x05, 0x0001, 0x0000},753{0x00, 0x0000, 0x0001},754{0x00, 0x0000, 0x0002},755{0x00, 0x000c, 0x0003},756{0x00, 0x0000, 0x0004},757{0x00, 0x0090, 0x0005},758{0x00, 0x0000, 0x0006},759{0x00, 0x0040, 0x0007},760{0x00, 0x00c0, 0x0008},761{0x00, 0x004a, 0x0009},762{0x00, 0x0000, 0x000a},763{0x00, 0x0000, 0x000b},764{0x00, 0x0001, 0x000c},765{0x00, 0x0001, 0x000d},766{0x00, 0x0000, 0x000e},767{0x00, 0x0002, 0x000f},768{0x00, 0x0001, 0x0010},769{0x00, 0x0000, 0x0011},770{0x00, 0x0000, 0x0012},771{0x00, 0x0002, 0x0020},772{0x00, 0x0080, 0x0021},773{0x00, 0x0001, 0x0022},774{0x00, 0x00e0, 0x0023},775{0x00, 0x0000, 0x0024},776{0x00, 0x00d5, 0x0025},777{0x00, 0x0000, 0x0026},778{0x00, 0x000b, 0x0027},779{0x00, 0x0000, 0x0046},780{0x00, 0x0000, 0x0047},781{0x00, 0x0000, 0x0048},782{0x00, 0x0000, 0x0049},783{0x00, 0x0008, 0x004a},784{0xff, 0x0000, 0x00d0},785{0xff, 0x00d8, 0x00d1},786{0xff, 0x0000, 0x00d4},787{0xff, 0x0000, 0x00d5},788{0x01, 0x00a6, 0x0000},789{0x01, 0x0028, 0x0001},790{0x01, 0x0000, 0x0002},791{0x01, 0x000a, 0x0003},792{0x01, 0x0040, 0x0004},793{0x01, 0x0066, 0x0007},794{0x01, 0x0011, 0x0008},795{0x01, 0x0032, 0x0009},796{0x01, 0x00fd, 0x000a},797{0x01, 0x0038, 0x000b},798{0x01, 0x00d1, 0x000c},799{0x01, 0x00f7, 0x000d},800{0x01, 0x00ed, 0x000e},801{0x01, 0x00d8, 0x000f},802{0x01, 0x0038, 0x0010},803{0x01, 0x00ff, 0x0015},804{0x01, 0x0001, 0x0016},805{0x01, 0x0032, 0x0017},806{0x01, 0x0023, 0x0018},807{0x01, 0x00ce, 0x0019},808{0x01, 0x0023, 0x001a},809{0x01, 0x0032, 0x001b},810{0x01, 0x008d, 0x001c},811{0x01, 0x00ce, 0x001d},812{0x01, 0x008d, 0x001e},813{0x01, 0x0000, 0x001f},814{0x01, 0x0000, 0x0020},815{0x01, 0x00ff, 0x003e},816{0x01, 0x0003, 0x003f},817{0x01, 0x0000, 0x0040},818{0x01, 0x0035, 0x0041},819{0x01, 0x0053, 0x0042},820{0x01, 0x0069, 0x0043},821{0x01, 0x007c, 0x0044},822{0x01, 0x008c, 0x0045},823{0x01, 0x009a, 0x0046},824{0x01, 0x00a8, 0x0047},825{0x01, 0x00b4, 0x0048},826{0x01, 0x00bf, 0x0049},827{0x01, 0x00ca, 0x004a},828{0x01, 0x00d4, 0x004b},829{0x01, 0x00dd, 0x004c},830{0x01, 0x00e7, 0x004d},831{0x01, 0x00ef, 0x004e},832{0x01, 0x00f8, 0x004f},833{0x01, 0x00ff, 0x0050},834{0x01, 0x0001, 0x0056},835{0x01, 0x0060, 0x0057},836{0x01, 0x0040, 0x0058},837{0x01, 0x0011, 0x0059},838{0x01, 0x0001, 0x005a},839{0x02, 0x0007, 0x0005},840{0x02, 0xa048, 0x0000},841{0x02, 0x0007, 0x0005},842{0x02, 0x0015, 0x0006},843{0x02, 0x100a, 0x0007},844{0x02, 0xa048, 0x0000},845{0x02, 0xc002, 0x0001},846{0x02, 0x000f, 0x0005},847{0x02, 0xa048, 0x0000},848{0x05, 0x0022, 0x0004},849{0x05, 0x0025, 0x0001},850{0x05, 0x0000, 0x0000},851{0x05, 0x0026, 0x0001},852{0x05, 0x0001, 0x0000},853{0x05, 0x0027, 0x0001},854{0x05, 0x0000, 0x0000},855{0x05, 0x0001, 0x0001},856{0x05, 0x0000, 0x0000},857{0x05, 0x0021, 0x0001},858{0x05, 0x00d2, 0x0000},859{0x05, 0x0020, 0x0001},860{0x05, 0x0000, 0x0000},861{0x00, 0x0090, 0x0005},862{0x01, 0x00a6, 0x0000},863{0x02, 0x0007, 0x0005},864{0x02, 0x2000, 0x0000},865{0x05, 0x0022, 0x0004},866{0x05, 0x0015, 0x0001},867{0x05, 0x00ea, 0x0000},868{0x05, 0x0021, 0x0001},869{0x05, 0x00d2, 0x0000},870{0x05, 0x0023, 0x0001},871{0x05, 0x0003, 0x0000},872{0x05, 0x0030, 0x0001},873{0x05, 0x002b, 0x0000},874{0x05, 0x0031, 0x0001},875{0x05, 0x0023, 0x0000},876{0x05, 0x0032, 0x0001},877{0x05, 0x0023, 0x0000},878{0x05, 0x0033, 0x0001},879{0x05, 0x0023, 0x0000},880{0x05, 0x0034, 0x0001},881{0x05, 0x0002, 0x0000},882{0x05, 0x0050, 0x0001},883{0x05, 0x0000, 0x0000},884{0x05, 0x0051, 0x0001},885{0x05, 0x0000, 0x0000},886{0x05, 0x0052, 0x0001},887{0x05, 0x0000, 0x0000},888{0x05, 0x0054, 0x0001},889{0x05, 0x0001, 0x0000},890{0x00, 0x0000, 0x0001},891{0x00, 0x0000, 0x0002},892{0x00, 0x000c, 0x0003},893{0x00, 0x0000, 0x0004},894{0x00, 0x0090, 0x0005},895{0x00, 0x0000, 0x0006},896{0x00, 0x0040, 0x0007},897{0x00, 0x00c0, 0x0008},898{0x00, 0x004a, 0x0009},899{0x00, 0x0000, 0x000a},900{0x00, 0x0000, 0x000b},901{0x00, 0x0001, 0x000c},902{0x00, 0x0001, 0x000d},903{0x00, 0x0000, 0x000e},904{0x00, 0x0002, 0x000f},905{0x00, 0x0001, 0x0010},906{0x00, 0x0000, 0x0011},907{0x00, 0x0000, 0x0012},908{0x00, 0x0002, 0x0020},909{0x00, 0x0080, 0x0021},910{0x00, 0x0001, 0x0022},911{0x00, 0x00e0, 0x0023},912{0x00, 0x0000, 0x0024},913{0x00, 0x00d5, 0x0025},914{0x00, 0x0000, 0x0026},915{0x00, 0x000b, 0x0027},916{0x00, 0x0000, 0x0046},917{0x00, 0x0000, 0x0047},918{0x00, 0x0000, 0x0048},919{0x00, 0x0000, 0x0049},920{0x00, 0x0008, 0x004a},921{0xff, 0x0000, 0x00d0},922{0xff, 0x00d8, 0x00d1},923{0xff, 0x0000, 0x00d4},924{0xff, 0x0000, 0x00d5},925{0x01, 0x00a6, 0x0000},926{0x01, 0x0028, 0x0001},927{0x01, 0x0000, 0x0002},928{0x01, 0x000a, 0x0003},929{0x01, 0x0040, 0x0004},930{0x01, 0x0066, 0x0007},931{0x01, 0x0011, 0x0008},932{0x01, 0x0032, 0x0009},933{0x01, 0x00fd, 0x000a},934{0x01, 0x0038, 0x000b},935{0x01, 0x00d1, 0x000c},936{0x01, 0x00f7, 0x000d},937{0x01, 0x00ed, 0x000e},938{0x01, 0x00d8, 0x000f},939{0x01, 0x0038, 0x0010},940{0x01, 0x00ff, 0x0015},941{0x01, 0x0001, 0x0016},942{0x01, 0x0032, 0x0017},943{0x01, 0x0023, 0x0018},944{0x01, 0x00ce, 0x0019},945{0x01, 0x0023, 0x001a},946{0x01, 0x0032, 0x001b},947{0x01, 0x008d, 0x001c},948{0x01, 0x00ce, 0x001d},949{0x01, 0x008d, 0x001e},950{0x01, 0x0000, 0x001f},951{0x01, 0x0000, 0x0020},952{0x01, 0x00ff, 0x003e},953{0x01, 0x0003, 0x003f},954{0x01, 0x0000, 0x0040},955{0x01, 0x0035, 0x0041},956{0x01, 0x0053, 0x0042},957{0x01, 0x0069, 0x0043},958{0x01, 0x007c, 0x0044},959{0x01, 0x008c, 0x0045},960{0x01, 0x009a, 0x0046},961{0x01, 0x00a8, 0x0047},962{0x01, 0x00b4, 0x0048},963{0x01, 0x00bf, 0x0049},964{0x01, 0x00ca, 0x004a},965{0x01, 0x00d4, 0x004b},966{0x01, 0x00dd, 0x004c},967{0x01, 0x00e7, 0x004d},968{0x01, 0x00ef, 0x004e},969{0x01, 0x00f8, 0x004f},970{0x01, 0x00ff, 0x0050},971{0x01, 0x0001, 0x0056},972{0x01, 0x0060, 0x0057},973{0x01, 0x0040, 0x0058},974{0x01, 0x0011, 0x0059},975{0x01, 0x0001, 0x005a},976{0x02, 0x0007, 0x0005},977{0x02, 0xa048, 0x0000},978{0x02, 0x0007, 0x0005},979{0x02, 0x0015, 0x0006},980{0x02, 0x100a, 0x0007},981{0x02, 0xa048, 0x0000},982{0x02, 0xc002, 0x0001},983{0x02, 0x000f, 0x0005},984{0x02, 0xa048, 0x0000},985{0x05, 0x0022, 0x0004},986{0x05, 0x0025, 0x0001},987{0x05, 0x0000, 0x0000},988{0x05, 0x0026, 0x0001},989{0x05, 0x0001, 0x0000},990{0x05, 0x0027, 0x0001},991{0x05, 0x0000, 0x0000},992{0x05, 0x0001, 0x0001},993{0x05, 0x0000, 0x0000},994{0x05, 0x0021, 0x0001},995{0x05, 0x00d2, 0x0000},996{0x05, 0x0020, 0x0001},997{0x05, 0x0000, 0x0000},998{0x00, 0x0090, 0x0005},999{0x01, 0x00a6, 0x0000},1000{0x01, 0x0003, 0x003f},1001{0x01, 0x0001, 0x0056},1002{0x01, 0x0011, 0x0008},1003{0x01, 0x0032, 0x0009},1004{0x01, 0xfffd, 0x000a},1005{0x01, 0x0023, 0x000b},1006{0x01, 0xffea, 0x000c},1007{0x01, 0xfff4, 0x000d},1008{0x01, 0xfffc, 0x000e},1009{0x01, 0xffe3, 0x000f},1010{0x01, 0x001f, 0x0010},1011{0x01, 0x00a8, 0x0001},1012{0x01, 0x0067, 0x0007},1013{0x01, 0x0032, 0x0017},1014{0x01, 0x0023, 0x0018},1015{0x01, 0x00ce, 0x0019},1016{0x01, 0x0023, 0x001a},1017{0x01, 0x0032, 0x001b},1018{0x01, 0x008d, 0x001c},1019{0x01, 0x00ce, 0x001d},1020{0x01, 0x008d, 0x001e},1021{0x01, 0x00c8, 0x0015},1022{0x01, 0x0032, 0x0016},1023{0x01, 0x0000, 0x0011},1024{0x01, 0x0000, 0x0012},1025{0x01, 0x0000, 0x0013},1026{0x01, 0x000a, 0x0003},1027{0x02, 0xc002, 0x0001},1028{0x02, 0x0007, 0x0005},1029{0x02, 0xc000, 0x0001},1030{0x02, 0x0000, 0x0005},1031{0x02, 0x0007, 0x0005},1032{0x02, 0x2000, 0x0000},1033{0x05, 0x0022, 0x0004},1034{0x05, 0x0015, 0x0001},1035{0x05, 0x00ea, 0x0000},1036{0x05, 0x0021, 0x0001},1037{0x05, 0x00d2, 0x0000},1038{0x05, 0x0023, 0x0001},1039{0x05, 0x0003, 0x0000},1040{0x05, 0x0030, 0x0001},1041{0x05, 0x002b, 0x0000},1042{0x05, 0x0031, 0x0001},1043{0x05, 0x0023, 0x0000},1044{0x05, 0x0032, 0x0001},1045{0x05, 0x0023, 0x0000},1046{0x05, 0x0033, 0x0001},1047{0x05, 0x0023, 0x0000},1048{0x05, 0x0034, 0x0001},1049{0x05, 0x0002, 0x0000},1050{0x05, 0x0050, 0x0001},1051{0x05, 0x0000, 0x0000},1052{0x05, 0x0051, 0x0001},1053{0x05, 0x0000, 0x0000},1054{0x05, 0x0052, 0x0001},1055{0x05, 0x0000, 0x0000},1056{0x05, 0x0054, 0x0001},1057{0x05, 0x0001, 0x0000},1058{0x00, 0x0000, 0x0001},1059{0x00, 0x0000, 0x0002},1060{0x00, 0x000c, 0x0003},1061{0x00, 0x0000, 0x0004},1062{0x00, 0x0090, 0x0005},1063{0x00, 0x0000, 0x0006},1064{0x00, 0x0040, 0x0007},1065{0x00, 0x00c0, 0x0008},1066{0x00, 0x004a, 0x0009},1067{0x00, 0x0000, 0x000a},1068{0x00, 0x0000, 0x000b},1069{0x00, 0x0001, 0x000c},1070{0x00, 0x0001, 0x000d},1071{0x00, 0x0000, 0x000e},1072{0x00, 0x0002, 0x000f},1073{0x00, 0x0001, 0x0010},1074{0x00, 0x0000, 0x0011},1075{0x00, 0x0000, 0x0012},1076{0x00, 0x0002, 0x0020},1077{0x00, 0x0080, 0x0021},1078{0x00, 0x0001, 0x0022},1079{0x00, 0x00e0, 0x0023},1080{0x00, 0x0000, 0x0024},1081{0x00, 0x00d5, 0x0025},1082{0x00, 0x0000, 0x0026},1083{0x00, 0x000b, 0x0027},1084{0x00, 0x0000, 0x0046},1085{0x00, 0x0000, 0x0047},1086{0x00, 0x0000, 0x0048},1087{0x00, 0x0000, 0x0049},1088{0x00, 0x0008, 0x004a},1089{0xff, 0x0000, 0x00d0},1090{0xff, 0x00d8, 0x00d1},1091{0xff, 0x0000, 0x00d4},1092{0xff, 0x0000, 0x00d5},1093{0x01, 0x00a6, 0x0000},1094{0x01, 0x0028, 0x0001},1095{0x01, 0x0000, 0x0002},1096{0x01, 0x000a, 0x0003},1097{0x01, 0x0040, 0x0004},1098{0x01, 0x0066, 0x0007},1099{0x01, 0x0011, 0x0008},1100{0x01, 0x0032, 0x0009},1101{0x01, 0x00fd, 0x000a},1102{0x01, 0x0038, 0x000b},1103{0x01, 0x00d1, 0x000c},1104{0x01, 0x00f7, 0x000d},1105{0x01, 0x00ed, 0x000e},1106{0x01, 0x00d8, 0x000f},1107{0x01, 0x0038, 0x0010},1108{0x01, 0x00ff, 0x0015},1109{0x01, 0x0001, 0x0016},1110{0x01, 0x0032, 0x0017},1111{0x01, 0x0023, 0x0018},1112{0x01, 0x00ce, 0x0019},1113{0x01, 0x0023, 0x001a},1114{0x01, 0x0032, 0x001b},1115{0x01, 0x008d, 0x001c},1116{0x01, 0x00ce, 0x001d},1117{0x01, 0x008d, 0x001e},1118{0x01, 0x0000, 0x001f},1119{0x01, 0x0000, 0x0020},1120{0x01, 0x00ff, 0x003e},1121{0x01, 0x0003, 0x003f},1122{0x01, 0x0000, 0x0040},1123{0x01, 0x0035, 0x0041},1124{0x01, 0x0053, 0x0042},1125{0x01, 0x0069, 0x0043},1126{0x01, 0x007c, 0x0044},1127{0x01, 0x008c, 0x0045},1128{0x01, 0x009a, 0x0046},1129{0x01, 0x00a8, 0x0047},1130{0x01, 0x00b4, 0x0048},1131{0x01, 0x00bf, 0x0049},1132{0x01, 0x00ca, 0x004a},1133{0x01, 0x00d4, 0x004b},1134{0x01, 0x00dd, 0x004c},1135{0x01, 0x00e7, 0x004d},1136{0x01, 0x00ef, 0x004e},1137{0x01, 0x00f8, 0x004f},1138{0x01, 0x00ff, 0x0050},1139{0x01, 0x0001, 0x0056},1140{0x01, 0x0060, 0x0057},1141{0x01, 0x0040, 0x0058},1142{0x01, 0x0011, 0x0059},1143{0x01, 0x0001, 0x005a},1144{0x02, 0x0007, 0x0005},1145{0x02, 0xa048, 0x0000},1146{0x02, 0x0007, 0x0005},1147{0x02, 0x0015, 0x0006},1148{0x02, 0x100a, 0x0007},1149{0x02, 0xa048, 0x0000},1150{0x02, 0xc002, 0x0001},1151{0x02, 0x000f, 0x0005},1152{0x02, 0xa048, 0x0000},1153{0x05, 0x0022, 0x0004},1154{0x05, 0x0025, 0x0001},1155{0x05, 0x0000, 0x0000},1156{0x05, 0x0026, 0x0001},1157{0x05, 0x0001, 0x0000},1158{0x05, 0x0027, 0x0001},1159{0x05, 0x0000, 0x0000},1160{0x05, 0x0001, 0x0001},1161{0x05, 0x0000, 0x0000},1162{0x05, 0x0021, 0x0001},1163{0x05, 0x00d2, 0x0000},1164{0x05, 0x0020, 0x0001},1165{0x05, 0x0000, 0x0000},1166{0x00, 0x0090, 0x0005},1167{0x01, 0x00a6, 0x0000},1168{0x02, 0x0007, 0x0005},1169{0x02, 0x2000, 0x0000},1170{0x05, 0x0022, 0x0004},1171{0x05, 0x0015, 0x0001},1172{0x05, 0x00ea, 0x0000},1173{0x05, 0x0021, 0x0001},1174{0x05, 0x00d2, 0x0000},1175{0x05, 0x0023, 0x0001},1176{0x05, 0x0003, 0x0000},1177{0x05, 0x0030, 0x0001},1178{0x05, 0x002b, 0x0000},1179{0x05, 0x0031, 0x0001},1180{0x05, 0x0023, 0x0000},1181{0x05, 0x0032, 0x0001},1182{0x05, 0x0023, 0x0000},1183{0x05, 0x0033, 0x0001},1184{0x05, 0x0023, 0x0000},1185{0x05, 0x0034, 0x0001},1186{0x05, 0x0002, 0x0000},1187{0x05, 0x0050, 0x0001},1188{0x05, 0x0000, 0x0000},1189{0x05, 0x0051, 0x0001},1190{0x05, 0x0000, 0x0000},1191{0x05, 0x0052, 0x0001},1192{0x05, 0x0000, 0x0000},1193{0x05, 0x0054, 0x0001},1194{0x05, 0x0001, 0x0000},1195{0x00, 0x0000, 0x0001},1196{0x00, 0x0000, 0x0002},1197{0x00, 0x000c, 0x0003},1198{0x00, 0x0000, 0x0004},1199{0x00, 0x0090, 0x0005},1200{0x00, 0x0000, 0x0006},1201{0x00, 0x0040, 0x0007},1202{0x00, 0x00c0, 0x0008},1203{0x00, 0x004a, 0x0009},1204{0x00, 0x0000, 0x000a},1205{0x00, 0x0000, 0x000b},1206{0x00, 0x0001, 0x000c},1207{0x00, 0x0001, 0x000d},1208{0x00, 0x0000, 0x000e},1209{0x00, 0x0002, 0x000f},1210{0x00, 0x0001, 0x0010},1211{0x00, 0x0000, 0x0011},1212{0x00, 0x0000, 0x0012},1213{0x00, 0x0002, 0x0020},1214{0x00, 0x0080, 0x0021},1215{0x00, 0x0001, 0x0022},1216{0x00, 0x00e0, 0x0023},1217{0x00, 0x0000, 0x0024},1218{0x00, 0x00d5, 0x0025},1219{0x00, 0x0000, 0x0026},1220{0x00, 0x000b, 0x0027},1221{0x00, 0x0000, 0x0046},1222{0x00, 0x0000, 0x0047},1223{0x00, 0x0000, 0x0048},1224{0x00, 0x0000, 0x0049},1225{0x00, 0x0008, 0x004a},1226{0xff, 0x0000, 0x00d0},1227{0xff, 0x00d8, 0x00d1},1228{0xff, 0x0000, 0x00d4},1229{0xff, 0x0000, 0x00d5},1230{0x01, 0x00a6, 0x0000},1231{0x01, 0x0028, 0x0001},1232{0x01, 0x0000, 0x0002},1233{0x01, 0x000a, 0x0003},1234{0x01, 0x0040, 0x0004},1235{0x01, 0x0066, 0x0007},1236{0x01, 0x0011, 0x0008},1237{0x01, 0x0032, 0x0009},1238{0x01, 0x00fd, 0x000a},1239{0x01, 0x0038, 0x000b},1240{0x01, 0x00d1, 0x000c},1241{0x01, 0x00f7, 0x000d},1242{0x01, 0x00ed, 0x000e},1243{0x01, 0x00d8, 0x000f},1244{0x01, 0x0038, 0x0010},1245{0x01, 0x00ff, 0x0015},1246{0x01, 0x0001, 0x0016},1247{0x01, 0x0032, 0x0017},1248{0x01, 0x0023, 0x0018},1249{0x01, 0x00ce, 0x0019},1250{0x01, 0x0023, 0x001a},1251{0x01, 0x0032, 0x001b},1252{0x01, 0x008d, 0x001c},1253{0x01, 0x00ce, 0x001d},1254{0x01, 0x008d, 0x001e},1255{0x01, 0x0000, 0x001f},1256{0x01, 0x0000, 0x0020},1257{0x01, 0x00ff, 0x003e},1258{0x01, 0x0003, 0x003f},1259{0x01, 0x0000, 0x0040},1260{0x01, 0x0035, 0x0041},1261{0x01, 0x0053, 0x0042},1262{0x01, 0x0069, 0x0043},1263{0x01, 0x007c, 0x0044},1264{0x01, 0x008c, 0x0045},1265{0x01, 0x009a, 0x0046},1266{0x01, 0x00a8, 0x0047},1267{0x01, 0x00b4, 0x0048},1268{0x01, 0x00bf, 0x0049},1269{0x01, 0x00ca, 0x004a},1270{0x01, 0x00d4, 0x004b},1271{0x01, 0x00dd, 0x004c},1272{0x01, 0x00e7, 0x004d},1273{0x01, 0x00ef, 0x004e},1274{0x01, 0x00f8, 0x004f},1275{0x01, 0x00ff, 0x0050},1276{0x01, 0x0001, 0x0056},1277{0x01, 0x0060, 0x0057},1278{0x01, 0x0040, 0x0058},1279{0x01, 0x0011, 0x0059},1280{0x01, 0x0001, 0x005a},1281{0x02, 0x0007, 0x0005},1282{0x02, 0xa048, 0x0000},1283{0x02, 0x0007, 0x0005},1284{0x02, 0x0015, 0x0006},1285{0x02, 0x100a, 0x0007},1286{0x02, 0xa048, 0x0000},1287{0x02, 0xc002, 0x0001},1288{0x02, 0x000f, 0x0005},1289{0x02, 0xa048, 0x0000},1290{0x05, 0x0022, 0x0004},1291{0x05, 0x0025, 0x0001},1292{0x05, 0x0000, 0x0000},1293{0x05, 0x0026, 0x0001},1294{0x05, 0x0001, 0x0000},1295{0x05, 0x0027, 0x0001},1296{0x05, 0x0000, 0x0000},1297{0x05, 0x0001, 0x0001},1298{0x05, 0x0000, 0x0000},1299{0x05, 0x0021, 0x0001},1300{0x05, 0x00d2, 0x0000},1301{0x05, 0x0020, 0x0001},1302{0x05, 0x0000, 0x0000},1303{0x00, 0x0090, 0x0005},1304{0x01, 0x00a6, 0x0000},1305{0x05, 0x0026, 0x0001},1306{0x05, 0x0001, 0x0000},1307{0x05, 0x0027, 0x0001},1308{0x05, 0x000f, 0x0000},1309{0x01, 0x0003, 0x003f},1310{0x01, 0x0001, 0x0056},1311{0x01, 0x0011, 0x0008},1312{0x01, 0x0032, 0x0009},1313{0x01, 0xfffd, 0x000a},1314{0x01, 0x0023, 0x000b},1315{0x01, 0xffea, 0x000c},1316{0x01, 0xfff4, 0x000d},1317{0x01, 0xfffc, 0x000e},1318{0x01, 0xffe3, 0x000f},1319{0x01, 0x001f, 0x0010},1320{0x01, 0x00a8, 0x0001},1321{0x01, 0x0067, 0x0007},1322{0x01, 0x0042, 0x0051},1323{0x01, 0x0051, 0x0053},1324{0x01, 0x000a, 0x0003},1325{0x02, 0xc002, 0x0001},1326{0x02, 0x0007, 0x0005},1327{0x02, 0xc000, 0x0001},1328{0x02, 0x0000, 0x0005},1329{0x02, 0x0007, 0x0005},1330{0x02, 0x2000, 0x0000},1331{0x05, 0x0022, 0x0004},1332{0x05, 0x0015, 0x0001},1333{0x05, 0x00ea, 0x0000},1334{0x05, 0x0021, 0x0001},1335{0x05, 0x00d2, 0x0000},1336{0x05, 0x0023, 0x0001},1337{0x05, 0x0003, 0x0000},1338{0x05, 0x0030, 0x0001},1339{0x05, 0x002b, 0x0000},1340{0x05, 0x0031, 0x0001},1341{0x05, 0x0023, 0x0000},1342{0x05, 0x0032, 0x0001},1343{0x05, 0x0023, 0x0000},1344{0x05, 0x0033, 0x0001},1345{0x05, 0x0023, 0x0000},1346{0x05, 0x0034, 0x0001},1347{0x05, 0x0002, 0x0000},1348{0x05, 0x0050, 0x0001},1349{0x05, 0x0000, 0x0000},1350{0x05, 0x0051, 0x0001},1351{0x05, 0x0000, 0x0000},1352{0x05, 0x0052, 0x0001},1353{0x05, 0x0000, 0x0000},1354{0x05, 0x0054, 0x0001},1355{0x05, 0x0001, 0x0000},1356{0x00, 0x0000, 0x0001},1357{0x00, 0x0000, 0x0002},1358{0x00, 0x000c, 0x0003},1359{0x00, 0x0000, 0x0004},1360{0x00, 0x0090, 0x0005},1361{0x00, 0x0000, 0x0006},1362{0x00, 0x0040, 0x0007},1363{0x00, 0x00c0, 0x0008},1364{0x00, 0x004a, 0x0009},1365{0x00, 0x0000, 0x000a},1366{0x00, 0x0000, 0x000b},1367{0x00, 0x0001, 0x000c},1368{0x00, 0x0001, 0x000d},1369{0x00, 0x0000, 0x000e},1370{0x00, 0x0002, 0x000f},1371{0x00, 0x0001, 0x0010},1372{0x00, 0x0000, 0x0011},1373{0x00, 0x0000, 0x0012},1374{0x00, 0x0002, 0x0020},1375{0x00, 0x0080, 0x0021},1376{0x00, 0x0001, 0x0022},1377{0x00, 0x00e0, 0x0023},1378{0x00, 0x0000, 0x0024},1379{0x00, 0x00d5, 0x0025},1380{0x00, 0x0000, 0x0026},1381{0x00, 0x000b, 0x0027},1382{0x00, 0x0000, 0x0046},1383{0x00, 0x0000, 0x0047},1384{0x00, 0x0000, 0x0048},1385{0x00, 0x0000, 0x0049},1386{0x00, 0x0008, 0x004a},1387{0xff, 0x0000, 0x00d0},1388{0xff, 0x00d8, 0x00d1},1389{0xff, 0x0000, 0x00d4},1390{0xff, 0x0000, 0x00d5},1391{0x01, 0x00a6, 0x0000},1392{0x01, 0x0028, 0x0001},1393{0x01, 0x0000, 0x0002},1394{0x01, 0x000a, 0x0003},1395{0x01, 0x0040, 0x0004},1396{0x01, 0x0066, 0x0007},1397{0x01, 0x0011, 0x0008},1398{0x01, 0x0032, 0x0009},1399{0x01, 0x00fd, 0x000a},1400{0x01, 0x0038, 0x000b},1401{0x01, 0x00d1, 0x000c},1402{0x01, 0x00f7, 0x000d},1403{0x01, 0x00ed, 0x000e},1404{0x01, 0x00d8, 0x000f},1405{0x01, 0x0038, 0x0010},1406{0x01, 0x00ff, 0x0015},1407{0x01, 0x0001, 0x0016},1408{0x01, 0x0032, 0x0017},1409{0x01, 0x0023, 0x0018},1410{0x01, 0x00ce, 0x0019},1411{0x01, 0x0023, 0x001a},1412{0x01, 0x0032, 0x001b},1413{0x01, 0x008d, 0x001c},1414{0x01, 0x00ce, 0x001d},1415{0x01, 0x008d, 0x001e},1416{0x01, 0x0000, 0x001f},1417{0x01, 0x0000, 0x0020},1418{0x01, 0x00ff, 0x003e},1419{0x01, 0x0003, 0x003f},1420{0x01, 0x0000, 0x0040},1421{0x01, 0x0035, 0x0041},1422{0x01, 0x0053, 0x0042},1423{0x01, 0x0069, 0x0043},1424{0x01, 0x007c, 0x0044},1425{0x01, 0x008c, 0x0045},1426{0x01, 0x009a, 0x0046},1427{0x01, 0x00a8, 0x0047},1428{0x01, 0x00b4, 0x0048},1429{0x01, 0x00bf, 0x0049},1430{0x01, 0x00ca, 0x004a},1431{0x01, 0x00d4, 0x004b},1432{0x01, 0x00dd, 0x004c},1433{0x01, 0x00e7, 0x004d},1434{0x01, 0x00ef, 0x004e},1435{0x01, 0x00f8, 0x004f},1436{0x01, 0x00ff, 0x0050},1437{0x01, 0x0001, 0x0056},1438{0x01, 0x0060, 0x0057},1439{0x01, 0x0040, 0x0058},1440{0x01, 0x0011, 0x0059},1441{0x01, 0x0001, 0x005a},1442{0x02, 0x0007, 0x0005},1443{0x02, 0xa048, 0x0000},1444{0x02, 0x0007, 0x0005},1445{0x02, 0x0015, 0x0006},1446{0x02, 0x100a, 0x0007},1447{0x02, 0xa048, 0x0000},1448{0x02, 0xc002, 0x0001},1449{0x02, 0x000f, 0x0005},1450{0x02, 0xa048, 0x0000},1451{0x05, 0x0022, 0x0004},1452{0x05, 0x0025, 0x0001},1453{0x05, 0x0000, 0x0000},1454{0x05, 0x0026, 0x0001},1455{0x05, 0x0001, 0x0000},1456{0x05, 0x0027, 0x0001},1457{0x05, 0x0000, 0x0000},1458{0x05, 0x0001, 0x0001},1459{0x05, 0x0000, 0x0000},1460{0x05, 0x0021, 0x0001},1461{0x05, 0x00d2, 0x0000},1462{0x05, 0x0020, 0x0001},1463{0x05, 0x0000, 0x0000},1464{0x00, 0x0090, 0x0005},1465{0x01, 0x00a6, 0x0000},1466{0x02, 0x0007, 0x0005},1467{0x02, 0x2000, 0x0000},1468{0x05, 0x0022, 0x0004},1469{0x05, 0x0015, 0x0001},1470{0x05, 0x00ea, 0x0000},1471{0x05, 0x0021, 0x0001},1472{0x05, 0x00d2, 0x0000},1473{0x05, 0x0023, 0x0001},1474{0x05, 0x0003, 0x0000},1475{0x05, 0x0030, 0x0001},1476{0x05, 0x002b, 0x0000},1477{0x05, 0x0031, 0x0001},1478{0x05, 0x0023, 0x0000},1479{0x05, 0x0032, 0x0001},1480{0x05, 0x0023, 0x0000},1481{0x05, 0x0033, 0x0001},1482{0x05, 0x0023, 0x0000},1483{0x05, 0x0034, 0x0001},1484{0x05, 0x0002, 0x0000},1485{0x05, 0x0050, 0x0001},1486{0x05, 0x0000, 0x0000},1487{0x05, 0x0051, 0x0001},1488{0x05, 0x0000, 0x0000},1489{0x05, 0x0052, 0x0001},1490{0x05, 0x0000, 0x0000},1491{0x05, 0x0054, 0x0001},1492{0x05, 0x0001, 0x0000},1493{0x00, 0x0000, 0x0001},1494{0x00, 0x0000, 0x0002},1495{0x00, 0x000c, 0x0003},1496{0x00, 0x0000, 0x0004},1497{0x00, 0x0090, 0x0005},1498{0x00, 0x0000, 0x0006},1499{0x00, 0x0040, 0x0007},1500{0x00, 0x00c0, 0x0008},1501{0x00, 0x004a, 0x0009},1502{0x00, 0x0000, 0x000a},1503{0x00, 0x0000, 0x000b},1504{0x00, 0x0001, 0x000c},1505{0x00, 0x0001, 0x000d},1506{0x00, 0x0000, 0x000e},1507{0x00, 0x0002, 0x000f},1508{0x00, 0x0001, 0x0010},1509{0x00, 0x0000, 0x0011},1510{0x00, 0x0000, 0x0012},1511{0x00, 0x0002, 0x0020},1512{0x00, 0x0080, 0x0021},1513{0x00, 0x0001, 0x0022},1514{0x00, 0x00e0, 0x0023},1515{0x00, 0x0000, 0x0024},1516{0x00, 0x00d5, 0x0025},1517{0x00, 0x0000, 0x0026},1518{0x00, 0x000b, 0x0027},1519{0x00, 0x0000, 0x0046},1520{0x00, 0x0000, 0x0047},1521{0x00, 0x0000, 0x0048},1522{0x00, 0x0000, 0x0049},1523{0x00, 0x0008, 0x004a},1524{0xff, 0x0000, 0x00d0},1525{0xff, 0x00d8, 0x00d1},1526{0xff, 0x0000, 0x00d4},1527{0xff, 0x0000, 0x00d5},1528{0x01, 0x00a6, 0x0000},1529{0x01, 0x0028, 0x0001},1530{0x01, 0x0000, 0x0002},1531{0x01, 0x000a, 0x0003},1532{0x01, 0x0040, 0x0004},1533{0x01, 0x0066, 0x0007},1534{0x01, 0x0011, 0x0008},1535{0x01, 0x0032, 0x0009},1536{0x01, 0x00fd, 0x000a},1537{0x01, 0x0038, 0x000b},1538{0x01, 0x00d1, 0x000c},1539{0x01, 0x00f7, 0x000d},1540{0x01, 0x00ed, 0x000e},1541{0x01, 0x00d8, 0x000f},1542{0x01, 0x0038, 0x0010},1543{0x01, 0x00ff, 0x0015},1544{0x01, 0x0001, 0x0016},1545{0x01, 0x0032, 0x0017},1546{0x01, 0x0023, 0x0018},1547{0x01, 0x00ce, 0x0019},1548{0x01, 0x0023, 0x001a},1549{0x01, 0x0032, 0x001b},1550{0x01, 0x008d, 0x001c},1551{0x01, 0x00ce, 0x001d},1552{0x01, 0x008d, 0x001e},1553{0x01, 0x0000, 0x001f},1554{0x01, 0x0000, 0x0020},1555{0x01, 0x00ff, 0x003e},1556{0x01, 0x0003, 0x003f},1557{0x01, 0x0000, 0x0040},1558{0x01, 0x0035, 0x0041},1559{0x01, 0x0053, 0x0042},1560{0x01, 0x0069, 0x0043},1561{0x01, 0x007c, 0x0044},1562{0x01, 0x008c, 0x0045},1563{0x01, 0x009a, 0x0046},1564{0x01, 0x00a8, 0x0047},1565{0x01, 0x00b4, 0x0048},1566{0x01, 0x00bf, 0x0049},1567{0x01, 0x00ca, 0x004a},1568{0x01, 0x00d4, 0x004b},1569{0x01, 0x00dd, 0x004c},1570{0x01, 0x00e7, 0x004d},1571{0x01, 0x00ef, 0x004e},1572{0x01, 0x00f8, 0x004f},1573{0x01, 0x00ff, 0x0050},1574{0x01, 0x0001, 0x0056},1575{0x01, 0x0060, 0x0057},1576{0x01, 0x0040, 0x0058},1577{0x01, 0x0011, 0x0059},1578{0x01, 0x0001, 0x005a},1579{0x02, 0x0007, 0x0005},1580{0x02, 0xa048, 0x0000},1581{0x02, 0x0007, 0x0005},1582{0x02, 0x0015, 0x0006},1583{0x02, 0x100a, 0x0007},1584{0x02, 0xa048, 0x0000},1585{0x02, 0xc002, 0x0001},1586{0x02, 0x000f, 0x0005},1587{0x02, 0xa048, 0x0000},1588{0x05, 0x0022, 0x0004},1589{0x05, 0x0025, 0x0001},1590{0x05, 0x0000, 0x0000},1591{0x05, 0x0026, 0x0001},1592{0x05, 0x0001, 0x0000},1593{0x05, 0x0027, 0x0001},1594{0x05, 0x0000, 0x0000},1595{0x05, 0x0001, 0x0001},1596{0x05, 0x0000, 0x0000},1597{0x05, 0x0021, 0x0001},1598{0x05, 0x00d2, 0x0000},1599{0x05, 0x0020, 0x0001},1600{0x05, 0x0000, 0x0000},1601{0x00, 0x0090, 0x0005},1602{0x01, 0x00a6, 0x0000},1603{0x05, 0x0026, 0x0001},1604{0x05, 0x0001, 0x0000},1605{0x05, 0x0027, 0x0001},1606{0x05, 0x001e, 0x0000},1607{0x01, 0x0003, 0x003f},1608{0x01, 0x0001, 0x0056},1609{0x01, 0x0011, 0x0008},1610{0x01, 0x0032, 0x0009},1611{0x01, 0xfffd, 0x000a},1612{0x01, 0x0023, 0x000b},1613{0x01, 0xffea, 0x000c},1614{0x01, 0xfff4, 0x000d},1615{0x01, 0xfffc, 0x000e},1616{0x01, 0xffe3, 0x000f},1617{0x01, 0x001f, 0x0010},1618{0x01, 0x00a8, 0x0001},1619{0x01, 0x0067, 0x0007},1620{0x01, 0x0042, 0x0051},1621{0x01, 0x0051, 0x0053},1622{0x01, 0x000a, 0x0003},1623{0x02, 0xc002, 0x0001},1624{0x02, 0x0007, 0x0005},1625{0x01, 0x0042, 0x0051},1626{0x01, 0x0051, 0x0053},1627{0x05, 0x0026, 0x0001},1628{0x05, 0x0001, 0x0000},1629{0x05, 0x0027, 0x0001},1630{0x05, 0x002d, 0x0000},1631{0x01, 0x0003, 0x003f},1632{0x01, 0x0001, 0x0056},1633{0x02, 0xc000, 0x0001},1634{0x02, 0x0000, 0x0005},1635{}1636};16371638/* Unknown camera from Ori Usbid 0x0000:0x0000 */1639/* Based on snoops from Ori Cohen */1640static const __u16 spca501c_mysterious_open_data[][3] = {1641{0x02, 0x000f, 0x0005},1642{0x02, 0xa048, 0x0000},1643{0x05, 0x0022, 0x0004},1644/* DSP Registers */1645{0x01, 0x0016, 0x0011}, /* RGB offset */1646{0x01, 0x0000, 0x0012},1647{0x01, 0x0006, 0x0013},1648{0x01, 0x0078, 0x0051},1649{0x01, 0x0040, 0x0052},1650{0x01, 0x0046, 0x0053},1651{0x01, 0x0040, 0x0054},1652{0x00, 0x0025, 0x0000},1653/* {0x00, 0x0000, 0x0000 }, */1654/* Part 2 */1655/* TG Registers */1656{0x00, 0x0026, 0x0000},1657{0x00, 0x0001, 0x0000},1658{0x00, 0x0027, 0x0000},1659{0x00, 0x008a, 0x0000},1660{0x02, 0x0007, 0x0005},1661{0x02, 0x2000, 0x0000},1662{0x05, 0x0022, 0x0004},1663{0x05, 0x0015, 0x0001},1664{0x05, 0x00ea, 0x0000},1665{0x05, 0x0021, 0x0001},1666{0x05, 0x00d2, 0x0000},1667{0x05, 0x0023, 0x0001},1668{0x05, 0x0003, 0x0000},1669{0x05, 0x0030, 0x0001},1670{0x05, 0x002b, 0x0000},1671{0x05, 0x0031, 0x0001},1672{0x05, 0x0023, 0x0000},1673{0x05, 0x0032, 0x0001},1674{0x05, 0x0023, 0x0000},1675{0x05, 0x0033, 0x0001},1676{0x05, 0x0023, 0x0000},1677{0x05, 0x0034, 0x0001},1678{0x05, 0x0002, 0x0000},1679{0x05, 0x0050, 0x0001},1680{0x05, 0x0000, 0x0000},1681{0x05, 0x0051, 0x0001},1682{0x05, 0x0000, 0x0000},1683{0x05, 0x0052, 0x0001},1684{0x05, 0x0000, 0x0000},1685{0x05, 0x0054, 0x0001},1686{0x05, 0x0001, 0x0000},1687{}1688};16891690/* Based on snoops from Ori Cohen */1691static const __u16 spca501c_mysterious_init_data[][3] = {1692/* Part 3 */1693/* TG registers */1694/* {0x00, 0x0000, 0x0000}, */1695{0x00, 0x0000, 0x0001},1696{0x00, 0x0000, 0x0002},1697{0x00, 0x0006, 0x0003},1698{0x00, 0x0000, 0x0004},1699{0x00, 0x0090, 0x0005},1700{0x00, 0x0000, 0x0006},1701{0x00, 0x0040, 0x0007},1702{0x00, 0x00c0, 0x0008},1703{0x00, 0x004a, 0x0009},1704{0x00, 0x0000, 0x000a},1705{0x00, 0x0000, 0x000b},1706{0x00, 0x0001, 0x000c},1707{0x00, 0x0001, 0x000d},1708{0x00, 0x0000, 0x000e},1709{0x00, 0x0002, 0x000f},1710{0x00, 0x0001, 0x0010},1711{0x00, 0x0000, 0x0011},1712{0x00, 0x0001, 0x0012},1713{0x00, 0x0002, 0x0020},1714{0x00, 0x0080, 0x0021}, /* 640 */1715{0x00, 0x0001, 0x0022},1716{0x00, 0x00e0, 0x0023}, /* 480 */1717{0x00, 0x0000, 0x0024}, /* Offset H hight */1718{0x00, 0x00d3, 0x0025}, /* low */1719{0x00, 0x0000, 0x0026}, /* Offset V */1720{0x00, 0x000d, 0x0027}, /* low */1721{0x00, 0x0000, 0x0046},1722{0x00, 0x0000, 0x0047},1723{0x00, 0x0000, 0x0048},1724{0x00, 0x0000, 0x0049},1725{0x00, 0x0008, 0x004a},1726/* DSP Registers */1727{0x01, 0x00a6, 0x0000},1728{0x01, 0x0028, 0x0001},1729{0x01, 0x0000, 0x0002},1730{0x01, 0x000a, 0x0003}, /* Level Calc bit7 ->1 Auto */1731{0x01, 0x0040, 0x0004},1732{0x01, 0x0066, 0x0007},1733{0x01, 0x000f, 0x0008}, /* A11 Color correction coeff */1734{0x01, 0x002d, 0x0009}, /* A12 */1735{0x01, 0x0005, 0x000a}, /* A13 */1736{0x01, 0x0023, 0x000b}, /* A21 */1737{0x01, 0x00e0, 0x000c}, /* A22 */1738{0x01, 0x00fd, 0x000d}, /* A23 */1739{0x01, 0x00f4, 0x000e}, /* A31 */1740{0x01, 0x00e4, 0x000f}, /* A32 */1741{0x01, 0x0028, 0x0010}, /* A33 */1742{0x01, 0x00ff, 0x0015}, /* Reserved */1743{0x01, 0x0001, 0x0016}, /* Reserved */1744{0x01, 0x0032, 0x0017}, /* Win1 Start begin */1745{0x01, 0x0023, 0x0018},1746{0x01, 0x00ce, 0x0019},1747{0x01, 0x0023, 0x001a},1748{0x01, 0x0032, 0x001b},1749{0x01, 0x008d, 0x001c},1750{0x01, 0x00ce, 0x001d},1751{0x01, 0x008d, 0x001e},1752{0x01, 0x0000, 0x001f},1753{0x01, 0x0000, 0x0020}, /* Win1 Start end */1754{0x01, 0x00ff, 0x003e}, /* Reserved begin */1755{0x01, 0x0002, 0x003f},1756{0x01, 0x0000, 0x0040},1757{0x01, 0x0035, 0x0041},1758{0x01, 0x0053, 0x0042},1759{0x01, 0x0069, 0x0043},1760{0x01, 0x007c, 0x0044},1761{0x01, 0x008c, 0x0045},1762{0x01, 0x009a, 0x0046},1763{0x01, 0x00a8, 0x0047},1764{0x01, 0x00b4, 0x0048},1765{0x01, 0x00bf, 0x0049},1766{0x01, 0x00ca, 0x004a},1767{0x01, 0x00d4, 0x004b},1768{0x01, 0x00dd, 0x004c},1769{0x01, 0x00e7, 0x004d},1770{0x01, 0x00ef, 0x004e},1771{0x01, 0x00f8, 0x004f},1772{0x01, 0x00ff, 0x0050},1773{0x01, 0x0003, 0x0056}, /* Reserved end */1774{0x01, 0x0060, 0x0057}, /* Edge Gain */1775{0x01, 0x0040, 0x0058},1776{0x01, 0x0011, 0x0059}, /* Edge Bandwidth */1777{0x01, 0x0001, 0x005a},1778{0x02, 0x0007, 0x0005},1779{0x02, 0xa048, 0x0000},1780{0x02, 0x0007, 0x0005},1781{0x02, 0x0015, 0x0006},1782{0x02, 0x200a, 0x0007},1783{0x02, 0xa048, 0x0000},1784{0x02, 0xc000, 0x0001},1785{0x02, 0x000f, 0x0005},1786{0x02, 0xa048, 0x0000},1787{0x05, 0x0022, 0x0004},1788{0x05, 0x0025, 0x0001},1789{0x05, 0x0000, 0x0000},1790/* Part 4 */1791{0x05, 0x0026, 0x0001},1792{0x05, 0x0001, 0x0000},1793{0x05, 0x0027, 0x0001},1794{0x05, 0x0000, 0x0000},1795{0x05, 0x0001, 0x0001},1796{0x05, 0x0000, 0x0000},1797{0x05, 0x0021, 0x0001},1798{0x05, 0x00d2, 0x0000},1799{0x05, 0x0020, 0x0001},1800{0x05, 0x0000, 0x0000},1801{0x00, 0x0090, 0x0005},1802{0x01, 0x00a6, 0x0000},1803{0x02, 0x0000, 0x0005},1804{0x05, 0x0026, 0x0001},1805{0x05, 0x0001, 0x0000},1806{0x05, 0x0027, 0x0001},1807{0x05, 0x004e, 0x0000},1808/* Part 5 */1809{0x01, 0x0003, 0x003f},1810{0x01, 0x0001, 0x0056},1811{0x01, 0x000f, 0x0008},1812{0x01, 0x002d, 0x0009},1813{0x01, 0x0005, 0x000a},1814{0x01, 0x0023, 0x000b},1815{0x01, 0xffe0, 0x000c},1816{0x01, 0xfffd, 0x000d},1817{0x01, 0xfff4, 0x000e},1818{0x01, 0xffe4, 0x000f},1819{0x01, 0x0028, 0x0010},1820{0x01, 0x00a8, 0x0001},1821{0x01, 0x0066, 0x0007},1822{0x01, 0x0032, 0x0017},1823{0x01, 0x0023, 0x0018},1824{0x01, 0x00ce, 0x0019},1825{0x01, 0x0023, 0x001a},1826{0x01, 0x0032, 0x001b},1827{0x01, 0x008d, 0x001c},1828{0x01, 0x00ce, 0x001d},1829{0x01, 0x008d, 0x001e},1830{0x01, 0x00c8, 0x0015}, /* c8 Poids fort Luma */1831{0x01, 0x0032, 0x0016}, /* 32 */1832{0x01, 0x0016, 0x0011}, /* R 00 */1833{0x01, 0x0016, 0x0012}, /* G 00 */1834{0x01, 0x0016, 0x0013}, /* B 00 */1835{0x01, 0x000a, 0x0003},1836{0x02, 0xc002, 0x0001},1837{0x02, 0x0007, 0x0005},1838{}1839};18401841static int reg_write(struct usb_device *dev,1842__u16 req, __u16 index, __u16 value)1843{1844int ret;18451846ret = usb_control_msg(dev,1847usb_sndctrlpipe(dev, 0),1848req,1849USB_TYPE_VENDOR | USB_RECIP_DEVICE,1850value, index, NULL, 0, 500);1851PDEBUG(D_USBO, "reg write: 0x%02x 0x%02x 0x%02x",1852req, index, value);1853if (ret < 0)1854err("reg write: error %d", ret);1855return ret;1856}185718581859static int write_vector(struct gspca_dev *gspca_dev,1860const __u16 data[][3])1861{1862struct usb_device *dev = gspca_dev->dev;1863int ret, i = 0;18641865while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) {1866ret = reg_write(dev, data[i][0], data[i][2], data[i][1]);1867if (ret < 0) {1868PDEBUG(D_ERR,1869"Reg write failed for 0x%02x,0x%02x,0x%02x",1870data[i][0], data[i][1], data[i][2]);1871return ret;1872}1873i++;1874}1875return 0;1876}18771878static void setbrightness(struct gspca_dev *gspca_dev)1879{1880struct sd *sd = (struct sd *) gspca_dev;18811882reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x12, sd->brightness);1883}18841885static void setcontrast(struct gspca_dev *gspca_dev)1886{1887struct sd *sd = (struct sd *) gspca_dev;18881889reg_write(gspca_dev->dev, 0x00, 0x00,1890(sd->contrast >> 8) & 0xff);1891reg_write(gspca_dev->dev, 0x00, 0x01,1892sd->contrast & 0xff);1893}18941895static void setcolors(struct gspca_dev *gspca_dev)1896{1897struct sd *sd = (struct sd *) gspca_dev;18981899reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x0c, sd->colors);1900}19011902static void setblue_balance(struct gspca_dev *gspca_dev)1903{1904struct sd *sd = (struct sd *) gspca_dev;19051906reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x11, sd->blue_balance);1907}19081909static void setred_balance(struct gspca_dev *gspca_dev)1910{1911struct sd *sd = (struct sd *) gspca_dev;19121913reg_write(gspca_dev->dev, SPCA501_REG_CCDSP, 0x13, sd->red_balance);1914}19151916/* this function is called at probe time */1917static int sd_config(struct gspca_dev *gspca_dev,1918const struct usb_device_id *id)1919{1920struct sd *sd = (struct sd *) gspca_dev;1921struct cam *cam;19221923cam = &gspca_dev->cam;1924cam->cam_mode = vga_mode;1925cam->nmodes = ARRAY_SIZE(vga_mode);1926sd->subtype = id->driver_info;1927sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value;1928sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value;1929sd->colors = sd_ctrls[MY_COLOR].qctrl.default_value;19301931return 0;1932}19331934/* this function is called at probe and resume time */1935static int sd_init(struct gspca_dev *gspca_dev)1936{1937struct sd *sd = (struct sd *) gspca_dev;19381939switch (sd->subtype) {1940case Arowana300KCMOSCamera:1941case SmileIntlCamera:1942/* Arowana 300k CMOS Camera data */1943if (write_vector(gspca_dev, spca501c_arowana_init_data))1944goto error;1945break;1946case MystFromOriUnknownCamera:1947/* Unknown Ori CMOS Camera data */1948if (write_vector(gspca_dev, spca501c_mysterious_open_data))1949goto error;1950break;1951default:1952/* generic spca501 init data */1953if (write_vector(gspca_dev, spca501_init_data))1954goto error;1955break;1956}1957PDEBUG(D_STREAM, "Initializing SPCA501 finished");1958return 0;1959error:1960return -EINVAL;1961}19621963static int sd_start(struct gspca_dev *gspca_dev)1964{1965struct sd *sd = (struct sd *) gspca_dev;1966struct usb_device *dev = gspca_dev->dev;1967int mode;19681969switch (sd->subtype) {1970case ThreeComHomeConnectLite:1971/* Special handling for 3com data */1972write_vector(gspca_dev, spca501_3com_open_data);1973break;1974case Arowana300KCMOSCamera:1975case SmileIntlCamera:1976/* Arowana 300k CMOS Camera data */1977write_vector(gspca_dev, spca501c_arowana_open_data);1978break;1979case MystFromOriUnknownCamera:1980/* Unknown CMOS Camera data */1981write_vector(gspca_dev, spca501c_mysterious_init_data);1982break;1983default:1984/* Generic 501 open data */1985write_vector(gspca_dev, spca501_open_data);1986}19871988/* memorize the wanted pixel format */1989mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;19901991/* Enable ISO packet machine CTRL reg=2,1992* index=1 bitmask=0x2 (bit ordinal 1) */1993reg_write(dev, SPCA50X_REG_USB, 0x6, 0x94);1994switch (mode) {1995case 0: /* 640x480 */1996reg_write(dev, SPCA50X_REG_USB, 0x07, 0x004a);1997break;1998case 1: /* 320x240 */1999reg_write(dev, SPCA50X_REG_USB, 0x07, 0x104a);2000break;2001default:2002/* case 2: * 160x120 */2003reg_write(dev, SPCA50X_REG_USB, 0x07, 0x204a);2004break;2005}2006reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02);20072008/* HDG atleast the Intel CreateAndShare needs to have one of its2009* brightness / contrast / color set otherwise it assumes what seems2010* max contrast. Note that strange enough setting any of these is2011* enough to fix the max contrast problem, to be sure we set all 3 */2012setbrightness(gspca_dev);2013setcontrast(gspca_dev);2014setcolors(gspca_dev);2015return 0;2016}20172018static void sd_stopN(struct gspca_dev *gspca_dev)2019{2020/* Disable ISO packet2021* machine CTRL reg=2, index=1 bitmask=0x0 (bit ordinal 1) */2022reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x01, 0x00);2023}20242025/* called on streamoff with alt 0 and on disconnect */2026static void sd_stop0(struct gspca_dev *gspca_dev)2027{2028if (!gspca_dev->present)2029return;2030reg_write(gspca_dev->dev, SPCA501_REG_CTLRL, 0x05, 0x00);2031}20322033static void sd_pkt_scan(struct gspca_dev *gspca_dev,2034u8 *data, /* isoc packet */2035int len) /* iso packet length */2036{2037switch (data[0]) {2038case 0: /* start of frame */2039gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);2040data += SPCA501_OFFSET_DATA;2041len -= SPCA501_OFFSET_DATA;2042gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);2043return;2044case 0xff: /* drop */2045/* gspca_dev->last_packet_type = DISCARD_PACKET; */2046return;2047}2048data++;2049len--;2050gspca_frame_add(gspca_dev, INTER_PACKET, data, len);2051}20522053static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)2054{2055struct sd *sd = (struct sd *) gspca_dev;20562057sd->brightness = val;2058if (gspca_dev->streaming)2059setbrightness(gspca_dev);2060return 0;2061}20622063static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)2064{2065struct sd *sd = (struct sd *) gspca_dev;20662067*val = sd->brightness;2068return 0;2069}20702071static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)2072{2073struct sd *sd = (struct sd *) gspca_dev;20742075sd->contrast = val;2076if (gspca_dev->streaming)2077setcontrast(gspca_dev);2078return 0;2079}20802081static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)2082{2083struct sd *sd = (struct sd *) gspca_dev;20842085*val = sd->contrast;2086return 0;2087}20882089static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val)2090{2091struct sd *sd = (struct sd *) gspca_dev;20922093sd->colors = val;2094if (gspca_dev->streaming)2095setcolors(gspca_dev);2096return 0;2097}20982099static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)2100{2101struct sd *sd = (struct sd *) gspca_dev;21022103*val = sd->colors;2104return 0;2105}21062107static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val)2108{2109struct sd *sd = (struct sd *) gspca_dev;21102111sd->blue_balance = val;2112if (gspca_dev->streaming)2113setblue_balance(gspca_dev);2114return 0;2115}21162117static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val)2118{2119struct sd *sd = (struct sd *) gspca_dev;21202121*val = sd->blue_balance;2122return 0;2123}21242125static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val)2126{2127struct sd *sd = (struct sd *) gspca_dev;21282129sd->red_balance = val;2130if (gspca_dev->streaming)2131setred_balance(gspca_dev);2132return 0;2133}21342135static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val)2136{2137struct sd *sd = (struct sd *) gspca_dev;21382139*val = sd->red_balance;2140return 0;2141}21422143/* sub-driver description */2144static const struct sd_desc sd_desc = {2145.name = MODULE_NAME,2146.ctrls = sd_ctrls,2147.nctrls = ARRAY_SIZE(sd_ctrls),2148.config = sd_config,2149.init = sd_init,2150.start = sd_start,2151.stopN = sd_stopN,2152.stop0 = sd_stop0,2153.pkt_scan = sd_pkt_scan,2154};21552156/* -- module initialisation -- */2157static const struct usb_device_id device_table[] = {2158{USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},2159{USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},2160{USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},2161{USB_DEVICE(0x0733, 0x0401), .driver_info = IntelCreateAndShare},2162{USB_DEVICE(0x0733, 0x0402), .driver_info = ViewQuestM318B},2163{USB_DEVICE(0x1776, 0x501c), .driver_info = Arowana300KCMOSCamera},2164{USB_DEVICE(0x0000, 0x0000), .driver_info = MystFromOriUnknownCamera},2165{}2166};2167MODULE_DEVICE_TABLE(usb, device_table);21682169/* -- device connect -- */2170static int sd_probe(struct usb_interface *intf,2171const struct usb_device_id *id)2172{2173return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),2174THIS_MODULE);2175}21762177static struct usb_driver sd_driver = {2178.name = MODULE_NAME,2179.id_table = device_table,2180.probe = sd_probe,2181.disconnect = gspca_disconnect,2182#ifdef CONFIG_PM2183.suspend = gspca_suspend,2184.resume = gspca_resume,2185#endif2186};21872188/* -- module insert / remove -- */2189static int __init sd_mod_init(void)2190{2191return usb_register(&sd_driver);2192}2193static void __exit sd_mod_exit(void)2194{2195usb_deregister(&sd_driver);2196}21972198module_init(sd_mod_init);2199module_exit(sd_mod_exit);220022012202