Commit fe2b6032 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (13559): gspca - pac7302: Some webcams are upside-down by default.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 327ae597
...@@ -90,6 +90,9 @@ struct sd { ...@@ -90,6 +90,9 @@ struct sd {
unsigned char autogain; unsigned char autogain;
__u8 hflip; __u8 hflip;
__u8 vflip; __u8 vflip;
u8 flags;
#define FL_HFLIP 0x01 /* mirrored by default */
#define FL_VFLIP 0x02 /* vertical flipped by default */
u8 sof_read; u8 sof_read;
u8 autogain_ignore_frames; u8 autogain_ignore_frames;
...@@ -552,6 +555,7 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -552,6 +555,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->autogain = AUTOGAIN_DEF; sd->autogain = AUTOGAIN_DEF;
sd->hflip = HFLIP_DEF; sd->hflip = HFLIP_DEF;
sd->vflip = VFLIP_DEF; sd->vflip = VFLIP_DEF;
sd->flags = id->driver_info;
return 0; return 0;
} }
...@@ -708,10 +712,17 @@ static int sethvflip(struct gspca_dev *gspca_dev) ...@@ -708,10 +712,17 @@ static int sethvflip(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
int ret; int ret;
__u8 data; u8 data, hflip, vflip;
hflip = sd->hflip;
if (sd->flags & FL_HFLIP)
hflip = !hflip;
vflip = sd->vflip;
if (sd->flags & FL_VFLIP)
vflip = !vflip;
ret = reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ ret = reg_w(gspca_dev, 0xff, 0x03); /* page 3 */
data = (sd->hflip ? 0x08 : 0x00) | (sd->vflip ? 0x04 : 0x00); data = (hflip ? 0x08 : 0x00) | (vflip ? 0x04 : 0x00);
if (0 <= ret) if (0 <= ret)
ret = reg_w(gspca_dev, 0x21, data); ret = reg_w(gspca_dev, 0x21, data);
/* load registers to sensor (Bit 0, auto clear) */ /* load registers to sensor (Bit 0, auto clear) */
...@@ -1222,8 +1233,8 @@ static __devinitdata struct usb_device_id device_table[] = { ...@@ -1222,8 +1233,8 @@ static __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x06f8, 0x3009)}, {USB_DEVICE(0x06f8, 0x3009)},
{USB_DEVICE(0x093a, 0x2620)}, {USB_DEVICE(0x093a, 0x2620)},
{USB_DEVICE(0x093a, 0x2621)}, {USB_DEVICE(0x093a, 0x2621)},
{USB_DEVICE(0x093a, 0x2622)}, {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP},
{USB_DEVICE(0x093a, 0x2624)}, {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP},
{USB_DEVICE(0x093a, 0x2626)}, {USB_DEVICE(0x093a, 0x2626)},
{USB_DEVICE(0x093a, 0x2628)}, {USB_DEVICE(0x093a, 0x2628)},
{USB_DEVICE(0x093a, 0x2629)}, {USB_DEVICE(0x093a, 0x2629)},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment