Skip to contentSkip to conversation

TCM825x: invertation of image mirroring register bits

PATCH New Sakari Ailus 1 participant 2 messages May 13, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi,

The patch I'm about to send adds invertation of image mirroring register bits to the sensor configuration. This is useful if the sensor is actually mounted upside down, which is the case for example in Nokia N810 --- the V4L2 mirroring controls for the sensor still work properly.

Signature · 7 lines
Sakari Ailus
[email protected]

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#1 lore raw

PATCH 1/1 TCM825x: Include invertation of image mirroring in configuration

Add invertation of image mirroring register bits to default configuration.

This is useful when the camera module is e.g. mounted upside down.

---
 drivers/media/video/tcm825x.c |    6 ++++++
 drivers/media/video/tcm825x.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)
drivers/media/video/tcm825x.c +6 -0
index e57a646..216638e 100644
@@ -523,6 +523,9 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s,
 	if (val < 0)
 		return val;
 
+	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
+		val ^= sensor->platform_data->is_upside_down();
+
 	vc->value = val;
 	return 0;
 }
@@ -556,6 +559,9 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s,
 	if (lvc == NULL)
 		return -EINVAL;
 
+	if (vc->id == V4L2_CID_HFLIP || vc->id == V4L2_CID_VFLIP)
+		val ^= sensor->platform_data->is_upside_down();
+
 	val = val << lvc->start_bit;
 	if (tcm825x_write_reg_mask(client, lvc->reg, val))
 		return -EIO;
drivers/media/video/tcm825x.h +1 -0
index 966765b..770ebac 100644
@@ -182,6 +182,7 @@ struct tcm825x_platform_data {
 	int (*needs_reset)(struct v4l2_int_device *s, void *buf,
 			   struct v4l2_pix_format *fmt);
 	int (*ifparm)(struct v4l2_ifparm *p);
+	int (*is_upside_down)(void);
 };
 
 /* Array of image sizes supported by TCM825X.  These must be ordered from
Signature · 6 lines
1.5.0.6

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list