Commit 2724be03 authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman

greybus: battery: move implementation to power_supply

Rename protocol to POWER_SUPPLY and implementation details from battery
to power_supply.

Also fix some tabs between define and macro name.
Signed-off-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 46488841
......@@ -30,7 +30,7 @@ enum greybus_protocol {
GREYBUS_PROTOCOL_HID = 0x05,
GREYBUS_PROTOCOL_USB = 0x06,
GREYBUS_PROTOCOL_SDIO = 0x07,
GREYBUS_PROTOCOL_BATTERY = 0x08,
GREYBUS_PROTOCOL_POWER_SUPPLY = 0x08,
GREYBUS_PROTOCOL_PWM = 0x09,
/* 0x0a is unused */
GREYBUS_PROTOCOL_SPI = 0x0b,
......@@ -58,7 +58,7 @@ enum greybus_class_type {
GREYBUS_CLASS_HID = 0x05,
GREYBUS_CLASS_USB = 0x06,
GREYBUS_CLASS_SDIO = 0x07,
GREYBUS_CLASS_BATTERY = 0x08,
GREYBUS_CLASS_POWER_SUPPLY = 0x08,
GREYBUS_CLASS_PWM = 0x09,
/* 0x0a is unused */
GREYBUS_CLASS_SPI = 0x0b,
......
......@@ -198,60 +198,60 @@ struct gb_firmware_ready_to_boot_request {
/* Firmware protocol Ready to boot response has no payload */
/* BATTERY */
/* Version of the Greybus battery protocol we support */
#define GB_BATTERY_VERSION_MAJOR 0x00
#define GB_BATTERY_VERSION_MINOR 0x01
/* Greybus battery request types */
#define GB_BATTERY_TYPE_TECHNOLOGY 0x02
#define GB_BATTERY_TYPE_STATUS 0x03
#define GB_BATTERY_TYPE_MAX_VOLTAGE 0x04
#define GB_BATTERY_TYPE_PERCENT_CAPACITY 0x05
#define GB_BATTERY_TYPE_TEMPERATURE 0x06
#define GB_BATTERY_TYPE_VOLTAGE 0x07
#define GB_BATTERY_TYPE_CURRENT 0x08
#define GB_BATTERY_TYPE_CAPACITY 0x09 // TODO - POWER_SUPPLY_PROP_CURRENT_MAX
#define GB_BATTERY_TYPE_SHUTDOWN_TEMP 0x0a // TODO - POWER_SUPPLY_PROP_TEMP_ALERT_MAX
/* Should match up with battery types in linux/power_supply.h */
#define GB_BATTERY_TECH_UNKNOWN 0x0000
#define GB_BATTERY_TECH_NiMH 0x0001
#define GB_BATTERY_TECH_LION 0x0002
#define GB_BATTERY_TECH_LIPO 0x0003
#define GB_BATTERY_TECH_LiFe 0x0004
#define GB_BATTERY_TECH_NiCd 0x0005
#define GB_BATTERY_TECH_LiMn 0x0006
struct gb_battery_technology_response {
/* Power Supply */
/* Version of the Greybus power supply protocol we support */
#define GB_POWER_SUPPLY_VERSION_MAJOR 0x00
#define GB_POWER_SUPPLY_VERSION_MINOR 0x01
/* Greybus power supply request types */
#define GB_POWER_SUPPLY_TYPE_TECHNOLOGY 0x02
#define GB_POWER_SUPPLY_TYPE_STATUS 0x03
#define GB_POWER_SUPPLY_TYPE_MAX_VOLTAGE 0x04
#define GB_POWER_SUPPLY_TYPE_PERCENT_CAPACITY 0x05
#define GB_POWER_SUPPLY_TYPE_TEMPERATURE 0x06
#define GB_POWER_SUPPLY_TYPE_VOLTAGE 0x07
#define GB_POWER_SUPPLY_TYPE_CURRENT 0x08
#define GB_POWER_SUPPLY_TYPE_CAPACITY 0x09 // TODO - POWER_SUPPLY_PROP_CURRENT_MAX
#define GB_POWER_SUPPLY_TYPE_SHUTDOWN_TEMP 0x0a // TODO - POWER_SUPPLY_PROP_TEMP_ALERT_MAX
/* Should match up with battery technology types in linux/power_supply.h */
#define GB_POWER_SUPPLY_TECH_UNKNOWN 0x0000
#define GB_POWER_SUPPLY_TECH_NiMH 0x0001
#define GB_POWER_SUPPLY_TECH_LION 0x0002
#define GB_POWER_SUPPLY_TECH_LIPO 0x0003
#define GB_POWER_SUPPLY_TECH_LiFe 0x0004
#define GB_POWER_SUPPLY_TECH_NiCd 0x0005
#define GB_POWER_SUPPLY_TECH_LiMn 0x0006
struct gb_power_supply_technology_response {
__le32 technology;
} __packed;
/* Should match up with battery status in linux/power_supply.h */
#define GB_BATTERY_STATUS_UNKNOWN 0x0000
#define GB_BATTERY_STATUS_CHARGING 0x0001
#define GB_BATTERY_STATUS_DISCHARGING 0x0002
#define GB_BATTERY_STATUS_NOT_CHARGING 0x0003
#define GB_BATTERY_STATUS_FULL 0x0004
/* Should match up with power supply status in linux/power_supply.h */
#define GB_POWER_SUPPLY_STATUS_UNKNOWN 0x0000
#define GB_POWER_SUPPLY_STATUS_CHARGING 0x0001
#define GB_POWER_SUPPLY_STATUS_DISCHARGING 0x0002
#define GB_POWER_SUPPLY_STATUS_NOT_CHARGING 0x0003
#define GB_POWER_SUPPLY_STATUS_FULL 0x0004
struct gb_battery_status_response {
__le16 battery_status;
struct gb_power_supply_status_response {
__le16 psy_status;
} __packed;
struct gb_battery_max_voltage_response {
struct gb_power_supply_max_voltage_response {
__le32 max_voltage;
} __packed;
struct gb_battery_capacity_response {
struct gb_power_supply_capacity_response {
__le32 capacity;
} __packed;
struct gb_battery_temperature_response {
struct gb_power_supply_temperature_response {
__le32 temperature;
} __packed;
struct gb_battery_voltage_response {
struct gb_power_supply_voltage_response {
__le32 voltage;
} __packed;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment