Loading drivers/power/supply/qcom/smb5-lib.c +31 −0 Original line number Diff line number Diff line Loading @@ -7458,6 +7458,7 @@ static void apsd_timer_cb(struct timer_list *tm) chg->apsd_ext_timeout = true; } #define SOFT_JEITA_HYSTERESIS_OFFSET 0x200 static void jeita_update_work(struct work_struct *work) { struct smb_charger *chg = container_of(work, struct smb_charger, Loading @@ -7467,6 +7468,8 @@ static void jeita_update_work(struct work_struct *work) union power_supply_propval val; int rc, tmp[2], max_fcc_ma, max_fv_uv; u32 jeita_hard_thresholds[2]; u16 addr; u8 buff[2]; batt_node = of_find_node_by_name(node, "qcom,battery-data"); if (!batt_node) { Loading Loading @@ -7529,6 +7532,34 @@ static void jeita_update_work(struct work_struct *work) rc); goto out; } } else { /* Populate the jeita-soft-thresholds */ addr = CHGR_JEITA_THRESHOLD_BASE_REG(JEITA_SOFT); rc = smblib_batch_read(chg, addr, buff, 2); if (rc < 0) { pr_err("failed to read 0x%4X, rc=%d\n", addr, rc); goto out; } chg->jeita_soft_thlds[1] = buff[1] | buff[0] << 8; rc = smblib_batch_read(chg, addr + 2, buff, 2); if (rc < 0) { pr_err("failed to read 0x%4X, rc=%d\n", addr + 2, rc); goto out; } chg->jeita_soft_thlds[0] = buff[1] | buff[0] << 8; /* * Update the soft jeita hysteresis 2 DegC less for warm and * 2 DegC more for cool than the soft jeita thresholds to avoid * overwriting the registers with invalid values. */ chg->jeita_soft_hys_thlds[0] = chg->jeita_soft_thlds[0] - SOFT_JEITA_HYSTERESIS_OFFSET; chg->jeita_soft_hys_thlds[1] = chg->jeita_soft_thlds[1] + SOFT_JEITA_HYSTERESIS_OFFSET; } chg->jeita_soft_fcc[0] = chg->jeita_soft_fcc[1] = -EINVAL; Loading Loading
drivers/power/supply/qcom/smb5-lib.c +31 −0 Original line number Diff line number Diff line Loading @@ -7458,6 +7458,7 @@ static void apsd_timer_cb(struct timer_list *tm) chg->apsd_ext_timeout = true; } #define SOFT_JEITA_HYSTERESIS_OFFSET 0x200 static void jeita_update_work(struct work_struct *work) { struct smb_charger *chg = container_of(work, struct smb_charger, Loading @@ -7467,6 +7468,8 @@ static void jeita_update_work(struct work_struct *work) union power_supply_propval val; int rc, tmp[2], max_fcc_ma, max_fv_uv; u32 jeita_hard_thresholds[2]; u16 addr; u8 buff[2]; batt_node = of_find_node_by_name(node, "qcom,battery-data"); if (!batt_node) { Loading Loading @@ -7529,6 +7532,34 @@ static void jeita_update_work(struct work_struct *work) rc); goto out; } } else { /* Populate the jeita-soft-thresholds */ addr = CHGR_JEITA_THRESHOLD_BASE_REG(JEITA_SOFT); rc = smblib_batch_read(chg, addr, buff, 2); if (rc < 0) { pr_err("failed to read 0x%4X, rc=%d\n", addr, rc); goto out; } chg->jeita_soft_thlds[1] = buff[1] | buff[0] << 8; rc = smblib_batch_read(chg, addr + 2, buff, 2); if (rc < 0) { pr_err("failed to read 0x%4X, rc=%d\n", addr + 2, rc); goto out; } chg->jeita_soft_thlds[0] = buff[1] | buff[0] << 8; /* * Update the soft jeita hysteresis 2 DegC less for warm and * 2 DegC more for cool than the soft jeita thresholds to avoid * overwriting the registers with invalid values. */ chg->jeita_soft_hys_thlds[0] = chg->jeita_soft_thlds[0] - SOFT_JEITA_HYSTERESIS_OFFSET; chg->jeita_soft_hys_thlds[1] = chg->jeita_soft_thlds[1] + SOFT_JEITA_HYSTERESIS_OFFSET; } chg->jeita_soft_fcc[0] = chg->jeita_soft_fcc[1] = -EINVAL; Loading