From bbdac95d75adc8793a7c3a84a39ec49c31cec27e Mon Sep 17 00:00:00 2001
From: Zhengchun Li <quic_zhengchu@quicinc.com>
Date: Thu, 20 Jun 2024 17:08:14 +0800
Subject: [PATCH] PENDING: USB: Adapt USB5807 driver for IPC hardware design

Updated reset GPIO handling logic:
   - The RESET pin for USB5807 is directly controlled
     by hardware in the IPC design, and no software
     intervention is required.
   - Adjusted the code to ensure the driver operates
     correctly even when the reset GPIO is not configured
     in the software.

Change-Id: I6063f6989275600dbd0735100f8f1809cb4aa66c
Signed-off-by: Zhengchun Li <quic_zhengchu@quicinc.com>
---
 drivers/usb/misc/usb5807.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/misc/usb5807.c b/drivers/usb/misc/usb5807.c
index 89772de99d874..d37d682c1a12a 100644
--- a/drivers/usb/misc/usb5807.c
+++ b/drivers/usb/misc/usb5807.c
@@ -109,8 +109,8 @@ static int usb5807_i2c_probe(struct i2c_client *i2c)
 	reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset",
 					     GPIOD_OUT_HIGH);
 	if (IS_ERR(reset_gpio)) {
-		return dev_err_probe(&i2c->dev, PTR_ERR(reset_gpio),
-				     "Failed to request reset GPIO\n");
+		dev_warn(&i2c->dev, "Failed to request reset GPIO\n");
+		reset_gpio = NULL;
 	}
 	/* Reset timing: Assert for >= 5 us */
 	usleep_range(5, 10);
@@ -118,7 +118,9 @@ static int usb5807_i2c_probe(struct i2c_client *i2c)
 	/* Lock the bus for >= 1ms while the hub reads the I2C strapping */
 	i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
 
-	gpiod_set_value_cansleep(reset_gpio, 0);
+	if (reset_gpio)
+		gpiod_set_value_cansleep(reset_gpio, 0);
+
 	usleep_range(1000, 2000);
 
 	i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
-- 
GitLab