diff options
author | Lukas Karas <lukas.karas@centrum.cz> | 2008-12-28 12:09:21 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:37 -0400 |
commit | 4a7581f084ce308a448f4940ed2c664e9e3d78a1 (patch) | |
tree | 6ebb4b8f8bfc41a938e111cd42c7377253d126c7 /drivers | |
parent | dc913258ffb3dd90d6bafdd9111565777b5aad08 (diff) |
V4L/DVB (11408): gspca - m5602-s5k83a: Add led support to the s5k83a sensor.
This patch toggles the led seen on many laptops having a m5602 connected
to a Samsung s5k83a sensor.
Signed-off-by: Lukas Karas <lukas.karas@centrum.cz>
Signed-off-by: Erik Andr?n <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_core.c | 6 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_s5k83a.c | 29 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_s5k83a.h | 10 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_sensor.h | 3 |
4 files changed, 45 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c index 9f833b4ec525..bae7aa6f0f80 100644 --- a/drivers/media/video/gspca/m5602/m5602_core.c +++ b/drivers/media/video/gspca/m5602/m5602_core.c | |||
@@ -309,7 +309,11 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev, | |||
309 | 309 | ||
310 | static void m5602_stop_transfer(struct gspca_dev *gspca_dev) | 310 | static void m5602_stop_transfer(struct gspca_dev *gspca_dev) |
311 | { | 311 | { |
312 | /* Is there are a command to stop a data transfer? */ | 312 | struct sd *sd = (struct sd *) gspca_dev; |
313 | |||
314 | /* Run the sensor specific end transfer sequence */ | ||
315 | if (sd->sensor->stop) | ||
316 | sd->sensor->stop(sd); | ||
313 | } | 317 | } |
314 | 318 | ||
315 | /* sub-driver description, the ctrl and nctrl is filled at probe time */ | 319 | /* sub-driver description, the ctrl and nctrl is filled at probe time */ |
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c index 9bea347b9ef1..5ce69d74dac9 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c +++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c | |||
@@ -108,6 +108,16 @@ int s5k83a_init(struct sd *sd) | |||
108 | return (err < 0) ? err : 0; | 108 | return (err < 0) ? err : 0; |
109 | } | 109 | } |
110 | 110 | ||
111 | int s5k83a_start(struct sd *sd) | ||
112 | { | ||
113 | return s5k83a_set_led_indication(sd, 1); | ||
114 | } | ||
115 | |||
116 | int s5k83a_stop(struct sd *sd) | ||
117 | { | ||
118 | return s5k83a_set_led_indication(sd, 0); | ||
119 | } | ||
120 | |||
111 | int s5k83a_power_down(struct sd *sd) | 121 | int s5k83a_power_down(struct sd *sd) |
112 | { | 122 | { |
113 | return 0; | 123 | return 0; |
@@ -345,3 +355,22 @@ int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val) | |||
345 | 355 | ||
346 | return err; | 356 | return err; |
347 | } | 357 | } |
358 | |||
359 | int s5k83a_set_led_indication(struct sd *sd, u8 val) | ||
360 | { | ||
361 | int err = 0; | ||
362 | u8 data[1]; | ||
363 | |||
364 | err = m5602_read_bridge(sd, M5602_XB_GPIO_DAT, data); | ||
365 | if (err < 0) | ||
366 | return err; | ||
367 | |||
368 | if (val) | ||
369 | data[0] = data[0] | S5K83A_GPIO_LED_MASK; | ||
370 | else | ||
371 | data[0] = data[0] & ~S5K83A_GPIO_LED_MASK; | ||
372 | |||
373 | err = m5602_write_bridge(sd, M5602_XB_GPIO_DAT, data[0]); | ||
374 | |||
375 | return (err < 0) ? err : 0; | ||
376 | } | ||
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/drivers/media/video/gspca/m5602/m5602_s5k83a.h index 05ccb5b57a88..40ed14165c2a 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k83a.h +++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.h | |||
@@ -34,7 +34,7 @@ | |||
34 | #define S5K83A_DEFAULT_GAIN 0x00 | 34 | #define S5K83A_DEFAULT_GAIN 0x00 |
35 | #define S5K83A_MAXIMUM_GAIN 0x3c | 35 | #define S5K83A_MAXIMUM_GAIN 0x3c |
36 | #define S5K83A_FLIP_MASK 0x10 | 36 | #define S5K83A_FLIP_MASK 0x10 |
37 | 37 | #define S5K83A_GPIO_LED_MASK 0x10 | |
38 | 38 | ||
39 | /*****************************************************************************/ | 39 | /*****************************************************************************/ |
40 | 40 | ||
@@ -44,8 +44,12 @@ extern int dump_sensor; | |||
44 | 44 | ||
45 | int s5k83a_probe(struct sd *sd); | 45 | int s5k83a_probe(struct sd *sd); |
46 | int s5k83a_init(struct sd *sd); | 46 | int s5k83a_init(struct sd *sd); |
47 | int s5k83a_start(struct sd *sd); | ||
48 | int s5k83a_stop(struct sd *sd); | ||
47 | int s5k83a_power_down(struct sd *sd); | 49 | int s5k83a_power_down(struct sd *sd); |
48 | 50 | ||
51 | int s5k83a_set_led_indication(struct sd *sd, u8 val); | ||
52 | |||
49 | int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val); | 53 | int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val); |
50 | int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val); | 54 | int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val); |
51 | int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val); | 55 | int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val); |
@@ -61,6 +65,8 @@ static struct m5602_sensor s5k83a = { | |||
61 | .name = "S5K83A", | 65 | .name = "S5K83A", |
62 | .probe = s5k83a_probe, | 66 | .probe = s5k83a_probe, |
63 | .init = s5k83a_init, | 67 | .init = s5k83a_init, |
68 | .start = s5k83a_start, | ||
69 | .stop = s5k83a_stop, | ||
64 | .power_down = s5k83a_power_down, | 70 | .power_down = s5k83a_power_down, |
65 | .i2c_slave_id = 0x5a, | 71 | .i2c_slave_id = 0x5a, |
66 | .i2c_regW = 2, | 72 | .i2c_regW = 2, |
@@ -381,7 +387,7 @@ static const unsigned char init_s5k83a[][4] = | |||
381 | {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00}, | 387 | {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00}, |
382 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xf0, 0x00}, | 388 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xf0, 0x00}, |
383 | {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00}, | 389 | {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00}, |
384 | {BRIDGE, M5602_XB_GPIO_DAT, 0x1c, 0x00}, | 390 | {BRIDGE, M5602_XB_GPIO_DAT, 0x08, 0x00}, |
385 | {BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00}, | 391 | {BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00}, |
386 | {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06, 0x00}, | 392 | {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06, 0x00}, |
387 | {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00}, | 393 | {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00, 0x00}, |
diff --git a/drivers/media/video/gspca/m5602/m5602_sensor.h b/drivers/media/video/gspca/m5602/m5602_sensor.h index 261623f0da48..8eed4cc0b413 100644 --- a/drivers/media/video/gspca/m5602/m5602_sensor.h +++ b/drivers/media/video/gspca/m5602/m5602_sensor.h | |||
@@ -61,6 +61,9 @@ struct m5602_sensor { | |||
61 | /* Executed when the camera starts to send data */ | 61 | /* Executed when the camera starts to send data */ |
62 | int (*start)(struct sd *sd); | 62 | int (*start)(struct sd *sd); |
63 | 63 | ||
64 | /* Executed when the camera ends to send data */ | ||
65 | int (*stop)(struct sd *sd); | ||
66 | |||
64 | /* Performs a power down sequence */ | 67 | /* Performs a power down sequence */ |
65 | int (*power_down)(struct sd *sd); | 68 | int (*power_down)(struct sd *sd); |
66 | 69 | ||