summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca/m5602
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2008-11-26 17:32:46 +0100
committerErik Andrén <erik.andren@gmail.com>2008-11-26 17:32:46 +0100
commit35f33378721e6f823dde92b83dd9f37348905cd1 (patch)
tree0a7406102b30d28431cbb9d0fb3f16bacbdb7f6f /linux/drivers/media/video/gspca/m5602
parent4afcf3e7639390bd67f0720078b16234019af1fe (diff)
downloadmediapointer-dvb-s2-35f33378721e6f823dde92b83dd9f37348905cd1.tar.gz
mediapointer-dvb-s2-35f33378721e6f823dde92b83dd9f37348905cd1.tar.bz2
Add flush control to each sensor
From: Erik Andrén <erik.andren@gmail.com> Priority: normal Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Diffstat (limited to 'linux/drivers/media/video/gspca/m5602')
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_core.c11
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h1
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_ov9650.h2
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_po1030.h1
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h5
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h3
-rw-r--r--linux/drivers/media/video/gspca/m5602/m5602_sensor.h2
7 files changed, 21 insertions, 4 deletions
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_core.c b/linux/drivers/media/video/gspca/m5602/m5602_core.c
index 1d1fb541f..d86b905cb 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_core.c
+++ b/linux/drivers/media/video/gspca/m5602/m5602_core.c
@@ -85,6 +85,9 @@ int m5602_read_sensor(struct sd *sd, const u8 address,
{
int err, i;
+ if (!len || (len > sd->sensor->i2c_regW))
+ return -EINVAL;
+
do {
err = m5602_read_bridge(sd, M5602_XB_I2C_STATUS, i2c_data);
} while ((*i2c_data & I2C_BUSY) && !err);
@@ -102,9 +105,11 @@ int m5602_read_sensor(struct sd *sd, const u8 address,
if (err < 0)
goto out;
- err = m5602_write_bridge(sd, M5602_XB_I2C_CTRL, 0x08);
- if (err < 0)
- goto out;
+ if (sd->sensor->i2c_need_flush) {
+ err = m5602_write_bridge(sd, M5602_XB_I2C_CTRL, 0x08);
+ if (err < 0)
+ goto out;
+ }
for (i = 0; (i < len) && !err; i++) {
err = m5602_read_bridge(sd, M5602_XB_I2C_DATA, &(i2c_data[i]));
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h b/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h
index 763b17ee6..db64c122b 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h
@@ -102,6 +102,7 @@ static struct m5602_sensor mt9m111 = {
.i2c_slave_id = 0xba,
.i2c_regW = 2,
+ .i2c_need_flush = 0,
.probe = mt9m111_probe,
.init = mt9m111_init,
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h
index 1f33a7b8d..732447932 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h
@@ -152,6 +152,8 @@ static struct m5602_sensor ov9650 = {
.name = "OV9650",
.i2c_slave_id = 0x60,
.i2c_regW = 1,
+ .i2c_need_flush = 1,
+
.probe = ov9650_probe,
.init = ov9650_init,
.power_down = ov9650_power_down,
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h
index c4dad6449..a44a4ac6b 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h
@@ -149,6 +149,7 @@ static struct m5602_sensor po1030 = {
.i2c_slave_id = 0xdc,
.i2c_regW = 1,
+ .i2c_need_flush = 1,
.probe = po1030_probe,
.init = po1030_init,
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h b/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
index a38103a88..8088e8ea4 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
@@ -83,9 +83,12 @@ static struct m5602_sensor s5k4aa = {
.name = "S5K4AA",
.probe = s5k4aa_probe,
.init = s5k4aa_init,
- .power_down = s5k4aa_power_down,
+
.i2c_slave_id = 0x5a,
.i2c_regW = 2,
+ .i2c_need_flush = 1,
+
+ .power_down = s5k4aa_power_down,
.nctrls = 4,
.ctrls = {
{
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h
index 735701127..e721229eb 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h
@@ -65,8 +65,11 @@ static struct m5602_sensor s5k83a = {
.probe = s5k83a_probe,
.init = s5k83a_init,
.power_down = s5k83a_power_down,
+
.i2c_slave_id = 0x5a,
.i2c_regW = 2,
+ .i2c_need_flush = 0,
+
.nctrls = 5,
.ctrls = {
{
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_sensor.h b/linux/drivers/media/video/gspca/m5602/m5602_sensor.h
index 23c0ef948..0f6e1d83f 100644
--- a/linux/drivers/media/video/gspca/m5602/m5602_sensor.h
+++ b/linux/drivers/media/video/gspca/m5602/m5602_sensor.h
@@ -52,6 +52,8 @@ struct m5602_sensor {
/* Width of each i2c register (in bytes) */
u8 i2c_regW;
+ u8 i2c_need_flush;
+
/* Probes if the sensor is connected */
int (*probe)(struct sd *sd);