OSDN Git Service

usb: typec: tcpm: Extend the matching rules on PPS APDO selection
authorKyle Tso <kyletso@google.com>
Mon, 17 Dec 2018 13:22:13 +0000 (21:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Dec 2018 07:13:26 +0000 (08:13 +0100)
commitc710d0bb76ff0795d8b6c1cda1e01e6e1e661a4a
tree9e542b9470f32745806a21b2459d3eec25f47492
parent28ce553985fa23815d942e8ad4294dec30645e5b
usb: typec: tcpm: Extend the matching rules on PPS APDO selection

Current matching rules ensure that the voltage range of selected Source
Capability is entirely within the range defined in one of the Sink
Capabilities. This is reasonable but not practical because Sink may not
support wide range of voltage when sinking power while Source could
advertise its capabilities in relatively wider range. For example, a
Source PDO advertising 3.3V-11V@3A (9V Prog of Fixed Nominal Voltage)
will not be selected if the Sink requires 5V-12V@3A PPS power. However,
the Sink could work well if the requested voltage range in RDOs is
5V-11V@3A.

Currently accepted:
|--------- source -----|
|----------- sink ---------------|

Currently not accepted:
|--------- source -----|
|----------- sink ---------------|

|--------- source -----|
|----------- sink ---------------|

|--------- source -----------------|
|------ sink -------|

To improve the usability, change the matching rules to what listed
below:
a. The Source PDO is selectable if any portion of the voltage range
   overlaps one of the Sink PDO's voltage range.
b. The maximum operational voltage will be the lower one between the
   selected Source PDO and the matching Sink PDO.
c. The maximum power will be the maximum operational voltage times the
   maximum current defined in the selected Source PDO
d. Select the Source PDO with the highest maximum power

Signed-off-by: Kyle Tso <kyletso@google.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c