aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-01-14 08:26:15 -0500
committerLee Jones <lee.jones@linaro.org>2013-02-04 03:28:41 -0500
commit379749c46320c82df95c7909ec888da8ed1fb22c (patch)
tree5d57a71f4bdf660a20f23b02b7bfa9f9361b9d2f /drivers/mfd
parent949db153b6466c6f7cad5a427ecea94985927311 (diff)
mfd: ab8500-sysctrl: Provide a platform specific pm_power_off() call-back
The kernel allows us to specify a function call-back which will be invoked when a system power-off request has been received. Here we provide one which is to be used when shutting down AB8500 based platforms. Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ab8500-sysctrl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index 8a33b2c7eead..888e066c715b 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -7,12 +7,29 @@
7#include <linux/err.h> 7#include <linux/err.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/pm.h>
11#include <linux/signal.h>
10#include <linux/mfd/abx500.h> 12#include <linux/mfd/abx500.h>
11#include <linux/mfd/abx500/ab8500.h> 13#include <linux/mfd/abx500/ab8500.h>
12#include <linux/mfd/abx500/ab8500-sysctrl.h> 14#include <linux/mfd/abx500/ab8500-sysctrl.h>
13 15
14static struct device *sysctrl_dev; 16static struct device *sysctrl_dev;
15 17
18void ab8500_power_off(void)
19{
20 sigset_t old;
21 sigset_t all;
22
23 sigfillset(&all);
24
25 if (!sigprocmask(SIG_BLOCK, &all, &old)) {
26 (void)ab8500_sysctrl_set(AB8500_STW4500CTRL1,
27 AB8500_STW4500CTRL1_SWOFF |
28 AB8500_STW4500CTRL1_SWRESET4500N);
29 (void)sigprocmask(SIG_SETMASK, &old, NULL);
30 }
31}
32
16static inline bool valid_bank(u8 bank) 33static inline bool valid_bank(u8 bank)
17{ 34{
18 return ((bank == AB8500_SYS_CTRL1_BLOCK) || 35 return ((bank == AB8500_SYS_CTRL1_BLOCK) ||
@@ -51,7 +68,12 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
51 68
52static int ab8500_sysctrl_probe(struct platform_device *pdev) 69static int ab8500_sysctrl_probe(struct platform_device *pdev)
53{ 70{
71 struct ab8500_platform_data *plat;
72
54 sysctrl_dev = &pdev->dev; 73 sysctrl_dev = &pdev->dev;
74 plat = dev_get_platdata(pdev->dev.parent);
75 if (plat->pm_power_off)
76 pm_power_off = ab8500_power_off;
55 return 0; 77 return 0;
56} 78}
57 79