diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2009-03-22 15:33:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:32 -0400 |
commit | 235d0ff2874091981c482d71bbce8b7c30cbc3b3 (patch) | |
tree | 0e0d07481d33b6bd21f231b3638753d712254f2d /drivers/media/video/gspca/vc032x.c | |
parent | e30bdc669371ad511a5b4898aacfc01015553c5b (diff) |
V4L/DVB (11146): gspca - vc032x: Change the probe sequence.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/vc032x.c')
-rw-r--r-- | drivers/media/video/gspca/vc032x.c | 73 |
1 files changed, 50 insertions, 23 deletions
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index ca96cbc98794..728fff902f15 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
@@ -1877,26 +1877,42 @@ static const __u8 po1200_initVGA_data[][4] = { | |||
1877 | }; | 1877 | }; |
1878 | 1878 | ||
1879 | struct sensor_info { | 1879 | struct sensor_info { |
1880 | int sensorId; | 1880 | s8 sensorId; |
1881 | __u8 I2cAdd; | 1881 | u8 I2cAdd; |
1882 | __u8 IdAdd; | 1882 | u8 IdAdd; |
1883 | __u16 VpId; | 1883 | u16 VpId; |
1884 | __u8 m1; | 1884 | u8 m1; |
1885 | __u8 m2; | 1885 | u8 m2; |
1886 | __u8 op; | 1886 | u8 op; |
1887 | }; | 1887 | }; |
1888 | 1888 | ||
1889 | static const struct sensor_info sensor_info_data[] = { | 1889 | static const struct sensor_info sensor_info_data[] = { |
1890 | /* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */ | 1890 | /* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */ |
1891 | {SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01}, | 1891 | {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05}, |
1892 | {SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05}, | 1892 | {-1, 0x80 | 0x20, 0x82, 0x0000, 0x24, 0x25, 0x01}, |
1893 | /* (tested in vc032x_probe_sensor) */ | ||
1894 | /* {-1, 0x80 | 0x20, 0x83, 0x0000, 0x24, 0x25, 0x01}, */ | ||
1893 | {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, | 1895 | {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x3130, 0x24, 0x25, 0x01}, |
1894 | {SENSOR_MI1320, 0x80 | 0xc8, 0x00, 0x148c, 0x64, 0x65, 0x01}, | ||
1895 | {SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05}, | ||
1896 | {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01}, | 1896 | {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01}, |
1897 | /* (tested in vc032x_probe_sensor) */ | 1897 | /* (tested in vc032x_probe_sensor) */ |
1898 | /* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */ | 1898 | /* {SENSOR_MI0360, 0x80 | 0x5d, 0x00, 0x8243, 0x24, 0x25, 0x01}, */ |
1899 | {SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01}, | ||
1900 | {-1, 0x80 | 0x21, 0x0a, 0x0000, 0x21, 0x20, 0x05}, | ||
1901 | {-1, 0x80 | 0x40, 0x00, 0x0000, 0x20, 0x22, 0x05}, | ||
1902 | {SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05}, | ||
1903 | /* {SENSOR_PO3130NC, 0x80 | 0x76, 0x00, 0x0000, 0x24, 0x25, 0x01}, */ | ||
1904 | {-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01}, | ||
1905 | /* {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x0000, 0x24, 0x25, 0x01}, */ | ||
1906 | /* {-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05}, */ | ||
1907 | {-1, 0x80 | 0x11, 0x39, 0x0000, 0x24, 0x25, 0x01}, | ||
1899 | {SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01}, | 1908 | {SENSOR_PO1200, 0x80 | 0x5c, 0x00, 0x1200, 0x67, 0x67, 0x01}, |
1909 | {-1, 0x80 | 0x2d, 0x00, 0x0000, 0x65, 0x67, 0x01}, | ||
1910 | {-1, 0x80 | 0x6e, 0x00, 0x0000, 0x24, 0x25, 0x01}, | ||
1911 | {-1, 0x80 | 0x56, 0x01, 0x0000, 0x64, 0x67, 0x01}, | ||
1912 | {-1, 0x80 | 0x48, 0x00, 0x0000, 0x64, 0x67, 0x01}, | ||
1913 | /*fixme: not in the ms-win probe - may be found before?*/ | ||
1914 | {SENSOR_MI1320, 0x80 | 0x48, 0x00, 0x148c, 0x64, 0x65, 0x01}, | ||
1915 | {SENSOR_OV7670, 0x80 | 0x21, 0x0a, 0x7673, 0x66, 0x67, 0x05}, | ||
1900 | }; | 1916 | }; |
1901 | 1917 | ||
1902 | /* read 'len' bytes in gspca_dev->usb_buf */ | 1918 | /* read 'len' bytes in gspca_dev->usb_buf */ |
@@ -1931,7 +1947,7 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, | |||
1931 | u16 address) | 1947 | u16 address) |
1932 | { | 1948 | { |
1933 | struct usb_device *dev = gspca_dev->dev; | 1949 | struct usb_device *dev = gspca_dev->dev; |
1934 | __u8 ldata, mdata, hdata; | 1950 | u8 ldata, mdata, hdata; |
1935 | int retry = 50; | 1951 | int retry = 50; |
1936 | 1952 | ||
1937 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); | 1953 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); |
@@ -1944,9 +1960,11 @@ static u16 read_sensor_register(struct gspca_dev *gspca_dev, | |||
1944 | reg_w(dev, 0xa0, 0x02, 0xb339); | 1960 | reg_w(dev, 0xa0, 0x02, 0xb339); |
1945 | 1961 | ||
1946 | do { | 1962 | do { |
1947 | msleep(8); | ||
1948 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); | 1963 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); |
1949 | } while (retry-- && gspca_dev->usb_buf[0]); | 1964 | if (gspca_dev->usb_buf[0] == 0x00) |
1965 | break; | ||
1966 | msleep(40); | ||
1967 | } while (--retry >= 0); | ||
1950 | 1968 | ||
1951 | reg_r(gspca_dev, 0xa1, 0xb33e, 1); | 1969 | reg_r(gspca_dev, 0xa1, 0xb33e, 1); |
1952 | ldata = gspca_dev->usb_buf[0]; | 1970 | ldata = gspca_dev->usb_buf[0]; |
@@ -1967,7 +1985,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) | |||
1967 | { | 1985 | { |
1968 | struct usb_device *dev = gspca_dev->dev; | 1986 | struct usb_device *dev = gspca_dev->dev; |
1969 | int i; | 1987 | int i; |
1970 | __u16 value; | 1988 | u16 value; |
1971 | const struct sensor_info *ptsensor_info; | 1989 | const struct sensor_info *ptsensor_info; |
1972 | 1990 | ||
1973 | reg_r(gspca_dev, 0xa1, 0xbfcf, 1); | 1991 | reg_r(gspca_dev, 0xa1, 0xbfcf, 1); |
@@ -1982,13 +2000,22 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) | |||
1982 | reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); | 2000 | reg_w(dev, 0xa0, ptsensor_info->I2cAdd, 0xb335); |
1983 | reg_w(dev, 0xa0, ptsensor_info->op, 0xb301); | 2001 | reg_w(dev, 0xa0, ptsensor_info->op, 0xb301); |
1984 | value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd); | 2002 | value = read_sensor_register(gspca_dev, ptsensor_info->IdAdd); |
1985 | if (value == ptsensor_info->VpId) | 2003 | if (value == 0 && ptsensor_info->IdAdd == 0x82) |
1986 | return ptsensor_info->sensorId; | 2004 | value = read_sensor_register(gspca_dev, 0x83); |
1987 | 2005 | if (value != 0) { | |
1988 | /* special case for MI0360 */ | 2006 | PDEBUG(D_ERR|D_PROBE, "Sensor ID %04x (%d)", |
1989 | if (ptsensor_info->sensorId == SENSOR_MI1310_SOC | 2007 | value, i); |
1990 | && value == 0x8243) | 2008 | if (value == ptsensor_info->VpId) |
1991 | return SENSOR_MI0360; | 2009 | return ptsensor_info->sensorId; |
2010 | |||
2011 | switch (value) { | ||
2012 | case 0x7673: | ||
2013 | return SENSOR_OV7670; | ||
2014 | case 0x8243: | ||
2015 | return SENSOR_MI0360; | ||
2016 | } | ||
2017 | /*fixme: should return here*/ | ||
2018 | } | ||
1992 | } | 2019 | } |
1993 | return -1; | 2020 | return -1; |
1994 | } | 2021 | } |