From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
To: Jacopo Mondi <jacopo@jmondi.org>, linux-renesas-soc@vger.kernel.org
Subject: [RFC PATCH v6 11/13] [DNI:DEBUG] media: i2c: max9286: Add max9286_check_config_link()
Date: Mon, 16 Dec 2019 10:29:28 +0000 [thread overview]
Message-ID: <20191216102930.5867-12-kieran.bingham+renesas@ideasonboard.com> (raw)
In-Reply-To: <20191216102930.5867-1-kieran.bingham+renesas@ideasonboard.com>
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Add extra debug status output.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
drivers/media/i2c/max9286.c | 50 +++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 6e1dfc518e03..057258a3c645 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -502,6 +502,51 @@ static const struct v4l2_async_notifier_operations max9286_notify_ops = {
.unbind = max9286_notify_unbind,
};
+/*
+ * max9286_check_config_link() - Detect and wait for configuration links
+ *
+ * Determine if the configuration channel is up and settled for a link.
+ *
+ * Returns 0 for success, -EIO for errors.
+ */
+static int max9286_check_config_link(struct max9286_priv *priv,
+ unsigned int source_mask)
+{
+ unsigned int i;
+ int ret;
+ const unsigned int max_loops = 1000;
+
+ source_mask &= 0xf;
+ source_mask <<= 4;
+
+ /*
+ * Make sure requested configuration links are detected.
+ */
+ for (i = 0; i < max_loops; i++) {
+ ret = max9286_read(priv, 0x49);
+ if (ret < 0)
+ return -EIO;
+
+ if ((ret & source_mask) == source_mask)
+ break;
+
+ usleep_range(350, 500);
+ }
+
+ if (i == max_loops) {
+ dev_err(&priv->client->dev,
+ "Unable to detect configuration links: 0x%02x expected 0x%02x\n",
+ ret, source_mask);
+ return -EIO;
+ }
+
+ dev_err(&priv->client->dev,
+ "Successfully detected configuration links after %u loops: 0x%02x\n",
+ i, ret);
+
+ return 0;
+}
+
/*
* max9286_check_video_links() - Make sure video links are detected and locked
*
@@ -831,6 +876,11 @@ static int max9286_setup(struct max9286_priv *priv)
*/
usleep_range(2000, 5000);
+ /*
+ * Check to see if the expected configuration links are up.
+ */
+ max9286_check_config_link(priv, priv->source_mask);
+
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2019-12-16 10:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 12:44 [PATCH v6 0/2] MAX9286 GMSL Support Kieran Bingham
2019-12-11 12:44 ` [PATCH v6 1/2] dt-bindings: media: i2c: Add bindings for Maxim Integrated MAX9286 Kieran Bingham
2019-12-18 18:13 ` Rob Herring
2019-12-19 11:46 ` Kieran Bingham
2019-12-11 12:44 ` [PATCH v6 2/2] media: i2c: Add MAX9286 driver Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 00/13] GMSL Renesas Platform Support Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 01/13] media: i2c: max9286: Add GPIO chip controller Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 02/13] dt-bindings: media: i2c: Add bindings for IMI RDACM20 Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 03/13] media: i2c: Add RDACM20 driver Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 04/13] arm64: dts: renesas: eagle: enable VIN Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 05/13] arm64: dts: renesas: eagle: Provide MAX9286 GMSL deserialiser Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 06/13] arm64: dts: renesas: eagle: Provide Eagle FAKRA dynamic overlay Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 07/13] arm64: dts: renesas: salvator-x: Add MAX9286 expansion board Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 08/13] arm64: dts: renesas: eagle: Include Eagle FAKRA overlay Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 09/13] arm64: dts: renesas: r8a7795-es1-salvator-x: Include MAX9286 8 Camera expansion board Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 10/13] media: i2c: max9286: Introduce a debugfs layer Kieran Bingham
2019-12-16 10:29 ` Kieran Bingham [this message]
2019-12-16 10:29 ` [RFC PATCH v6 12/13] media: i2c: max9286: [Workaround] Hard delay while waiting to enable the V3M cameras Kieran Bingham
2019-12-16 10:29 ` [RFC PATCH v6 13/13] media: i2c: max9286: [Workaround] 'device is bound' 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=20191216102930.5867-12-kieran.bingham+renesas@ideasonboard.com \
--to=kieran.bingham+renesas@ideasonboard.com \
--cc=jacopo@jmondi.org \
--cc=linux-renesas-soc@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).