Skip to contentSkip to conversation

ucsi driver fixes

PATCH In review Heikki Krogerus 2 participants 5 messages Jan 8, 2020

Subsystems (2)
lore
Share & tools
lore

Heikki Krogerus

author maintainer
#0 lore raw

cover ucsi driver fixes

Hi Greg,

Here are two fixes for the ucsi driver. Both fix issues with the Set Notification Enable command.

Heikki Krogerus (2):
usb: typec: ucsi: Fix the notification bit offsets
usb: typec: ucsi: Actually enable all the interface notifications

 drivers/usb/typec/ucsi/ucsi.c |  1 +
 drivers/usb/typec/ucsi/ucsi.h | 18 +++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.24.1
author maintainer
#1 lore raw

PATCH 1/2 usb: typec: ucsi: Fix the notification bit offsets

The bit offsets for the Set Notification Enable command were not considering the reserved bits in the middle.

Fixes 470ce43a1a81 ("usb: typec: ucsi: Remove struct ucsi_control")
---
 drivers/usb/typec/ucsi/ucsi.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/typec/ucsi/ucsi.h +9 -9
index 9e01a9556603..e434b9c9a9eb 100644
@@ -99,15 +99,15 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num);
 #define UCSI_ENABLE_NTFY_CMD_COMPLETE		BIT(16)
 #define UCSI_ENABLE_NTFY_EXT_PWR_SRC_CHANGE	BIT(17)
 #define UCSI_ENABLE_NTFY_PWR_OPMODE_CHANGE	BIT(18)
-#define UCSI_ENABLE_NTFY_CAP_CHANGE		BIT(19)
-#define UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE	BIT(20)
-#define UCSI_ENABLE_NTFY_PD_RESET_COMPLETE	BIT(21)
-#define UCSI_ENABLE_NTFY_CAM_CHANGE		BIT(22)
-#define UCSI_ENABLE_NTFY_BAT_STATUS_CHANGE	BIT(23)
-#define UCSI_ENABLE_NTFY_PARTNER_CHANGE		BIT(24)
-#define UCSI_ENABLE_NTFY_PWR_DIR_CHANGE		BIT(25)
-#define UCSI_ENABLE_NTFY_CONNECTOR_CHANGE	BIT(26)
-#define UCSI_ENABLE_NTFY_ERROR			BIT(27)
+#define UCSI_ENABLE_NTFY_CAP_CHANGE		BIT(21)
+#define UCSI_ENABLE_NTFY_PWR_LEVEL_CHANGE	BIT(22)
+#define UCSI_ENABLE_NTFY_PD_RESET_COMPLETE	BIT(23)
+#define UCSI_ENABLE_NTFY_CAM_CHANGE		BIT(24)
+#define UCSI_ENABLE_NTFY_BAT_STATUS_CHANGE	BIT(25)
+#define UCSI_ENABLE_NTFY_PARTNER_CHANGE		BIT(27)
+#define UCSI_ENABLE_NTFY_PWR_DIR_CHANGE		BIT(28)
+#define UCSI_ENABLE_NTFY_CONNECTOR_CHANGE	BIT(30)
+#define UCSI_ENABLE_NTFY_ERROR			BIT(31)
 #define UCSI_ENABLE_NTFY_ALL			0xdbe70000
 
 /* SET_UOR command bits */
Signature · 1 line
2.24.1
author maintainer
#2 lore raw

PATCH 2/2 usb: typec: ucsi: Actually enable all the interface notifications

In reply to Heikki Krogerus

The notification mask was not updated properly before all the notifications were enabled in ucsi_init().

Fixes 71a1fa0df2a3 ("usb: typec: ucsi: Store the notification mask")
---
 drivers/usb/typec/ucsi/ucsi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/typec/ucsi/ucsi.c +1 -0
index 466bd8afceea..59c8ccdc68ac 100644
@@ -1007,6 +1007,7 @@ int ucsi_init(struct ucsi *ucsi)
 	}
 
 	/* Enable all notifications */
+	ucsi->ntfy = UCSI_ENABLE_NTFY_ALL;
 	command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;
 	ret = ucsi_run_command(ucsi, command, NULL, 0);
 	if (ret < 0)
Signature · 1 line
2.24.1
author maintainer
#3 lore raw

Re: [PATCH 2/2] usb: typec: ucsi: Actually enable all the interface notifications

Hi Greg,

Quoted 4 lines · Heikki Krogerus

The notification mask was not updated properly before all the notifications were enabled in ucsi_init().

Fixes 71a1fa0df2a3 ("usb: typec: ucsi: Store the notification mask")

That commit (71a1fa0df2a3) is still in your usb-next branch, so this patch should also go only to your usb-next.

Sorry about the mix-up.

Quoted 19 lines
---
 drivers/usb/typec/ucsi/ucsi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/typec/ucsi/ucsi.c +1 -0
index 466bd8afceea..59c8ccdc68ac 100644
@@ -1007,6 +1007,7 @@ int ucsi_init(struct ucsi *ucsi)
 	}
 
 	/* Enable all notifications */
+	ucsi->ntfy = UCSI_ENABLE_NTFY_ALL;
 	command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;
 	ret = ucsi_run_command(ucsi, command, NULL, 0);
 	if (ret < 0)
Signature · 1 line
2.24.1

thanks,

Signature · 1 line
heikki
#4 lore raw

Re: [PATCH 2/2] usb: typec: ucsi: Actually enable all the interface notifications

Quoted 6 lines · Heikki Krogerus

Hi Greg,

Quoted 3 lines · Heikki Krogerus

The notification mask was not updated properly before all the notifications were enabled in ucsi_init().

Quoted 6 lines
Quoted 1 line
Fixes 71a1fa0df2a3 ("usb: typec: ucsi: Store the notification mask")

That commit (71a1fa0df2a3) is still in your usb-next branch, so this patch should also go only to your usb-next.

Sorry about the mix-up.

No problem, I'll split the two patches between my two branches, thanks for the heads-up.

greg k-h