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

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

Merge "power: smb1360: Add workaround flag for battery detection"

parents 58d96bdb e5155cdd
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@

enum {
	WRKRND_FG_CONFIG_FAIL = BIT(0),
	WRKRND_BATT_DET_FAIL = BIT(1),
};

enum {
@@ -1067,6 +1068,14 @@ static int chg_inhibit_handler(struct smb1360_chip *chip, u8 rt_stat)

static int min_soc_handler(struct smb1360_chip *chip, u8 rt_stat)
{
	/*
	 * Avoid holding a wake_source if there is no battery
	 * or if the SMB rev. has a battery detection issue
	 */
	if (!chip->batt_present ||
			(chip->workaround_flags & WRKRND_BATT_DET_FAIL))
		return 0;

	if (rt_stat) {
		pr_debug("Below minimum SOC, holding wake_source\n");
		pm_stay_awake(chip->dev);
@@ -2006,10 +2015,13 @@ static int smb1360_hw_init(struct smb1360_chip *chip)
	 *
	 * The REV_1 of the chip does not allow access to
	 * FG config registers (20-2FH). Set the workaround flag.
	 * Also, the battery detection does not work when the DCIN is absent,
	 * add a workaround flag for it.
	*/

	if (chip->revision == SMB1360_REV_1)
		chip->workaround_flags |= WRKRND_FG_CONFIG_FAIL;
		chip->workaround_flags |=
			WRKRND_FG_CONFIG_FAIL | WRKRND_BATT_DET_FAIL;

	smb1360_fg_config(chip);

@@ -2151,6 +2163,10 @@ static int smb1360_probe(struct i2c_client *client,
		return -ENODEV;
	}

	rc = read_revision(chip, &chip->revision);
	if (rc)
		dev_err(chip->dev, "Couldn't read revision rc = %d\n", rc);

	rc = smb_parse_dt(chip);
	if (rc < 0) {
		dev_err(&client->dev, "Unable to parse DT nodes\n");
@@ -2298,10 +2314,6 @@ static int smb1360_probe(struct i2c_client *client,
				rc);
	}

	rc = read_revision(chip, &chip->revision);
	if (rc)
		dev_err(chip->dev, "Couldn't read revision rc = %d\n", rc);

	dev_info(chip->dev, "SMB1360 revision=0x%x probe success! batt=%d usb=%d soc=%d\n",
			chip->revision,
			smb1360_get_prop_batt_present(chip),