summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiogo Ivo <diogo.ivo@tecnico.ulisboa.pt>2024-05-24 13:58:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-04 16:45:16 +0300
commit5821bf2dffbe18fe1f097dbb027415fa15a38e9a (patch)
tree057810b277928b80a1dd96823ba1cfd20b146943
parent4207df37dd744f0cb09b7c09b9c5338ea65c44e7 (diff)
downloadlinux-5821bf2dffbe18fe1f097dbb027415fa15a38e9a.tar.xz
usb: typec: ucsi: Enable UCSI v2.0 notifications
UCSI version 2.0 and above define new PPM notifications. Update the logic to determine which notifications to enable taking into account these changes. Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20240524105837.15342-3-diogo.ivo@tecnico.ulisboa.pt Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/typec/ucsi/ucsi.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 52a14bfe4107..f2424a9a5dee 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1672,7 +1672,7 @@ out_unlock:
static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
{
- u8 features = ucsi->cap.features;
+ u16 features = ucsi->cap.features;
u64 ntfy = UCSI_ENABLE_NTFY_ALL;
if (!(features & UCSI_CAP_ALT_MODE_DETAILS))
@@ -1688,6 +1688,23 @@ static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
if (!(features & UCSI_CAP_PD_RESET))
ntfy &= ~UCSI_ENABLE_NTFY_PD_RESET_COMPLETE;
+ if (ucsi->version <= UCSI_VERSION_1_2)
+ return ntfy;
+
+ ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE;
+
+ if (features & UCSI_CAP_GET_ATTENTION_VDO)
+ ntfy |= UCSI_ENABLE_NTFY_ATTENTION;
+
+ if (features & UCSI_CAP_FW_UPDATE_REQUEST)
+ ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ;
+
+ if (features & UCSI_CAP_SECURITY_REQUEST)
+ ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER;
+
+ if (features & UCSI_CAP_SET_RETIMER_MODE)
+ ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE;
+
return ntfy;
}