diff options
author | David Lin <dtwlin@google.com> | 2016-04-07 20:15:30 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-04-07 21:37:59 -0700 |
commit | ddb10c8acc8554ffb68bdb6d80d0e277e124cb2b (patch) | |
tree | 93c3a6e93f4b5fbe6bdab7993c66863a77a55872 /drivers/staging/greybus/greybus_protocols.h | |
parent | 89de9a06213240b9266f9f368a867cf90d0024bf (diff) | |
download | op-kernel-dev-ddb10c8acc8554ffb68bdb6d80d0e277e124cb2b.zip op-kernel-dev-ddb10c8acc8554ffb68bdb6d80d0e277e124cb2b.tar.gz |
greybus: svc: add Interface power measurements support
This change implements the AP Power Monitor functions for obtaining
current/voltage/power on a specific rail of an Interface.
Testing Done:
$ cat /sys/bus/greybus/devices/1-3/current_now
103
$ cat /sys/bus/greybus/devices/1-3/power_now
303
$ cat /sys/bus/greybus/devices/1-3/voltage_now
203
Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/greybus_protocols.h')
-rw-r--r-- | drivers/staging/greybus/greybus_protocols.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 959ff1b..e3ef3c9 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -798,6 +798,10 @@ struct gb_spi_transfer_response { #define GB_SVC_TYPE_INTF_EJECT 0x11 #define GB_SVC_TYPE_KEY_EVENT 0x12 #define GB_SVC_TYPE_PING 0x13 +#define GB_SVC_TYPE_PWRMON_RAIL_COUNT_GET 0x14 +#define GB_SVC_TYPE_PWRMON_RAIL_NAMES_GET 0x15 +#define GB_SVC_TYPE_PWRMON_SAMPLE_GET 0x16 +#define GB_SVC_TYPE_PWRMON_INTF_SAMPLE_GET 0x17 /* * SVC version request/response has the same payload as @@ -963,6 +967,25 @@ struct gb_svc_key_event_request { #define GB_SVC_KEY_PRESSED 0x01 } __packed; +#define GB_SVC_PWRMON_TYPE_CURR 0x01 +#define GB_SVC_PWRMON_TYPE_VOL 0x02 +#define GB_SVC_PWRMON_TYPE_PWR 0x03 + +#define GB_SVC_PWRMON_GET_SAMPLE_OK 0x00 +#define GB_SVC_PWRMON_GET_SAMPLE_INVAL 0x01 +#define GB_SVC_PWRMON_GET_SAMPLE_NOSUPP 0x02 +#define GB_SVC_PWRMON_GET_SAMPLE_HWERR 0x03 + +struct gb_svc_pwrmon_intf_sample_get_request { + __u8 intf_id; + __u8 measurement_type; +} __packed; + +struct gb_svc_pwrmon_intf_sample_get_response { + __u8 result; + __le32 measurement; +} __packed; + /* RAW */ /* Version of the Greybus raw protocol we support */ |