Merge "qpnp-smb2: add support to configure auto recharge"
This commit is contained in:
commit
24f3e90971
2 changed files with 34 additions and 1 deletions
|
@ -138,6 +138,14 @@ Charger specific properties:
|
|||
then charge inhibit will be disabled by default.
|
||||
Allowed values are: 50, 100, 200, 300.
|
||||
|
||||
- qcom,auto-recharge-soc
|
||||
Usage: optional
|
||||
Value type: <empty>
|
||||
Definition: Specifies if automatic recharge needs to be based off battery
|
||||
SOC. If this property is not specified, then auto recharge will
|
||||
be based off battery voltage. For both SOC and battery voltage,
|
||||
charger receives the signal from FG to resume charging.
|
||||
|
||||
=============================================
|
||||
Second Level Nodes - SMB2 Charger Peripherals
|
||||
=============================================
|
||||
|
|
|
@ -214,7 +214,6 @@ static struct smb_params v1_params = {
|
|||
|
||||
#define STEP_CHARGING_MAX_STEPS 5
|
||||
struct smb_dt_props {
|
||||
bool no_battery;
|
||||
int fcc_ua;
|
||||
int usb_icl_ua;
|
||||
int otg_cl_ua;
|
||||
|
@ -226,7 +225,9 @@ struct smb_dt_props {
|
|||
struct device_node *revid_dev_node;
|
||||
int float_option;
|
||||
int chg_inhibit_thr_mv;
|
||||
bool no_battery;
|
||||
bool hvdcp_disable;
|
||||
bool auto_recharge_soc;
|
||||
};
|
||||
|
||||
struct smb2 {
|
||||
|
@ -344,6 +345,8 @@ static int smb2_parse_dt(struct smb2 *chip)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
chip->dt.auto_recharge_soc = of_property_read_bool(node,
|
||||
"qcom,auto-recharge-soc");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1295,6 +1298,28 @@ static int smb2_init_hw(struct smb2 *chip)
|
|||
return rc;
|
||||
}
|
||||
|
||||
if (chip->dt.auto_recharge_soc) {
|
||||
rc = smblib_masked_write(chg, FG_UPDATE_CFG_2_SEL_REG,
|
||||
SOC_LT_CHG_RECHARGE_THRESH_SEL_BIT |
|
||||
VBT_LT_CHG_RECHARGE_THRESH_SEL_BIT,
|
||||
VBT_LT_CHG_RECHARGE_THRESH_SEL_BIT);
|
||||
if (rc < 0) {
|
||||
dev_err(chg->dev, "Couldn't configure FG_UPDATE_CFG2_SEL_REG rc=%d\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
rc = smblib_masked_write(chg, FG_UPDATE_CFG_2_SEL_REG,
|
||||
SOC_LT_CHG_RECHARGE_THRESH_SEL_BIT |
|
||||
VBT_LT_CHG_RECHARGE_THRESH_SEL_BIT,
|
||||
SOC_LT_CHG_RECHARGE_THRESH_SEL_BIT);
|
||||
if (rc < 0) {
|
||||
dev_err(chg->dev, "Couldn't configure FG_UPDATE_CFG2_SEL_REG rc=%d\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue