diff options
Diffstat (limited to 'board/taeko/battery.c')
-rw-r--r-- | board/taeko/battery.c | 110 |
1 files changed, 73 insertions, 37 deletions
diff --git a/board/taeko/battery.c b/board/taeko/battery.c index fde02cc6c4..1244044f0a 100644 --- a/board/taeko/battery.c +++ b/board/taeko/battery.c @@ -5,10 +5,11 @@ * Battery pack vendor provided charging profile */ +#include "battery.h" #include "battery_fuel_gauge.h" +#include "battery_smart.h" #include "common.h" -#include "compile_time_macros.h" - +#include "util.h" /* * Battery info for all Taeko battery types. Note that the fields * start_charging_min/max and charging_min/max are not used for the charger. @@ -32,67 +33,102 @@ * address, mask, and disconnect value need to be provided. */ const struct board_batt_params board_battery_info[] = { - /* POW-TECH GQA05 Battery Information */ - [BATTERY_POWER_TECH] = { - /* BQ40Z50 Fuel Gauge */ + [BATTERY_SMP] = { .fuel_gauge = { - .manuf_name = "POW-TECH", - .device_name = "BATGQA05L22", + .manuf_name = "SMP", + .device_name = "L19M4PG2", .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, + .reg_addr = 0x34, + .reg_data = { 0x0000, 0x1000 }, }, .fet = { - .mfgacc_support = 1, - .reg_addr = 0x00, - .reg_mask = 0x2000, /* XDSG */ - .disconnect_val = 0x2000, + .reg_addr = 0x34, + .reg_mask = 0x0100, + .disconnect_val = 0x0100, } }, .batt_info = { - .voltage_max = TARGET_WITH_MARGIN(13050, 5), - .voltage_normal = 11400, /* mV */ - .voltage_min = 9000, /* mV */ - .precharge_current = 280, /* mA */ + .voltage_max = 8800, /* mV */ + .voltage_normal = 7680, /* mV */ + .voltage_min = 6000, /* mV */ + .precharge_current = 332, /* mA */ .start_charging_min_c = 0, - .start_charging_max_c = 45, + .start_charging_max_c = 50, .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, + .charging_max_c = 60, + .discharging_min_c = -20, .discharging_max_c = 60, }, }, - /* LGC L17L3PB0 Battery Information */ - /* - * Battery info provided by ODM on b/143477210, comment #11 - */ - [BATTERY_LGC011] = { + [BATTERY_LGC] = { .fuel_gauge = { .manuf_name = "LGC", + .device_name = "L19L4PG2", .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, + .reg_addr = 0x34, + .reg_data = { 0x0000, 0x1000 }, }, .fet = { - .reg_addr = 0x0, - .reg_mask = 0x6000, - .disconnect_val = 0x6000, + .reg_addr = 0x34, + .reg_mask = 0x0100, + .disconnect_val = 0x0100, } }, .batt_info = { - .voltage_max = TARGET_WITH_MARGIN(13200, 5), - .voltage_normal = 11550, /* mV */ - .voltage_min = 9000, /* mV */ + .voltage_max = 8800, /* mV */ + .voltage_normal = 7700, /* mV */ + /* + * voltage min value and precharge current value are + * specified by LGC directly and not shown in the SPEC. + */ + .voltage_min = 6000, /* mV */ .precharge_current = 256, /* mA */ .start_charging_min_c = 0, - .start_charging_max_c = 45, + .start_charging_max_c = 50, .charging_min_c = 0, .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 75, + .discharging_min_c = -20, + .discharging_max_c = 73, + }, + }, + [BATTERY_SUNWODA] = { + .fuel_gauge = { + .manuf_name = "SUNWODA", + .device_name = "L19D4PG2", + .ship_mode = { + .reg_addr = 0x34, + .reg_data = { 0x0000, 0x1000 }, + }, + .fet = { + .reg_addr = 0x34, + .reg_mask = 0x0100, + .disconnect_val = 0x0100, + } + }, + .batt_info = { + .voltage_max = 8800, /* mV */ + .voltage_normal = 7680, /* mV */ + .voltage_min = 6000, /* mV */ + .precharge_current = 333, /* mA */ + .start_charging_min_c = 0, + .start_charging_max_c = 50, + .charging_min_c = 0, + .charging_max_c = 60, + .discharging_min_c = -20, + .discharging_max_c = 60, }, }, }; BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_POWER_TECH; +const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SMP; + +__override bool board_battery_is_initialized(void) +{ + bool batt_initialization_state; + int batt_status; + + batt_initialization_state = (battery_status(&batt_status) ? false : + !!(batt_status & STATUS_INITIALIZED)); + return batt_initialization_state; +} |