mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
Driver: BD99955: Set minimum charge current & charge voltage values
If the charge current or charge voltage registers are set to zero then the
charger cuts the power to board. BD99955 does not support 0mA charge current
& 0mV charge voltage values hence set the charge current & charge voltage
to charger's minimum values.
BUG=chrome-os-partner:52050
BRANCH=none
TEST=Manually tested on Amenia. Board can boot without the battery.
Battery does not discharge when the charger current or charger
voltage is sent to 0 from the charger manager.
Change-Id: I8049525594d107d7ad1ff2f17e8df757ee86458c
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/337404
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
1a5fd44c31
commit
55032aa123
@@ -322,6 +322,9 @@ int charger_set_current(int current)
|
||||
/* Charge current step 64 mA */
|
||||
current &= ~0x3F;
|
||||
|
||||
if (current < bd99955_charger_info.current_min)
|
||||
current = bd99955_charger_info.current_min;
|
||||
|
||||
return ch_raw_write16(BD99955_CMD_CHG_CURRENT, current,
|
||||
BD99955_BAT_CHG_COMMAND);
|
||||
}
|
||||
@@ -334,21 +337,12 @@ int charger_get_voltage(int *voltage)
|
||||
|
||||
int charger_set_voltage(int voltage)
|
||||
{
|
||||
/*
|
||||
* The BD99955 will drop voltage to as low as requested. As the
|
||||
* charger state machine will pass in 0 voltage, protect the system
|
||||
* voltage by capping to the minimum. The reason is that the BD99955
|
||||
* only can regulate the system voltage which will kill the board's
|
||||
* power if below 0.
|
||||
*/
|
||||
if (voltage == 0) {
|
||||
const struct battery_info *bi = battery_get_info();
|
||||
|
||||
voltage = bi->voltage_min;
|
||||
}
|
||||
|
||||
/* Charge voltage step 16 mV */
|
||||
voltage &= ~0x0F;
|
||||
|
||||
if (voltage < bd99955_charger_info.voltage_min)
|
||||
voltage = bd99955_charger_info.voltage_min;
|
||||
|
||||
return ch_raw_write16(BD99955_CMD_CHG_VOLTAGE, voltage,
|
||||
BD99955_BAT_CHG_COMMAND);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ enum bd99955_charge_port {
|
||||
#define CHARGE_V_MIN 3072
|
||||
#define CHARGE_V_STEP 16
|
||||
#define CHARGE_I_MAX 16320
|
||||
#define CHARGE_I_MIN 0
|
||||
#define CHARGE_I_MIN 64
|
||||
#define CHARGE_I_OFF 0
|
||||
#define CHARGE_I_STEP 64
|
||||
#define INPUT_I_MAX 16352
|
||||
|
||||
Reference in New Issue
Block a user