staging: typec: fusb302: Export current-limit through a power_supply class dev
authorHans de Goede <hdegoede@redhat.com>
Wed, 30 Aug 2017 09:48:10 +0000 (11:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Aug 2017 16:26:10 +0000 (18:26 +0200)
commit4046c06fb11cbb5d90324da2df7e2acafcb9826c
treee0a4c755095cd76905bc99fdc6f3e64b33713d7b
parent382099d6bcffa13ea729ad5c8f0ae67fafbe563f
staging: typec: fusb302: Export current-limit through a power_supply class dev

The fusb302 Type-C port-controller cannot control the current-limit
directly, so we need to exported the limit so that another driver
(e.g. the charger driver) can pick the limit up and configure the
system accordingly.

The power-supply subsys already provides infrastructure for this,
power-supply devices have the notion of being supplied by another
power-supply and have properties through which we can export the
current-limit.

Register a power_supply and export the current-limit through the
power_supply's current-max property.

Cc: "Yueyao (Nathan) Zhu" <yueyao@google.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/typec/fusb302/Kconfig
drivers/staging/typec/fusb302/fusb302.c