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

Commit d01ddee4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-fg: Add support to control the SW based Rbias"

parents 9558a23b 3323e36d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -42,6 +42,10 @@ Parent node optional properties:
- qcom,resume-soc:			soc to resume charging in percentage.
- qcom,use-otp-profile:			Specify this flag to avoid RAM loading
					any battery profile.
- qcom,sw-rbias-control:		Boolean property which defines whether
					the Rbias needs to be controlled by
					software. If this is not set, it will
					be controlled by hardware (default).

qcom,fg-soc node required properties:
- reg : offset and length of the PMIC peripheral register map.
+28 −16
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ struct fg_chip {
	bool			use_otp_profile;
	bool			battery_missing;
	bool			power_supply_registered;
	bool			sw_rbias_ctrl;
	struct delayed_work	update_jeita_setting;
	struct delayed_work	update_sram_data;
	char			*batt_profile;
@@ -1670,6 +1671,8 @@ static int fg_of_init(struct fg_chip *chip)
		rc = 0;
	}

	chip->sw_rbias_ctrl = of_property_read_bool(chip->spmi->dev.of_node,
				"qcom,sw-rbias-control");
	return rc;
}

@@ -2292,6 +2295,7 @@ static int fg_hw_init(struct fg_chip *chip)
		}
	}

	if (chip->sw_rbias_ctrl) {
		rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT,
				BATT_TEMP_CNTRL_MASK,
				BATT_TEMP_ON,
@@ -2309,6 +2313,7 @@ static int fg_hw_init(struct fg_chip *chip)
			pr_err("failed to write to memif rc=%d\n", rc);
			return rc;
		}
	}

	if (chip->use_thermal_coefficients) {
		fg_mem_write(chip, chip->thermal_coefficients,
@@ -2499,6 +2504,9 @@ static int fg_suspend(struct device *dev)
	int total_time_ms;
	int rc;

	if (!chip->sw_rbias_ctrl)
		return 0;

	enter_time = ktime_get();
	rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT,
			BATT_TEMP_CNTRL_MASK,
@@ -2511,7 +2519,8 @@ static int fg_suspend(struct device *dev)
	total_time_ms = ktime_to_ms(total_time);

	if ((total_time_ms > 1500) && (fg_debug_mask & FG_STATUS))
		pr_info("spent %dms configuring rbias\n", total_time_ms);
		pr_info("spent %dms configuring rbias\n",
			total_time_ms);

	return 0;
}
@@ -2525,6 +2534,9 @@ static int fg_resume(struct device *dev)
	unsigned long current_time = 0, next_update_time, time_left;
	int rc;

	if (!chip->sw_rbias_ctrl)
		return 0;

	enter_time = ktime_get();
	rc = fg_mem_masked_write(chip, EXTERNAL_SENSE_SELECT,
			BATT_TEMP_CNTRL_MASK,