mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
charging: add battery ovp debounce
As some times charger pump detect vbat hight, so add battery ovp debounce to avoid stop charging. Change-Id: I6ed0bde0eb61232e368f31a3b308c948c05843b7 Signed-off-by: Haijian Ma <mahj8@motorola.com> Reviewed-on: https://gerrit.mot.com/2325324 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
eb88899d5c
commit
bebc619ba5
2 changed files with 32 additions and 10 deletions
|
|
@ -87,6 +87,7 @@ static int chrg_cv_delta_volt = 0;
|
|||
static int quit_slave_chrg_cnt = 0;
|
||||
static int batt_curr_roof = 0;
|
||||
static int pd_constant_power_cnt = 0;
|
||||
static int batt_ovp_cnt = 0;
|
||||
|
||||
static void mmi_chrg_sm_move_state(struct mmi_charger_manager *chip, pm_sm_state_t state)
|
||||
{
|
||||
|
|
@ -242,6 +243,7 @@ void mmi_chrg_enable_all_cp(struct mmi_charger_manager *chip, int val)
|
|||
#define DISABLE_CHRG_LIMIT -1
|
||||
#define CP_CHRG_SOC_LIMIT 90
|
||||
#define PD_CONT_PWR_CNT 5
|
||||
#define BATT_OVP_COUNT 5
|
||||
|
||||
static void clear_chg_manager(struct mmi_charger_manager *chip)
|
||||
{
|
||||
|
|
@ -396,16 +398,25 @@ void mmi_chrg_sm_work_func(struct work_struct *work)
|
|||
|
||||
if (chip->pres_temp_zone == ZONE_COLD
|
||||
|| chip->pres_temp_zone == ZONE_HOT
|
||||
|| !chrg_list->chrg_dev[PMIC_SW]->charger_enabled
|
||||
|| vbatt_volt > chip->batt_ovp_lmt) {
|
||||
|| !chrg_list->chrg_dev[PMIC_SW]->charger_enabled) {
|
||||
|
||||
mmi_chrg_info(chip, "Force stop charging, "
|
||||
"pres_temp_zone %d, "
|
||||
"pmic charger enabled %d, "
|
||||
"pmic charger enabled %d\n",
|
||||
chip->pres_temp_zone,
|
||||
chrg_list->chrg_dev[PMIC_SW]->charger_enabled);
|
||||
mmi_chrg_sm_move_state(chip, PM_STATE_STOP_CHARGE);
|
||||
}
|
||||
|
||||
if (vbatt_volt > chip->batt_ovp_lmt)
|
||||
batt_ovp_cnt ++;
|
||||
else
|
||||
batt_ovp_cnt = 0;
|
||||
|
||||
if (batt_ovp_cnt >= BATT_OVP_COUNT) {
|
||||
mmi_chrg_info(chip, "Force stop charging, "
|
||||
"vbatt_volt %dmv, "
|
||||
"batt ovp limit %dmv\n",
|
||||
chip->pres_temp_zone,
|
||||
chrg_list->chrg_dev[PMIC_SW]->charger_enabled,
|
||||
vbatt_volt, chip->batt_ovp_lmt);
|
||||
mmi_chrg_sm_move_state(chip, PM_STATE_STOP_CHARGE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ static int qc3p_chrg_cv_delta_volt = 0;
|
|||
static int qc3p_quit_slave_chrg_cnt = 0;
|
||||
static int qc3p_batt_curr_roof = 0;
|
||||
static int qc3p_constant_power_cnt = 0;
|
||||
static int qc3p_batt_ovp_cnt = 0;
|
||||
|
||||
static void mmi_chrg_qc3p_sm_move_state(struct mmi_charger_manager *chip, pm_sm_qc3p_state_t state)
|
||||
{
|
||||
|
|
@ -238,6 +239,7 @@ void mmi_qc3p_chrg_enable_all_cp(struct mmi_charger_manager *chip, int val)
|
|||
#define QC3P_CP_CHRG_SOC_LIMIT 90
|
||||
#define QC3P_CONT_PWR_CNT 5
|
||||
#define CP_CV_VOLT_TOLERANCE 10000 //10mV
|
||||
#define QC3P_BATT_OVP_COUNT 5
|
||||
|
||||
void qc3p_clear_chg_manager(struct mmi_charger_manager *chip)
|
||||
{
|
||||
|
|
@ -383,16 +385,25 @@ void mmi_qc3p_chrg_sm_work_func(struct work_struct *work)
|
|||
|
||||
if (chip->pres_temp_zone == ZONE_COLD
|
||||
|| chip->pres_temp_zone == ZONE_HOT
|
||||
|| !chrg_list->chrg_dev[PMIC_SW]->charger_enabled
|
||||
|| vbatt_volt > chip->batt_ovp_lmt) {
|
||||
|| !chrg_list->chrg_dev[PMIC_SW]->charger_enabled) {
|
||||
|
||||
mmi_chrg_info(chip, "Force stop charging, "
|
||||
"pres_temp_zone %d, "
|
||||
"pmic charger enabled %d, "
|
||||
"pmic charger enabled %d\n",
|
||||
chip->pres_temp_zone,
|
||||
chrg_list->chrg_dev[PMIC_SW]->charger_enabled);
|
||||
mmi_chrg_qc3p_sm_move_state(chip, PM_QC3P_STATE_STOP_CHARGE);
|
||||
}
|
||||
|
||||
if (vbatt_volt > chip->batt_ovp_lmt)
|
||||
qc3p_batt_ovp_cnt ++;
|
||||
else
|
||||
qc3p_batt_ovp_cnt = 0;
|
||||
|
||||
if (qc3p_batt_ovp_cnt >= QC3P_BATT_OVP_COUNT) {
|
||||
mmi_chrg_info(chip, "Force stop charging, "
|
||||
"vbatt_volt %dmv, "
|
||||
"batt ovp limit %dmv\n",
|
||||
chip->pres_temp_zone,
|
||||
chrg_list->chrg_dev[PMIC_SW]->charger_enabled,
|
||||
vbatt_volt, chip->batt_ovp_lmt);
|
||||
mmi_chrg_qc3p_sm_move_state(chip, PM_QC3P_STATE_STOP_CHARGE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue