aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/reset
diff options
context:
space:
mode:
authorAbhimanyu Kapur <abhimany@codeaurora.org>2013-07-30 20:05:28 -0400
committerAnton Vorontsov <anton@enomsg.org>2013-08-09 14:47:53 -0400
commit78be3176c4335b8ff3d9625ed3fc571e7d2ba8f4 (patch)
tree08a71d66ac0069147b18f76e3265f7b9b8bbbc84 /drivers/power/reset
parent68ace3e1886b94925c73e08702437f6dcd539a4d (diff)
power: reset: Add msm restart support
Add support for restart and poweroff functionality present on MSM chipsets with the MPM2 ps-hold hardware. Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org> Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power/reset')
-rw-r--r--drivers/power/reset/Kconfig6
-rw-r--r--drivers/power/reset/Makefile1
-rw-r--r--drivers/power/reset/msm-poweroff.c73
3 files changed, 80 insertions, 0 deletions
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index ee039dcead04..94122906f9cf 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -14,6 +14,12 @@ config POWER_RESET_GPIO
14 If your board needs a GPIO high/low to power down, say Y and 14 If your board needs a GPIO high/low to power down, say Y and
15 create a binding in your devicetree. 15 create a binding in your devicetree.
16 16
17config POWER_RESET_MSM
18 bool "Qualcomm MSM power-off driver"
19 depends on POWER_RESET && ARCH_MSM
20 help
21 Power off and restart support for Qualcomm boards.
22
17config POWER_RESET_QNAP 23config POWER_RESET_QNAP
18 bool "QNAP power-off driver" 24 bool "QNAP power-off driver"
19 depends on OF_GPIO && POWER_RESET && PLAT_ORION 25 depends on OF_GPIO && POWER_RESET && PLAT_ORION
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 372807fd83f7..b82288e99e92 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -1,4 +1,5 @@
1obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o 1obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
2obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
2obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o 3obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
3obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o 4obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
4obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o 5obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c
new file mode 100644
index 000000000000..774f9a3b310d
--- /dev/null
+++ b/drivers/power/reset/msm-poweroff.c
@@ -0,0 +1,73 @@
1/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/delay.h>
15#include <linux/err.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/io.h>
19#include <linux/of.h>
20#include <linux/platform_device.h>
21#include <linux/module.h>
22#include <linux/reboot.h>
23
24#include <asm/system_misc.h>
25
26static void __iomem *msm_ps_hold;
27
28static void do_msm_restart(enum reboot_mode reboot_mode, const char *cmd)
29{
30 writel(0, msm_ps_hold);
31 mdelay(10000);
32}
33
34static void do_msm_poweroff(void)
35{
36 /* TODO: Add poweroff capability */
37 do_msm_restart(REBOOT_HARD, NULL);
38}
39
40static int msm_restart_probe(struct platform_device *pdev)
41{
42 struct device *dev = &pdev->dev;
43 struct resource *mem;
44
45 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
46 msm_ps_hold = devm_ioremap_resource(dev, mem);
47 if (IS_ERR(msm_ps_hold))
48 return PTR_ERR(msm_ps_hold);
49
50 pm_power_off = do_msm_poweroff;
51 arm_pm_restart = do_msm_restart;
52 return 0;
53}
54
55static const struct of_device_id of_msm_restart_match[] = {
56 { .compatible = "qcom,pshold", },
57 {},
58};
59MODULE_DEVICE_TABLE(of, of_msm_restart_match);
60
61static struct platform_driver msm_restart_driver = {
62 .probe = msm_restart_probe,
63 .driver = {
64 .name = "msm-restart",
65 .of_match_table = of_match_ptr(of_msm_restart_match),
66 },
67};
68
69static int __init msm_restart_init(void)
70{
71 return platform_driver_register(&msm_restart_driver);
72}
73device_initcall(msm_restart_init);