diff options
Diffstat (limited to 'drivers/media')
-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 9f833b4..bae7aa6 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, static void m5602_stop_transfer(struct gspca_dev *gspca_dev) { - /* Is there are a command to stop a data transfer? */ + struct sd *sd = (struct sd *) gspca_dev; + + /* Run the sensor specific end transfer sequence */ + if (sd->sensor->stop) + sd->sensor->stop(sd); } /* 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 9bea347..5ce69d7 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) return (err < 0) ? err : 0; } +int s5k83a_start(struct sd *sd) +{ + return s5k83a_set_led_indication(sd, 1); +} + +int s5k83a_stop(struct sd *sd) +{ + return s5k83a_set_led_indication(sd, 0); +} + int s5k83a_power_down(struct sd *sd) { return 0; @@ -345,3 +355,22 @@ int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val) return err; } + +int s5k83a_set_led_indication(struct sd *sd, u8 val) +{ + int err = 0; + u8 data[1]; + + err = m5602_read_bridge(sd, M5602_XB_GPIO_DAT, data); + if (err < 0) + return err; + + if (val) + data[0] = data[0] | S5K83A_GPIO_LED_MASK; + else + data[0] = data[0] & ~S5K83A_GPIO_LED_MASK; + + err = m5602_write_bridge(sd, M5602_XB_GPIO_DAT, data[0]); + + return (err < 0) ? err : 0; +} diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/drivers/media/video/gspca/m5602/m5602_s5k83a.h index 05ccb5b..40ed141 100644 --- a/drivers/media/video/gspca/m5602/m5602_s5k83a.h +++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.h @@ -34,7 +34,7 @@ #define S5K83A_DEFAULT_GAIN 0x00 #define S5K83A_MAXIMUM_GAIN 0x3c #define S5K83A_FLIP_MASK 0x10 - +#define S5K83A_GPIO_LED_MASK 0x10 /*****************************************************************************/ @@ -44,8 +44,12 @@ extern int dump_sensor; int s5k83a_probe(struct sd *sd); int s5k83a_init(struct sd *sd); +int s5k83a_start(struct sd *sd); +int s5k83a_stop(struct sd *sd); int s5k83a_power_down(struct sd *sd); +int s5k83a_set_led_indication(struct sd *sd, u8 val); + int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val); int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val); int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val); @@ -61,6 +65,8 @@ static struct m5602_sensor s5k83a = { .name = "S5K83A", .probe = s5k83a_probe, .init = s5k83a_init, + .start = s5k83a_start, + .stop = s5k83a_stop, .power_down = s5k83a_power_down, .i2c_slave_id = 0x5a, .i2c_regW = 2, @@ -381,7 +387,7 @@ static const unsigned char init_s5k83a[][4] = {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00}, {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xf0, 0x00}, {BRIDGE, M5602_XB_GPIO_DIR, 0x1d, 0x00}, - {BRIDGE, M5602_XB_GPIO_DAT, 0x1c, 0x00}, + {BRIDGE, M5602_XB_GPIO_DAT, 0x08, 0x00}, {BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00}, {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06, 0x00}, {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 261623f..8eed4cc 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 { /* Executed when the camera starts to send data */ int (*start)(struct sd *sd); + /* Executed when the camera ends to send data */ + int (*stop)(struct sd *sd); + /* Performs a power down sequence */ int (*power_down)(struct sd *sd); |