lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Jul 2015 01:11:17 +0930
From:	Anand Moon <linux.amoon@...il.com>
To:	Sangbeom Kim <sbkim73@...sung.com>,
	Krzysztof Kozlowski <k.kozlowski@...sung.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>
Cc:	linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
	Anand Moon <linux.amoon@...il.com>
Subject: [PATCHv2] regulator: s2mps11: Added shutdown function to poweroff

Added .shutdown function to s2mps11 to help poweroff the board successfully.

s2mps11-pmic: S2MPS11_REG_CTRL1 reg value 16:00000000000000000000000000010000

The device driver clears the register to turn off the PMIC.

Signed-off-by: Anand Moon <linux.amoon@...il.com>

---
Console log for improper shutdown.
root@...oidxu3:~# poweroff
...
  * 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.

Console log for proper shutdown.
root@...oidxu3:~# poweroff
...
  * Unmounting temporary filesystems...                                   [ OK ]
  * Deactivating swap...                                                  [ OK ]
  * Unmounting local filesystems...                                       [ OK ]
  * Will now halt
  [  476.283071] reboo
---
 drivers/regulator/s2mps11.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 326ffb5..823180e 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1060,6 +1060,31 @@ out:
 	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, &reg_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-pmic", S2MPS11X},
 	{ "s2mps13-pmic", S2MPS13X},
@@ -1074,6 +1099,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.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ