Linux USB
 help / color / mirror / Atom feed
From: vipoll <vipoll@mainlining.org>
To: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	Victor Paul <vipoll@mainlining.org>,
	stable@vger.kernel.org
Subject: [PATCH] usb: typec: fsa4480: Add chip id read retry loop
Date: Mon, 11 May 2026 16:22:46 +0400	[thread overview]
Message-ID: <20260511122246.31673-1-vipoll@mainlining.org> (raw)

From: Victor Paul <vipoll@mainlining.org>

The first read attempt may fail on some devices (e.g. Xiaomi Pad 6)

Cc: stable@vger.kernel.org
Signed-off-by: Victor Paul <vipoll@mainlining.org>
---
 drivers/usb/typec/mux/fsa4480.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c
index c54e42c7e6a1..ae496c0fa805 100644
--- a/drivers/usb/typec/mux/fsa4480.c
+++ b/drivers/usb/typec/mux/fsa4480.c
@@ -256,6 +256,7 @@ static int fsa4480_probe(struct i2c_client *client)
 	struct typec_switch_desc sw_desc = { };
 	struct typec_mux_desc mux_desc = { };
 	struct fsa4480 *fsa;
+	int retries = 5;
 	int val = 0;
 	int ret;
 
@@ -278,7 +279,12 @@ static int fsa4480_probe(struct i2c_client *client)
 	if (ret && ret != -ENODEV)
 		return dev_err_probe(dev, ret, "Failed to get regulator\n");
 
-	ret = regmap_read(fsa->regmap, FSA4480_DEVICE_ID, &val);
+	do {
+		ret = regmap_read(fsa->regmap, FSA4480_DEVICE_ID, &val);
+		if (!ret)
+			break;
+		usleep_range(1000, 1200);
+	} while (retries--);
 	if (ret)
 		return dev_err_probe(dev, -ENODEV, "FSA4480 not found\n");
 
-- 
2.52.0


             reply	other threads:[~2026-05-11 12:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 12:22 vipoll [this message]
2026-05-11 12:29 ` [PATCH] usb: typec: fsa4480: Add chip id read retry loop Greg KH
2026-05-11 12:29 ` Greg KH

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=20260511122246.31673-1-vipoll@mainlining.org \
    --to=vipoll@mainlining.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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