diff mbox series

[5/7] usb: typec: ucsi: limit the UCSI_NO_PARTNER_PDOS even further

Message ID 20240313-qcom-ucsi-fixes-v1-5-74d90cb48a00@linaro.org
State Superseded
Headers show
Series usb: typec: ucsi: fix several issues manifesting on Qualcomm platforms | expand

Commit Message

Dmitry Baryshkov March 13, 2024, 3:54 a.m. UTC
Reading Partner Source PDOs for the consumer Connectors appears to be
working. Permit getting PDOs in this case in order to populate
capabilities of the connected power supply in the sysfs.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/usb/typec/ucsi/ucsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Heikki Krogerus March 18, 2024, 10:52 a.m. UTC | #1
On Wed, Mar 13, 2024 at 05:54:15AM +0200, Dmitry Baryshkov wrote:
> Reading Partner Source PDOs for the consumer Connectors appears to be
> working. Permit getting PDOs in this case in order to populate
> capabilities of the connected power supply in the sysfs.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/ucsi/ucsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 011d52bf34f6..72d368433b1f 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -642,7 +642,9 @@ static int ucsi_read_pdos(struct ucsi_connector *con,
>  	int ret;
>  
>  	if (is_partner &&
> -	    ucsi->quirks & UCSI_NO_PARTNER_PDOS)
> +	    ucsi->quirks & UCSI_NO_PARTNER_PDOS &&
> +	    ((con->status.flags & UCSI_CONSTAT_PWR_DIR) ||
> +	     !is_source(role)))
>  		return 0;
>  
>  	command = UCSI_COMMAND(UCSI_GET_PDOS) | UCSI_CONNECTOR_NUMBER(con->num);
> 
> -- 
> 2.39.2
diff mbox series

Patch

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 011d52bf34f6..72d368433b1f 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -642,7 +642,9 @@  static int ucsi_read_pdos(struct ucsi_connector *con,
 	int ret;
 
 	if (is_partner &&
-	    ucsi->quirks & UCSI_NO_PARTNER_PDOS)
+	    ucsi->quirks & UCSI_NO_PARTNER_PDOS &&
+	    ((con->status.flags & UCSI_CONSTAT_PWR_DIR) ||
+	     !is_source(role)))
 		return 0;
 
 	command = UCSI_COMMAND(UCSI_GET_PDOS) | UCSI_CONNECTOR_NUMBER(con->num);