greybus: battery: Move request/response structure/definitions to greybus_protocols.h
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 12 Aug 2015 06:21:10 +0000 (11:51 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 13 Aug 2015 03:57:56 +0000 (20:57 -0700)
These must be exposed to external modules, like gbsim. Move them to
greybus_protocols.h file.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/battery.c
drivers/staging/greybus/greybus_protocols.h

index a56eb81b23862a29d9b5d502dbe61be5ec09fe92..6b354de146d1a5b473e7c51b5985c43c9f1c10a6 100644 (file)
@@ -35,61 +35,6 @@ struct gb_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 {
-       __le32  technology;
-};
-
-/* 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
-
-struct gb_battery_status_response {
-       __le16  battery_status;
-};
-
-struct gb_battery_max_voltage_response {
-       __le32  max_voltage;
-};
-
-struct gb_battery_capacity_response {
-       __le32  capacity;
-};
-
-struct gb_battery_temperature_response {
-       __le32  temperature;
-};
-
-struct gb_battery_voltage_response {
-       __le32  voltage;
-};
-
 static int get_tech(struct gb_battery *gb)
 {
        struct gb_battery_technology_response tech_response;
index 43a072881715786d528cb0dcf62a5840899384aa..e0aed3be21d08ff9049b34b21e360d597d4fb1f1 100644 (file)
@@ -200,6 +200,64 @@ 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 {
+       __le32  technology;
+};
+
+/* 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
+
+struct gb_battery_status_response {
+       __le16  battery_status;
+};
+
+struct gb_battery_max_voltage_response {
+       __le32  max_voltage;
+};
+
+struct gb_battery_capacity_response {
+       __le32  capacity;
+};
+
+struct gb_battery_temperature_response {
+       __le32  temperature;
+};
+
+struct gb_battery_voltage_response {
+       __le32  voltage;
+};
+
+
 /* I2C */
 
 /* Version of the Greybus i2c protocol we support */