linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: typec: fsa4480: Relax CHIP_ID check
@ 2024-08-18 20:21 Luca Weiss
  2024-08-18 20:30 ` Luca Weiss
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luca Weiss @ 2024-08-18 20:21 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Konrad Dybcio,
	Dmitry Baryshkov, Caleb Connolly
  Cc: ~postmarketos/upstreaming, phone-devel, linux-usb, linux-kernel,
	linux-arm-msm, stable, Luca Weiss

Some FSA4480-compatible chips like the OCP96011 used on Fairphone 5
return 0x00 from the CHIP_ID register. Handle that gracefully and only
fail probe when the I2C read has failed.

With this the dev_dbg will print 0 but otherwise continue working.

  [    0.251581] fsa4480 1-0042: Found FSA4480 v0.0 (Vendor ID = 0)

Cc: stable@vger.kernel.org
Fixes: e885f5f1f2b4 ("usb: typec: fsa4480: Check if the chip is really there")
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
 drivers/usb/typec/mux/fsa4480.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c
index cd235339834b..f71dba8bf07c 100644
--- a/drivers/usb/typec/mux/fsa4480.c
+++ b/drivers/usb/typec/mux/fsa4480.c
@@ -274,7 +274,7 @@ static int fsa4480_probe(struct i2c_client *client)
 		return dev_err_probe(dev, PTR_ERR(fsa->regmap), "failed to initialize regmap\n");
 
 	ret = regmap_read(fsa->regmap, FSA4480_DEVICE_ID, &val);
-	if (ret || !val)
+	if (ret)
 		return dev_err_probe(dev, -ENODEV, "FSA4480 not found\n");
 
 	dev_dbg(dev, "Found FSA4480 v%lu.%lu (Vendor ID = %lu)\n",

---
base-commit: ccdbf91fdf5a71881ef32b41797382c4edd6f670
change-id: 20240818-fsa4480-chipid-fix-2c7cf5810135

Best regards,
-- 
Luca Weiss <luca.weiss@fairphone.com>


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

* Re: [PATCH] usb: typec: fsa4480: Relax CHIP_ID check
  2024-08-18 20:21 [PATCH] usb: typec: fsa4480: Relax CHIP_ID check Luca Weiss
@ 2024-08-18 20:30 ` Luca Weiss
  2024-08-19  9:17 ` neil.armstrong
  2024-08-19 12:39 ` Heikki Krogerus
  2 siblings, 0 replies; 4+ messages in thread
From: Luca Weiss @ 2024-08-18 20:30 UTC (permalink / raw)
  To: Luca Weiss, Heikki Krogerus, Greg Kroah-Hartman, Konrad Dybcio,
	Dmitry Baryshkov, Caleb Connolly
  Cc: ~postmarketos/upstreaming, phone-devel, linux-usb, linux-kernel,
	linux-arm-msm, stable

On Sun Aug 18, 2024 at 10:21 PM CEST, Luca Weiss wrote:
> Some FSA4480-compatible chips like the OCP96011 used on Fairphone 5
> return 0x00 from the CHIP_ID register. Handle that gracefully and only
> fail probe when the I2C read has failed.
>
> With this the dev_dbg will print 0 but otherwise continue working.
>
>   [    0.251581] fsa4480 1-0042: Found FSA4480 v0.0 (Vendor ID = 0)

Short appendix: just checked the OCP96011 datasheet and it does mention
register 00H being "Device ID" and "Reset Value" being 0x00 so that's
expected behavior on this specific chip.

Regards
Luca

>
> Cc: stable@vger.kernel.org
> Fixes: e885f5f1f2b4 ("usb: typec: fsa4480: Check if the chip is really there")
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>  drivers/usb/typec/mux/fsa4480.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c
> index cd235339834b..f71dba8bf07c 100644
> --- a/drivers/usb/typec/mux/fsa4480.c
> +++ b/drivers/usb/typec/mux/fsa4480.c
> @@ -274,7 +274,7 @@ static int fsa4480_probe(struct i2c_client *client)
>  		return dev_err_probe(dev, PTR_ERR(fsa->regmap), "failed to initialize regmap\n");
>  
>  	ret = regmap_read(fsa->regmap, FSA4480_DEVICE_ID, &val);
> -	if (ret || !val)
> +	if (ret)
>  		return dev_err_probe(dev, -ENODEV, "FSA4480 not found\n");
>  
>  	dev_dbg(dev, "Found FSA4480 v%lu.%lu (Vendor ID = %lu)\n",
>
> ---
> base-commit: ccdbf91fdf5a71881ef32b41797382c4edd6f670
> change-id: 20240818-fsa4480-chipid-fix-2c7cf5810135
>
> Best regards,


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

* Re: [PATCH] usb: typec: fsa4480: Relax CHIP_ID check
  2024-08-18 20:21 [PATCH] usb: typec: fsa4480: Relax CHIP_ID check Luca Weiss
  2024-08-18 20:30 ` Luca Weiss
@ 2024-08-19  9:17 ` neil.armstrong
  2024-08-19 12:39 ` Heikki Krogerus
  2 siblings, 0 replies; 4+ messages in thread
From: neil.armstrong @ 2024-08-19  9:17 UTC (permalink / raw)
  To: Luca Weiss, Heikki Krogerus, Greg Kroah-Hartman, Konrad Dybcio,
	Dmitry Baryshkov, Caleb Connolly
  Cc: ~postmarketos/upstreaming, phone-devel, linux-usb, linux-kernel,
	linux-arm-msm, stable

On 18/08/2024 22:21, Luca Weiss wrote:
> Some FSA4480-compatible chips like the OCP96011 used on Fairphone 5
> return 0x00 from the CHIP_ID register. Handle that gracefully and only
> fail probe when the I2C read has failed.
> 
> With this the dev_dbg will print 0 but otherwise continue working.
> 
>    [    0.251581] fsa4480 1-0042: Found FSA4480 v0.0 (Vendor ID = 0)
> 
> Cc: stable@vger.kernel.org
> Fixes: e885f5f1f2b4 ("usb: typec: fsa4480: Check if the chip is really there")
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
>   drivers/usb/typec/mux/fsa4480.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c
> index cd235339834b..f71dba8bf07c 100644
> --- a/drivers/usb/typec/mux/fsa4480.c
> +++ b/drivers/usb/typec/mux/fsa4480.c
> @@ -274,7 +274,7 @@ static int fsa4480_probe(struct i2c_client *client)
>   		return dev_err_probe(dev, PTR_ERR(fsa->regmap), "failed to initialize regmap\n");
>   
>   	ret = regmap_read(fsa->regmap, FSA4480_DEVICE_ID, &val);
> -	if (ret || !val)
> +	if (ret)
>   		return dev_err_probe(dev, -ENODEV, "FSA4480 not found\n");
>   
>   	dev_dbg(dev, "Found FSA4480 v%lu.%lu (Vendor ID = %lu)\n",
> 
> ---
> base-commit: ccdbf91fdf5a71881ef32b41797382c4edd6f670
> change-id: 20240818-fsa4480-chipid-fix-2c7cf5810135
> 
> Best regards,

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

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

* Re: [PATCH] usb: typec: fsa4480: Relax CHIP_ID check
  2024-08-18 20:21 [PATCH] usb: typec: fsa4480: Relax CHIP_ID check Luca Weiss
  2024-08-18 20:30 ` Luca Weiss
  2024-08-19  9:17 ` neil.armstrong
@ 2024-08-19 12:39 ` Heikki Krogerus
  2 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2024-08-19 12:39 UTC (permalink / raw)
  To: Luca Weiss
  Cc: Greg Kroah-Hartman, Konrad Dybcio, Dmitry Baryshkov,
	Caleb Connolly, ~postmarketos/upstreaming, phone-devel, linux-usb,
	linux-kernel, linux-arm-msm, stable

On Sun, Aug 18, 2024 at 10:21:01PM +0200, Luca Weiss wrote:
> Some FSA4480-compatible chips like the OCP96011 used on Fairphone 5
> return 0x00 from the CHIP_ID register. Handle that gracefully and only
> fail probe when the I2C read has failed.
> 
> With this the dev_dbg will print 0 but otherwise continue working.
> 
>   [    0.251581] fsa4480 1-0042: Found FSA4480 v0.0 (Vendor ID = 0)
> 
> Cc: stable@vger.kernel.org
> Fixes: e885f5f1f2b4 ("usb: typec: fsa4480: Check if the chip is really there")
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/mux/fsa4480.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c
> index cd235339834b..f71dba8bf07c 100644
> --- a/drivers/usb/typec/mux/fsa4480.c
> +++ b/drivers/usb/typec/mux/fsa4480.c
> @@ -274,7 +274,7 @@ static int fsa4480_probe(struct i2c_client *client)
>  		return dev_err_probe(dev, PTR_ERR(fsa->regmap), "failed to initialize regmap\n");
>  
>  	ret = regmap_read(fsa->regmap, FSA4480_DEVICE_ID, &val);
> -	if (ret || !val)
> +	if (ret)
>  		return dev_err_probe(dev, -ENODEV, "FSA4480 not found\n");
>  
>  	dev_dbg(dev, "Found FSA4480 v%lu.%lu (Vendor ID = %lu)\n",
> 
> ---
> base-commit: ccdbf91fdf5a71881ef32b41797382c4edd6f670
> change-id: 20240818-fsa4480-chipid-fix-2c7cf5810135
> 
> Best regards,
> -- 
> Luca Weiss <luca.weiss@fairphone.com>

-- 
heikki

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

end of thread, other threads:[~2024-08-19 12:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-18 20:21 [PATCH] usb: typec: fsa4480: Relax CHIP_ID check Luca Weiss
2024-08-18 20:30 ` Luca Weiss
2024-08-19  9:17 ` neil.armstrong
2024-08-19 12:39 ` Heikki Krogerus

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