usb: typec: tcpm: fix getting pd_revision

Move up getting pd_revision in case it would be skipped while
power-role is configured as source.

Fixes: 765b15bf79 ("usb: typec: tcpm: amend pd negotiated revision")
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Change-Id: I63d06d622cc00db6bacb301f6e61aba0a36cd854
This commit is contained in:
Frank Wang 2023-03-15 11:08:16 +08:00 committed by Tao Huang
parent b87d415824
commit adb1f241f3

View File

@ -6059,6 +6059,13 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
if (!fwnode)
return -EINVAL;
ret = fwnode_property_read_u32(fwnode, "pd-revision",
&pd_revision);
if (ret < 0)
port->typec_caps.pd_revision = 0x0300;
else
port->typec_caps.pd_revision = pd_revision & 0xffff;
/* USB data support is optional */
ret = fwnode_property_read_string(fwnode, "data-role", &cap_str);
if (ret == 0) {
@ -6162,13 +6169,6 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
return ret;
}
ret = fwnode_property_read_u32(fwnode, "pd-revision",
&pd_revision);
if (ret < 0)
port->typec_caps.pd_revision = 0x0300;
else
port->typec_caps.pd_revision = pd_revision & 0xffff;
return 0;
}