From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sakari Ailus Subject: [PATCH 1/3] TCM825x: Include invertation of image mirroring in configuration Date: Wed, 14 May 2008 15:05:31 +0300 Message-ID: <12107667331990-git-send-email-sakari.ailus@nokia.com> References: <482AD555.40905@nokia.com> Return-path: Received: from smtp.nokia.com ([192.100.122.233]:17249 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760150AbYENMF4 (ORCPT ); Wed, 14 May 2008 08:05:56 -0400 Received: from esebh107.NOE.Nokia.com (esebh107.ntc.nokia.com [172.21.143.143]) by mgw-mx06.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id m4EC5ask031349 for ; Wed, 14 May 2008 15:05:54 +0300 Received: from kaali.localdomain (kaali.localdomain [192.168.239.7]) by maxwell.research.nokia.com (Postfix) with ESMTP id 622A24674E for ; Wed, 14 May 2008 15:05:33 +0300 (EEST) Received: from sailus by kaali.localdomain with local (Exim 4.63) (envelope-from ) id 1JwFjh-0006RR-Er for linux-omap@vger.kernel.org; Wed, 14 May 2008 15:05:33 +0300 In-Reply-To: <482AD555.40905@nokia.com> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: linux-omap@vger.kernel.org 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 --- 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