summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver/charger/bd99955.c20
-rw-r--r--driver/charger/bd99955.h2
2 files changed, 8 insertions, 14 deletions
diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c
index 61dc4eaf31..e2d968c7f6 100644
--- a/driver/charger/bd99955.c
+++ b/driver/charger/bd99955.c
@@ -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);
}
diff --git a/driver/charger/bd99955.h b/driver/charger/bd99955.h
index aab249842c..cd9bfdfff5 100644
--- a/driver/charger/bd99955.h
+++ b/driver/charger/bd99955.h
@@ -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