[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210126084544.682641-4-kyletso@google.com>
Date: Tue, 26 Jan 2021 16:45:44 +0800
From: Kyle Tso <kyletso@...gle.com>
To: linux@...ck-us.net, heikki.krogerus@...ux.intel.com,
gregkh@...uxfoundation.org, robh+dt@...nel.org,
hdegoede@...hat.com, badhri@...gle.com
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, Kyle Tso <kyletso@...gle.com>
Subject: [PATCH 3/3] usb: typec: tcpm: Get Sink VDO from fwnode
Current design only allows TCPM to get the Sink VDO from TCPC configs.
Add an additional way from fwnode.
Signed-off-by: Kyle Tso <kyletso@...gle.com>
---
drivers/usb/typec/tcpm/tcpm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index c14cf7842520..7b797d14d9db 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5673,6 +5673,18 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
port->new_source_frs_current = frs_current;
}
+ ret = fwnode_property_read_u32_array(fwnode, "sink-vdos", NULL, 0);
+ if (ret <= 0 && ret != -EINVAL) {
+ return -EINVAL;
+ } else if (ret > 0) {
+ port->nr_snk_vdo = min(ret, VDO_MAX_OBJECTS);
+ ret = fwnode_property_read_u32_array(fwnode, "sink-vdos",
+ port->snk_vdo,
+ port->nr_snk_vdo);
+ if (ret < 0)
+ return -EINVAL;
+ }
+
return 0;
}
--
2.30.0.280.ga3ce27912f-goog
Powered by blists - more mailing lists