* [PATCH] usb: typec: ucsi: don't retrieve PDOs if not supported
@ 2024-06-09 21:43 Mark Pearson
2024-06-10 13:08 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Mark Pearson @ 2024-06-09 21:43 UTC (permalink / raw)
To: mpearson-lenovo
Cc: diogo.ivo, dmitry.baryshkov, heikki.krogerus, gregkh, linux-usb,
linux-kernel
On systems where the UCSI PDOs are not supported, the UCSI driver is
giving an error message. This can cause users to believe there is a HW
issue with their system when in fact it is working as designed.
Check if PDO_DETAILS are supported as a feature before attempting to
access PDO. If not supported return that zero PDOs are available.
Tested on Lenovo L14 G5 AMD and confirmed with Lenovo FW team that PDOs
are not supported on this platform.
Suggested-by: Diogo Ivo <diogo.ivo@siemens.com>
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
Note this patch replaces my previous submission 'treat get_pdos not supported
condition as info instead of error', based on feedback from review.
drivers/usb/typec/ucsi/ucsi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index cb52e7b0a2c5..cadea8d328ed 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -641,9 +641,13 @@ static int ucsi_read_pdos(struct ucsi_connector *con,
static int ucsi_get_pdos(struct ucsi_connector *con, enum typec_role role,
int is_partner, u32 *pdos)
{
+ struct ucsi *ucsi = con->ucsi;
u8 num_pdos;
int ret;
+ if (!(ucsi->cap.features & UCSI_CAP_PDO_DETAILS))
+ return 0;
+
/* UCSI max payload means only getting at most 4 PDOs at a time */
ret = ucsi_read_pdos(con, role, is_partner, pdos, 0, UCSI_MAX_PDOS);
if (ret < 0)
--
2.45.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: typec: ucsi: don't retrieve PDOs if not supported
2024-06-09 21:43 [PATCH] usb: typec: ucsi: don't retrieve PDOs if not supported Mark Pearson
@ 2024-06-10 13:08 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2024-06-10 13:08 UTC (permalink / raw)
To: Mark Pearson; +Cc: diogo.ivo, dmitry.baryshkov, gregkh, linux-usb, linux-kernel
On Sun, Jun 09, 2024 at 05:43:18PM -0400, Mark Pearson wrote:
> On systems where the UCSI PDOs are not supported, the UCSI driver is
> giving an error message. This can cause users to believe there is a HW
> issue with their system when in fact it is working as designed.
>
> Check if PDO_DETAILS are supported as a feature before attempting to
> access PDO. If not supported return that zero PDOs are available.
>
> Tested on Lenovo L14 G5 AMD and confirmed with Lenovo FW team that PDOs
> are not supported on this platform.
>
> Suggested-by: Diogo Ivo <diogo.ivo@siemens.com>
> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> Note this patch replaces my previous submission 'treat get_pdos not supported
> condition as info instead of error', based on feedback from review.
>
> drivers/usb/typec/ucsi/ucsi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index cb52e7b0a2c5..cadea8d328ed 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -641,9 +641,13 @@ static int ucsi_read_pdos(struct ucsi_connector *con,
> static int ucsi_get_pdos(struct ucsi_connector *con, enum typec_role role,
> int is_partner, u32 *pdos)
> {
> + struct ucsi *ucsi = con->ucsi;
> u8 num_pdos;
> int ret;
>
> + if (!(ucsi->cap.features & UCSI_CAP_PDO_DETAILS))
> + return 0;
> +
> /* UCSI max payload means only getting at most 4 PDOs at a time */
> ret = ucsi_read_pdos(con, role, is_partner, pdos, 0, UCSI_MAX_PDOS);
> if (ret < 0)
> --
> 2.45.1
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-10 13:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-09 21:43 [PATCH] usb: typec: ucsi: don't retrieve PDOs if not supported Mark Pearson
2024-06-10 13:08 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox