All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo+renesas@jmondi.org>
To: kieran.bingham+renesas@ideasonboard.com,
	niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	hyunk@xilinx.com, manivannan.sadhasivam@linaro.org,
	linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org
Subject: [PATCH 3/5] media: i2c: max9286: Parse overlap window value
Date: Mon, 16 Mar 2020 21:27:55 +0100	[thread overview]
Message-ID: <20200316202757.529740-4-jacopo+renesas@jmondi.org> (raw)
In-Reply-To: <20200316202757.529740-1-jacopo+renesas@jmondi.org>

Parse the 'maxim,overlap-window' property value and cache its
content to later program registers 0x63 and 0x64.

As specified by the bindings documentation, the property is mandatory as
long as a default value cannot be established to guarantee DTB backward
compatibility.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/max9286.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 06edd8bd3e82..0357515860b2 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -117,6 +117,9 @@
 #define MAX9286_REV_FLEN(n)		((n) - 20)
 /* Register 0x49 */
 #define MAX9286_VIDEO_DETECT_MASK	0x0f
+/* Register 0x64 */
+#define MAX9286_OVLP_WINDOWH_MASK	GENMASK(4, 0)
+
 /* Register 0x69 */
 #define MAX9286_LFLTBMONMASKED		BIT(7)
 #define MAX9286_LOCKMONMASKED		BIT(6)
@@ -164,6 +167,8 @@ struct max9286_priv {
 	unsigned int csi2_data_lanes;
 	struct max9286_source sources[MAX9286_NUM_GMSL];
 	struct v4l2_async_notifier notifier;
+
+	u32 overlap_window;
 };
 
 static struct max9286_source *next_source(struct max9286_priv *priv,
@@ -895,6 +900,11 @@ static int max9286_setup(struct max9286_priv *priv)
 	max9286_write(priv, 0x01, MAX9286_FSYNCMODE_INT_HIZ |
 		      MAX9286_FSYNCMETH_AUTO);
 
+	/* Configure overlap window. */
+	max9286_write(priv, 0x63, priv->overlap_window);
+	max9286_write(priv, 0x64, (priv->overlap_window >> 8) &
+				  MAX9286_OVLP_WINDOWH_MASK);
+
 	/* Enable HS/VS encoding, use D14/15 for HS/VS, invert VS. */
 	max9286_write(priv, 0x0c, MAX9286_HVEN | MAX9286_INVVS |
 		      MAX9286_HVSRC_D14);
@@ -1041,8 +1051,24 @@ static int max9286_parse_dt(struct max9286_priv *priv)
 	struct device_node *i2c_mux;
 	struct device_node *node = NULL;
 	unsigned int i2c_mux_mask = 0;
+	int ret;
 
 	of_node_get(dev->of_node);
+
+	/*
+	 * FIXM: Require overlap window value to be specified by DTS as long as
+	 * the control function is not clarified. As soon as a default
+	 * behaviour can be established drop this requirement, while older
+	 * DTBs are guaranteed to be fully specified.
+	 */
+	ret = of_property_read_u32(dev->of_node, "maxim,overlap-window",
+				   &priv->overlap_window);
+	if (ret) {
+		dev_err(dev, "Missing property \"maxim,overlap-window\"\n");
+		of_node_put(dev->of_node);
+		return -EINVAL;
+	}
+
 	i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux");
 	if (!i2c_mux) {
 		dev_err(dev, "Failed to find i2c-mux node\n");
-- 
2.25.1


  parent reply	other threads:[~2020-03-16 20:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 20:27 [PATCH 0/5] media: i2c: max9286: Add configuration properties Jacopo Mondi
2020-03-16 20:27 ` [PATCH 1/5] media: i2c: max9286: Put of node on error Jacopo Mondi
2020-03-18  9:32   ` Kieran Bingham
2020-03-18 14:06     ` Jacopo Mondi
2020-03-16 20:27 ` [PATCH 2/5] dt-bindings: media: max9286: Add overlap window Jacopo Mondi
2020-03-18  9:45   ` Kieran Bingham
2020-03-18 14:19     ` Jacopo Mondi
2020-03-19  1:08       ` Hyun Kwon
2020-03-19  9:00         ` Jacopo Mondi
2020-03-16 20:27 ` Jacopo Mondi [this message]
2020-03-18  9:50   ` [PATCH 3/5] media: i2c: max9286: Parse overlap window value Kieran Bingham
2020-03-18 14:22     ` Jacopo Mondi
2020-03-16 20:27 ` [PATCH 4/5] dt-bindings: media: max9286: Add reverse channel amplitude Jacopo Mondi
2020-03-18  9:55   ` Kieran Bingham
2020-03-16 20:27 ` [PATCH 5/5] media: i2c: max9286: Parse " Jacopo Mondi
2020-03-18  9:57   ` Kieran Bingham
2020-03-18 14:32     ` Jacopo Mondi
2020-03-19 11:13       ` Kieran Bingham

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=20200316202757.529740-4-jacopo+renesas@jmondi.org \
    --to=jacopo+renesas@jmondi.org \
    --cc=hyunk@xilinx.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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.