Skip to contentSkip to conversation

ucsi_ccg: Check DEV_INT bit only when starting CCG4

PATCH Superseded Wayne Chang 2 participants 3 messages Jan 7, 2022 – Jan 11, 2022

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ucsi_ccg: Check DEV_INT bit only when starting CCG4

From: Sing-Han Chen <[email protected]>

after driver sending the UCSI_START cmd, CCGx would clear Bit 0:Device Interrupt in the INTR_REG if CCGX reset successfully.

however, there might be a chance that other bits in INTR_REG are not cleared due to internal data queued in PPM and cause the driver thinks CCGx reset failed.

the commit checks bit 0 in INTR_REG and ignore other bits. ucsi driver would reset PPM later.

---
 drivers/usb/typec/ucsi/ucsi_ccg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi_ccg.c +1 -1
index bff96d64dddf..6db7c8ddd51c 100644
@@ -325,7 +325,7 @@ static int ucsi_ccg_init(struct ucsi_ccg *uc)
 		if (status < 0)
 			return status;
 
-		if (!data)
+		if (!(data & DEV_INT))
 			return 0;
 
 		status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data));
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 10 lines · Wayne Chang

From: Sing-Han Chen <[email protected]>

after driver sending the UCSI_START cmd, CCGx would clear Bit 0:Device Interrupt in the INTR_REG if CCGX reset successfully.

however, there might be a chance that other bits in INTR_REG are not cleared due to internal data queued in PPM and cause the driver thinks CCGx reset failed.

Quoted 5 lines

the commit checks bit 0 in INTR_REG and ignore other bits. ucsi driver would reset PPM later.

                 ^^^^^^^^^^

You probable should have a space there. In any case, FWIW:

Quoted 19 lines
---
 drivers/usb/typec/ucsi/ucsi_ccg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rivers/usb/typec/ucsi/ucsi_ccg.c renamed from drivers/usb/typec/ucsi/ucsi_ccg.c +1 -1
index bff96d64dddf..6db7c8ddd51c 100644
@@ -325,7 +325,7 @@ static int ucsi_ccg_init(struct ucsi_ccg *uc)
 		if (status < 0)
 			return status;
 
-		if (!data)
+		if (!(data & DEV_INT))
 			return 0;
 
 		status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data));
Signature · 1 line
2.25.1

thanks,

Signature · 1 line
heikki
#2 lore raw

Hi Heikki,

Thanks for the review.

Quoted 18 lines · Heikki Krogerus

Hi,

Quoted 13 lines · Wayne Chang

From: Sing-Han Chen <[email protected]>

after driver sending the UCSI_START cmd, CCGx would clear Bit 0:Device Interrupt in the INTR_REG if CCGX reset successfully.

however, there might be a chance that other bits in INTR_REG are not cleared due to internal data queued in PPM and cause the driver thinks CCGx reset failed.

the commit checks bit 0 in INTR_REG and ignore other bits. ucsi driver would reset PPM later.

Quoted 7 lines
Quoted 2 lines
                  ^^^^^^^^^^

You probable should have a space there. In any case, FWIW:

Yes, I'll update the commit message and send it out.

Quoted 16 lines
Quoted 16 lines
---
  drivers/usb/typec/ucsi/ucsi_ccg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
rivers/usb/typec/ucsi/ucsi_ccg.c renamed from drivers/usb/typec/ucsi/ucsi_ccg.c +1 -1
index bff96d64dddf..6db7c8ddd51c 100644
@@ -325,7 +325,7 @@ static int ucsi_ccg_init(struct ucsi_ccg *uc)
               if (status < 0)
                       return status;
 
-             if (!data)
+             if (!(data & DEV_INT))
                       return 0;
 
Quoted 9 lines
Quoted 3 lines
rivers/usb/typec/ucsi/ucsi_ccg.c renamed from drivers/usb/typec/ucsi/ucsi_ccg.c +0 -1
               status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data));
--

2.25.1

thanks,

--
heikki

thanks,
Wayne.