linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] usb: typec: ucsi_ccg: Disable UCSI ALT support on Tegra
@ 2022-09-28 15:08 Wayne Chang
  2022-10-03  8:51 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Wayne Chang @ 2022-09-28 15:08 UTC (permalink / raw)
  To: heikki.krogerus, gregkh
  Cc: waynec, Sanket.Goswami, singhanc, linux-usb, linux-kernel

From: Sing-Han Chen <singhanc@nvidia.com>

Firmware built for Tegra doesn't support UCSI ALT command and has known
issue of reporting wrong capability info.

This commit disables UCSI ALT support when reading the capability on
Tegra.

Signed-off-by: Sing-Han Chen <singhanc@nvidia.com>
Signed-off-by: Wayne Chang <waynec@nvidia.com>
---
V1 -> V2: updated the commit message and removed the unnecessary changes for RTX
We are now enabling the NVIDIA Tegra products on upstream kernel.
The change is to add the Cypress cypd 4226 support for NVIDA Tegra
products including Xavier AGX, Xavier Orin and the upcoming products.
The Cypress cypd4226 is not enabled in current kernel codebase.
And thus, we shall not need it for stable kernels and backporting

 drivers/usb/typec/ucsi/ucsi_ccg.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 5c0bf48be766..cbd93f893e48 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -125,6 +125,11 @@ struct version_format {
 #define CCG_FW_BUILD_NVIDIA	(('n' << 8) | 'v')
 #define CCG_OLD_FW_VERSION	(CCG_VERSION(0x31) | CCG_VERSION_PATCH(10))
 
+/* Firmware for Tegra doesn't support UCSI ALT command, built
+ * for NVIDIA has known issue of reporting wrong capability info
+ */
+#define CCG_FW_BUILD_NVIDIA_TEGRA	(('g' << 8) | 'n')
+
 /* Altmode offset for NVIDIA Function Test Board (FTB) */
 #define NVIDIA_FTB_DP_OFFSET	(2)
 #define NVIDIA_FTB_DBG_OFFSET	(3)
@@ -513,6 +518,7 @@ static int ucsi_ccg_read(struct ucsi *ucsi, unsigned int offset,
 {
 	struct ucsi_ccg *uc = ucsi_get_drvdata(ucsi);
 	u16 reg = CCGX_RAB_UCSI_DATA_BLOCK(offset);
+	struct ucsi_capability *cap;
 	struct ucsi_altmode *alt;
 	int ret;
 
@@ -536,6 +542,12 @@ static int ucsi_ccg_read(struct ucsi *ucsi, unsigned int offset,
 				ucsi_ccg_nvidia_altmode(uc, alt);
 		}
 		break;
+	case UCSI_GET_CAPABILITY:
+		if (uc->fw_build == CCG_FW_BUILD_NVIDIA_TEGRA) {
+			cap = val;
+			cap->features &= ~UCSI_CAP_ALT_MODE_DETAILS;
+		}
+		break;
 	default:
 		break;
 	}
-- 
2.25.1


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

* Re: [PATCH v2 1/1] usb: typec: ucsi_ccg: Disable UCSI ALT support on Tegra
  2022-09-28 15:08 [PATCH v2 1/1] usb: typec: ucsi_ccg: Disable UCSI ALT support on Tegra Wayne Chang
@ 2022-10-03  8:51 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2022-10-03  8:51 UTC (permalink / raw)
  To: Wayne Chang; +Cc: gregkh, Sanket.Goswami, singhanc, linux-usb, linux-kernel

On Wed, Sep 28, 2022 at 11:08:40PM +0800, Wayne Chang wrote:
> From: Sing-Han Chen <singhanc@nvidia.com>
> 
> Firmware built for Tegra doesn't support UCSI ALT command and has known
> issue of reporting wrong capability info.
> 
> This commit disables UCSI ALT support when reading the capability on
> Tegra.
> 
> Signed-off-by: Sing-Han Chen <singhanc@nvidia.com>
> Signed-off-by: Wayne Chang <waynec@nvidia.com>

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

> ---
> V1 -> V2: updated the commit message and removed the unnecessary changes for RTX
> We are now enabling the NVIDIA Tegra products on upstream kernel.
> The change is to add the Cypress cypd 4226 support for NVIDA Tegra
> products including Xavier AGX, Xavier Orin and the upcoming products.
> The Cypress cypd4226 is not enabled in current kernel codebase.
> And thus, we shall not need it for stable kernels and backporting
> 
>  drivers/usb/typec/ucsi/ucsi_ccg.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> index 5c0bf48be766..cbd93f893e48 100644
> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> @@ -125,6 +125,11 @@ struct version_format {
>  #define CCG_FW_BUILD_NVIDIA	(('n' << 8) | 'v')
>  #define CCG_OLD_FW_VERSION	(CCG_VERSION(0x31) | CCG_VERSION_PATCH(10))
>  
> +/* Firmware for Tegra doesn't support UCSI ALT command, built
> + * for NVIDIA has known issue of reporting wrong capability info
> + */
> +#define CCG_FW_BUILD_NVIDIA_TEGRA	(('g' << 8) | 'n')
> +
>  /* Altmode offset for NVIDIA Function Test Board (FTB) */
>  #define NVIDIA_FTB_DP_OFFSET	(2)
>  #define NVIDIA_FTB_DBG_OFFSET	(3)
> @@ -513,6 +518,7 @@ static int ucsi_ccg_read(struct ucsi *ucsi, unsigned int offset,
>  {
>  	struct ucsi_ccg *uc = ucsi_get_drvdata(ucsi);
>  	u16 reg = CCGX_RAB_UCSI_DATA_BLOCK(offset);
> +	struct ucsi_capability *cap;
>  	struct ucsi_altmode *alt;
>  	int ret;
>  
> @@ -536,6 +542,12 @@ static int ucsi_ccg_read(struct ucsi *ucsi, unsigned int offset,
>  				ucsi_ccg_nvidia_altmode(uc, alt);
>  		}
>  		break;
> +	case UCSI_GET_CAPABILITY:
> +		if (uc->fw_build == CCG_FW_BUILD_NVIDIA_TEGRA) {
> +			cap = val;
> +			cap->features &= ~UCSI_CAP_ALT_MODE_DETAILS;
> +		}
> +		break;
>  	default:
>  		break;
>  	}

thanks,

-- 
heikki

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

end of thread, other threads:[~2022-10-03  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 15:08 [PATCH v2 1/1] usb: typec: ucsi_ccg: Disable UCSI ALT support on Tegra Wayne Chang
2022-10-03  8:51 ` Heikki Krogerus

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).