Chrome platform driver development
 help / color / mirror / Atom feed
From: Prashant Malani <pmalani@chromium.org>
To: linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev
Cc: Prashant Malani <pmalani@chromium.org>,
	Benson Leung <bleung@chromium.org>
Subject: [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag
Date: Wed,  4 Jan 2023 06:08:45 +0000	[thread overview]
Message-ID: <20230104060846.112216-2-pmalani@chromium.org> (raw)
In-Reply-To: <20230104060846.112216-1-pmalani@chromium.org>

Not all ports have retimers. Only register a retimer switch if the
"retimer-switch" property is present for that port's mux
device.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
 drivers/platform/chrome/cros_typec_switch.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index 2536bda03bf3..9ed1605f4071 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -246,14 +246,16 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
 		port->port_num = index;
 		sdata->ports[index] = port;
 
-		ret = cros_typec_register_retimer(port, fwnode);
-		if (ret) {
-			dev_err(dev, "Retimer switch register failed\n");
-			goto err_switch;
+		if (fwnode_property_present(fwnode, "retimer-switch")) {
+			ret = cros_typec_register_retimer(port, fwnode);
+			if (ret) {
+				dev_err(dev, "Retimer switch register failed\n");
+				goto err_switch;
+			}
+
+			dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
 		}
 
-		dev_dbg(dev, "Retimer switch registered for index %llu\n", index);
-
 		if (!fwnode_property_present(fwnode, "mode-switch"))
 			continue;
 
-- 
2.39.0.314.g84b9a713c41-goog


  reply	other threads:[~2023-01-04  6:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  6:08 [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Prashant Malani
2023-01-04  6:08 ` Prashant Malani [this message]
2023-01-05 18:46   ` [PATCH 2/2] platform/chrome: cros_typec_switch: Check for retimer flag Benson Leung
2023-01-05 18:44 ` [PATCH 1/2] platform/chrome: cros_typec_switch: Use fwnode* prop check Benson Leung
2023-01-10 20:50 ` patchwork-bot+chrome-platform
2023-01-13 21:20 ` patchwork-bot+chrome-platform

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=20230104060846.112216-2-pmalani@chromium.org \
    --to=pmalani@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=linux-kernel@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