All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugen Hristev <eugen.hristev@microchip.com>
To: <akinobu.mita@gmail.com>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <sakari.ailus@linux.intel.com>,
	Eugen Hristev <eugen.hristev@microchip.com>
Subject: [PATCH] media: i2c: ov7740: implement get_mbus_config
Date: Tue, 2 Nov 2021 17:30:08 +0200	[thread overview]
Message-ID: <20211102153008.1349895-1-eugen.hristev@microchip.com> (raw)

Implement the get_mbus_config callback.
ov7740 is a parallel sensor, and according to datasheet, the register
REG12 controls the CCIR656 mode. This register is written to 0 in yuyv mode.
According to REG12[5] , CCIR656 mode, the behavior is:
CCIR656: disabled
REG28 controls the polarity of the signals. This register is unused.
The default behavior is then:
HSYNC polarity : positive
VSYNC polarity : positive
HREF polarity: positive

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/media/i2c/ov7740.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c
index 2539cfee85c8..f8a717aecb6f 100644
--- a/drivers/media/i2c/ov7740.c
+++ b/drivers/media/i2c/ov7740.c
@@ -873,12 +873,26 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd,
 	return ret;
 }
 
+static int ov7740_get_mbus_config(struct v4l2_subdev *sd,
+				  unsigned int pad,
+				  struct v4l2_mbus_config *cfg)
+{
+	cfg->type = V4L2_MBUS_PARALLEL;
+	cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
+		     V4L2_MBUS_VSYNC_ACTIVE_HIGH |
+		     V4L2_MBUS_PCLK_SAMPLE_RISING |
+		     V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH;
+
+	return 0;
+}
+
 static const struct v4l2_subdev_pad_ops ov7740_subdev_pad_ops = {
 	.enum_frame_interval = ov7740_enum_frame_interval,
 	.enum_frame_size = ov7740_enum_frame_size,
 	.enum_mbus_code = ov7740_enum_mbus_code,
 	.get_fmt = ov7740_get_fmt,
 	.set_fmt = ov7740_set_fmt,
+	.get_mbus_config = ov7740_get_mbus_config,
 };
 
 static const struct v4l2_subdev_ops ov7740_subdev_ops = {
-- 
2.25.1


             reply	other threads:[~2021-11-02 15:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 15:30 Eugen Hristev [this message]
2021-11-03  8:08 ` [PATCH] media: i2c: ov7740: implement get_mbus_config Sakari Ailus
2021-11-03 12:39   ` Eugen.Hristev
2021-11-03 13:46     ` Jacopo Mondi
2021-11-03 14:17     ` Sakari Ailus

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=20211102153008.1349895-1-eugen.hristev@microchip.com \
    --to=eugen.hristev@microchip.com \
    --cc=akinobu.mita@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.