diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2016-08-03 14:26:22 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-03 19:41:02 -0700 |
commit | d93cbcff8df27a0b0a490e3caf24d87cc289c55b (patch) | |
tree | e6710941e23a0137f3611ee07c486cbe5d42084c | |
parent | d67f3aa1f60ff9abd4f03c58a103ab4eecf99e7f (diff) | |
download | chrome-ec-d93cbcff8df27a0b0a490e3caf24d87cc289c55b.tar.gz |
reef: Add code to read battery temperature
Reef doesn't have the battery temperature sense pin connected to
the charger, hence reading the battery temperature from the battery
registers.
BUG=chrome-os-partner:55834
BRANCH=none
TEST=Using 'battery' & 'temps' console command verified,
temperature readings are same from both the commands.
Change-Id: I897e453296151f31344f3e0434202baa67c7025d
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/365970
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
-rw-r--r-- | board/reef/board.c | 11 | ||||
-rw-r--r-- | driver/charger/bd99955.c | 4 | ||||
-rw-r--r-- | driver/charger/bd99955.h | 2 | ||||
-rw-r--r-- | include/config.h | 6 |
4 files changed, 11 insertions, 12 deletions
diff --git a/board/reef/board.c b/board/reef/board.c index 19a3ccfcf2..eab9828a94 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -249,15 +249,6 @@ void board_tcpc_init(void) } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1); -int board_get_battery_temp(int idx, int *temp_ptr) -{ - if (bd99955_get_temp(temp_ptr) < 0) - return -1; - - *temp_ptr = C_TO_K(*temp_ptr); - return 0; -} - /* * Data derived from Seinhart-Hart equation in a resistor divider circuit with * Vdd=3300mV, R = 13.7Kohm, and Murata NCP15WB-series thermistor (B = 4050, @@ -325,7 +316,7 @@ int board_get_ambient_temp(int idx, int *temp_ptr) const struct temp_sensor_t temp_sensors[] = { /* FIXME(dhendrix): tweak action_delay_sec */ - {"Battery", TEMP_SENSOR_TYPE_BATTERY, board_get_battery_temp, 0, 1}, + {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val, 0, 1}, {"Ambient", TEMP_SENSOR_TYPE_BOARD, board_get_ambient_temp, 0, 5}, {"Charger", TEMP_SENSOR_TYPE_BOARD, board_get_charger_temp, 1, 1}, }; diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c index a4eb1c07ca..cac77ab322 100644 --- a/driver/charger/bd99955.c +++ b/driver/charger/bd99955.c @@ -813,7 +813,8 @@ int bd99955_select_input_port(enum bd99955_charge_port port) BD99955_EXTENDED_COMMAND); } -int bd99955_get_temp(int *temp_ptr) +#ifdef CONFIG_CHARGER_BATTERY_TSENSE +int bd99955_get_battery_temp(int *temp_ptr) { int rv; @@ -826,6 +827,7 @@ int bd99955_get_temp(int *temp_ptr) *temp_ptr = 200 - *temp_ptr; return EC_SUCCESS; } +#endif #ifdef HAS_TASK_USB_CHG int bd99955_bc12_enable_charging(enum bd99955_charge_port port, int enable) diff --git a/driver/charger/bd99955.h b/driver/charger/bd99955.h index 214a20fd7b..f9c95d7663 100644 --- a/driver/charger/bd99955.h +++ b/driver/charger/bd99955.h @@ -296,6 +296,6 @@ int bd99955_bc12_enable_charging(enum bd99955_charge_port port, int enable); /* Interrupt handler for USB charger VBUS */ void bd99955_vbus_interrupt(enum gpio_signal signal); /* Read temperature measurement value (in Celsius) */ -int bd99955_get_temp(int *temp_ptr); +int bd99955_get_battery_temp(int *temp_ptr); #endif /* __CROS_EC_BD99955_H */ diff --git a/include/config.h b/include/config.h index 0142e1286c..182d56ba78 100644 --- a/include/config.h +++ b/include/config.h @@ -364,6 +364,12 @@ #undef CONFIG_CHARGER_TPS65090 /* Note: does not use CONFIG_CHARGER */ /* + * If the battery temperature sense pin is connected to charger, + * get the battery temperature from the charger. + */ +#undef CONFIG_CHARGER_BATTERY_TSENSE + +/* * BQ2589x IR Compensation settings. * Should be the combination of BQ2589X_IR_TREG_xxxC, BQ2589X_IR_VCLAMP_yyyMV * and BQ2589X_IR_BAT_COMP_zzzMOHM. |