mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin Dørum" <martid0311@gmail.com>
To: sakari.ailus@linux.intel.com,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Martin Dørum" <martid0311@gmail.com>,
	"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
	linux-media@vger.kernel.org (open list:MEDIA INPUT
	INFRASTRUCTURE (V4L/DVB)),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] media: i2c: ov5645: Fix horizontal flip
Date: Mon, 26 Jul 2021 15:50:06 +0200	[thread overview]
Message-ID: <20210726135009.140168-1-martid0311@gmail.com> (raw)

The ov5645 driver currently handles horizontal flipping by setting the
"sensor mirror" bit (bit 1) in the TIMING_TC_REG21 register. This
just reverses the sensor data readout for each row, which works for the
brightness (Y) bytes, but it ends up reversing the color (U and V)
bytes.

This fix adds the "ISP mirror" bit (bit 2) in the same register.
The datasheet I have isn't very detailed, but it seems like "ISP mirror"
makes the image sensor processor flip the color byte pairs (so UV -> VU),
so reversing data readout in combination with "ISP mirror" gives us a
horizontally flipped image with correct colors.

Signed-off-by: Martin Dørum <martid0311@gmail.com>
---
 drivers/media/i2c/ov5645.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index 368fa21e675e..c40bcb4b5484 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -52,7 +52,7 @@
 #define		OV5645_SENSOR_VFLIP		BIT(1)
 #define		OV5645_ISP_VFLIP		BIT(2)
 #define OV5645_TIMING_TC_REG21		0x3821
-#define		OV5645_SENSOR_MIRROR		BIT(1)
+#define		OV5645_SENSOR_MIRROR		(BIT(1) | BIT(2))
 #define OV5645_MIPI_CTRL00		0x4800
 #define OV5645_PRE_ISP_TEST_SETTING_1	0x503d
 #define		OV5645_TEST_PATTERN_MASK	0x3
-- 
2.31.1


                 reply	other threads:[~2021-07-26 13:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210726135009.140168-1-martid0311@gmail.com \
    --to=martid0311@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    /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

all inboxes | Powered by JetHome®