summaryrefslogtreecommitdiff
path: root/include/charge_state.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-11-06 13:13:37 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-02 22:03:51 +0000
commitc0ec787ba10dd3ef5fc089cf1449468ec45ff668 (patch)
tree23c74570671da8750b1f299b6c9c7df1fe032943 /include/charge_state.h
parent5a3c90d5db8ce869cad977ed143a198e221689ae (diff)
downloadchrome-ec-c0ec787ba10dd3ef5fc089cf1449468ec45ff668.tar.gz
Add battery_get_params()
The charge state machine asks for all of this stuff at the same time anyway. Bundling it into a single function removes a number of redundant (and painfully slow) I2C reads. Also refactor the battery debug command so it doesn't have so many local variables all in one function; it was consuming considerably more stack space than any other debug command. Spring still needs low-level access to the smart battery, so move the two functions it needs directly into the Spring implementation. BUG=chrome-os-partner:20881 BRANCH=none TEST=charge/discharge rambi, pit and spring; watch debug messages and LED and output of 'battery' debug command. All should behave the same as before. Then run 'taskinfo' and see that the console task has at least 20 bytes unused. Change-Id: I951b569542e28bbbb58853d62b57b0aaaf183e3f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/177797
Diffstat (limited to 'include/charge_state.h')
-rw-r--r--include/charge_state.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/include/charge_state.h b/include/charge_state.h
index bd8e5d05e6..5a176c1b40 100644
--- a/include/charge_state.h
+++ b/include/charge_state.h
@@ -22,24 +22,21 @@
/* Power state error flags */
#define F_CHARGER_INIT (1 << 0) /* Charger initialization */
-#define F_CHARGER_VOLTAGE (1 << 1) /* Charger maximun output voltage */
+#define F_CHARGER_VOLTAGE (1 << 1) /* Charger maximum output voltage */
#define F_CHARGER_CURRENT (1 << 2) /* Charger maximum output current */
#define F_BATTERY_VOLTAGE (1 << 3) /* Battery voltage */
-#define F_BATTERY_CURRENT (1 << 4) /* Battery charging current */
-#define F_DESIRED_VOLTAGE (1 << 5) /* Battery desired voltage */
-#define F_DESIRED_CURRENT (1 << 6) /* Battery desired current */
-#define F_BATTERY_TEMPERATURE (1 << 7) /* Battery temperature */
#define F_BATTERY_MODE (1 << 8) /* Battery mode */
#define F_BATTERY_CAPACITY (1 << 9) /* Battery capacity */
#define F_BATTERY_STATE_OF_CHARGE (1 << 10) /* State of charge, percentage */
#define F_BATTERY_UNRESPONSIVE (1 << 11) /* Battery not responding */
#define F_BATTERY_NOT_CONNECTED (1 << 12) /* Battery not connected */
+#define F_BATTERY_GET_PARAMS (1 << 13) /* Any battery parameter bad */
-#define F_BATTERY_MASK (F_BATTERY_VOLTAGE | F_BATTERY_CURRENT | \
- F_DESIRED_VOLTAGE | F_DESIRED_CURRENT | \
- F_BATTERY_TEMPERATURE | F_BATTERY_MODE | \
+#define F_BATTERY_MASK (F_BATTERY_VOLTAGE | \
+ F_BATTERY_MODE | \
F_BATTERY_CAPACITY | F_BATTERY_STATE_OF_CHARGE | \
- F_BATTERY_UNRESPONSIVE | F_BATTERY_NOT_CONNECTED)
+ F_BATTERY_UNRESPONSIVE | F_BATTERY_NOT_CONNECTED | \
+ F_BATTERY_GET_PARAMS)
#define F_CHARGER_MASK (F_CHARGER_VOLTAGE | F_CHARGER_CURRENT | \
F_CHARGER_INIT)