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

Commit b818c332 authored by Xiaozhe Shi's avatar Xiaozhe Shi
Browse files

power: qpnp-smbcharger: add option for charging unknown batteries



Currently, the qpnp-smbcharger is set to never charge unrecognized
batteries. However, certain devices do not yet have battery profiles
ready to be loaded into the fuel gauge. There should still be a way to
charge the battery without having a fuel gauge profile.

Add the devicetree property qcom,charge-unknown-battery in order to
disable this feature and charge any battery as long as a valid charger
is present.

Change-Id: I36004c58238de4baa807ae0ea92c4a29e810e496
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent 408d933c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,12 @@ Optional Properties:
				algorithm is disabled. If this node is present
				SMB uses the THERM pin for battery missing
				detection.
- qcom,charge-unknown-battery	Boolean that indicates whether an unknown
				battery without a matching profile will be
				charged. If this is not set, if the fuel gauge
				does not recognize the battery based on its
				battery ID, the charger will not start
				charging.
- qcom,bmd-pin-src		A string that indicates the source pin for the
				battery missind detection. This can be either:
				- "bpd_none"
+4 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ struct smbchg_chip {
	bool				soft_vfloat_comp_disabled;
	bool				chg_enabled;
	bool				low_icl_wa_on;
	bool				charge_unknown_battery;
	struct parallel_usb_cfg		parallel;

	/* status variables */
@@ -2099,7 +2100,7 @@ static int smbchg_hw_init(struct smbchg_chip *chip)
	 */
	rc = smbchg_sec_masked_write(chip, chip->usb_chgpth_base + CHGPTH_CFG,
		USBIN_SUSPEND_SRC_BIT | USB51_COMMAND_POL | USB51AC_CTRL,
		USBIN_SUSPEND_SRC_BIT);
		(chip->charge_unknown_battery ? 0 : USBIN_SUSPEND_SRC_BIT));
	if (rc < 0) {
		dev_err(chip->dev, "Couldn't set usb_chgpth cfg rc=%d\n", rc);
		return rc;
@@ -2350,6 +2351,8 @@ static int smb_parse_dt(struct smbchg_chip *chip)
					"qcom,soft-vfloat-comp-disabled");
	chip->chg_enabled = !(of_property_read_bool(node,
						"qcom,charging-disabled"));
	chip->charge_unknown_battery = of_property_read_bool(node,
						"qcom,charge-unknown-battery");

	/* parse the battery missing detection pin source */
	rc = of_property_read_string(chip->spmi->dev.of_node,