76 lines
2.5 KiB
Diff
76 lines
2.5 KiB
Diff
|
From 8a552e21a0996be6e4376bb3ea8506a68ec4aa0d Mon Sep 17 00:00:00 2001
|
||
|
From: Anand Moon <moon.linux@yahoo.com>
|
||
|
Date: Sun, 12 Jul 2015 18:41:20 +0530
|
||
|
Subject: [PATCH 034/109] ODROID-XU4: regulator: s2mps11: call shutdown
|
||
|
function to poweroff
|
||
|
|
||
|
Added .shutdown function to s2mps11 to help poweroff the board successfully.
|
||
|
The device driver clears the register to turn off the PMIC.
|
||
|
|
||
|
s2mps11-pmic: S2MPS11_REG_CTRL1 reg value 16:00000000000000000000000000010000
|
||
|
|
||
|
Console log.
|
||
|
|
||
|
* Unmounting temporary filesystems... [ OK ]
|
||
|
* Deactivating swap... [ OK ]
|
||
|
* Unmounting local filesystems... [ OK ]
|
||
|
* Will now halt
|
||
|
[ 209.020280] reboot: Power down
|
||
|
[ 209.122039] Power down failed, please power off system manually.
|
||
|
|
||
|
Change-Id: If6ea0dec154b00ceeaaddbac393c67dc35c26279
|
||
|
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
|
||
|
Signed-off-by: memeka <mihailescu2m@gmail.com>
|
||
|
Signed-off-by: Marian Mihailescu <mihailescu2m@gmail.com>
|
||
|
---
|
||
|
drivers/regulator/s2mps11.c | 26 ++++++++++++++++++++++++++
|
||
|
1 file changed, 26 insertions(+)
|
||
|
|
||
|
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
|
||
|
index 33cf84bce05a..f1ade60ee8d3 100644
|
||
|
--- a/drivers/regulator/s2mps11.c
|
||
|
+++ b/drivers/regulator/s2mps11.c
|
||
|
@@ -1243,6 +1243,31 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
+static void s2mps11_pmic_shutdown(struct platform_device *pdev)
|
||
|
+{
|
||
|
+ struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
|
||
|
+ unsigned int reg_val, ret;
|
||
|
+
|
||
|
+ ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_CTRL1, ®_val);
|
||
|
+ if (ret < 0) {
|
||
|
+ dev_crit(&pdev->dev, "could not read S2MPS11_REG_CTRL1 value\n");
|
||
|
+ } else {
|
||
|
+ /*
|
||
|
+ * s2mps11-pmic: S2MPS11_REG_CTRL1 reg value
|
||
|
+ * is 00000000000000000000000000010000
|
||
|
+ * clear the S2MPS11_REG_CTRL1 0x10 value to shutdown.
|
||
|
+ */
|
||
|
+ if (reg_val & BIT(4)) {
|
||
|
+ ret = regmap_update_bits(iodev->regmap_pmic,
|
||
|
+ S2MPS11_REG_CTRL1,
|
||
|
+ BIT(4), BIT(0));
|
||
|
+ if (ret)
|
||
|
+ dev_crit(&pdev->dev,
|
||
|
+ "could not write S2MPS11_REG_CTRL1 value\n");
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
static const struct platform_device_id s2mps11_pmic_id[] = {
|
||
|
{ "s2mps11-regulator", S2MPS11X},
|
||
|
{ "s2mps13-regulator", S2MPS13X},
|
||
|
@@ -1258,6 +1283,7 @@ static struct platform_driver s2mps11_pmic_driver = {
|
||
|
.name = "s2mps11-pmic",
|
||
|
},
|
||
|
.probe = s2mps11_pmic_probe,
|
||
|
+ .shutdown = s2mps11_pmic_shutdown,
|
||
|
.id_table = s2mps11_pmic_id,
|
||
|
};
|
||
|
|
||
|
--
|
||
|
2.25.1
|
||
|
|