aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pearson <[email protected]>2024-06-09 17:43:18 -0400
committerGreg Kroah-Hartman <[email protected]>2024-06-20 19:30:51 +0200
commit50a7230a02ec1218441ef21ba863596d282ff90b (patch)
tree2256ec7f14f007d7c100996fe9f7112953a46a6b
parenta353686e7f5f3f3eef3ac4561ae7ade1f8e5dfdd (diff)
usb: typec: ucsi: don't retrieve PDOs if not supported
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 <[email protected]> Suggested-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Mark Pearson <[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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 134ef4e17d85..b39e8dcf0dba 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -646,9 +646,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)