Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: fsa4480: Add chip id read retry loop
@ 2026-05-11 12:22 vipoll
  2026-05-11 12:29 ` Greg KH
  2026-05-11 12:29 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: vipoll @ 2026-05-11 12:22 UTC (permalink / raw)
  To: heikki.krogerus, gregkh
  Cc: linux-usb, linux-kernel, ~postmarketos/upstreaming, Victor Paul,
	stable

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: typec: fsa4480: Add chip id read retry loop
  2026-05-11 12:22 [PATCH] usb: typec: fsa4480: Add chip id read retry loop vipoll
@ 2026-05-11 12:29 ` Greg KH
  2026-05-11 12:29 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-05-11 12:29 UTC (permalink / raw)
  To: vipoll
  Cc: heikki.krogerus, linux-usb, linux-kernel,
	~postmarketos/upstreaming, stable

On Mon, May 11, 2026 at 04:22:46PM +0400, vipoll wrote:
> 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;

why 5?  Why not 5000?

>  	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);

Why these hard coded numbers?  And are you sure this is the correct call
for this, I thought there was a "better" one now when you want to sleep
a range of time.

And what is going to make this now "work"?  Is this needed for all calls
to this hardware?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: typec: fsa4480: Add chip id read retry loop
  2026-05-11 12:22 [PATCH] usb: typec: fsa4480: Add chip id read retry loop vipoll
  2026-05-11 12:29 ` Greg KH
@ 2026-05-11 12:29 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-05-11 12:29 UTC (permalink / raw)
  To: vipoll
  Cc: heikki.krogerus, linux-usb, linux-kernel,
	~postmarketos/upstreaming, stable

On Mon, May 11, 2026 at 04:22:46PM +0400, vipoll wrote:
> 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

What commit id does this fix?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-11 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 12:22 [PATCH] usb: typec: fsa4480: Add chip id read retry loop vipoll
2026-05-11 12:29 ` Greg KH
2026-05-11 12:29 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox