aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/ab8500-sysctrl.c22
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
2 files changed, 24 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
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 1cb5698b4d76..6119b2fbad97 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -274,6 +274,7 @@ struct ab8500_codec_platform_data;
274/** 274/**
275 * struct ab8500_platform_data - AB8500 platform data 275 * struct ab8500_platform_data - AB8500 platform data
276 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 276 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
277 * @pm_power_off: Should machine pm power off hook be registered or not
277 * @init: board-specific initialization after detection of ab8500 278 * @init: board-specific initialization after detection of ab8500
278 * @num_regulator_reg_init: number of regulator init registers 279 * @num_regulator_reg_init: number of regulator init registers
279 * @regulator_reg_init: regulator init registers 280 * @regulator_reg_init: regulator init registers
@@ -282,6 +283,7 @@ struct ab8500_codec_platform_data;
282 */ 283 */
283struct ab8500_platform_data { 284struct ab8500_platform_data {
284 int irq_base; 285 int irq_base;
286 bool pm_power_off;
285 void (*init) (struct ab8500 *); 287 void (*init) (struct ab8500 *);
286 int num_regulator_reg_init; 288 int num_regulator_reg_init;
287 struct ab8500_regulator_reg_init *regulator_reg_init; 289 struct ab8500_regulator_reg_init *regulator_reg_init;