Re: [PATCH RFC] usb: typec: ucsi: Set orientation as none when connector is unplugged

From: Johan Hovold
Date: Tue Oct 22 2024 - 12:33:17 EST


On Thu, Oct 17, 2024 at 07:01:01PM +0300, Abel Vesa wrote:
> Currently, the ucsi glink client is only reporting orientation normal or
> reversed, based on the level of the gpio. On unplug, it defaults to
> orientation normal instead of none. This confuses some of the orientation
> switches drivers as they might rely on orientation none in order to
> configure the HW in some sort of safe mode.

Can you be more specific here (e.g. so that reviewers and backporter can
determine whether this is a fix that should be backported to stable)?

Which driver is confused? How does this manifest itself?

Is this an issue today? Or something you need for future work, etc?

> So propagate the orientation
> none instead when the connector status flags says cable is disconnected.
>
> Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxx>
> ---
> drivers/usb/typec/ucsi/ucsi_glink.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index 3e4d88ab338e50d4265df15fc960907c36675282..b3bc02e4b0427a894c5b5df470af47433145243e 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -185,6 +185,11 @@ static void pmic_glink_ucsi_connector_status(struct ucsi_connector *con)
> struct pmic_glink_ucsi *ucsi = ucsi_get_drvdata(con->ucsi);
> int orientation;
>
> + if (!(con->status.flags & UCSI_CONSTAT_CONNECTED)) {
> + typec_set_orientation(con->port, TYPEC_ORIENTATION_NONE);
> + return;
> + }
> +
> if (con->num >= PMIC_GLINK_MAX_PORTS ||
> !ucsi->port_orientation[con->num - 1])
> return;

Johan