Commit 9c33afc6 authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

V4L/DVB: gspca - sonixj: More static const and better array initialization

Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 32208d44
...@@ -67,17 +67,19 @@ struct sd { ...@@ -67,17 +67,19 @@ struct sd {
#define BRIDGE_SN9C110 2 #define BRIDGE_SN9C110 2
#define BRIDGE_SN9C120 3 #define BRIDGE_SN9C120 3
u8 sensor; /* Type of image sensor chip */ u8 sensor; /* Type of image sensor chip */
#define SENSOR_ADCM1700 0 enum {
#define SENSOR_HV7131R 1 SENSOR_ADCM1700,
#define SENSOR_MI0360 2 SENSOR_HV7131R,
#define SENSOR_MO4000 3 SENSOR_MI0360,
#define SENSOR_MT9V111 4 SENSOR_MO4000,
#define SENSOR_OM6802 5 SENSOR_MT9V111,
#define SENSOR_OV7630 6 SENSOR_OM6802,
#define SENSOR_OV7648 7 SENSOR_OV7630,
#define SENSOR_OV7660 8 SENSOR_OV7648,
#define SENSOR_PO1030 9 SENSOR_OV7660,
#define SENSOR_SP80708 10 SENSOR_PO1030,
SENSOR_SP80708,
} sensors;
u8 i2c_addr; u8 i2c_addr;
u8 *jpeg_hdr; u8 *jpeg_hdr;
...@@ -281,29 +283,47 @@ static const struct ctrl sd_ctrls[] = { ...@@ -281,29 +283,47 @@ static const struct ctrl sd_ctrls[] = {
}; };
/* table of the disabled controls */ /* table of the disabled controls */
static __u32 ctrl_dis[] = { static const __u32 ctrl_dis[] = {
(1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX) | [SENSOR_ADCM1700] = (1 << AUTOGAIN_IDX) |
(1 << AUTOGAIN_IDX), /* SENSOR_ADCM1700 0 */ (1 << INFRARED_IDX) |
(1 << INFRARED_IDX) | (1 << FREQ_IDX), (1 << VFLIP_IDX) |
/* SENSOR_HV7131R 1 */ (1 << FREQ_IDX),
(1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX),
/* SENSOR_MI0360 2 */ [SENSOR_HV7131R] = (1 << INFRARED_IDX) |
(1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), (1 << FREQ_IDX),
/* SENSOR_MO4000 3 */
(1 << VFLIP_IDX) | (1 << FREQ_IDX), [SENSOR_MI0360] = (1 << INFRARED_IDX) |
/* SENSOR_MT9V111 4 */ (1 << VFLIP_IDX) |
(1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), (1 << FREQ_IDX),
/* SENSOR_OM6802 5 */
(1 << INFRARED_IDX), [SENSOR_MO4000] = (1 << INFRARED_IDX) |
/* SENSOR_OV7630 6 */ (1 << VFLIP_IDX) |
(1 << INFRARED_IDX), (1 << FREQ_IDX),
/* SENSOR_OV7648 7 */
(1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), [SENSOR_MT9V111] = (1 << VFLIP_IDX) |
/* SENSOR_OV7660 8 */ (1 << FREQ_IDX),
(1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) |
(1 << FREQ_IDX), /* SENSOR_PO1030 9 */ [SENSOR_OM6802] = (1 << INFRARED_IDX) |
(1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << VFLIP_IDX) |
(1 << FREQ_IDX), /* SENSOR_SP80708 10 */ (1 << FREQ_IDX),
[SENSOR_OV7630] = (1 << INFRARED_IDX),
[SENSOR_OV7648] = (1 << INFRARED_IDX),
[SENSOR_OV7660] = (1 << AUTOGAIN_IDX) |
(1 << INFRARED_IDX) |
(1 << VFLIP_IDX),
[SENSOR_PO1030] = (1 << AUTOGAIN_IDX) |
(1 << INFRARED_IDX) |
(1 << VFLIP_IDX) |
(1 << FREQ_IDX),
[SENSOR_SP80708] = (1 << AUTOGAIN_IDX) |
(1 << INFRARED_IDX) |
(1 << VFLIP_IDX) |
(1 << FREQ_IDX),
}; };
static const struct v4l2_pix_format cif_mode[] = { static const struct v4l2_pix_format cif_mode[] = {
...@@ -456,17 +476,17 @@ static const u8 sn_sp80708[0x1c] = { ...@@ -456,17 +476,17 @@ static const u8 sn_sp80708[0x1c] = {
/* sequence specific to the sensors - !! index = SENSOR_xxx */ /* sequence specific to the sensors - !! index = SENSOR_xxx */
static const u8 *sn_tb[] = { static const u8 *sn_tb[] = {
sn_adcm1700, [SENSOR_ADCM1700] = sn_adcm1700,
sn_hv7131, [SENSOR_HV7131R] = sn_hv7131,
sn_mi0360, [SENSOR_MI0360] = sn_mi0360,
sn_mo4000, [SENSOR_MO4000] = sn_mo4000,
sn_mt9v111, [SENSOR_MT9V111] = sn_mt9v111,
sn_om6802, [SENSOR_OM6802] = sn_om6802,
sn_ov7630, [SENSOR_OV7630] = sn_ov7630,
sn_ov7648, [SENSOR_OV7648] = sn_ov7648,
sn_ov7660, [SENSOR_OV7660] = sn_ov7660,
sn_po1030, [SENSOR_PO1030] = sn_po1030,
sn_sp80708 [SENSOR_SP80708] = sn_sp80708
}; };
/* default gamma table */ /* default gamma table */
...@@ -1069,18 +1089,18 @@ static const u8 sp80708_sensor_param1[][8] = { ...@@ -1069,18 +1089,18 @@ static const u8 sp80708_sensor_param1[][8] = {
{} {}
}; };
static const u8 (*sensor_init[11])[8] = { static const u8 (*sensor_init[])[8] = {
adcm1700_sensor_init, /* ADCM1700 0 */ [SENSOR_ADCM1700] = adcm1700_sensor_init,
hv7131r_sensor_init, /* HV7131R 1 */ [SENSOR_HV7131R] = hv7131r_sensor_init,
mi0360_sensor_init, /* MI0360 2 */ [SENSOR_MI0360] = mi0360_sensor_init,
mo4000_sensor_init, /* MO4000 3 */ [SENSOR_MO4000] = mo4000_sensor_init,
mt9v111_sensor_init, /* MT9V111 4 */ [SENSOR_MT9V111] = mt9v111_sensor_init,
om6802_sensor_init, /* OM6802 5 */ [SENSOR_OM6802] = om6802_sensor_init,
ov7630_sensor_init, /* OV7630 6 */ [SENSOR_OV7630] = ov7630_sensor_init,
ov7648_sensor_init, /* OV7648 7 */ [SENSOR_OV7648] = ov7648_sensor_init,
ov7660_sensor_init, /* OV7660 8 */ [SENSOR_OV7660] = ov7660_sensor_init,
po1030_sensor_init, /* PO1030 9 */ [SENSOR_PO1030] = po1030_sensor_init,
sp80708_sensor_init, /* SP80708 10 */ [SENSOR_SP80708] = sp80708_sensor_init,
}; };
/* read <len> bytes to gspca_dev->usb_buf */ /* read <len> bytes to gspca_dev->usb_buf */
...@@ -1703,7 +1723,7 @@ static void setcolors(struct gspca_dev *gspca_dev) ...@@ -1703,7 +1723,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int i, v; int i, v;
u8 reg8a[12]; /* U & V gains */ u8 reg8a[12]; /* U & V gains */
static s16 uv[6] = { /* same as reg84 in signed decimal */ static const s16 uv[6] = { /* same as reg84 in signed decimal */
-24, -38, 64, /* UR UG UB */ -24, -38, 64, /* UR UG UB */
62, -51, -9 /* VR VG VB */ 62, -51, -9 /* VR VG VB */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment