Commit 9712a8be6b842ba9ffbd1b74a8d9b04c785b8ac1
Committed by
Mauro Carvalho Chehab
1 parent
f65e93d600
V4L/DVB: gspca_sonixj: Add camera button support
gspca_sonixj: Add camera button support Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Showing 1 changed file with 30 additions and 3 deletions Side-by-side Diff
drivers/media/video/gspca/sonixj.c
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | |
22 | 22 | #define MODULE_NAME "sonixj" |
23 | 23 | |
24 | +#include <linux/input.h> | |
24 | 25 | #include "gspca.h" |
25 | 26 | #include "jpeg.h" |
26 | 27 | |
... | ... | @@ -1344,7 +1345,8 @@ |
1344 | 1345 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; |
1345 | 1346 | static const u8 regd4[] = {0x60, 0x00, 0x00}; |
1346 | 1347 | |
1347 | - reg_w1(gspca_dev, 0xf1, 0x00); | |
1348 | + /* sensor clock already enabled in sd_init */ | |
1349 | + /* reg_w1(gspca_dev, 0xf1, 0x00); */ | |
1348 | 1350 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); |
1349 | 1351 | |
1350 | 1352 | /* configure gpio */ |
... | ... | @@ -1536,7 +1538,9 @@ |
1536 | 1538 | break; |
1537 | 1539 | } |
1538 | 1540 | |
1539 | - reg_w1(gspca_dev, 0xf1, 0x01); | |
1541 | + /* Note we do not disable the sensor clock here (power saving mode), | |
1542 | + as that also disables the button on the cam. */ | |
1543 | + reg_w1(gspca_dev, 0xf1, 0x00); | |
1540 | 1544 | |
1541 | 1545 | /* set the i2c address */ |
1542 | 1546 | sn9c1xx = sn_tb[sd->sensor]; |
... | ... | @@ -2197,7 +2201,8 @@ |
2197 | 2201 | reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); |
2198 | 2202 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); |
2199 | 2203 | reg_w1(gspca_dev, 0x01, data); |
2200 | - reg_w1(gspca_dev, 0xf1, 0x00); | |
2204 | + /* Don't disable sensor clock as that disables the button on the cam */ | |
2205 | + /* reg_w1(gspca_dev, 0xf1, 0x01); */ | |
2201 | 2206 | } |
2202 | 2207 | |
2203 | 2208 | static void sd_stop0(struct gspca_dev *gspca_dev) |
... | ... | @@ -2550,6 +2555,25 @@ |
2550 | 2555 | return -EINVAL; |
2551 | 2556 | } |
2552 | 2557 | |
2558 | +#ifdef CONFIG_INPUT | |
2559 | +static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, | |
2560 | + u8 *data, /* interrupt packet data */ | |
2561 | + int len) /* interrupt packet length */ | |
2562 | +{ | |
2563 | + int ret = -EINVAL; | |
2564 | + | |
2565 | + if (len == 1 && data[0] == 1) { | |
2566 | + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); | |
2567 | + input_sync(gspca_dev->input_dev); | |
2568 | + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); | |
2569 | + input_sync(gspca_dev->input_dev); | |
2570 | + ret = 0; | |
2571 | + } | |
2572 | + | |
2573 | + return ret; | |
2574 | +} | |
2575 | +#endif | |
2576 | + | |
2553 | 2577 | /* sub-driver description */ |
2554 | 2578 | static const struct sd_desc sd_desc = { |
2555 | 2579 | .name = MODULE_NAME, |
... | ... | @@ -2565,6 +2589,9 @@ |
2565 | 2589 | .get_jcomp = sd_get_jcomp, |
2566 | 2590 | .set_jcomp = sd_set_jcomp, |
2567 | 2591 | .querymenu = sd_querymenu, |
2592 | +#ifdef CONFIG_INPUT | |
2593 | + .int_pkt_scan = sd_int_pkt_scan, | |
2594 | +#endif | |
2568 | 2595 | }; |
2569 | 2596 | |
2570 | 2597 | /* -- module initialisation -- */ |