Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142474
b: refs/heads/master
c: 4a7581f
h: refs/heads/master
v: v3
  • Loading branch information
Lukas Karas authored and Mauro Carvalho Chehab committed Apr 7, 2009
1 parent 0b768cb commit 37649ad
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc913258ffb3dd90d6bafdd9111565777b5aad08
refs/heads/master: 4a7581f084ce308a448f4940ed2c664e9e3d78a1
6 changes: 5 additions & 1 deletion trunk/drivers/media/video/gspca/m5602/m5602_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
29 changes: 29 additions & 0 deletions trunk/drivers/media/video/gspca/m5602/m5602_s5k83a.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
10 changes: 8 additions & 2 deletions trunk/drivers/media/video/gspca/m5602/m5602_s5k83a.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/*****************************************************************************/

Expand All @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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},
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/media/video/gspca/m5602/m5602_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 37649ad

Please sign in to comment.