Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit cee1c5e

Browse files
lumagTreehugger Robot
authored andcommitted
UPSTREAM: usb: typec: tcpm: Parse Accessory Mode information
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. Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20231215173005.313422-3-dmitry.baryshkov@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Bug: 206108037 (cherry picked from commit e9158c7) Signed-off-by: Kyle Tso <kyletso@google.com> (cherry picked from https://android-review.googlesource.com/q/commit:33854a1fee6cc57f82c14ea0d584d1f425a5d95e) Merged-In: Iece498046926d631d4a572152fbe41957b8354e4 Change-Id: Iece498046926d631d4a572152fbe41957b8354e4
1 parent f7bcb2b commit cee1c5e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6128,6 +6128,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
61286128
{
61296129
const char *opmode_str;
61306130
int ret;
6131+
int mode;
61316132
u32 mw, frs_current;
61326133

61336134
if (!fwnode)
@@ -6146,6 +6147,14 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
61466147
if (ret < 0)
61476148
return ret;
61486149

6150+
mode = 0;
6151+
6152+
if (fwnode_property_read_bool(fwnode, "accessory-mode-audio"))
6153+
port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_AUDIO;
6154+
6155+
if (fwnode_property_read_bool(fwnode, "accessory-mode-debug"))
6156+
port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_DEBUG;
6157+
61496158
port->port_type = port->typec_caps.type;
61506159
port->pd_supported = !fwnode_property_read_bool(fwnode, "pd-disable");
61516160

0 commit comments

Comments
 (0)