power: qpnp-fg-gen3: allow negative Rconn configuration

In some cases, to offset the battery resistance which may be high
because of battery profile characterization and hardware layout,
negative connector resistance (Rconn) should be specified. Allow
configuring it.

Change-Id: Ief64ac13ba0a384a599fe6fffdbc0d093180d0b8
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
Subbaraman Narayanamurthy 2017-03-14 19:50:57 -07:00
parent bda96ffdc0
commit 46b94b6448

View file

@ -1598,6 +1598,9 @@ static int fg_rconn_config(struct fg_chip *chip)
u64 scaling_factor;
u32 val = 0;
if (!chip->dt.rconn_mohms)
return 0;
rc = fg_sram_read(chip, PROFILE_INTEGRITY_WORD,
SW_CONFIG_OFFSET, (u8 *)&val, 1, FG_IMA_DEFAULT);
if (rc < 0) {
@ -3176,12 +3179,10 @@ static int fg_hw_init(struct fg_chip *chip)
return rc;
}
if (chip->dt.rconn_mohms > 0) {
rc = fg_rconn_config(chip);
if (rc < 0) {
pr_err("Error in configuring Rconn, rc=%d\n", rc);
return rc;
}
rc = fg_rconn_config(chip);
if (rc < 0) {
pr_err("Error in configuring Rconn, rc=%d\n", rc);
return rc;
}
fg_encode(chip->sp, FG_SRAM_ESR_TIGHT_FILTER,
@ -3957,9 +3958,7 @@ static int fg_parse_dt(struct fg_chip *chip)
pr_err("Error in parsing Ki coefficients, rc=%d\n", rc);
rc = of_property_read_u32(node, "qcom,fg-rconn-mohms", &temp);
if (rc < 0)
chip->dt.rconn_mohms = -EINVAL;
else
if (!rc)
chip->dt.rconn_mohms = temp;
rc = of_property_read_u32(node, "qcom,fg-esr-filter-switch-temp",