aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/sonixj.c
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-03-17 14:25:32 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:47:22 -0400
commit9c33afc6102517764fb5d308dcf49bf42893da2c (patch)
tree5b0d8c21c213562ea082f1cb9c97dd7a44991489 /drivers/media/video/gspca/sonixj.c
parent32208d444ab6ed427d18deebc4ad783602c695ba (diff)
V4L/DVB: gspca - sonixj: More static const and better array initialization
Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sonixj.c')
-rw-r--r--drivers/media/video/gspca/sonixj.c136
1 files changed, 78 insertions, 58 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 1d61b92f6bfc..20ca161bc3d0 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -67,17 +67,19 @@ struct sd {
67#define BRIDGE_SN9C110 2 67#define BRIDGE_SN9C110 2
68#define BRIDGE_SN9C120 3 68#define BRIDGE_SN9C120 3
69 u8 sensor; /* Type of image sensor chip */ 69 u8 sensor; /* Type of image sensor chip */
70#define SENSOR_ADCM1700 0 70enum {
71#define SENSOR_HV7131R 1 71 SENSOR_ADCM1700,
72#define SENSOR_MI0360 2 72 SENSOR_HV7131R,
73#define SENSOR_MO4000 3 73 SENSOR_MI0360,
74#define SENSOR_MT9V111 4 74 SENSOR_MO4000,
75#define SENSOR_OM6802 5 75 SENSOR_MT9V111,
76#define SENSOR_OV7630 6 76 SENSOR_OM6802,
77#define SENSOR_OV7648 7 77 SENSOR_OV7630,
78#define SENSOR_OV7660 8 78 SENSOR_OV7648,
79#define SENSOR_PO1030 9 79 SENSOR_OV7660,
80#define SENSOR_SP80708 10 80 SENSOR_PO1030,
81 SENSOR_SP80708,
82} sensors;
81 u8 i2c_addr; 83 u8 i2c_addr;
82 84
83 u8 *jpeg_hdr; 85 u8 *jpeg_hdr;
@@ -281,29 +283,47 @@ static const struct ctrl sd_ctrls[] = {
281}; 283};
282 284
283/* table of the disabled controls */ 285/* table of the disabled controls */
284static __u32 ctrl_dis[] = { 286static const __u32 ctrl_dis[] = {
285 (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX) | 287[SENSOR_ADCM1700] = (1 << AUTOGAIN_IDX) |
286 (1 << AUTOGAIN_IDX), /* SENSOR_ADCM1700 0 */ 288 (1 << INFRARED_IDX) |
287 (1 << INFRARED_IDX) | (1 << FREQ_IDX), 289 (1 << VFLIP_IDX) |
288 /* SENSOR_HV7131R 1 */ 290 (1 << FREQ_IDX),
289 (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), 291
290 /* SENSOR_MI0360 2 */ 292[SENSOR_HV7131R] = (1 << INFRARED_IDX) |
291 (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), 293 (1 << FREQ_IDX),
292 /* SENSOR_MO4000 3 */ 294
293 (1 << VFLIP_IDX) | (1 << FREQ_IDX), 295[SENSOR_MI0360] = (1 << INFRARED_IDX) |
294 /* SENSOR_MT9V111 4 */ 296 (1 << VFLIP_IDX) |
295 (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), 297 (1 << FREQ_IDX),
296 /* SENSOR_OM6802 5 */ 298
297 (1 << INFRARED_IDX), 299[SENSOR_MO4000] = (1 << INFRARED_IDX) |
298 /* SENSOR_OV7630 6 */ 300 (1 << VFLIP_IDX) |
299 (1 << INFRARED_IDX), 301 (1 << FREQ_IDX),
300 /* SENSOR_OV7648 7 */ 302
301 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), 303[SENSOR_MT9V111] = (1 << VFLIP_IDX) |
302 /* SENSOR_OV7660 8 */ 304 (1 << FREQ_IDX),
303 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | 305
304 (1 << FREQ_IDX), /* SENSOR_PO1030 9 */ 306[SENSOR_OM6802] = (1 << INFRARED_IDX) |
305 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | 307 (1 << VFLIP_IDX) |
306 (1 << FREQ_IDX), /* SENSOR_SP80708 10 */ 308 (1 << FREQ_IDX),
309
310[SENSOR_OV7630] = (1 << INFRARED_IDX),
311
312[SENSOR_OV7648] = (1 << INFRARED_IDX),
313
314[SENSOR_OV7660] = (1 << AUTOGAIN_IDX) |
315 (1 << INFRARED_IDX) |
316 (1 << VFLIP_IDX),
317
318[SENSOR_PO1030] = (1 << AUTOGAIN_IDX) |
319 (1 << INFRARED_IDX) |
320 (1 << VFLIP_IDX) |
321 (1 << FREQ_IDX),
322
323[SENSOR_SP80708] = (1 << AUTOGAIN_IDX) |
324 (1 << INFRARED_IDX) |
325 (1 << VFLIP_IDX) |
326 (1 << FREQ_IDX),
307}; 327};
308 328
309static const struct v4l2_pix_format cif_mode[] = { 329static const struct v4l2_pix_format cif_mode[] = {
@@ -456,17 +476,17 @@ static const u8 sn_sp80708[0x1c] = {
456 476
457/* sequence specific to the sensors - !! index = SENSOR_xxx */ 477/* sequence specific to the sensors - !! index = SENSOR_xxx */
458static const u8 *sn_tb[] = { 478static const u8 *sn_tb[] = {
459 sn_adcm1700, 479[SENSOR_ADCM1700] = sn_adcm1700,
460 sn_hv7131, 480[SENSOR_HV7131R] = sn_hv7131,
461 sn_mi0360, 481[SENSOR_MI0360] = sn_mi0360,
462 sn_mo4000, 482[SENSOR_MO4000] = sn_mo4000,
463 sn_mt9v111, 483[SENSOR_MT9V111] = sn_mt9v111,
464 sn_om6802, 484[SENSOR_OM6802] = sn_om6802,
465 sn_ov7630, 485[SENSOR_OV7630] = sn_ov7630,
466 sn_ov7648, 486[SENSOR_OV7648] = sn_ov7648,
467 sn_ov7660, 487[SENSOR_OV7660] = sn_ov7660,
468 sn_po1030, 488[SENSOR_PO1030] = sn_po1030,
469 sn_sp80708 489[SENSOR_SP80708] = sn_sp80708
470}; 490};
471 491
472/* default gamma table */ 492/* default gamma table */
@@ -1069,18 +1089,18 @@ static const u8 sp80708_sensor_param1[][8] = {
1069 {} 1089 {}
1070}; 1090};
1071 1091
1072static const u8 (*sensor_init[11])[8] = { 1092static const u8 (*sensor_init[])[8] = {
1073 adcm1700_sensor_init, /* ADCM1700 0 */ 1093[SENSOR_ADCM1700] = adcm1700_sensor_init,
1074 hv7131r_sensor_init, /* HV7131R 1 */ 1094[SENSOR_HV7131R] = hv7131r_sensor_init,
1075 mi0360_sensor_init, /* MI0360 2 */ 1095[SENSOR_MI0360] = mi0360_sensor_init,
1076 mo4000_sensor_init, /* MO4000 3 */ 1096[SENSOR_MO4000] = mo4000_sensor_init,
1077 mt9v111_sensor_init, /* MT9V111 4 */ 1097[SENSOR_MT9V111] = mt9v111_sensor_init,
1078 om6802_sensor_init, /* OM6802 5 */ 1098[SENSOR_OM6802] = om6802_sensor_init,
1079 ov7630_sensor_init, /* OV7630 6 */ 1099[SENSOR_OV7630] = ov7630_sensor_init,
1080 ov7648_sensor_init, /* OV7648 7 */ 1100[SENSOR_OV7648] = ov7648_sensor_init,
1081 ov7660_sensor_init, /* OV7660 8 */ 1101[SENSOR_OV7660] = ov7660_sensor_init,
1082 po1030_sensor_init, /* PO1030 9 */ 1102[SENSOR_PO1030] = po1030_sensor_init,
1083 sp80708_sensor_init, /* SP80708 10 */ 1103[SENSOR_SP80708] = sp80708_sensor_init,
1084}; 1104};
1085 1105
1086/* read <len> bytes to gspca_dev->usb_buf */ 1106/* read <len> bytes to gspca_dev->usb_buf */
@@ -1703,7 +1723,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
1703 struct sd *sd = (struct sd *) gspca_dev; 1723 struct sd *sd = (struct sd *) gspca_dev;
1704 int i, v; 1724 int i, v;
1705 u8 reg8a[12]; /* U & V gains */ 1725 u8 reg8a[12]; /* U & V gains */
1706 static s16 uv[6] = { /* same as reg84 in signed decimal */ 1726 static const s16 uv[6] = { /* same as reg84 in signed decimal */
1707 -24, -38, 64, /* UR UG UB */ 1727 -24, -38, 64, /* UR UG UB */
1708 62, -51, -9 /* VR VG VB */ 1728 62, -51, -9 /* VR VG VB */
1709 }; 1729 };