* [PATCH 1/3] mfd: max8925: add function to work as wakeup source
@ 2012-01-04 7:14 Haojian Zhuang
2012-01-04 7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Haojian Zhuang @ 2012-01-04 7:14 UTC (permalink / raw)
To: sameo, a.zummo, dmitry.torokhov, linux-kernel; +Cc: Kevin Liu, Haojian Zhuang
From: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/mfd/max8925-i2c.c | 27 +++++++++++++++++++++++++++
include/linux/mfd/max8925.h | 2 ++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index 0219115..d9e4b36 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -161,6 +161,8 @@ static int __devinit max8925_probe(struct i2c_client *client,
chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR);
i2c_set_clientdata(chip->adc, chip);
+ device_init_wakeup(&client->dev, 1);
+
max8925_device_init(chip, pdata);
return 0;
@@ -177,10 +179,35 @@ static int __devexit max8925_remove(struct i2c_client *client)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int max8925_suspend(struct device *dev)
+{
+ struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+ struct max8925_chip *chip = i2c_get_clientdata(client);
+
+ if (device_may_wakeup(dev) && chip->wakeup_flag)
+ enable_irq_wake(chip->core_irq);
+ return 0;
+}
+
+static int max8925_resume(struct device *dev)
+{
+ struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+ struct max8925_chip *chip = i2c_get_clientdata(client);
+
+ if (device_may_wakeup(dev) && chip->wakeup_flag)
+ disable_irq_wake(chip->core_irq);
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume);
+
static struct i2c_driver max8925_driver = {
.driver = {
.name = "max8925",
.owner = THIS_MODULE,
+ .pm = &max8925_pm_ops,
},
.probe = max8925_probe,
.remove = __devexit_p(max8925_remove),
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 5259dfe..daaba00 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -206,6 +206,8 @@ struct max8925_chip {
int irq_base;
int core_irq;
int tsc_irq;
+
+ unsigned int wakeup_flag;
};
struct max8925_backlight_pdata {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] misc: max8925_onkey: add function to work as wakeup source
2012-01-04 7:14 [PATCH 1/3] mfd: max8925: add function to work as wakeup source Haojian Zhuang
@ 2012-01-04 7:14 ` Haojian Zhuang
2012-01-09 0:29 ` Samuel Ortiz
2012-01-04 7:14 ` [PATCH 3/3] rtc: max8925: " Haojian Zhuang
2012-01-09 0:05 ` [PATCH 1/3] mfd: " Samuel Ortiz
2 siblings, 1 reply; 9+ messages in thread
From: Haojian Zhuang @ 2012-01-04 7:14 UTC (permalink / raw)
To: sameo, a.zummo, dmitry.torokhov, linux-kernel; +Cc: Kevin Liu, Haojian Zhuang
From: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/input/misc/max8925_onkey.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
index 7de0ded..89a5ac6 100644
--- a/drivers/input/misc/max8925_onkey.c
+++ b/drivers/input/misc/max8925_onkey.c
@@ -122,6 +122,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
info->idev->evbit[0] = BIT_MASK(EV_KEY);
info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
+ device_init_wakeup(&pdev->dev, 1);
error = input_register_device(info->idev);
if (error) {
@@ -158,10 +159,39 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int max8925_onkey_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+ if (device_may_wakeup(dev)) {
+ chip->wakeup_flag |= 1 << (onkey_irq[0] - chip->irq_base);
+ chip->wakeup_flag |= 1 << (onkey_irq[1] - chip->irq_base);
+ }
+ return 0;
+}
+
+static int max8925_onkey_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+ if (device_may_wakeup(dev)) {
+ chip->wakeup_flag &= ~(1 << (onkey_irq[0] - chip->irq_base));
+ chip->wakeup_flag &= ~(1 << (onkey_irq[1] - chip->irq_base));
+ }
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(max8925_onkey_pm_ops, max8925_onkey_suspend, max8925_onkey_resume);
+
static struct platform_driver max8925_onkey_driver = {
.driver = {
.name = "max8925-onkey",
.owner = THIS_MODULE,
+ .pm = &max8925_onkey_pm_ops,
},
.probe = max8925_onkey_probe,
.remove = __devexit_p(max8925_onkey_remove),
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] rtc: max8925: add function to work as wakeup source
2012-01-04 7:14 [PATCH 1/3] mfd: max8925: add function to work as wakeup source Haojian Zhuang
2012-01-04 7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
@ 2012-01-04 7:14 ` Haojian Zhuang
2012-01-09 0:05 ` [PATCH 1/3] mfd: " Samuel Ortiz
2 siblings, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2012-01-04 7:14 UTC (permalink / raw)
To: sameo, a.zummo, dmitry.torokhov, linux-kernel; +Cc: Kevin Liu, Haojian Zhuang
From: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/rtc/rtc-max8925.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c
index 3bc046f..b281bae 100644
--- a/drivers/rtc/rtc-max8925.c
+++ b/drivers/rtc/rtc-max8925.c
@@ -261,6 +261,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
/* XXX - isn't this redundant? */
platform_set_drvdata(pdev, info);
+ device_init_wakeup(&pdev->dev, 1);
+
info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
&max8925_rtc_ops, THIS_MODULE);
ret = PTR_ERR(info->rtc_dev);
@@ -290,10 +292,34 @@ static int __devexit max8925_rtc_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int max8925_rtc_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+ if (device_may_wakeup(dev))
+ chip->wakeup_flag |= 1 << MAX8925_IRQ_RTC_ALARM0;
+ return 0;
+}
+static int max8925_rtc_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+ if (device_may_wakeup(dev))
+ chip->wakeup_flag &= ~(1 << MAX8925_IRQ_RTC_ALARM0);
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(max8925_rtc_pm_ops, max8925_rtc_suspend, max8925_rtc_resume);
+
static struct platform_driver max8925_rtc_driver = {
.driver = {
.name = "max8925-rtc",
.owner = THIS_MODULE,
+ .pm = &max8925_rtc_pm_ops,
},
.probe = max8925_rtc_probe,
.remove = __devexit_p(max8925_rtc_remove),
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] mfd: max8925: add function to work as wakeup source
2012-01-04 7:14 [PATCH 1/3] mfd: max8925: add function to work as wakeup source Haojian Zhuang
2012-01-04 7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
2012-01-04 7:14 ` [PATCH 3/3] rtc: max8925: " Haojian Zhuang
@ 2012-01-09 0:05 ` Samuel Ortiz
2 siblings, 0 replies; 9+ messages in thread
From: Samuel Ortiz @ 2012-01-09 0:05 UTC (permalink / raw)
To: Haojian Zhuang; +Cc: a.zummo, dmitry.torokhov, linux-kernel, Kevin Liu
Hi Haojian,
On Wed, Jan 04, 2012 at 03:14:24PM +0800, Haojian Zhuang wrote:
> From: Kevin Liu <kliu5@marvell.com>
>
> Signed-off-by: Kevin Liu <kliu5@marvell.com>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
All 3 patches applied, thanks.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] misc: max8925_onkey: add function to work as wakeup source
2012-01-04 7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
@ 2012-01-09 0:29 ` Samuel Ortiz
2012-01-10 10:11 ` Haojian Zhuang
2012-01-10 10:24 ` Haojian Zhuang
0 siblings, 2 replies; 9+ messages in thread
From: Samuel Ortiz @ 2012-01-09 0:29 UTC (permalink / raw)
To: Haojian Zhuang; +Cc: a.zummo, dmitry.torokhov, linux-kernel, Kevin Liu
Hi Haojian,
On Wed, Jan 04, 2012 at 03:14:25PM +0800, Haojian Zhuang wrote:
> From: Kevin Liu <kliu5@marvell.com>
I got this build error:
CC drivers/input/misc/max8925_onkey.o
drivers/input/misc/max8925_onkey.c: In function ‘max8925_onkey_suspend’:
drivers/input/misc/max8925_onkey.c:169:30: error: ‘onkey_irq’ undeclared
(first use in this function)
drivers/input/misc/max8925_onkey.c:169:30: note: each undeclared identifier is
reported only once for each function it appears in
drivers/input/misc/max8925_onkey.c: In function ‘max8925_onkey_resume’:
drivers/input/misc/max8925_onkey.c:181:32: error: ‘onkey_irq’ undeclared
(first use in this function)
make[3]: *** [drivers/input/misc/max8925_onkey.o] Error 1
make[2]: *** [drivers/input/misc] Error 2
make[1]: *** [drivers/input] Error 2
So I put this one aside.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] misc: max8925_onkey: add function to work as wakeup source
2012-01-09 0:29 ` Samuel Ortiz
@ 2012-01-10 10:11 ` Haojian Zhuang
2012-01-10 10:24 ` Haojian Zhuang
1 sibling, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2012-01-10 10:11 UTC (permalink / raw)
To: Samuel Ortiz
Cc: Haojian Zhuang, a.zummo, dmitry.torokhov, linux-kernel, Kevin Liu
On Mon, Jan 9, 2012 at 8:29 AM, Samuel Ortiz <sameo@linux.intel.com> wrote:
> Hi Haojian,
>
> On Wed, Jan 04, 2012 at 03:14:25PM +0800, Haojian Zhuang wrote:
>> From: Kevin Liu <kliu5@marvell.com>
>
> I got this build error:
>
> CC drivers/input/misc/max8925_onkey.o
> drivers/input/misc/max8925_onkey.c: In function ‘max8925_onkey_suspend’:
> drivers/input/misc/max8925_onkey.c:169:30: error: ‘onkey_irq’ undeclared
> (first use in this function)
> drivers/input/misc/max8925_onkey.c:169:30: note: each undeclared identifier is
> reported only once for each function it appears in
> drivers/input/misc/max8925_onkey.c: In function ‘max8925_onkey_resume’:
> drivers/input/misc/max8925_onkey.c:181:32: error: ‘onkey_irq’ undeclared
> (first use in this function)
> make[3]: *** [drivers/input/misc/max8925_onkey.o] Error 1
> make[2]: *** [drivers/input/misc] Error 2
> make[1]: *** [drivers/input] Error 2
>
> So I put this one aside.
>
> Cheers,
> Samuel.
>
Hi Samuel,
I'm sorry on this patch. I'll send a new one to replace it.
Best Regards
Haojian
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] misc: max8925_onkey: add function to work as wakeup source
2012-01-09 0:29 ` Samuel Ortiz
2012-01-10 10:11 ` Haojian Zhuang
@ 2012-01-10 10:24 ` Haojian Zhuang
2012-02-20 11:02 ` Samuel Ortiz
1 sibling, 1 reply; 9+ messages in thread
From: Haojian Zhuang @ 2012-01-10 10:24 UTC (permalink / raw)
To: sameo, a.zummo, dmitry.torokhov, linux-kernel, kliu5
From: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
drivers/input/misc/max8925_onkey.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
index 7de0ded..b0fe395 100644
--- a/drivers/input/misc/max8925_onkey.c
+++ b/drivers/input/misc/max8925_onkey.c
@@ -122,6 +122,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
info->idev->evbit[0] = BIT_MASK(EV_KEY);
info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
+ device_init_wakeup(&pdev->dev, 1);
error = input_register_device(info->idev);
if (error) {
@@ -158,10 +159,41 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int max8925_onkey_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct max8925_onkey_info *info = platform_get_drvdata(pdev);
+ struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+ if (device_may_wakeup(dev)) {
+ chip->wakeup_flag |= 1 << (info->irq[0] - chip->irq_base);
+ chip->wakeup_flag |= 1 << (info->irq[1] - chip->irq_base);
+ }
+ return 0;
+}
+
+static int max8925_onkey_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct max8925_onkey_info *info = platform_get_drvdata(pdev);
+ struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+ if (device_may_wakeup(dev)) {
+ chip->wakeup_flag &= ~(1 << (info->irq[0] - chip->irq_base));
+ chip->wakeup_flag &= ~(1 << (info->irq[1] - chip->irq_base));
+ }
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(max8925_onkey_pm_ops, max8925_onkey_suspend, max8925_onkey_resume);
+
static struct platform_driver max8925_onkey_driver = {
.driver = {
.name = "max8925-onkey",
.owner = THIS_MODULE,
+ .pm = &max8925_onkey_pm_ops,
},
.probe = max8925_onkey_probe,
.remove = __devexit_p(max8925_onkey_remove),
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] misc: max8925_onkey: add function to work as wakeup source
2012-01-10 10:24 ` Haojian Zhuang
@ 2012-02-20 11:02 ` Samuel Ortiz
2012-03-06 6:09 ` Dmitry Torokhov
0 siblings, 1 reply; 9+ messages in thread
From: Samuel Ortiz @ 2012-02-20 11:02 UTC (permalink / raw)
To: Haojian Zhuang, dmitry.torokhov
Cc: a.zummo, dmitry.torokhov, linux-kernel, kliu5
Hi Dmitry
On Tue, Jan 10, 2012 at 06:24:40PM +0800, Haojian Zhuang wrote:
> From: Kevin Liu <kliu5@marvell.com>
Could you please, take this one from the input tree ? All the mfd related bits
are upstream already.
Let me know if you prefer that I take it through the MFD tree.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] misc: max8925_onkey: add function to work as wakeup source
2012-02-20 11:02 ` Samuel Ortiz
@ 2012-03-06 6:09 ` Dmitry Torokhov
0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2012-03-06 6:09 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: Haojian Zhuang, a.zummo, linux-kernel, kliu5
On Mon, Feb 20, 2012 at 12:02:26PM +0100, Samuel Ortiz wrote:
> Hi Dmitry
>
> On Tue, Jan 10, 2012 at 06:24:40PM +0800, Haojian Zhuang wrote:
> > From: Kevin Liu <kliu5@marvell.com>
> Could you please, take this one from the input tree ? All the mfd related bits
> are upstream already.
> Let me know if you prefer that I take it through the MFD tree.
>
Applied, thanks everyone.
--
Dmitry
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-03-06 8:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04 7:14 [PATCH 1/3] mfd: max8925: add function to work as wakeup source Haojian Zhuang
2012-01-04 7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
2012-01-09 0:29 ` Samuel Ortiz
2012-01-10 10:11 ` Haojian Zhuang
2012-01-10 10:24 ` Haojian Zhuang
2012-02-20 11:02 ` Samuel Ortiz
2012-03-06 6:09 ` Dmitry Torokhov
2012-01-04 7:14 ` [PATCH 3/3] rtc: max8925: " Haojian Zhuang
2012-01-09 0:05 ` [PATCH 1/3] mfd: " Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).