2021-01-27 06:04:26

by Kyle Tso

[permalink] [raw]
Subject: [PATCH 0/3] common SVDM version and VDO from dt

The correct SVDM version we should use is the lowest common version
between the port partners (plug) as stated in the PD3 Spec 6.4.4.2.3.
It is determined in the Discovery Identity command so cache it and set
the value to the version field of the VDM header in every later SVDM.

Like the previous patch "usb: typec: tcpm: Create legacy PDOs for PD2
connection"
(https://lore.kernel.org/linux-usb/[email protected]/)
The field is changed before sending it out of the port. I know this is
not a good idea but at least it works.

The other two patches are about to get the VDO from fwnode so as to give
more flexibility.

Kyle Tso (3):
usb: typec: Determine common SVDM Versions
dt-bindings: connector: Add SVDM VDO properties
usb: typec: tcpm: Get Sink VDO from fwnode

drivers/usb/typec/altmodes/displayport.c | 6 ++-
drivers/usb/typec/class.c | 8 ++--
drivers/usb/typec/tcpm/tcpm.c | 56 ++++++++++++++++++++----
drivers/usb/typec/ucsi/displayport.c | 12 +++--
include/dt-bindings/usb/pd.h | 53 +++++++++++++++++++++-
include/linux/usb/pd_vdo.h | 40 ++++++++++++-----
6 files changed, 147 insertions(+), 28 deletions(-)

--
2.30.0.280.ga3ce27912f-goog


2021-01-27 06:06:28

by Kyle Tso

[permalink] [raw]
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 <[email protected]>
---
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