* [PATCH] usb: typec: ucsi: fix gpio-based orientation detection
@ 2023-12-08 12:36 Johan Hovold
2023-12-08 12:37 ` Dmitry Baryshkov
2023-12-08 13:56 ` Heikki Krogerus
0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2023-12-08 12:36 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Neil Armstrong, Dmitry Baryshkov, Konrad Dybcio, linux-usb,
linux-kernel, Johan Hovold
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: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
I found this one through inspection when skimming the driver.
Johan
drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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]);
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: typec: ucsi: fix gpio-based orientation detection
2023-12-08 12:36 [PATCH] usb: typec: ucsi: fix gpio-based orientation detection Johan Hovold
@ 2023-12-08 12:37 ` Dmitry Baryshkov
2023-12-08 13:56 ` Heikki Krogerus
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2023-12-08 12:37 UTC (permalink / raw)
To: Johan Hovold
Cc: Heikki Krogerus, Greg Kroah-Hartman, Neil Armstrong,
Konrad Dybcio, linux-usb, linux-kernel
On Fri, 8 Dec 2023 at 14:37, Johan Hovold <johan+linaro@kernel.org> wrote:
>
> 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: Neil Armstrong <neil.armstrong@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>
> I found this one through inspection when skimming the driver.
>
> Johan
>
>
> drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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]);
>
> --
> 2.41.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: typec: ucsi: fix gpio-based orientation detection
2023-12-08 12:36 [PATCH] usb: typec: ucsi: fix gpio-based orientation detection Johan Hovold
2023-12-08 12:37 ` Dmitry Baryshkov
@ 2023-12-08 13:56 ` Heikki Krogerus
1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2023-12-08 13:56 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Neil Armstrong, Dmitry Baryshkov,
Konrad Dybcio, linux-usb, linux-kernel
On Fri, Dec 08, 2023 at 01:36:02PM +0100, Johan Hovold wrote:
> 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: Neil Armstrong <neil.armstrong@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
>
> I found this one through inspection when skimming the driver.
>
> Johan
>
>
> drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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]);
>
> --
> 2.41.0
--
heikki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-08 13:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-08 12:36 [PATCH] usb: typec: ucsi: fix gpio-based orientation detection Johan Hovold
2023-12-08 12:37 ` Dmitry Baryshkov
2023-12-08 13:56 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox