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

Commit dc6d3a31 authored by Ashay Jaiswal's avatar Ashay Jaiswal Committed by Subbaraman Narayanamurthy
Browse files

power: smb1390: disable SMB1390 at shutdown



Add shutdown hook to disable SMB1390 at shutdown.

Change-Id: I6ac329c38c9dff87988c3c7ba0d28d70d8471e65
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 42cee208
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -1235,6 +1235,20 @@ static int smb1390_remove(struct platform_device *pdev)
	return 0;
	return 0;
}
}


static void smb1390_shutdown(struct platform_device *pdev)
{
	struct smb1390 *chip = platform_get_drvdata(pdev);
	int rc;

	power_supply_unreg_notifier(&chip->nb);
	/* Disable SMB1390 */
	smb1390_dbg(chip, PR_MISC, "Disabling SMB1390\n");
	rc = smb1390_masked_write(chip, CORE_CONTROL1_REG,
					CMD_EN_SWITCHER_BIT, 0);
	if (rc < 0)
		pr_err("Couldn't disable chip rc=%d\n", rc);
}

static int smb1390_suspend(struct device *dev)
static int smb1390_suspend(struct device *dev)
{
{
	struct smb1390 *chip = dev_get_drvdata(dev);
	struct smb1390 *chip = dev_get_drvdata(dev);
@@ -1272,6 +1286,7 @@ static struct platform_driver smb1390_driver = {
	},
	},
	.probe	= smb1390_probe,
	.probe	= smb1390_probe,
	.remove	= smb1390_remove,
	.remove	= smb1390_remove,
	.shutdown = smb1390_shutdown,
};
};
module_platform_driver(smb1390_driver);
module_platform_driver(smb1390_driver);