chrome-platform.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_typec_switch: Add Pin D support
@ 2023-05-08 18:34 Prashant Malani
  2023-05-09 12:38 ` Heikki Krogerus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Prashant Malani @ 2023-05-08 18:34 UTC (permalink / raw)
  To: linux-kernel, chrome-platform; +Cc: bleung, Prashant Malani, Heikki Krogerus

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>
---
 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;
 }
-- 
2.40.1.521.gf1e218fcd8-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: cros_typec_switch: Add Pin D support
  2023-05-08 18:34 [PATCH] platform/chrome: cros_typec_switch: Add Pin D support Prashant Malani
@ 2023-05-09 12:38 ` Heikki Krogerus
  2023-05-11 21:20 ` patchwork-bot+chrome-platform
  2023-05-19  2:00 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2023-05-09 12:38 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform, bleung

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: cros_typec_switch: Add Pin D support
  2023-05-08 18:34 [PATCH] platform/chrome: cros_typec_switch: Add Pin D support Prashant Malani
  2023-05-09 12:38 ` Heikki Krogerus
@ 2023-05-11 21:20 ` patchwork-bot+chrome-platform
  2023-05-19  2:00 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-05-11 21:20 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform, bleung, heikki.krogerus

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Prashant Malani <pmalani@chromium.org>:

On Mon,  8 May 2023 18:34:27 +0000 you 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>
> 
> [...]

Here is the summary with links:
  - platform/chrome: cros_typec_switch: Add Pin D support
    https://git.kernel.org/chrome-platform/c/c9f9c6c875d1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: cros_typec_switch: Add Pin D support
  2023-05-08 18:34 [PATCH] platform/chrome: cros_typec_switch: Add Pin D support Prashant Malani
  2023-05-09 12:38 ` Heikki Krogerus
  2023-05-11 21:20 ` patchwork-bot+chrome-platform
@ 2023-05-19  2:00 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-05-19  2:00 UTC (permalink / raw)
  To: Prashant Malani; +Cc: linux-kernel, chrome-platform, bleung, heikki.krogerus

Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Prashant Malani <pmalani@chromium.org>:

On Mon,  8 May 2023 18:34:27 +0000 you 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>
> 
> [...]

Here is the summary with links:
  - platform/chrome: cros_typec_switch: Add Pin D support
    https://git.kernel.org/chrome-platform/c/c9f9c6c875d1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-19  2:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08 18:34 [PATCH] platform/chrome: cros_typec_switch: Add Pin D support Prashant Malani
2023-05-09 12:38 ` Heikki Krogerus
2023-05-11 21:20 ` patchwork-bot+chrome-platform
2023-05-19  2:00 ` patchwork-bot+chrome-platform

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).