* [PATCH] MFD: pm poweroff moved to ab8500-sysctrl
@ 2011-03-02 10:54 Mattias Wallin
2011-03-02 12:01 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Mattias Wallin @ 2011-03-02 10:54 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, Linus Walleij, Mattias Wallin
This patch moves the machine pm power off hook from the platform
code to the ab8500-sysctrl driver.
Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mfd/ab8500-sysctrl.c | 22 ++++++++++++++++++++++
include/linux/mfd/ab8500.h | 2 ++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index 3921859..e6de6a2 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -6,12 +6,29 @@
#include <linux/err.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>
+#include <linux/signal.h>
#include <linux/mfd/ab8500.h>
#include <linux/mfd/abx500.h>
#include <linux/mfd/ab8500/sysctrl.h>
static struct device *sysctrl_dev;
+void ab8500_power_off(void)
+{
+ sigset_t old;
+ sigset_t all;
+
+ sigfillset(&all);
+
+ if (!sigprocmask(SIG_BLOCK, &all, &old)) {
+ (void)ab8500_sysctrl_set(AB8500_STW4500CTRL1,
+ AB8500_STW4500CTRL1_SWOFF |
+ AB8500_STW4500CTRL1_SWRESET4500N);
+ (void)sigprocmask(SIG_SETMASK, &old, NULL);
+ }
+}
+
static inline bool valid_bank(u8 bank)
{
return ((bank == AB8500_SYS_CTRL1_BLOCK) ||
@@ -50,7 +67,12 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
static int __devinit ab8500_sysctrl_probe(struct platform_device *pdev)
{
+ struct ab8500_platform_data *plat;
+
sysctrl_dev = &pdev->dev;
+ plat = dev_get_platdata(pdev->dev.parent);
+ if (plat->pm_power_off)
+ pm_power_off = ab8500_power_off;
return 0;
}
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index 56f8dea..279f9f3 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -144,11 +144,13 @@ struct regulator_init_data;
/**
* struct ab8500_platform_data - AB8500 platform data
* @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
+ * @pm_power_off: Should machine pm power off hook be registered or not
* @init: board-specific initialization after detection of ab8500
* @regulator: machine-specific constraints for regulators
*/
struct ab8500_platform_data {
int irq_base;
+ bool pm_power_off;
void (*init) (struct ab8500 *);
int num_regulator;
struct regulator_init_data *regulator;
--
1.7.4.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] MFD: pm poweroff moved to ab8500-sysctrl
2011-03-02 10:54 [PATCH] MFD: pm poweroff moved to ab8500-sysctrl Mattias Wallin
@ 2011-03-02 12:01 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2011-03-02 12:01 UTC (permalink / raw)
To: Mattias Wallin; +Cc: linux-kernel, Linus Walleij
Hi Mattias,
On Wed, Mar 02, 2011 at 11:54:30AM +0100, Mattias Wallin wrote:
> This patch moves the machine pm power off hook from the platform
> code to the ab8500-sysctrl driver.
A couple questions:
- Where is the aforementioned platform code ? In LinusW tree ?
- I suppose you're moving it in the sysctrl driver to prevent the same routine
to be spread over several platforms. If that's the case, please mention it in
the changelog.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-02 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 10:54 [PATCH] MFD: pm poweroff moved to ab8500-sysctrl Mattias Wallin
2011-03-02 12:01 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®