Commit 65c5259c authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (10429): gspca - sonixj: Simplify the probe of the sensors mi0360/mt9v111.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b083b92f
...@@ -1009,18 +1009,19 @@ static int hv7131r_probe(struct gspca_dev *gspca_dev) ...@@ -1009,18 +1009,19 @@ static int hv7131r_probe(struct gspca_dev *gspca_dev)
return -ENODEV; return -ENODEV;
} }
static int mi0360_probe(struct gspca_dev *gspca_dev) static void mi0360_probe(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev;
int i, j; int i, j;
u16 val; u16 val;
static const u8 probe_tb[][4][8] = { static const u8 probe_tb[][4][8] = {
{ { /* mi0360 */
{0xb0, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, {0xb0, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
{0x90, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, {0x90, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xa2, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa2, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xb0, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10} {0xb0, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10}
}, },
{ { /* mt9v111 */
{0xb0, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10}, {0xb0, 0x5c, 0x01, 0x00, 0x04, 0x00, 0x00, 0x10},
{0x90, 0x5c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x10}, {0x90, 0x5c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xa2, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa2, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
...@@ -1046,13 +1047,16 @@ static int mi0360_probe(struct gspca_dev *gspca_dev) ...@@ -1046,13 +1047,16 @@ static int mi0360_probe(struct gspca_dev *gspca_dev)
switch (val) { switch (val) {
case 0x823a: case 0x823a:
PDEBUG(D_PROBE, "Sensor mt9v111"); PDEBUG(D_PROBE, "Sensor mt9v111");
return SENSOR_MT9V111; sd->sensor = SENSOR_MT9V111;
sd->i2c_base = 0x5c;
break;
case 0x8243: case 0x8243:
PDEBUG(D_PROBE, "Sensor mi0360"); PDEBUG(D_PROBE, "Sensor mi0360");
return SENSOR_MI0360; break;
default:
PDEBUG(D_PROBE, "Unknown sensor %04x - forced to mi0360", val);
break;
} }
PDEBUG(D_PROBE, "Unknown sensor %04x - forced to mi0360", val);
return SENSOR_MI0360;
} }
static int configure_gpio(struct gspca_dev *gspca_dev, static int configure_gpio(struct gspca_dev *gspca_dev,
...@@ -1319,21 +1323,15 @@ static int sd_init(struct gspca_dev *gspca_dev) ...@@ -1319,21 +1323,15 @@ static int sd_init(struct gspca_dev *gspca_dev)
case BRIDGE_SN9C105: case BRIDGE_SN9C105:
if (regF1 != 0x11) if (regF1 != 0x11)
return -ENODEV; return -ENODEV;
if (sd->sensor == SENSOR_MI0360) { if (sd->sensor == SENSOR_MI0360)
sd->sensor = mi0360_probe(gspca_dev); mi0360_probe(gspca_dev);
if (sd->sensor == SENSOR_MT9V111)
sd->i2c_base = 0x5c;
}
reg_w(gspca_dev, 0x01, regGpio, 2); reg_w(gspca_dev, 0x01, regGpio, 2);
break; break;
case BRIDGE_SN9C120: case BRIDGE_SN9C120:
if (regF1 != 0x12) if (regF1 != 0x12)
return -ENODEV; return -ENODEV;
if (sd->sensor == SENSOR_MI0360) { if (sd->sensor == SENSOR_MI0360)
sd->sensor = mi0360_probe(gspca_dev); mi0360_probe(gspca_dev);
if (sd->sensor == SENSOR_MT9V111)
sd->i2c_base = 0x5c;
}
regGpio[1] = 0x70; regGpio[1] = 0x70;
reg_w(gspca_dev, 0x01, regGpio, 2); reg_w(gspca_dev, 0x01, regGpio, 2);
break; break;
......
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