power: supply: cros: allow to set input voltage and current limit
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Tue, 7 May 2019 09:52:48 +0000 (11:52 +0200)
committerSebastian Reichel <sre@kernel.org>
Fri, 28 Jun 2019 15:28:27 +0000 (17:28 +0200)
commit2ffb500d824bbe6535c64d3e7e9971cca0db0a3e
tree5fcbf30bd0b5b075ebebb8f048b2ea1b8066f91b
parenta4496d52b3430cb3c4c16d03cdd5f4ee97ad1241
power: supply: cros: allow to set input voltage and current limit

This patch allows reading and writing the input voltage and current
limit through the POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT and
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT sysfs properties. This allows
userspace to see current values and to re-configure these values at
runtime based on system-level knowledge or user input.

By default there is no limit, this is reported as a -1 when reading from
userspace. Writing a value will set the current or voltage limit in uA
or uV, and writing any negative value will remove that limit.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/cros_usbpd-charger.c