Skip to contentSkip to conversation

gspca_sonixj: add hardware vertical flip support for hama AC-150

PATCH In review Németh Márton 2 participants 3 messages Oct 17, 2010 – Oct 18, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gspca_sonixj: add hardware vertical flip support for hama AC-150

From: Márton Németh <[email protected]>

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.

---

drivers/media/video/gspca/sonixj.c +17 -4
diff -upr b/drivers/media/video/gspca/sonixj.c c/drivers/media/video/gspca/sonixj.c
@@ -45,7 +45,7 @@ struct sd {
 	u8 blue;
 	u8 red;
 	u8 gamma;
-	u8 vflip;			/* ov7630/ov7648 only */
+	u8 vflip;			/* ov7630/ov7648/po2030n only */
 	u8 sharpness;
 	u8 infrared;			/* mt9v111 only */
 	u8 freq;			/* ov76xx only */
@@ -219,7 +219,7 @@ static const struct ctrl sd_ctrls[] = {
 	    .set = sd_setautogain,
 	    .get = sd_getautogain,
 	},
-/* ov7630/ov7648 only */
+/* ov7630/ov7648/po2030n only */
 #define VFLIP_IDX 7
 	{
 	    {
@@ -328,7 +328,6 @@ static const __u32 ctrl_dis[] = {
 
 [SENSOR_PO2030N] =	(1 << AUTOGAIN_IDX) |
 			(1 << INFRARED_IDX) |
-			(1 << VFLIP_IDX) |
 			(1 << FREQ_IDX),
 [SENSOR_SOI768] =	(1 << AUTOGAIN_IDX) |
 			(1 << INFRARED_IDX) |
@@ -2136,7 +2135,7 @@ static void setautogain(struct gspca_dev
 		sd->ag_cnt = -1;
 }
 
-/* hv7131r/ov7630/ov7648 only */
+/* hv7131r/ov7630/ov7648/po2030n only */
 static void setvflip(struct sd *sd)
 {
 	u8 comn;
@@ -2156,6 +2155,20 @@ static void setvflip(struct sd *sd)
 			comn |= 0x80;
 		i2c_w1(&sd->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->vflip)
+			comn |= 0x40;
+		i2c_w1(&sd->gspca_dev, 0x1E, comn);
+		break;
 	default:
 /*	case SENSOR_OV7648: */
 		comn = 0x06;
#1 lore raw
Quoted 3 lines · On Sun, 17 Oct 2010 13:08:01 +0200 Németh Márton <[email protected]> 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.

Signature · 2 lines
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
#2 lore raw

Hi Jean-Francois,

Quoted 10 lines · Jean-Francois Moine
Quoted 3 lines · On Sun, 17 Oct 2010 13:08:01 +0200 Németh Márton <[email protected]> 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]

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)

Looks good. It was a bit tricky for me sometimes to understand the changes together with the "V4L/DVB: gspca - main: New video control mechanism" (commit ccbfd092a4199a6fba17273c11c1e0b340d91eb5), but still looks good.

One small thing: the title of the patch shall be changed because this version contains horizontal and vertical flip also.

Note that I could not run the new driver, yet, together with hama AC-150, but I hope you could already try whether the new feature is working correctly.

Márton Németh