From: Jean-Francois Moine <moinejf@free.fr>
To: "Németh Márton" <nm127@freemail.hu>
Cc: V4L Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH 1/2] gspca_sonixj: add hardware vertical flip support for hama AC-150
Date: Mon, 18 Oct 2010 12:44:40 +0200 [thread overview]
Message-ID: <20101018124440.4dbc2538@tele> (raw)
In-Reply-To: <4CBAD911.9070800@freemail.hu>
[-- Attachment #1: Type: text/plain, Size: 542 bytes --]
On Sun, 17 Oct 2010 13:08:01 +0200
Németh Márton <nm127@freemail.hu> wrote:
> The PO2030N sensor chip found in hama AC-150 webcam supports vertical
> flipping the image by hardware. Add support for this in the
> gspca_sonixj driver also.
[snip]
Hi Németh,
The driver sonixj has changed in staging/2.6.37. I join a new version
of your patches. May you check it? (when acked, I'll keep you as the
author of the change)
Cheers.
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
[-- Attachment #2: patch.pat --]
[-- Type: application/octet-stream, Size: 4592 bytes --]
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 2105ecb..1b651e3 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -40,6 +40,7 @@ enum e_ctrl {
RED,
GAMMA,
AUTOGAIN,
+ HFLIP,
VFLIP,
SHARPNESS,
INFRARED,
@@ -102,7 +103,7 @@ static void setcolors(struct gspca_dev *gspca_dev);
static void setredblue(struct gspca_dev *gspca_dev);
static void setgamma(struct gspca_dev *gspca_dev);
static void setautogain(struct gspca_dev *gspca_dev);
-static void setvflip(struct gspca_dev *gspca_dev);
+static void sethvflip(struct gspca_dev *gspca_dev);
static void setsharpness(struct gspca_dev *gspca_dev);
static void setinfrared(struct gspca_dev *gspca_dev);
static void setfreq(struct gspca_dev *gspca_dev);
@@ -195,7 +196,18 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
},
.set_control = setautogain
},
-/* ov7630/ov7648 only */
+[HFLIP] = {
+ {
+ .id = V4L2_CID_VFLIP,
+ .type = V4L2_CTRL_TYPE_BOOLEAN,
+ .name = "Mirror",
+ .minimum = 0,
+ .maximum = 1,
+ .step = 1,
+ .default_value = 0,
+ },
+ .set_control = sethvflip
+ },
[VFLIP] = {
{
.id = V4L2_CID_VFLIP,
@@ -206,7 +218,7 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
.step = 1,
.default_value = 0,
},
- .set_control = setvflip
+ .set_control = sethvflip
},
[SHARPNESS] = {
{
@@ -252,59 +264,72 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
static const __u32 ctrl_dis[] = {
[SENSOR_ADCM1700] = (1 << AUTOGAIN) |
(1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
[SENSOR_GC0307] = (1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
[SENSOR_HV7131R] = (1 << INFRARED) |
+ (1 << HFLIP) |
(1 << FREQ),
[SENSOR_MI0360] = (1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
[SENSOR_MI0360B] = (1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
[SENSOR_MO4000] = (1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
-[SENSOR_MT9V111] = (1 << VFLIP) |
+[SENSOR_MT9V111] = (1 << HFLIP) |
+ (1 << VFLIP) |
(1 << FREQ),
[SENSOR_OM6802] = (1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
-[SENSOR_OV7630] = (1 << INFRARED),
+[SENSOR_OV7630] = (1 << INFRARED) |
+ (1 << HFLIP),
-[SENSOR_OV7648] = (1 << INFRARED),
+[SENSOR_OV7648] = (1 << INFRARED) |
+ (1 << HFLIP),
[SENSOR_OV7660] = (1 << AUTOGAIN) |
(1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP),
[SENSOR_PO1030] = (1 << AUTOGAIN) |
(1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
[SENSOR_PO2030N] = (1 << AUTOGAIN) |
(1 << INFRARED) |
- (1 << VFLIP) |
(1 << FREQ),
[SENSOR_SOI768] = (1 << AUTOGAIN) |
(1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
[SENSOR_SP80708] = (1 << AUTOGAIN) |
(1 << INFRARED) |
+ (1 << HFLIP) |
(1 << VFLIP) |
(1 << FREQ),
};
@@ -2238,14 +2263,11 @@ static void setautogain(struct gspca_dev *gspca_dev)
sd->ag_cnt = -1;
}
-/* hv7131r/ov7630/ov7648 only */
-static void setvflip(struct gspca_dev *gspca_dev)
+static void sethvflip(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
u8 comn;
- if (gspca_dev->ctrl_dis & (1 << VFLIP))
- return;
switch (sd->sensor) {
case SENSOR_HV7131R:
comn = 0x18; /* clkdiv = 1, ablcen = 1 */
@@ -2259,13 +2281,28 @@ static void setvflip(struct gspca_dev *gspca_dev)
comn |= 0x80;
i2c_w1(gspca_dev, 0x75, comn);
break;
- default:
-/* case SENSOR_OV7648: */
+ case SENSOR_OV7648:
comn = 0x06;
if (sd->ctrls[VFLIP].val)
comn |= 0x80;
i2c_w1(gspca_dev, 0x75, comn);
break;
+ case SENSOR_PO2030N:
+ /* Reg. 0x1E: Timing Generator Control Register 2 (Tgcontrol2)
+ * (reset value: 0x0A)
+ * bit7: HM: Horizontal Mirror: 0: disable, 1: enable
+ * bit6: VM: Vertical Mirror: 0: disable, 1: enable
+ * bit5: ST: Shutter Selection: 0: electrical, 1: mechanical
+ * bit4: FT: Single Frame Transfer: 0: disable, 1: enable
+ * bit3-0: X
+ */
+ comn = 0x0a;
+ if (sd->ctrls[HFLIP].val)
+ comn |= 0x80;
+ if (sd->ctrls[VFLIP].val)
+ comn |= 0x40;
+ i2c_w1(&sd->gspca_dev, 0x1e, comn);
+ break;
}
}
@@ -2652,7 +2689,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
reg_w1(gspca_dev, 0x17, reg17);
reg_w1(gspca_dev, 0x01, reg1);
- setvflip(gspca_dev);
+ sethvflip(gspca_dev);
setbrightness(gspca_dev);
setcontrast(gspca_dev);
setcolors(gspca_dev);
next prev parent reply other threads:[~2010-10-18 10:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-17 11:08 [PATCH 1/2] gspca_sonixj: add hardware vertical flip support for hama AC-150 Németh Márton
2010-10-18 10:44 ` Jean-Francois Moine [this message]
2010-10-18 19:47 ` Németh Márton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101018124440.4dbc2538@tele \
--to=moinejf@free.fr \
--cc=linux-media@vger.kernel.org \
--cc=nm127@freemail.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox