summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2008-12-30 15:27:17 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 21:44:39 -0300
commite4cc4fcc7b85ec32f05343b02229492c06baba1a (patch)
treeb2e3eaea31ec971963dc6532d14521882eec1d3c /drivers/media
parente335f224e35f413775a549889318afe6bd0342b0 (diff)
downloadlwn-e4cc4fcc7b85ec32f05343b02229492c06baba1a.tar.gz
lwn-e4cc4fcc7b85ec32f05343b02229492c06baba1a.zip
V4L/DVB (11411): gspca - m5602: Rework v4l ctrl handling in all sensors
Previously, all sensors allocated a part of a large ctrl vector. Define this vector separately for each sensor instead. Signed-off-by: Erik Andrén <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/m5602/Makefile3
-rw-r--r--drivers/media/video/gspca/m5602/m5602_bridge.h2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_mt9m111.c2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_mt9m111.h25
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.c2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.h35
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.h27
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.c3
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.h23
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k83a.c2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k83a.h29
-rw-r--r--drivers/media/video/gspca/m5602/m5602_sensor.h5
13 files changed, 75 insertions, 85 deletions
diff --git a/drivers/media/video/gspca/m5602/Makefile b/drivers/media/video/gspca/m5602/Makefile
index 226ab4fc9d60..9fa3644f4869 100644
--- a/drivers/media/video/gspca/m5602/Makefile
+++ b/drivers/media/video/gspca/m5602/Makefile
@@ -7,5 +7,4 @@ gspca_m5602-objs := m5602_core.o \
m5602_s5k83a.o \
m5602_s5k4aa.o
-EXTRA_CFLAGS += -Idrivers/media/video/gspca
-
+EXTRA_CFLAGS += -Idrivers/media/video/gspca \ No newline at end of file
diff --git a/drivers/media/video/gspca/m5602/m5602_bridge.h b/drivers/media/video/gspca/m5602/m5602_bridge.h
index a3f3b7a0c7e7..9ff41006673b 100644
--- a/drivers/media/video/gspca/m5602/m5602_bridge.h
+++ b/drivers/media/video/gspca/m5602/m5602_bridge.h
@@ -116,7 +116,7 @@ struct sd {
char *name;
/* A pointer to the currently connected sensor */
- struct m5602_sensor *sensor;
+ const struct m5602_sensor *sensor;
struct sd_desc *desc;
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
index f3e9d8f0efe9..69f8f6ce5811 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
@@ -65,7 +65,7 @@ sensor_found:
sd->gspca_dev.cam.cam_mode = mt9m111.modes;
sd->gspca_dev.cam.nmodes = mt9m111.nmodes;
sd->desc->ctrls = mt9m111.ctrls;
- sd->desc->nctrls = mt9m111.nctrls;
+ sd->desc->nctrls = ARRAY_SIZE(mt9m111_ctrls);
return 0;
}
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.h b/drivers/media/video/gspca/m5602/m5602_mt9m111.h
index e795ab7a36c9..23b8e4f57bbf 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.h
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.h
@@ -94,18 +94,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val);
-static struct m5602_sensor mt9m111 = {
- .name = "MT9M111",
-
- .i2c_slave_id = 0xba,
- .i2c_regW = 2,
-
- .probe = mt9m111_probe,
- .init = mt9m111_init,
- .power_down = mt9m111_power_down,
-
- .nctrls = 3,
- .ctrls = {
+const static struct ctrl mt9m111_ctrls[] = {
{
{
.id = V4L2_CID_VFLIP,
@@ -144,7 +133,17 @@ static struct m5602_sensor mt9m111 = {
.set = mt9m111_set_gain,
.get = mt9m111_get_gain
}
- },
+};
+
+static struct m5602_sensor mt9m111 = {
+ .name = "MT9M111",
+
+ .i2c_slave_id = 0xba,
+ .i2c_regW = 2,
+
+ .probe = mt9m111_probe,
+ .init = mt9m111_init,
+ .power_down = mt9m111_power_down,
.nmodes = 1,
.modes = {
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c
index 6581479c0b30..a9f6ff17ee95 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.c
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c
@@ -113,7 +113,7 @@ sensor_found:
sd->gspca_dev.cam.cam_mode = ov9650.modes;
sd->gspca_dev.cam.nmodes = ov9650.nmodes;
sd->desc->ctrls = ov9650.ctrls;
- sd->desc->nctrls = ov9650.nctrls;
+ sd->desc->nctrls = ARRAY_SIZE(ov9650_ctrls);
return 0;
}
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.h b/drivers/media/video/gspca/m5602/m5602_ov9650.h
index fe69ddfcb002..ebf7291332cc 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.h
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.h
@@ -156,18 +156,7 @@ int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val);
int ov9650_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val);
int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val);
-static struct m5602_sensor ov9650 = {
- .name = "OV9650",
- .i2c_slave_id = 0x60,
- .i2c_regW = 1,
- .probe = ov9650_probe,
- .init = ov9650_init,
- .start = ov9650_start,
- .stop = ov9650_stop,
- .power_down = ov9650_power_down,
-
- .nctrls = 8,
- .ctrls = {
+static struct ctrl ov9650_ctrls[] = {
{
{
.id = V4L2_CID_EXPOSURE,
@@ -267,7 +256,18 @@ static struct m5602_sensor ov9650 = {
.set = ov9650_set_auto_gain,
.get = ov9650_get_auto_gain
}
- },
+};
+
+static struct m5602_sensor ov9650 = {
+ .name = "OV9650",
+ .i2c_slave_id = 0x60,
+ .i2c_regW = 1,
+ .probe = ov9650_probe,
+ .init = ov9650_init,
+ .start = ov9650_start,
+ .stop = ov9650_stop,
+ .power_down = ov9650_power_down,
+ .ctrls = ov9650_ctrls,
.nmodes = 4,
.modes = {
@@ -444,19 +444,10 @@ static const unsigned char init_ov9650[][3] =
/* Enable denoise, and white-pixel erase */
{SENSOR, OV9650_COM22, 0x23},
- /* Set the high bits of the exposure value */
- {SENSOR, OV9650_AECH, ((EXPOSURE_DEFAULT & 0xff00) >> 8)},
-
/* Enable VARIOPIXEL */
{SENSOR, OV9650_COM3, OV9650_VARIOPIXEL},
{SENSOR, OV9650_COM4, OV9650_QVGA_VARIOPIXEL},
- /* Set the low bits of the exposure value */
- {SENSOR, OV9650_COM1, (EXPOSURE_DEFAULT & 0xff)},
- {SENSOR, OV9650_GAIN, GAIN_DEFAULT},
- {SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT},
- {SENSOR, OV9650_RED, RED_GAIN_DEFAULT},
-
/* Put the sensor in soft sleep mode */
{SENSOR, OV9650_COM2, OV9650_SOFT_SLEEP | OV9650_OUTPUT_DRIVE_2X},
};
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index d509330f5f51..7914dcc6e2a2 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -62,7 +62,7 @@ sensor_found:
sd->gspca_dev.cam.cam_mode = po1030.modes;
sd->gspca_dev.cam.nmodes = po1030.nmodes;
sd->desc->ctrls = po1030.ctrls;
- sd->desc->nctrls = po1030.nctrls;
+ sd->desc->nctrls = ARRAY_SIZE(po1030_ctrls);
return 0;
}
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h
index def39d5bcec6..afd776a07f9d 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.h
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.h
@@ -141,18 +141,7 @@ int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val);
int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
-static struct m5602_sensor po1030 = {
- .name = "PO1030",
-
- .i2c_slave_id = 0xdc,
- .i2c_regW = 1,
-
- .probe = po1030_probe,
- .init = po1030_init,
- .power_down = po1030_power_down,
-
- .nctrls = 6,
- .ctrls = {
+static struct ctrl po1030_ctrls[] = {
{
{
.id = V4L2_CID_GAIN,
@@ -230,7 +219,19 @@ static struct m5602_sensor po1030 = {
.set = po1030_set_vflip,
.get = po1030_get_vflip
}
- },
+};
+
+static struct m5602_sensor po1030 = {
+ .name = "PO1030",
+
+ .i2c_slave_id = 0xdc,
+ .i2c_regW = 1,
+
+ .probe = po1030_probe,
+ .init = po1030_init,
+ .power_down = po1030_power_down,
+
+ .ctrls = po1030_ctrls,
.nmodes = 1,
.modes = {
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index 921d009e02c4..b7f1b045dca7 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -118,8 +118,7 @@ sensor_found:
sd->gspca_dev.cam.cam_mode = s5k4aa.modes;
sd->gspca_dev.cam.nmodes = s5k4aa.nmodes;
sd->desc->ctrls = s5k4aa.ctrls;
- sd->desc->nctrls = s5k4aa.nctrls;
-
+ sd->desc->nctrls = ARRAY_SIZE(s5k4aa_ctrls);
return 0;
}
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.h b/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
index 0c08ccffc7ff..33ba1621bc69 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
@@ -77,16 +77,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val);
-static struct m5602_sensor s5k4aa = {
- .name = "S5K4AA",
- .probe = s5k4aa_probe,
- .init = s5k4aa_init,
- .start = s5k4aa_start,
- .power_down = s5k4aa_power_down,
- .i2c_slave_id = 0x5a,
- .i2c_regW = 2,
- .nctrls = 4,
- .ctrls = {
+static struct ctrl s5k4aa_ctrls[] = {
{
{
.id = V4L2_CID_VFLIP,
@@ -140,7 +131,17 @@ static struct m5602_sensor s5k4aa = {
.set = s5k4aa_set_exposure,
.get = s5k4aa_get_exposure
}
- },
+};
+
+static struct m5602_sensor s5k4aa = {
+ .name = "S5K4AA",
+ .probe = s5k4aa_probe,
+ .init = s5k4aa_init,
+ .start = s5k4aa_start,
+ .power_down = s5k4aa_power_down,
+ .i2c_slave_id = 0x5a,
+ .i2c_regW = 2,
+ .ctrls = s5k4aa_ctrls,
.nmodes = 1,
.modes = {
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c
index 5ce69d74dac9..6880b31575c7 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c
@@ -66,7 +66,7 @@ sensor_found:
sd->gspca_dev.cam.cam_mode = s5k83a.modes;
sd->gspca_dev.cam.nmodes = s5k83a.nmodes;
sd->desc->ctrls = s5k83a.ctrls;
- sd->desc->nctrls = s5k83a.nctrls;
+ sd->desc->nctrls = ARRAY_SIZE(s5k83a_ctrls);
return 0;
}
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/drivers/media/video/gspca/m5602/m5602_s5k83a.h
index 40ed14165c2a..ed74d9734972 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k83a.h
+++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.h
@@ -61,17 +61,7 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val);
int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
-static struct m5602_sensor s5k83a = {
- .name = "S5K83A",
- .probe = s5k83a_probe,
- .init = s5k83a_init,
- .start = s5k83a_start,
- .stop = s5k83a_stop,
- .power_down = s5k83a_power_down,
- .i2c_slave_id = 0x5a,
- .i2c_regW = 2,
- .nctrls = 5,
- .ctrls = {
+static struct ctrl s5k83a_ctrls[] = {
{
{
.id = V4L2_CID_BRIGHTNESS,
@@ -136,8 +126,21 @@ static struct m5602_sensor s5k83a = {
},
.set = s5k83a_set_vflip,
.get = s5k83a_get_vflip
- }
- },
+ }
+};
+
+
+static struct m5602_sensor s5k83a = {
+ .name = "S5K83A",
+ .probe = s5k83a_probe,
+ .init = s5k83a_init,
+ .start = s5k83a_start,
+ .stop = s5k83a_stop,
+ .power_down = s5k83a_power_down,
+ .i2c_slave_id = 0x5a,
+ .i2c_regW = 2,
+ .ctrls = s5k83a_ctrls,
+
.nmodes = 1,
.modes = {
{
diff --git a/drivers/media/video/gspca/m5602/m5602_sensor.h b/drivers/media/video/gspca/m5602/m5602_sensor.h
index 8eed4cc0b413..5867ee258918 100644
--- a/drivers/media/video/gspca/m5602/m5602_sensor.h
+++ b/drivers/media/video/gspca/m5602/m5602_sensor.h
@@ -24,8 +24,6 @@
#define M5602_DEFAULT_FRAME_WIDTH 640
#define M5602_DEFAULT_FRAME_HEIGHT 480
-#define M5602_MAX_CTRLS (V4L2_CID_LASTP1 - V4L2_CID_BASE + 10)
-
/* Enumerates all supported sensors */
enum sensors {
OV9650_SENSOR = 1,
@@ -67,8 +65,7 @@ struct m5602_sensor {
/* Performs a power down sequence */
int (*power_down)(struct sd *sd);
- int nctrls;
- struct ctrl ctrls[M5602_MAX_CTRLS];
+ const struct ctrl *ctrls;
char nmodes;
struct v4l2_pix_format modes[];