From 2ab1b9bec32898885e4908cf8dc0675ddacf530a Mon Sep 17 00:00:00 2001 From: Kyle Tso Date: Fri, 5 Feb 2021 11:34:15 +0800 Subject: [PATCH] UPSTREAM: usb: typec: tcpm: Get Sink VDO from fwnode Commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration mechanism") removed the tcpc_config which includes the Sink VDO and it is not yet added back with fwnode. Add it now. Acked-by: Heikki Krogerus Signed-off-by: Kyle Tso Link: https://lore.kernel.org/r/20210205033415.3320439-8-kyletso@google.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit f5d1d63e7359c6b3c65097b4941756b3d8ac0be0 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Signed-off-by: Greg Kroah-Hartman Change-Id: I5ac46e01f3c8f3f616e81097bb013a4603e8fa05 --- drivers/usb/typec/tcpm/tcpm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 06e1e321babb..9973ead3fd98 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5778,6 +5778,20 @@ sink: port->new_source_frs_current = frs_current; } + /* sink-vdos is optional */ + ret = fwnode_property_count_u32(fwnode, "sink-vdos"); + if (ret < 0) + ret = 0; + + port->nr_snk_vdo = min(ret, VDO_MAX_OBJECTS); + if (port->nr_snk_vdo) { + ret = fwnode_property_read_u32_array(fwnode, "sink-vdos", + port->snk_vdo, + port->nr_snk_vdo); + if (ret < 0) + return ret; + } + return 0; }