power: supply: cros: add support for dedicated port
authorFabien Parent <fparent@baylibre.com>
Fri, 10 Aug 2018 13:13:48 +0000 (15:13 +0200)
committerSebastian Reichel <sre@kernel.org>
Sun, 16 Sep 2018 10:55:25 +0000 (12:55 +0200)
commit3af15cfacd1eef7f223802d49a88cae23c509183
treedbef476439df1c80c27fd06affc2f3e84e84b75f
parent36f47383c7f9fa0fdc20a92635435ff77ff71a6f
power: supply: cros: add support for dedicated port

ChromeOS devices can have one optional dedicated port.
The Dedicated port is unique and similar to the USB PD ports
except that it doesn't support as many properties.

The presence of a dedicated port is determined from whether the
EC's charger port count is equal to 'number of USB PD port' + 1.
The dedicated port ID is always the last valid port ID.

This commit keeps compatibility with Embedded Controllers that do not
support the new EC_CMD_CHARGE_PORT_COUNT command by setting
the number of charger port to be equal to the number of USB PD port
when this command fails.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/cros_usbpd-charger.c