diff options
Diffstat (limited to 'drivers/media/video/gspca/nw80x.c')
-rw-r--r-- | drivers/media/video/gspca/nw80x.c | 85 |
1 files changed, 55 insertions, 30 deletions
diff --git a/drivers/media/video/gspca/nw80x.c b/drivers/media/video/gspca/nw80x.c index e5928b1de534..f4c6f407f56e 100644 --- a/drivers/media/video/gspca/nw80x.c +++ b/drivers/media/video/gspca/nw80x.c | |||
@@ -172,14 +172,14 @@ static const struct v4l2_pix_format vga_mode[] = { | |||
172 | #define I2C0 0xff | 172 | #define I2C0 0xff |
173 | 173 | ||
174 | static const u8 nw800_init[] = { | 174 | static const u8 nw800_init[] = { |
175 | 0x05, 0x00, 0x01, 0x55, | 175 | 0x04, 0x05, 0x01, 0x61, |
176 | 0x10, 0x9b, 0x01, 0xaa, | 176 | 0x04, 0x04, 0x01, 0x01, |
177 | 0x05, 0x02, 0x01, 0x02, | ||
178 | 0x06, 0x00, 0x02, 0x04, 0xd9, | ||
179 | 0x05, 0x05, 0x01, 0x00, | ||
180 | 0x05, 0x05, 0x01, 0x01, | ||
181 | 0x04, 0x06, 0x01, 0x04, | 177 | 0x04, 0x06, 0x01, 0x04, |
182 | 178 | 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, | |
179 | 0x05, 0x05, 0x01, 0x00, | ||
180 | 0, 0, 0 | ||
181 | }; | ||
182 | static const u8 nw800_start[] = { | ||
183 | 0x04, 0x06, 0x01, 0xc0, | 183 | 0x04, 0x06, 0x01, 0xc0, |
184 | 0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f, | 184 | 0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f, |
185 | 0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19, | 185 | 0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19, |
@@ -530,8 +530,9 @@ static const u8 spacecam_init[] = { | |||
530 | 0x04, 0x06, 0x01, 0x04, | 530 | 0x04, 0x06, 0x01, 0x04, |
531 | 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, | 531 | 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, |
532 | 0x05, 0x05, 0x01, 0x00, | 532 | 0x05, 0x05, 0x01, 0x00, |
533 | /*fixme: add 300ms delay?*/ | 533 | 0, 0, 0 |
534 | /*fixme: at capture start time*/ | 534 | }; |
535 | static const u8 spacecam_start[] = { | ||
535 | 0x04, 0x06, 0x01, 0x44, | 536 | 0x04, 0x06, 0x01, 0x44, |
536 | 0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f, | 537 | 0x00, 0x00, 0x40, 0x10, 0x43, 0x00, 0xb4, 0x01, 0x10, 0x00, 0x4f, |
537 | 0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19, | 538 | 0xef, 0x0e, 0x00, 0x74, 0x01, 0x01, 0x00, 0x19, |
@@ -1221,9 +1222,12 @@ static const u8 mustek_start[] = { | |||
1221 | }; | 1222 | }; |
1222 | 1223 | ||
1223 | /* nw802 - Scope USB Microscope M2 (ProScope) (Hitachi HD49322BF) */ | 1224 | /* nw802 - Scope USB Microscope M2 (ProScope) (Hitachi HD49322BF) */ |
1224 | static const u8 proscope_init_1[] = { | 1225 | static const u8 proscope_init[] = { |
1225 | 0x04, 0x05, 0x01, 0x21, | 1226 | 0x04, 0x05, 0x01, 0x21, |
1226 | 0x04, 0x04, 0x01, 0x01, | 1227 | 0x04, 0x04, 0x01, 0x01, |
1228 | 0, 0, 0 | ||
1229 | }; | ||
1230 | static const u8 proscope_start_1[] = { | ||
1227 | 0x04, 0x06, 0x01, 0x04, | 1231 | 0x04, 0x06, 0x01, 0x04, |
1228 | 0x00, 0x00, 0x40, 0x10, 0x01, 0x00, 0xf9, 0x02, 0x10, 0x00, 0x04, | 1232 | 0x00, 0x00, 0x40, 0x10, 0x01, 0x00, 0xf9, 0x02, 0x10, 0x00, 0x04, |
1229 | 0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19, | 1233 | 0x0f, 0x1f, 0x00, 0x0d, 0x02, 0x01, 0x00, 0x19, |
@@ -1512,8 +1516,8 @@ static const u8 dvcv6_start[] = { | |||
1512 | }; | 1516 | }; |
1513 | 1517 | ||
1514 | static const u8 *webcam_start[] = { | 1518 | static const u8 *webcam_start[] = { |
1515 | [Generic800] = nw800_init, | 1519 | [Generic800] = nw800_start, |
1516 | [SpaceCam] = spacecam_init, | 1520 | [SpaceCam] = spacecam_start, |
1517 | [SpaceCam2] = spacecam2_start, | 1521 | [SpaceCam2] = spacecam2_start, |
1518 | [Cvideopro] = cvideopro_start, | 1522 | [Cvideopro] = cvideopro_start, |
1519 | [Dlink350c] = dlink_start, | 1523 | [Dlink350c] = dlink_start, |
@@ -1521,7 +1525,7 @@ static const u8 *webcam_start[] = { | |||
1521 | [Kr651us] = kr651_start_1, | 1525 | [Kr651us] = kr651_start_1, |
1522 | [Kritter] = kritter_start, | 1526 | [Kritter] = kritter_start, |
1523 | [Mustek300] = mustek_start, | 1527 | [Mustek300] = mustek_start, |
1524 | [Proscope] = proscope_init_1, | 1528 | [Proscope] = proscope_start_1, |
1525 | [Twinkle] = twinkle_start, | 1529 | [Twinkle] = twinkle_start, |
1526 | [DvcV6] = dvcv6_start, | 1530 | [DvcV6] = dvcv6_start, |
1527 | [P35u] = nw801_start_1, | 1531 | [P35u] = nw801_start_1, |
@@ -1720,21 +1724,6 @@ static void setautogain(struct gspca_dev *gspca_dev) | |||
1720 | } | 1724 | } |
1721 | } | 1725 | } |
1722 | 1726 | ||
1723 | /* this function is called at probe time */ | ||
1724 | static int sd_config(struct gspca_dev *gspca_dev, | ||
1725 | const struct usb_device_id *id) | ||
1726 | { | ||
1727 | struct sd *sd = (struct sd *) gspca_dev; | ||
1728 | |||
1729 | if ((unsigned) webcam >= NWEBCAMS) | ||
1730 | webcam = 0; | ||
1731 | sd->webcam = webcam; | ||
1732 | gspca_dev->cam.reverse_alts = 1; | ||
1733 | gspca_dev->cam.ctrls = sd->ctrls; | ||
1734 | sd->ag_cnt = -1; | ||
1735 | return 0; | ||
1736 | } | ||
1737 | |||
1738 | static int nw802_test_reg(struct gspca_dev *gspca_dev, | 1727 | static int nw802_test_reg(struct gspca_dev *gspca_dev, |
1739 | u16 index, | 1728 | u16 index, |
1740 | u8 value) | 1729 | u8 value) |
@@ -1748,11 +1737,19 @@ static int nw802_test_reg(struct gspca_dev *gspca_dev, | |||
1748 | return gspca_dev->usb_buf[0] == value; | 1737 | return gspca_dev->usb_buf[0] == value; |
1749 | } | 1738 | } |
1750 | 1739 | ||
1751 | /* this function is called at probe and resume time */ | 1740 | /* this function is called at probe time */ |
1752 | static int sd_init(struct gspca_dev *gspca_dev) | 1741 | static int sd_config(struct gspca_dev *gspca_dev, |
1742 | const struct usb_device_id *id) | ||
1753 | { | 1743 | { |
1754 | struct sd *sd = (struct sd *) gspca_dev; | 1744 | struct sd *sd = (struct sd *) gspca_dev; |
1755 | 1745 | ||
1746 | if ((unsigned) webcam >= NWEBCAMS) | ||
1747 | webcam = 0; | ||
1748 | sd->webcam = webcam; | ||
1749 | gspca_dev->cam.reverse_alts = 1; | ||
1750 | gspca_dev->cam.ctrls = sd->ctrls; | ||
1751 | sd->ag_cnt = -1; | ||
1752 | |||
1756 | /* | 1753 | /* |
1757 | * Autodetect sequence inspired from some log. | 1754 | * Autodetect sequence inspired from some log. |
1758 | * We try to detect what registers exist or not. | 1755 | * We try to detect what registers exist or not. |
@@ -1801,7 +1798,35 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
1801 | gspca_dev->ctrl_dis = ~(1 << GAIN); | 1798 | gspca_dev->ctrl_dis = ~(1 << GAIN); |
1802 | break; | 1799 | break; |
1803 | } | 1800 | } |
1801 | return gspca_dev->usb_err; | ||
1802 | } | ||
1804 | 1803 | ||
1804 | /* this function is called at probe and resume time */ | ||
1805 | static int sd_init(struct gspca_dev *gspca_dev) | ||
1806 | { | ||
1807 | struct sd *sd = (struct sd *) gspca_dev; | ||
1808 | |||
1809 | switch (sd->bridge) { | ||
1810 | case BRIDGE_NW800: | ||
1811 | switch (sd->webcam) { | ||
1812 | case SpaceCam: | ||
1813 | reg_w_buf(gspca_dev, spacecam_init); | ||
1814 | break; | ||
1815 | default: | ||
1816 | reg_w_buf(gspca_dev, nw800_init); | ||
1817 | break; | ||
1818 | } | ||
1819 | break; | ||
1820 | default: | ||
1821 | switch (sd->webcam) { | ||
1822 | case Mustek300: | ||
1823 | case P35u: | ||
1824 | case Proscope: | ||
1825 | reg_w_buf(gspca_dev, proscope_init); | ||
1826 | break; | ||
1827 | } | ||
1828 | break; | ||
1829 | } | ||
1805 | return gspca_dev->usb_err; | 1830 | return gspca_dev->usb_err; |
1806 | } | 1831 | } |
1807 | 1832 | ||