Commit 235d0ff2 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (11146): gspca - vc032x: Change the probe sequence.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e30bdc66
...@@ -1877,26 +1877,42 @@ static const __u8 po1200_initVGA_data[][4] = { ...@@ -1877,26 +1877,42 @@ static const __u8 po1200_initVGA_data[][4] = {
}; };
struct sensor_info { struct sensor_info {
int sensorId; s8 sensorId;
__u8 I2cAdd; u8 I2cAdd;
__u8 IdAdd; u8 IdAdd;
__u16 VpId; u16 VpId;
__u8 m1; u8 m1;
__u8 m2; u8 m2;
__u8 op; u8 op;
}; };
static const struct sensor_info sensor_info_data[] = { static const struct sensor_info sensor_info_data[] = {
/* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */ /* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */
{SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01}, {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
{SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05}, {-1, 0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01},
/* (tested in vc032x_probe_sensor) */
/* {-1, 0x80 | 0x20, 0x83, 0x0000, 0x24, 0x25, 0x01}, */
{SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01},
{SENSOR_MI1320, 0x80 | 0xc8, 0x00, 0x148c, 0x64, 0x65, 0x01},
{SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
{SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01}, {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01},
/* (tested in vc032x_probe_sensor) */ /* (tested in vc032x_probe_sensor) */
/* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */ /* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */
{SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
{-1, 0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05},
{-1, 0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05},
{SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
/* {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
{-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
/* {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01}, */
/* {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05}, */
{-1, 0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01},
{SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01}, {SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01},
{-1, 0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01},
{-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01},
{-1, 0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01},
{-1, 0x80 | 0x48, 0x00, 0x0000, 0x64, 0x67, 0x01},
/*fixme: not in the ms-win probe - may be found before?*/
{SENSOR_MI1320, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01},
{SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05},
}; };
/* read 'len' bytes in gspca_dev->usb_buf */ /* read 'len' bytes in gspca_dev->usb_buf */
...@@ -1931,7 +1947,7 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, ...@@ -1931,7 +1947,7 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev,
u16 address) u16 address)
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
__u8 ldata, mdata, hdata; u8 ldata, mdata, hdata;
int retry = 50; int retry = 50;
reg_r(gspca_dev, 0xa1, 0xb33f, 1); reg_r(gspca_dev, 0xa1, 0xb33f, 1);
...@@ -1944,9 +1960,11 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, ...@@ -1944,9 +1960,11 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev,
reg_w(dev, 0xa0, 0x02, 0xb339); reg_w(dev, 0xa0, 0x02, 0xb339);
do { do {
msleep(8);
reg_r(gspca_dev, 0xa1, 0xb33b, 1); reg_r(gspca_dev, 0xa1, 0xb33b, 1);
} while (retry-- && gspca_dev->usb_buf[0]); if (gspca_dev->usb_buf[0] == 0x00)
break;
msleep(40);
} while (--retry >= 0);
reg_r(gspca_dev, 0xa1, 0xb33e, 1); reg_r(gspca_dev, 0xa1, 0xb33e, 1);
ldata = gspca_dev->usb_buf[0]; ldata = gspca_dev->usb_buf[0];
...@@ -1967,7 +1985,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) ...@@ -1967,7 +1985,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
{ {
struct usb_device *dev = gspca_dev->dev; struct usb_device *dev = gspca_dev->dev;
int i; int i;
__u16 value; u16 value;
const struct sensor_info *ptsensor_info; const struct sensor_info *ptsensor_info;
reg_r(gspca_dev, 0xa1, 0xbfcf, 1); reg_r(gspca_dev, 0xa1, 0xbfcf, 1);
...@@ -1982,13 +2000,22 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) ...@@ -1982,13 +2000,22 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335);
reg_w(dev, 0xa0, ptsensor_info->op, 0xb301); reg_w(dev, 0xa0, ptsensor_info->op, 0xb301);
value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd); value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd);
if (value == ptsensor_info->VpId) if (value == 0 && ptsensor_info->IdAdd == 0x82)
return ptsensor_info->sensorId; value = read_sensor_register(gspca_dev, 0x83);
if (value != 0) {
/* special case for MI0360 */ PDEBUG(D_ERR|D_PROBE, "Sensor ID %04x (%d)",
if (ptsensor_info->sensorId == SENSOR_MI1310_SOC value, i);
&& value == 0x8243) if (value == ptsensor_info->VpId)
return SENSOR_MI0360; return ptsensor_info->sensorId;
switch (value) {
case 0x7673:
return SENSOR_OV7670;
case 0x8243:
return SENSOR_MI0360;
}
/*fixme: should return here*/
}
} }
return -1; return -1;
} }
......
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