* [PATCH 0/2] usb: typec: tcpm: Handle Accessory Modes
@ 2023-11-20 23:11 Dmitry Baryshkov
2023-11-20 23:11 ` [PATCH 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
2023-11-20 23:11 ` [PATCH 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-11-20 23:11 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
linux-usb
In addition to Alternative Modes (see [1]), some of the TCPM-backed
boards (e.g. Qualcomm SM8150-HDK) can support USB-C Accessory Modes
(e.g. the Analog Audio). Add bindings and driver support for parsing
this kind of information.
Note, while it might make sense to put accessory-mode-audio and -debug
handling to typec_get_fw_cap(), I decided against it. Several existing
drivers use this function, while providing AccMode caps based on some
internal logic.
[1] https://lore.kernel.org/linux-usb/20231120224919.2293730-1-dmitry.baryshkov@linaro.org/
Dmitry Baryshkov (2):
dt-bindings: connector: usb: add accessory mode description
usb: typec: tcpm: Parse Accessory Mode information
.../devicetree/bindings/connector/usb-connector.yaml | 12 ++++++++++++
drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
2 files changed, 19 insertions(+)
--
2.42.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] dt-bindings: connector: usb: add accessory mode description
2023-11-20 23:11 [PATCH 0/2] usb: typec: tcpm: Handle Accessory Modes Dmitry Baryshkov
@ 2023-11-20 23:11 ` Dmitry Baryshkov
2023-11-20 23:11 ` [PATCH 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-11-20 23:11 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
linux-usb
Add description of the USB-C Accessory Modes supported on the particular
USB-C connector. This is required for devices like Qualcomm SM8150-HDK,
which have no other way to express accessory modes supported by the
hardware platform.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../devicetree/bindings/connector/usb-connector.yaml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
index c1aaac861d9d..b4f96ef85fb0 100644
--- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
+++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
@@ -171,6 +171,18 @@ properties:
offer the power, Capability Mismatch is set. Required for power sink and
power dual role.
+ accessory-mode-audio:
+ type: boolean
+ description: Whether the device supports Audio Adapter Accessory Mode. This
+ is only necessary if there are no other means to discover supported
+ alternative modes (e.g. through the UCSI firmware interface).
+
+ accessory-mode-debug:
+ type: boolean
+ description: Whether the device supports Debug Accessory Mode. This
+ is only necessary if there are no other means to discover supported
+ alternative modes (e.g. through the UCSI firmware interface).
+
altmodes:
type: object
description: List of Alternative Modes supported by the schematics on the
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] usb: typec: tcpm: Parse Accessory Mode information
2023-11-20 23:11 [PATCH 0/2] usb: typec: tcpm: Handle Accessory Modes Dmitry Baryshkov
2023-11-20 23:11 ` [PATCH 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
@ 2023-11-20 23:11 ` Dmitry Baryshkov
2023-11-21 9:24 ` Sergei Shtylyov
1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-11-20 23:11 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
linux-usb
Some of the boards supported by the TCPM drivers can support USB-C
Accessory Modes (Analog Audio, Debug). Parse information about supported
modes from the device tree.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 6e843c511b85..6297f803de53 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -6114,6 +6114,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
{
const char *opmode_str;
int ret;
+ int mode;
u32 mw, frs_current;
if (!fwnode)
@@ -6132,6 +6133,12 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
if (ret < 0)
return ret;
+ if (fwnode_property_read_bool(fwnode, "accessory-mode-audio"))
+ port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_AUDIO;
+
+ if (fwnode_property_read_bool(fwnode, "accessory-mode-debug"))
+ port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_DEBUG;
+
port->port_type = port->typec_caps.type;
port->pd_supported = !fwnode_property_read_bool(fwnode, "pd-disable");
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] usb: typec: tcpm: Parse Accessory Mode information
2023-11-20 23:11 ` [PATCH 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
@ 2023-11-21 9:24 ` Sergei Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2023-11-21 9:24 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andy Gross, Bjorn Andersson, Konrad Dybcio, Hans de Goede,
Ilpo Järvinen, Mark Gross, Heikki Krogerus,
Greg Kroah-Hartman
Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
linux-usb
On 11/21/23 2:11 AM, Dmitry Baryshkov wrote:
> Some of the boards supported by the TCPM drivers can support USB-C
> Accessory Modes (Analog Audio, Debug). Parse information about supported
> modes from the device tree.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 6e843c511b85..6297f803de53 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -6114,6 +6114,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
> {
> const char *opmode_str;
> int ret;
> + int mode;
> u32 mw, frs_current;
>
> if (!fwnode)
> @@ -6132,6 +6133,12 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
> if (ret < 0)
> return ret;
>
> + if (fwnode_property_read_bool(fwnode, "accessory-mode-audio"))
> + port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_AUDIO;
> +
> + if (fwnode_property_read_bool(fwnode, "accessory-mode-debug"))
> + port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_DEBUG;
> +
Hm, I don't see where that mode variable is initialized?
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-21 9:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 23:11 [PATCH 0/2] usb: typec: tcpm: Handle Accessory Modes Dmitry Baryshkov
2023-11-20 23:11 ` [PATCH 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
2023-11-20 23:11 ` [PATCH 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
2023-11-21 9:24 ` Sergei Shtylyov
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).