linux/drivers/usb/typec
Kyle Tso a07ddce4df usb: typec: tcpm: Correct the PPS out_volt calculation
When Sink negotiates PPS, the voltage range of selected PPS APDO might
not cover the previous voltage (out_volt). If the previous out_volt is
lower than the new min_volt, the output voltage in RDO might be set to
an invalid value. For instance, supposed that the previous voltage is
5V, and the new voltage range in the APDO is 7V-12V. Then the output
voltage in the RDO should not be set to 5V which is lower than the
possible min_volt 7V.

Fix this by choosing the maximal value between the previous voltage and
the new min_volt first. And ensure that this value will not exceed the
new max_volt. The new out_volt will fall within the new voltage range
while being the closest value compared to the previous out_volt.

Signed-off-by: Kyle Tso <kyletso@google.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Fixes: c710d0bb76 ("usb: typec: tcpm: Extend the matching rules on PPS APDO selection")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-31 09:14:00 +01:00
..
altmodes usb: typec: unlock dp->lock on error exit path, and also zero ret if successful 2018-07-06 16:36:19 +02:00
mux usb: typec: pi3usb30532: Start using generic state values 2018-07-02 17:42:36 +02:00
tcpm usb: typec: tcpm: Correct the PPS out_volt calculation 2019-01-31 09:14:00 +01:00
ucsi usb: typec: ucsi: add support for Cypress CCGx 2018-11-09 18:49:59 +01:00
bus.c usb/typec: fix kernel-doc notation warning for typec_match_altmode 2018-09-05 14:36:53 +02:00
bus.h usb: typec: avoid format-overflow warning 2018-07-06 16:36:19 +02:00
class.c usb: typec: Fix copy/paste on typec_set_vconn_role() kerneldoc 2018-10-09 16:05:41 +02:00
Kconfig usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
Makefile usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
mux.c usb: typec: mux: Take care of driver module reference counting 2018-09-20 13:35:01 +02:00
tps6598x.c ACPI / scan: Create platform device for INT3515 ACPI nodes 2018-12-03 21:40:03 +02:00