Loading Documentation/devicetree/bindings/power/qpnp-smbcharger.txt +3 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,9 @@ Optional Properties: should resume charging. If this is not defined, the only way to resume charging is through the voltage drop specified by qcom,resume-delta-mv. - qcom,chg-inhibit-fg Indicates if the recharge threshold source has to be Fuel gauge ADC. If this is not set, it will be analog sensor by default. - qcom,bmd-algo-disabled Indicates if the battery missing detection algorithm is disabled. If this node is present SMB uses the THERM pin for battery missing Loading drivers/power/qpnp-smbcharger.c +35 −18 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ struct smbchg_chip { bool low_icl_wa_on; bool battery_unknown; bool charge_unknown_battery; bool chg_inhibit_source_fg; u8 original_usbin_allowance; struct parallel_usb_cfg parallel; struct delayed_work parallel_en_work; Loading Loading @@ -2906,11 +2907,18 @@ static int smbchg_hw_init(struct smbchg_chip *chip) } /* * use the analog sensors instead of the fuelgauge adcs so that * tcc detection works without trimmed parts * Based on the configuration, use the analog sensors or the fuelgauge * adc for recharge threshold source. */ if (chip->chg_inhibit_source_fg) rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1, TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT, RECHG_THRESHOLD_SRC_BIT); else rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1, TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT, 0); if (rc < 0) { dev_err(chip->dev, "Couldn't set chgr_cfg2 rc=%d\n", rc); return rc; Loading Loading @@ -3042,6 +3050,12 @@ static int smbchg_hw_init(struct smbchg_chip *chip) smbchg_dc_en(chip, chip->chg_enabled, REASON_USER); /* resume threshold */ if (chip->resume_delta_mv != -EINVAL) { /* * Configure only if the recharge threshold source is not * fuel gauge ADC. */ if (!chip->chg_inhibit_source_fg) { if (chip->resume_delta_mv < 100) reg = CHG_INHIBIT_50MV_VAL; else if (chip->resume_delta_mv < 200) Loading @@ -3059,6 +3073,7 @@ static int smbchg_hw_init(struct smbchg_chip *chip) rc); return rc; } } rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG, Loading Loading @@ -3200,6 +3215,8 @@ static int smb_parse_dt(struct smbchg_chip *chip) "qcom,charging-disabled")); chip->charge_unknown_battery = of_property_read_bool(node, "qcom,charge-unknown-battery"); chip->chg_inhibit_source_fg = of_property_read_bool(node, "qcom,chg-inhibit-fg"); /* parse the battery missing detection pin source */ rc = of_property_read_string(chip->spmi->dev.of_node, Loading Loading
Documentation/devicetree/bindings/power/qpnp-smbcharger.txt +3 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,9 @@ Optional Properties: should resume charging. If this is not defined, the only way to resume charging is through the voltage drop specified by qcom,resume-delta-mv. - qcom,chg-inhibit-fg Indicates if the recharge threshold source has to be Fuel gauge ADC. If this is not set, it will be analog sensor by default. - qcom,bmd-algo-disabled Indicates if the battery missing detection algorithm is disabled. If this node is present SMB uses the THERM pin for battery missing Loading
drivers/power/qpnp-smbcharger.c +35 −18 Original line number Diff line number Diff line Loading @@ -92,6 +92,7 @@ struct smbchg_chip { bool low_icl_wa_on; bool battery_unknown; bool charge_unknown_battery; bool chg_inhibit_source_fg; u8 original_usbin_allowance; struct parallel_usb_cfg parallel; struct delayed_work parallel_en_work; Loading Loading @@ -2906,11 +2907,18 @@ static int smbchg_hw_init(struct smbchg_chip *chip) } /* * use the analog sensors instead of the fuelgauge adcs so that * tcc detection works without trimmed parts * Based on the configuration, use the analog sensors or the fuelgauge * adc for recharge threshold source. */ if (chip->chg_inhibit_source_fg) rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1, TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT, RECHG_THRESHOLD_SRC_BIT); else rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1, TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT, 0); if (rc < 0) { dev_err(chip->dev, "Couldn't set chgr_cfg2 rc=%d\n", rc); return rc; Loading Loading @@ -3042,6 +3050,12 @@ static int smbchg_hw_init(struct smbchg_chip *chip) smbchg_dc_en(chip, chip->chg_enabled, REASON_USER); /* resume threshold */ if (chip->resume_delta_mv != -EINVAL) { /* * Configure only if the recharge threshold source is not * fuel gauge ADC. */ if (!chip->chg_inhibit_source_fg) { if (chip->resume_delta_mv < 100) reg = CHG_INHIBIT_50MV_VAL; else if (chip->resume_delta_mv < 200) Loading @@ -3059,6 +3073,7 @@ static int smbchg_hw_init(struct smbchg_chip *chip) rc); return rc; } } rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG, Loading Loading @@ -3200,6 +3215,8 @@ static int smb_parse_dt(struct smbchg_chip *chip) "qcom,charging-disabled")); chip->charge_unknown_battery = of_property_read_bool(node, "qcom,charge-unknown-battery"); chip->chg_inhibit_source_fg = of_property_read_bool(node, "qcom,chg-inhibit-fg"); /* parse the battery missing detection pin source */ rc = of_property_read_string(chip->spmi->dev.of_node, Loading