diff options
Diffstat (limited to 'drivers/media/usb/gspca/pac207.c')
-rw-r--r-- | drivers/media/usb/gspca/pac207.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/media/usb/gspca/pac207.c b/drivers/media/usb/gspca/pac207.c index d236d1791f78..3b75097dd34e 100644 --- a/drivers/media/usb/gspca/pac207.c +++ b/drivers/media/usb/gspca/pac207.c | |||
@@ -55,6 +55,11 @@ MODULE_LICENSE("GPL"); | |||
55 | 55 | ||
56 | #define PAC207_AUTOGAIN_DEADZONE 30 | 56 | #define PAC207_AUTOGAIN_DEADZONE 30 |
57 | 57 | ||
58 | /* global parameters */ | ||
59 | static int led_invert; | ||
60 | module_param(led_invert, int, 0644); | ||
61 | MODULE_PARM_DESC(led_invert, "Invert led"); | ||
62 | |||
58 | /* specific webcam descriptor */ | 63 | /* specific webcam descriptor */ |
59 | struct sd { | 64 | struct sd { |
60 | struct gspca_dev gspca_dev; /* !! must be the first item */ | 65 | struct gspca_dev gspca_dev; /* !! must be the first item */ |
@@ -187,10 +192,14 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
187 | /* this function is called at probe and resume time */ | 192 | /* this function is called at probe and resume time */ |
188 | static int sd_init(struct gspca_dev *gspca_dev) | 193 | static int sd_init(struct gspca_dev *gspca_dev) |
189 | { | 194 | { |
190 | pac207_write_reg(gspca_dev, 0x41, 0x00); | 195 | u8 mode; |
191 | /* Bit_0=Image Format, | 196 | |
192 | * Bit_1=LED, | 197 | /* mode: Image Format (Bit 0), LED (1), Compr. test mode (2) */ |
193 | * Bit_2=Compression test mode enable */ | 198 | if (led_invert) |
199 | mode = 0x02; | ||
200 | else | ||
201 | mode = 0x00; | ||
202 | pac207_write_reg(gspca_dev, 0x41, mode); | ||
194 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ | 203 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ |
195 | 204 | ||
196 | return gspca_dev->usb_err; | 205 | return gspca_dev->usb_err; |
@@ -303,7 +312,11 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
303 | pac207_write_reg(gspca_dev, 0x02, | 312 | pac207_write_reg(gspca_dev, 0x02, |
304 | v4l2_ctrl_g_ctrl(gspca_dev->exposure)); /* PXCK = 12MHz /n */ | 313 | v4l2_ctrl_g_ctrl(gspca_dev->exposure)); /* PXCK = 12MHz /n */ |
305 | 314 | ||
306 | mode = 0x02; /* Image Format (Bit 0), LED (1), Compr. test mode (2) */ | 315 | /* mode: Image Format (Bit 0), LED (1), Compr. test mode (2) */ |
316 | if (led_invert) | ||
317 | mode = 0x00; | ||
318 | else | ||
319 | mode = 0x02; | ||
307 | if (gspca_dev->width == 176) { /* 176x144 */ | 320 | if (gspca_dev->width == 176) { /* 176x144 */ |
308 | mode |= 0x01; | 321 | mode |= 0x01; |
309 | PDEBUG(D_STREAM, "pac207_start mode 176x144"); | 322 | PDEBUG(D_STREAM, "pac207_start mode 176x144"); |
@@ -325,8 +338,15 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
325 | 338 | ||
326 | static void sd_stopN(struct gspca_dev *gspca_dev) | 339 | static void sd_stopN(struct gspca_dev *gspca_dev) |
327 | { | 340 | { |
341 | u8 mode; | ||
342 | |||
343 | /* mode: Image Format (Bit 0), LED (1), Compr. test mode (2) */ | ||
344 | if (led_invert) | ||
345 | mode = 0x02; | ||
346 | else | ||
347 | mode = 0x00; | ||
328 | pac207_write_reg(gspca_dev, 0x40, 0x00); /* Stop ISO pipe */ | 348 | pac207_write_reg(gspca_dev, 0x40, 0x00); /* Stop ISO pipe */ |
329 | pac207_write_reg(gspca_dev, 0x41, 0x00); /* Turn of LED */ | 349 | pac207_write_reg(gspca_dev, 0x41, mode); /* Turn off LED */ |
330 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ | 350 | pac207_write_reg(gspca_dev, 0x0f, 0x00); /* Power Control */ |
331 | } | 351 | } |
332 | 352 | ||
@@ -393,7 +413,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
393 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); | 413 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
394 | } | 414 | } |
395 | 415 | ||
396 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) | 416 | #if IS_ENABLED(CONFIG_INPUT) |
397 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, | 417 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
398 | u8 *data, /* interrupt packet data */ | 418 | u8 *data, /* interrupt packet data */ |
399 | int len) /* interrput packet length */ | 419 | int len) /* interrput packet length */ |
@@ -422,7 +442,7 @@ static const struct sd_desc sd_desc = { | |||
422 | .stopN = sd_stopN, | 442 | .stopN = sd_stopN, |
423 | .dq_callback = pac207_do_auto_gain, | 443 | .dq_callback = pac207_do_auto_gain, |
424 | .pkt_scan = sd_pkt_scan, | 444 | .pkt_scan = sd_pkt_scan, |
425 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) | 445 | #if IS_ENABLED(CONFIG_INPUT) |
426 | .int_pkt_scan = sd_int_pkt_scan, | 446 | .int_pkt_scan = sd_int_pkt_scan, |
427 | #endif | 447 | #endif |
428 | }; | 448 | }; |