aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/sn9c20x.c
diff options
context:
space:
mode:
authorBrian Johnson <brijohn@gmail.com>2010-03-16 12:58:27 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:50:07 -0400
commit0c045eb752259d4176eabacbdf28a627644a071a (patch)
tree6f4cd9974011052109cb1c6e1cda9c68b45fff89 /drivers/media/video/gspca/sn9c20x.c
parenta39db27a08ef85ae37beab261744d8b38f21225c (diff)
V4L/DVB: gspca - sn9c20x: Add support for camera LEDs
Signed-off-by: Brian Johnson <brijohn@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sn9c20x.c')
-rw-r--r--drivers/media/video/gspca/sn9c20x.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 1653567e992..825d5b8dfd6 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -54,6 +54,7 @@ MODULE_LICENSE("GPL");
54 54
55/* camera flags */ 55/* camera flags */
56#define HAS_BUTTON 0x1 56#define HAS_BUTTON 0x1
57#define LED_REVERSE 0x2 /* some cameras unset gpio to turn on leds */
57 58
58/* specific webcam descriptor */ 59/* specific webcam descriptor */
59struct sd { 60struct sd {
@@ -731,7 +732,8 @@ static u16 bridge_init[][2] = {
731 {0x11be, 0xf0}, {0x11bf, 0x00}, {0x118c, 0x1f}, 732 {0x11be, 0xf0}, {0x11bf, 0x00}, {0x118c, 0x1f},
732 {0x118d, 0x1f}, {0x118e, 0x1f}, {0x118f, 0x1f}, 733 {0x118d, 0x1f}, {0x118e, 0x1f}, {0x118f, 0x1f},
733 {0x1180, 0x01}, {0x1181, 0x00}, {0x1182, 0x01}, 734 {0x1180, 0x01}, {0x1181, 0x00}, {0x1182, 0x01},
734 {0x1183, 0x00}, {0x1184, 0x50}, {0x1185, 0x80} 735 {0x1183, 0x00}, {0x1184, 0x50}, {0x1185, 0x80},
736 {0x1007, 0x00}
735}; 737};
736 738
737/* Gain = (bit[3:0] / 16 + 1) * (bit[4] + 1) * (bit[5] + 1) * (bit[6] + 1) */ 739/* Gain = (bit[3:0] / 16 + 1) * (bit[4] + 1) * (bit[5] + 1) * (bit[6] + 1) */
@@ -1974,6 +1976,11 @@ static int sd_init(struct gspca_dev *gspca_dev)
1974 } 1976 }
1975 } 1977 }
1976 1978
1979 if (sd->flags & LED_REVERSE)
1980 reg_w1(gspca_dev, 0x1006, 0x00);
1981 else
1982 reg_w1(gspca_dev, 0x1006, 0x20);
1983
1977 if (reg_w(gspca_dev, 0x10c0, i2c_init, 9) < 0) { 1984 if (reg_w(gspca_dev, 0x10c0, i2c_init, 9) < 0) {
1978 err("Device initialization failed"); 1985 err("Device initialization failed");
1979 return -ENODEV; 1986 return -ENODEV;
@@ -2154,6 +2161,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
2154 set_exposure(gspca_dev); 2161 set_exposure(gspca_dev);
2155 set_hvflip(gspca_dev); 2162 set_hvflip(gspca_dev);
2156 2163
2164 reg_w1(gspca_dev, 0x1007, 0x20);
2165
2157 reg_r(gspca_dev, 0x1061, 1); 2166 reg_r(gspca_dev, 0x1061, 1);
2158 reg_w1(gspca_dev, 0x1061, gspca_dev->usb_buf[0] | 0x02); 2167 reg_w1(gspca_dev, 0x1061, gspca_dev->usb_buf[0] | 0x02);
2159 return 0; 2168 return 0;
@@ -2161,6 +2170,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
2161 2170
2162static void sd_stopN(struct gspca_dev *gspca_dev) 2171static void sd_stopN(struct gspca_dev *gspca_dev)
2163{ 2172{
2173 reg_w1(gspca_dev, 0x1007, 0x00);
2174
2164 reg_r(gspca_dev, 0x1061, 1); 2175 reg_r(gspca_dev, 0x1061, 1);
2165 reg_w1(gspca_dev, 0x1061, gspca_dev->usb_buf[0] & ~0x02); 2176 reg_w1(gspca_dev, 0x1061, gspca_dev->usb_buf[0] & ~0x02);
2166} 2177}
@@ -2350,7 +2361,7 @@ static const struct sd_desc sd_desc = {
2350}; 2361};
2351 2362
2352#define SN9C20X(sensor, i2c_addr, flags) \ 2363#define SN9C20X(sensor, i2c_addr, flags) \
2353 .driver_info = (flags << 16) \ 2364 .driver_info = ((flags & 0xff) << 16) \
2354 | (SENSOR_ ## sensor << 8) \ 2365 | (SENSOR_ ## sensor << 8) \
2355 | (i2c_addr) 2366 | (i2c_addr)
2356 2367
@@ -2358,7 +2369,8 @@ static const __devinitdata struct usb_device_id device_table[] = {
2358 {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, 2369 {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)},
2359 {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, 2370 {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)},
2360 {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, 2371 {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)},
2361 {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, HAS_BUTTON)}, 2372 {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30,
2373 (HAS_BUTTON | LED_REVERSE))},
2362 {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, 0)}, 2374 {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, 0)},
2363 {USB_DEVICE(0x0c45, 0x6251), SN9C20X(OV9650, 0x30, 0)}, 2375 {USB_DEVICE(0x0c45, 0x6251), SN9C20X(OV9650, 0x30, 0)},
2364 {USB_DEVICE(0x0c45, 0x6253), SN9C20X(OV9650, 0x30, 0)}, 2376 {USB_DEVICE(0x0c45, 0x6253), SN9C20X(OV9650, 0x30, 0)},