* [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values
@ 2025-09-26 12:32 Konrad Dybcio
2025-10-02 11:19 ` Tzung-Bi Shih
2025-10-08 10:41 ` Heikki Krogerus
0 siblings, 2 replies; 4+ messages in thread
From: Konrad Dybcio @ 2025-09-26 12:32 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Benson Leung,
Abhishek Pandit-Subedi, Jameson Thies, Andrei Kuchynski,
Tzung-Bi Shih, Guenter Roeck
Cc: linux-usb, linux-kernel, chrome-platform, Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
The value has been amended with the release of the USB Type-C
Specification v2.1, reportedly as an erratum.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
I bundled a change to the CrOS EC driver based on the assumption that
it worked around the faulty definition. I see the Intel PMC mux driver
also checks for this bit, but it seems like that driver assumes that
the value is in-spec (i.e. it may be buggy as of right now).
Adding the respective maintainers to make sure everyone can see this.
---
| 2 +-
| 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index b712bcff6fb2674ec79286159090df6d79b32e9a..d80f3de1b87c362a2825bd19f826c5be077583aa 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -585,7 +585,7 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec,
data.device_mode = TBT_MODE;
if (pd_ctrl->control_flags & USB_PD_CTRL_TBT_LEGACY_ADAPTER)
- data.device_mode = TBT_SET_ADAPTER(TBT_ADAPTER_TBT3);
+ data.device_mode = TBT_SET_ADAPTER(TBT_ADAPTER_LEGACY);
/* Cable Discover Mode VDO */
data.cable_mode = TBT_MODE;
--git a/include/linux/usb/typec_tbt.h b/include/linux/usb/typec_tbt.h
index 55dcea12082c80defeb6f199ad333279b58adcd7..6bf208c9dd5037f162678bc0be5be7ae1ca0deca 100644
--- a/include/linux/usb/typec_tbt.h
+++ b/include/linux/usb/typec_tbt.h
@@ -27,8 +27,8 @@ struct typec_thunderbolt_data {
/* TBT3 Device Discover Mode VDO bits */
#define TBT_MODE BIT(0)
#define TBT_ADAPTER(_vdo_) FIELD_GET(BIT(16), _vdo_)
-#define TBT_ADAPTER_LEGACY 0
-#define TBT_ADAPTER_TBT3 1
+#define TBT_ADAPTER_TBT3 0
+#define TBT_ADAPTER_LEGACY 1
#define TBT_INTEL_SPECIFIC_B0 BIT(26)
#define TBT_VENDOR_SPECIFIC_B0 BIT(30)
#define TBT_VENDOR_SPECIFIC_B1 BIT(31)
---
base-commit: 8e2755d7779a95dd61d8997ebce33ff8b1efd3fb
change-id: 20250926-topic-tbt_header_bit_fix-17aeb524df4a
Best regards,
--
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values
2025-09-26 12:32 [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values Konrad Dybcio
@ 2025-10-02 11:19 ` Tzung-Bi Shih
2025-10-02 19:30 ` Jameson Thies
2025-10-08 10:41 ` Heikki Krogerus
1 sibling, 1 reply; 4+ messages in thread
From: Tzung-Bi Shih @ 2025-10-02 11:19 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Heikki Krogerus, Greg Kroah-Hartman, Benson Leung,
Abhishek Pandit-Subedi, Jameson Thies, Andrei Kuchynski,
Guenter Roeck, linux-usb, linux-kernel, chrome-platform,
Konrad Dybcio
On Fri, Sep 26, 2025 at 02:32:57PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> The value has been amended with the release of the USB Type-C
> Specification v2.1, reportedly as an erratum.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> I bundled a change to the CrOS EC driver based on the assumption that
> it worked around the faulty definition. I see the Intel PMC mux driver
> also checks for this bit, but it seems like that driver assumes that
> the value is in-spec (i.e. it may be buggy as of right now).
>
> Adding the respective maintainers to make sure everyone can see this.
I have no context to review the patch. However, the prefix of patch title
should be "platform/chrome: cros_ec_typec:".
Hi CHROMEOS EC USB TYPE-C maintainers,
Does the patch make sense to you?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values
2025-10-02 11:19 ` Tzung-Bi Shih
@ 2025-10-02 19:30 ` Jameson Thies
0 siblings, 0 replies; 4+ messages in thread
From: Jameson Thies @ 2025-10-02 19:30 UTC (permalink / raw)
To: Tzung-Bi Shih
Cc: Konrad Dybcio, Heikki Krogerus, Greg Kroah-Hartman, Benson Leung,
Abhishek Pandit-Subedi, Andrei Kuchynski, Guenter Roeck,
linux-usb, linux-kernel, chrome-platform, Konrad Dybcio
Hi Konrad,
thanks for raising this. Yes, it looks like this works around the
current faulty definitions in typec_tbt.h. Where
pd_ctrl->control_flags is assigned in our EC firmware, the
USB_PD_CTRL_TBT_LEGACY_ADAPTER correctly gets set to 1 for TBT2 legacy
adapters. So the data.device_mode assignment you are updating here is
currently correct even though the macro is incorrect. Your patch LGTM.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values
2025-09-26 12:32 [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values Konrad Dybcio
2025-10-02 11:19 ` Tzung-Bi Shih
@ 2025-10-08 10:41 ` Heikki Krogerus
1 sibling, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2025-10-08 10:41 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Greg Kroah-Hartman, Benson Leung, Abhishek Pandit-Subedi,
Jameson Thies, Andrei Kuchynski, Tzung-Bi Shih, Guenter Roeck,
linux-usb, linux-kernel, chrome-platform, Konrad Dybcio
On Fri, Sep 26, 2025 at 02:32:57PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> The value has been amended with the release of the USB Type-C
> Specification v2.1, reportedly as an erratum.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Makes sense to me. FWIW:
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> I bundled a change to the CrOS EC driver based on the assumption that
> it worked around the faulty definition. I see the Intel PMC mux driver
> also checks for this bit, but it seems like that driver assumes that
> the value is in-spec (i.e. it may be buggy as of right now).
>
> Adding the respective maintainers to make sure everyone can see this.
> ---
> drivers/platform/chrome/cros_ec_typec.c | 2 +-
> include/linux/usb/typec_tbt.h | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index b712bcff6fb2674ec79286159090df6d79b32e9a..d80f3de1b87c362a2825bd19f826c5be077583aa 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -585,7 +585,7 @@ static int cros_typec_enable_tbt(struct cros_typec_data *typec,
> data.device_mode = TBT_MODE;
>
> if (pd_ctrl->control_flags & USB_PD_CTRL_TBT_LEGACY_ADAPTER)
> - data.device_mode = TBT_SET_ADAPTER(TBT_ADAPTER_TBT3);
> + data.device_mode = TBT_SET_ADAPTER(TBT_ADAPTER_LEGACY);
>
> /* Cable Discover Mode VDO */
> data.cable_mode = TBT_MODE;
> diff --git a/include/linux/usb/typec_tbt.h b/include/linux/usb/typec_tbt.h
> index 55dcea12082c80defeb6f199ad333279b58adcd7..6bf208c9dd5037f162678bc0be5be7ae1ca0deca 100644
> --- a/include/linux/usb/typec_tbt.h
> +++ b/include/linux/usb/typec_tbt.h
> @@ -27,8 +27,8 @@ struct typec_thunderbolt_data {
> /* TBT3 Device Discover Mode VDO bits */
> #define TBT_MODE BIT(0)
> #define TBT_ADAPTER(_vdo_) FIELD_GET(BIT(16), _vdo_)
> -#define TBT_ADAPTER_LEGACY 0
> -#define TBT_ADAPTER_TBT3 1
> +#define TBT_ADAPTER_TBT3 0
> +#define TBT_ADAPTER_LEGACY 1
> #define TBT_INTEL_SPECIFIC_B0 BIT(26)
> #define TBT_VENDOR_SPECIFIC_B0 BIT(30)
> #define TBT_VENDOR_SPECIFIC_B1 BIT(31)
>
> ---
> base-commit: 8e2755d7779a95dd61d8997ebce33ff8b1efd3fb
> change-id: 20250926-topic-tbt_header_bit_fix-17aeb524df4a
>
> Best regards,
> --
> Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-08 10:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 12:32 [PATCH RFC] usb: typec: thunderbolt: Fix Thunderbolt adapter type bitfield values Konrad Dybcio
2025-10-02 11:19 ` Tzung-Bi Shih
2025-10-02 19:30 ` Jameson Thies
2025-10-08 10:41 ` 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).