* [PATCH v2 0/2] usb: typec: tcpm: Handle Accessory Modes
@ 2023-11-21 20:26 Dmitry Baryshkov
2023-11-21 20:26 ` [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
2023-11-21 20:27 ` [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2023-11-21 20:26 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/
Changes since v1:
- Initialised the `mode' variable to 0 (Sergei Shtylyov)
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 | 9 +++++++++
2 files changed, 21 insertions(+)
--
2.42.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description
2023-11-21 20:26 [PATCH v2 0/2] usb: typec: tcpm: Handle Accessory Modes Dmitry Baryshkov
@ 2023-11-21 20:26 ` Dmitry Baryshkov
2023-11-27 20:05 ` Rob Herring
2023-12-04 13:31 ` Greg Kroah-Hartman
2023-11-21 20:27 ` [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
1 sibling, 2 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2023-11-21 20:26 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] 6+ messages in thread
* [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information
2023-11-21 20:26 [PATCH v2 0/2] usb: typec: tcpm: Handle Accessory Modes Dmitry Baryshkov
2023-11-21 20:26 ` [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
@ 2023-11-21 20:27 ` Dmitry Baryshkov
2023-11-24 9:31 ` Heikki Krogerus
1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Baryshkov @ 2023-11-21 20:27 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 | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 6e843c511b85..ba2926846269 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,14 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
if (ret < 0)
return ret;
+ mode = 0;
+
+ 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] 6+ messages in thread
* Re: [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information
2023-11-21 20:27 ` [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
@ 2023-11-24 9:31 ` Heikki Krogerus
0 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2023-11-24 9:31 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
Mark Gross, Greg Kroah-Hartman, devicetree, linux-kernel,
linux-arm-msm, platform-driver-x86, linux-usb
On Tue, Nov 21, 2023 at 10:27:00PM +0200, 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>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 6e843c511b85..ba2926846269 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,14 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
> if (ret < 0)
> return ret;
>
> + mode = 0;
> +
> + 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
--
heikki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description
2023-11-21 20:26 ` [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
@ 2023-11-27 20:05 ` Rob Herring
2023-12-04 13:31 ` Greg Kroah-Hartman
1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring @ 2023-11-27 20:05 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Conor Dooley, Mark Gross, Greg Kroah-Hartman, Andy Gross,
Bjorn Andersson, Hans de Goede, devicetree, Krzysztof Kozlowski,
Heikki Krogerus, Konrad Dybcio, linux-arm-msm, linux-usb,
Ilpo Järvinen, linux-kernel, platform-driver-x86,
Rob Herring
On Tue, 21 Nov 2023 22:26:59 +0200, Dmitry Baryshkov wrote:
> 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(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description
2023-11-21 20:26 ` [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
2023-11-27 20:05 ` Rob Herring
@ 2023-12-04 13:31 ` Greg Kroah-Hartman
1 sibling, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-04 13:31 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
Mark Gross, Heikki Krogerus, devicetree, linux-kernel,
linux-arm-msm, platform-driver-x86, linux-usb
On Tue, Nov 21, 2023 at 10:26:59PM +0200, Dmitry Baryshkov wrote:
> 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(+)
Does not apply to my tree, can you regenerate this against the next
linux-next and resend with the acks added?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-12-04 13:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21 20:26 [PATCH v2 0/2] usb: typec: tcpm: Handle Accessory Modes Dmitry Baryshkov
2023-11-21 20:26 ` [PATCH v2 1/2] dt-bindings: connector: usb: add accessory mode description Dmitry Baryshkov
2023-11-27 20:05 ` Rob Herring
2023-12-04 13:31 ` Greg Kroah-Hartman
2023-11-21 20:27 ` [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information Dmitry Baryshkov
2023-11-24 9:31 ` 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).