usb: typec: tcpm: Use configured PD revision for negotiation
Subsystems (3)
PATCH 1/1 usb: typec: tcpm: Use configured PD revision for negotiation
Initialize negotiated_rev and negotiated_rev_prime based on the port's configured PD revision (rev_major) rather than always defaulting to PD_MAX_REV. This ensures ports start PD communication using their appropriate revision level.
This allows proper communication with devices that require specific PD revision levels, especially for the hardware designed for PD 1.0 or 2.0 specifications.
Signed-off-by Cosmo Chou <[email protected]>
Reviewed-by Heikki Krogerus <[email protected]>
Reviewed-by Badhri Jagan Sridharan <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
[Cosmo: Resolved merge conflicts for backport:
- Removed references to negotiated_rev_prime (not present in 6.6)]
Signed-off-by Cosmo Chou <[email protected]>
--- drivers/usb/typec/tcpm/tcpm.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +24 -2
@@ -296,6 +296,10 @@ struct pd_pps_data {bool active; }; +#define PD_CAP_REV10 0x1 +#define PD_CAP_REV20 0x2 +#define PD_CAP_REV30 0x3 +struct pd_revision_info {u8 rev_major;u8 rev_minor;
@@ -3925,6 +3929,24 @@ static void tcpm_set_initial_svdm_version(struct tcpm_port *port) } } +static void tcpm_set_initial_negotiated_rev (struct tcpm_port *port) +{ +switch (port->pd_rev.rev_major) { +case PD_CAP_REV10 : + port->negotiated_rev =PD_REV10 ; +break ; +case PD_CAP_REV20 : + port->negotiated_rev =PD_REV20 ; +break ; +case PD_CAP_REV30 : + port->negotiated_rev =PD_REV30 ; +break ; +default : + port->negotiated_rev =PD_MAX_REV ; +break ; + } +} +static void run_state_machine (struct tcpm_port *port) {int ret;
@@ -4042,7 +4064,7 @@ static void run_state_machine(struct tcpm_port *port)typec_set_pwr_opmode (port->typec_port, opmode); port->pwr_opmode =TYPEC_PWR_MODE_USB ; port->caps_count =0 ; - port->negotiated_rev =PD_MAX_REV ; +tcpm_set_initial_negotiated_rev (port); port->message_id =0 ; port->rx_msgid =-1 ; port->explicit_contract = false;
@@ -4283,7 +4305,7 @@ static void run_state_machine(struct tcpm_port *port) port->cc2 : port->cc1);typec_set_pwr_opmode (port->typec_port, opmode); port->pwr_opmode =TYPEC_PWR_MODE_USB ; - port->negotiated_rev =PD_MAX_REV ; +tcpm_set_initial_negotiated_rev (port); port->message_id =0 ; port->rx_msgid =-1 ; port->explicit_contract = false;
Signature · 1 line
2.43.0