diff options
author | Johan Hovold <[email protected]> | 2023-12-08 13:36:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2023-12-15 14:00:28 +0100 |
commit | c994cb596bf7ef5928f06331c76f46e071b16f09 (patch) | |
tree | c027ab87b8d39fed5cfa3254d8a525ca994a1f48 | |
parent | aef05e349bfd81c95adb4489639413fadbb74a83 (diff) |
usb: typec: ucsi: fix gpio-based orientation detection
Fix the recently added connector sanity check which was off by one and
prevented orientation notifications from being handled correctly for the
second port when using GPIOs to determine orientation.
Fixes: c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events")
Cc: stable <[email protected]>
Cc: Neil Armstrong <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r-- | drivers/usb/typec/ucsi/ucsi_glink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index db6e248f8208..4853141cd10c 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -228,7 +228,7 @@ static void pmic_glink_ucsi_notify(struct work_struct *work) con_num = UCSI_CCI_CONNECTOR(cci); if (con_num) { - if (con_num < PMIC_GLINK_MAX_PORTS && + if (con_num <= PMIC_GLINK_MAX_PORTS && ucsi->port_orientation[con_num - 1]) { int orientation = gpiod_get_value(ucsi->port_orientation[con_num - 1]); |