Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16ef9a75 authored by Fenglin Wu's avatar Fenglin Wu
Browse files

power: qpnp-fg-gen3: Set invalid negative value for batt_id_ohms



Battery modules with 0 Ohm BATT_ID is possible so set the invalid
value for batt_id_ohms to a negative value.

Change-Id: I8e8a17dfee3fe693f2d5ab0d70f6321f2c7891af
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 4e4e8e74
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -833,7 +833,7 @@ static bool is_debug_batt_id(struct fg_chip *chip)
{
	int debug_batt_id[2], rc;

	if (!chip->batt_id_ohms)
	if (chip->batt_id_ohms < 0)
		return false;

	rc = fg_get_debug_batt_id(chip, debug_batt_id);
@@ -4237,6 +4237,7 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *data)
		chip->profile_available = false;
		chip->profile_loaded = false;
		chip->soc_reporting_ready = false;
		chip->batt_id_ohms = -EINVAL;
		return IRQ_HANDLED;
	}

@@ -5060,6 +5061,7 @@ static int fg_gen3_probe(struct platform_device *pdev)
	chip->prev_charge_status = -EINVAL;
	chip->ki_coeff_full_soc = -EINVAL;
	chip->online_status = -EINVAL;
	chip->batt_id_ohms = -EINVAL;
	chip->regmap = dev_get_regmap(chip->dev->parent, NULL);
	if (!chip->regmap) {
		dev_err(chip->dev, "Parent regmap is unavailable\n");
@@ -5207,8 +5209,8 @@ static int fg_gen3_probe(struct platform_device *pdev)
		rc = fg_get_battery_temp(chip, &batt_temp);

	if (!rc) {
		pr_info("battery SOC:%d voltage: %duV temp: %d id: %dKOhms\n",
			msoc, volt_uv, batt_temp, chip->batt_id_ohms / 1000);
		pr_info("battery SOC:%d voltage: %duV temp: %d\n",
				msoc, volt_uv, batt_temp);
		rc = fg_esr_filter_config(chip, batt_temp);
		if (rc < 0)
			pr_err("Error in configuring ESR filter rc:%d\n", rc);