usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage

Current code mistakenly checks against max current to determine
order but this should be max voltage. This commit fixes the issue
so order is correctly determined, thus avoiding failure based on
a higher voltage PPS APDO having a lower maximum current output,
which is actually valid.

Fixes: 2eadc33f40 ("typec: tcpm: Add core support for sink side PPS")
Cc: <stable@vger.kernel.org>
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Adam Thomson 2018-09-21 16:04:11 +01:00 committed by Greg Kroah-Hartman
parent e0a2e73e50
commit 1b6af2f58c
1 changed files with 2 additions and 2 deletions

View File

@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS) if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
break; break;
if (pdo_pps_apdo_max_current(pdo[i]) < if (pdo_pps_apdo_max_voltage(pdo[i]) <
pdo_pps_apdo_max_current(pdo[i - 1])) pdo_pps_apdo_max_voltage(pdo[i - 1]))
return PDO_ERR_PPS_APDO_NOT_SORTED; return PDO_ERR_PPS_APDO_NOT_SORTED;
else if (pdo_pps_apdo_min_voltage(pdo[i]) == else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
pdo_pps_apdo_min_voltage(pdo[i - 1]) && pdo_pps_apdo_min_voltage(pdo[i - 1]) &&