usb: typec: ucsi: register with power_supply class
authorK V, Abhilash <abhilash.k.v@intel.com>
Thu, 23 Apr 2020 13:20:58 +0000 (16:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 13:33:34 +0000 (15:33 +0200)
commit992a60ed0d5e312ce9a485c9e12097ac82ae4b3e
tree6ae6067e0cf253d19bd95fb029b2d9a76a7a6395
parent4dbc6a4ef06d6a79ff91be6fc2e90f8660031ce0
usb: typec: ucsi: register with power_supply class

With this change the UCSI device will show up in
/sys/class/power_supply/. The following values are exported:
- online
- usb_type
- voltage_min
- voltage_max
- voltage_now
- current_max
- current_now

Once a PD-capable type-C power source is connected to the system, GET_PDOS
UCSI command is used to query all source capabilities. Request data object
(RDO) is used to get current values.

Signed-off-by: K V, Abhilash <abhilash.k.v@intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20200423132058.6972-7-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/Makefile
drivers/usb/typec/ucsi/psy.c [new file with mode: 0644]
drivers/usb/typec/ucsi/ucsi.c
drivers/usb/typec/ucsi/ucsi.h