aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-02-20 02:30:45 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:11:10 -0500
commit92e232acd61f610e09449dad3f6ff6d3c78887e9 (patch)
tree99edfc1598d1942e7b482781d80637f2be2b232f /drivers/media
parent417a4d26591e3f2b7784791246048ed315f3fdce (diff)
V4L/DVB: gspca_ov519: Add support for the button on ov518 based cams
Due to hardware limitations this only works while the camera is streaming. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/ov519.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index d9b89a2803df..016f8bb5c375 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -2702,6 +2702,11 @@ static void sd_reset_snapshot(struct gspca_dev *gspca_dev)
2702 sd->snapshot_needs_reset = 0; 2702 sd->snapshot_needs_reset = 0;
2703 2703
2704 switch (sd->bridge) { 2704 switch (sd->bridge) {
2705 case BRIDGE_OV518:
2706 case BRIDGE_OV518PLUS:
2707 reg_w(sd, R51x_SYS_SNAP, 0x02); /* Reset */
2708 reg_w(sd, R51x_SYS_SNAP, 0x01); /* Enable */
2709 break;
2705 case BRIDGE_OV519: 2710 case BRIDGE_OV519:
2706 reg_w(sd, R51x_SYS_RESET, 0x40); 2711 reg_w(sd, R51x_SYS_RESET, 0x40);
2707 reg_w(sd, R51x_SYS_RESET, 0x00); 2712 reg_w(sd, R51x_SYS_RESET, 0x00);
@@ -3977,6 +3982,28 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
3977 w9968cf_stop0(sd); 3982 w9968cf_stop0(sd);
3978} 3983}
3979 3984
3985static void ov51x_handle_button(struct gspca_dev *gspca_dev, u8 state)
3986{
3987 struct sd *sd = (struct sd *) gspca_dev;
3988
3989 if (sd->snapshot_pressed != state) {
3990#ifdef CONFIG_INPUT
3991 input_report_key(gspca_dev->input_dev, KEY_CAMERA, state);
3992 input_sync(gspca_dev->input_dev);
3993#endif
3994 if (state)
3995 sd->snapshot_needs_reset = 1;
3996
3997 sd->snapshot_pressed = state;
3998 } else {
3999 /* On the ov519 we need to reset the button state multiple
4000 times, as resetting does not work as long as the button
4001 stays pressed */
4002 if (sd->bridge == BRIDGE_OV519 && state)
4003 sd->snapshot_needs_reset = 1;
4004 }
4005}
4006
3980static void ov511_pkt_scan(struct gspca_dev *gspca_dev, 4007static void ov511_pkt_scan(struct gspca_dev *gspca_dev,
3981 u8 *in, /* isoc packet */ 4008 u8 *in, /* isoc packet */
3982 int len) /* iso packet length */ 4009 int len) /* iso packet length */
@@ -4035,6 +4062,7 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev,
4035 /* A false positive here is likely, until OVT gives me 4062 /* A false positive here is likely, until OVT gives me
4036 * the definitive SOF/EOF format */ 4063 * the definitive SOF/EOF format */
4037 if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) { 4064 if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) {
4065 ov51x_handle_button(gspca_dev, (data[6] >> 1) & 1);
4038 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); 4066 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
4039 gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0); 4067 gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
4040 sd->packet_nr = 0; 4068 sd->packet_nr = 0;
@@ -4063,30 +4091,6 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev,
4063 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); 4091 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
4064} 4092}
4065 4093
4066static void ov519_handle_button(struct gspca_dev *gspca_dev, u8 state)
4067{
4068 struct sd *sd = (struct sd *) gspca_dev;
4069
4070 /* This should never happen, but better to check */
4071 if (state != 0 && state != 1)
4072 return;
4073
4074 /* We may need to reset the button state multiple times, as resetting
4075 does not work as long as the button stays pressed, so always set
4076 snapshot_needs_reset (instead of only on a state change to 1). */
4077 if (state)
4078 sd->snapshot_needs_reset = 1;
4079
4080 if (sd->snapshot_pressed != state) {
4081#ifdef CONFIG_INPUT
4082 input_report_key(gspca_dev->input_dev, KEY_CAMERA, state);
4083 input_sync(gspca_dev->input_dev);
4084#endif
4085
4086 sd->snapshot_pressed = state;
4087 }
4088}
4089
4090static void ov519_pkt_scan(struct gspca_dev *gspca_dev, 4094static void ov519_pkt_scan(struct gspca_dev *gspca_dev,
4091 u8 *data, /* isoc packet */ 4095 u8 *data, /* isoc packet */
4092 int len) /* iso packet length */ 4096 int len) /* iso packet length */
@@ -4120,7 +4124,7 @@ static void ov519_pkt_scan(struct gspca_dev *gspca_dev,
4120 gspca_dev->last_packet_type = DISCARD_PACKET; 4124 gspca_dev->last_packet_type = DISCARD_PACKET;
4121 return; 4125 return;
4122 case 0x51: /* end of frame */ 4126 case 0x51: /* end of frame */
4123 ov519_handle_button(gspca_dev, data[11]); 4127 ov51x_handle_button(gspca_dev, data[11] & 1);
4124 if (data[9] != 0) 4128 if (data[9] != 0)
4125 gspca_dev->last_packet_type = DISCARD_PACKET; 4129 gspca_dev->last_packet_type = DISCARD_PACKET;
4126 gspca_frame_add(gspca_dev, LAST_PACKET, 4130 gspca_frame_add(gspca_dev, LAST_PACKET,