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

Commit 39dccc5e authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

power: smb135x-charger: fix force_recharge debugfs property



The force_recharge should be a writeable property. Moreover if
charging is disabled it should respect that and not enable charging.
Fix it.

Change-Id: I978760f04f12a6a73dd12640cbc0aefbbaa6d25a
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 09c72248
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1775,6 +1775,11 @@ static int force_rechg_set(void *data, u64 val)
	int rc;
	struct smb135x_chg *chip = data;

	if (!chip->chg_enabled) {
		pr_debug("Charging Disabled force recharge not allowed\n");
		return -EINVAL;
	}

	rc = smb135x_masked_write(chip, CFG_14_REG, EN_CHG_INHIBIT_BIT, 0);
	if (rc)
		dev_err(chip->dev,
@@ -2511,7 +2516,8 @@ static int smb135x_charger_probe(struct i2c_client *client,
				"Couldn't create count debug file rc = %d\n",
				rc);

		ent = debugfs_create_file("force_recharge", S_IFREG | S_IRUGO,
		ent = debugfs_create_file("force_recharge",
					  S_IFREG | S_IWUSR | S_IRUGO,
					  chip->debug_root, chip,
					  &force_rechg_ops);
		if (!ent)