summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-03-19 11:15:57 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-20 23:51:03 +0000
commitdefaf5cdb5a44067ea0f2d7f18fd57e240d992a6 (patch)
tree26abaf6936bd5bb998c0ab4d9d909261d3cee769 /include
parenta025f18673583e1c030aa006e0f0cebeea18c062 (diff)
downloadchrome-ec-defaf5cdb5a44067ea0f2d7f18fd57e240d992a6.tar.gz
Create stub files for charge_state_v2.c
Remove copied code from V1 implementation, reduce to bare minimum needed to satisfy external dependencies. Don't actually enable it for any platforms, though. BRANCH=ToT BUG=chrome-os-partner:23776 TEST=make buildall -j It's used by anything and doesn't do anything if it was, but test compilation of the changed sources by defining CONFIG_CHARGER_V2. Change-Id: Iea37d0b4fc48c8ebf7f7088cd1674d6e275d03d4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190853 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/charge_state.h79
-rw-r--r--include/charge_state_v1.h79
-rw-r--r--include/charge_state_v2.h14
3 files changed, 93 insertions, 79 deletions
diff --git a/include/charge_state.h b/include/charge_state.h
index 8c0f73952c..581acfd285 100644
--- a/include/charge_state.h
+++ b/include/charge_state.h
@@ -8,6 +8,85 @@
#include "common.h"
/* Stuff that's common to all charger implementations can go here. */
+/* Power states */
+enum charge_state {
+ /* Meta-state; unchanged from previous time through task loop */
+ PWR_STATE_UNCHANGE = 0,
+ /* Initializing charge state machine at boot */
+ PWR_STATE_INIT,
+ /* Re-initializing charge state machine */
+ PWR_STATE_REINIT,
+ /* Just transitioned from init to idle */
+ PWR_STATE_IDLE0,
+ /* Idle; AC present */
+ PWR_STATE_IDLE,
+ /* Discharging */
+ PWR_STATE_DISCHARGE,
+ /* Charging */
+ PWR_STATE_CHARGE,
+ /* Charging, almost fully charged */
+ PWR_STATE_CHARGE_NEAR_FULL,
+ /* Charging state machine error */
+ PWR_STATE_ERROR
+};
+
+/* Charge state flags */
+/* Forcing idle state */
+#define CHARGE_FLAG_FORCE_IDLE (1 << 0)
+/* External (AC) power is present */
+#define CHARGE_FLAG_EXTERNAL_POWER (1 << 1)
+
+/* Debugging constants, in the same order as enum charge_state. This string
+ * table was moved here to sync with enum above.
+ */
+#define CHARGE_STATE_NAME_TABLE { \
+ "unchange", \
+ "init", \
+ "reinit", \
+ "idle0", \
+ "idle", \
+ "discharge", \
+ "charge", \
+ "charge_near_full", \
+ "error" \
+ }
+ /* End of CHARGE_STATE_NAME_TABLE macro */
+
+
+/**
+ * Return current charge state.
+ */
+enum charge_state charge_get_state(void);
+
+/**
+ * Return non-zero if battery is so low we want to keep AP off.
+ */
+int charge_keep_power_off(void);
+
+/**
+ * Return current charge state flags (CHARGE_FLAG_*)
+ */
+uint32_t charge_get_flags(void);
+
+/**
+ * Return current battery charge percentage.
+ */
+int charge_get_percent(void);
+
+/**
+ * Return non-zero if discharging and battery so low we should shut down.
+ */
+int charge_want_shutdown(void);
+
+/**
+ * Get the last polled battery/charger temperature.
+ *
+ * @param idx Sensor index to read.
+ * @param temp_ptr Destination for temperature in K.
+ *
+ * @return EC_SUCCESS if successful, non-zero if error.
+ */
+int charge_temp_sensor_get_val(int idx, int *temp_ptr);
/* Pick the right implementation */
diff --git a/include/charge_state_v1.h b/include/charge_state_v1.h
index 29afd96a6e..d0637a2d21 100644
--- a/include/charge_state_v1.h
+++ b/include/charge_state_v1.h
@@ -40,50 +40,6 @@
#define F_CHARGER_MASK (F_CHARGER_VOLTAGE | F_CHARGER_CURRENT | \
F_CHARGER_INIT)
-/* Power states */
-enum charge_state {
- /* Meta-state; unchanged from previous time through task loop */
- PWR_STATE_UNCHANGE = 0,
- /* Initializing charge state machine at boot */
- PWR_STATE_INIT,
- /* Re-initializing charge state machine */
- PWR_STATE_REINIT,
- /* Just transitioned from init to idle */
- PWR_STATE_IDLE0,
- /* Idle; AC present */
- PWR_STATE_IDLE,
- /* Discharging */
- PWR_STATE_DISCHARGE,
- /* Charging */
- PWR_STATE_CHARGE,
- /* Charging, almost fully charged */
- PWR_STATE_CHARGE_NEAR_FULL,
- /* Charging state machine error */
- PWR_STATE_ERROR
-};
-
-/* Charge state flags */
-/* Forcing idle state */
-#define CHARGE_FLAG_FORCE_IDLE (1 << 0)
-/* External (AC) power is present */
-#define CHARGE_FLAG_EXTERNAL_POWER (1 << 1)
-
-/* Debugging constants, in the same order as enum charge_state. This string
- * table was moved here to sync with enum above.
- */
-#define CHARGE_STATE_NAME_TABLE { \
- "unchange", \
- "init", \
- "reinit", \
- "idle0", \
- "idle", \
- "discharge", \
- "charge", \
- "charge_near_full", \
- "error" \
- }
- /* End of CHARGE_STATE_NAME_TABLE macro */
-
/* Power state data
* Status collection of charging state machine.
*/
@@ -120,40 +76,5 @@ struct charge_state_context {
int battery_responsive;
};
-/**
- * Return current charge state.
- */
-enum charge_state charge_get_state(void);
-
-/**
- * Return non-zero if battery is so low we want to keep AP off.
- */
-int charge_keep_power_off(void);
-
-/**
- * Return current charge state flags (CHARGE_FLAG_*)
- */
-uint32_t charge_get_flags(void);
-
-/**
- * Return current battery charge percentage.
- */
-int charge_get_percent(void);
-
-/**
- * Return non-zero if discharging and battery so low we should shut down.
- */
-int charge_want_shutdown(void);
-
-/**
- * Get the last polled battery/charger temperature.
- *
- * @param idx Sensor index to read.
- * @param temp_ptr Destination for temperature in K.
- *
- * @return EC_SUCCESS if successful, non-zero if error.
- */
-int charge_temp_sensor_get_val(int idx, int *temp_ptr);
-
#endif /* __CROS_EC_CHARGE_STATE_V1_H */
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
new file mode 100644
index 0000000000..085f2a2047
--- /dev/null
+++ b/include/charge_state_v2.h
@@ -0,0 +1,14 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "battery.h"
+#include "timer.h"
+
+#ifndef __CROS_EC_CHARGE_STATE_V2_H
+#define __CROS_EC_CHARGE_STATE_V2_H
+
+
+#endif /* __CROS_EC_CHARGE_STATE_V2_H */
+