public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* TCM825x: invertation of image mirroring register bits
@ 2008-05-13  9:20 Sakari Ailus
  2008-05-13  9:21 ` [PATCH] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Sakari Ailus @ 2008-05-13  9:20 UTC (permalink / raw)
  To: Linux and Kernel Video

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.

-- 
Sakari Ailus
sakari.ailus@nokia.com

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] TCM825x: Include invertation of image mirroring in configuration
  2008-05-13  9:20 TCM825x: invertation of image mirroring register bits Sakari Ailus
@ 2008-05-13  9:21 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2008-05-13  9:21 UTC (permalink / raw)
  To: video4linux-list

Add invertation of image mirroring register bits to default
configuration.

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

Signed-off-by: Sakari Ailus <sakari.ailus@nokia.com>
---
 drivers/media/video/tcm825x.c |    6 ++++++
 drivers/media/video/tcm825x.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c
index e57a646..216638e 100644
--- a/drivers/media/video/tcm825x.c
+++ b/drivers/media/video/tcm825x.c
@@ -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;
diff --git a/drivers/media/video/tcm825x.h b/drivers/media/video/tcm825x.h
index 966765b..770ebac 100644
--- a/drivers/media/video/tcm825x.h
+++ b/drivers/media/video/tcm825x.h
@@ -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
-- 
1.5.0.6

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-13  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-13  9:20 TCM825x: invertation of image mirroring register bits Sakari Ailus
2008-05-13  9:21 ` [PATCH] TCM825x: Include invertation of image mirroring in configuration Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox