Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>
Link: https://lore.kernel.org/r/20240609214328.6580-1-mpearson-lenovo@squebb.ca
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mark Pearson and committed by
Greg Kroah-Hartman
50a7230a a353686e

+4
+4
drivers/usb/typec/ucsi/ucsi.c
··· 646 646 static int ucsi_get_pdos(struct ucsi_connector *con, enum typec_role role, 647 647 int is_partner, u32 *pdos) 648 648 { 649 + struct ucsi *ucsi = con->ucsi; 649 650 u8 num_pdos; 650 651 int ret; 652 + 653 + if (!(ucsi->cap.features & UCSI_CAP_PDO_DETAILS)) 654 + return 0; 651 655 652 656 /* UCSI max payload means only getting at most 4 PDOs at a time */ 653 657 ret = ucsi_read_pdos(con, role, is_partner, pdos, 0, UCSI_MAX_PDOS);