public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev,
	bleung@chromium.org
Subject: Re: [PATCH] platform/chrome: cros_typec_switch: Add Pin D support
Date: Tue, 9 May 2023 15:38:58 +0300	[thread overview]
Message-ID: <ZFo+4hsf4g+BQJm1@kuha.fi.intel.com> (raw)
In-Reply-To: <20230508183428.1893357-1-pmalani@chromium.org>

On Mon, May 08, 2023 at 06:34:27PM +0000, Prashant Malani wrote:
> The ChromeOS EC's mux interface allows us to specify whether the port
> should be configured for Pin Assignment D in DisplayPort alternate mode
> (i.e 2 lanes USB + 2 lanes DP). Update the function that determines mux
> state to account for Pin Assignment D and return the appropriate mux
> setting.
> 
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

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

> ---
>  drivers/platform/chrome/cros_typec_switch.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
> index 752720483753..0eefdcf14d63 100644
> --- a/drivers/platform/chrome/cros_typec_switch.c
> +++ b/drivers/platform/chrome/cros_typec_switch.c
> @@ -51,13 +51,18 @@ static int cros_typec_cmd_mux_set(struct cros_typec_switch_data *sdata, int port
>  static int cros_typec_get_mux_state(unsigned long mode, struct typec_altmode *alt)
>  {
>  	int ret = -EOPNOTSUPP;
> +	u8 pin_assign;
>  
> -	if (mode == TYPEC_STATE_SAFE)
> +	if (mode == TYPEC_STATE_SAFE) {
>  		ret = USB_PD_MUX_SAFE_MODE;
> -	else if (mode == TYPEC_STATE_USB)
> +	} else if (mode == TYPEC_STATE_USB) {
>  		ret = USB_PD_MUX_USB_ENABLED;
> -	else if (alt && alt->svid == USB_TYPEC_DP_SID)
> +	} else if (alt && alt->svid == USB_TYPEC_DP_SID) {
>  		ret = USB_PD_MUX_DP_ENABLED;
> +		pin_assign = mode - TYPEC_STATE_MODAL;
> +		if (pin_assign & DP_PIN_ASSIGN_D)
> +			ret |= USB_PD_MUX_USB_ENABLED;
> +	}
>  
>  	return ret;
>  }

thanks,

-- 
heikki

  reply	other threads:[~2023-05-09 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 18:34 [PATCH] platform/chrome: cros_typec_switch: Add Pin D support Prashant Malani
2023-05-09 12:38 ` Heikki Krogerus [this message]
2023-05-11 21:20 ` patchwork-bot+chrome-platform
2023-05-19  2:00 ` patchwork-bot+chrome-platform

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZFo+4hsf4g+BQJm1@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmalani@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox