* [PATCH v2 0/2] MFD: MAX8997 Driver Update
@ 2011-08-18 7:37 MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 1/2] MFD: MAX8997: IRQ Handling Bugfix MyungJoo Ham
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: MyungJoo Ham @ 2011-08-18 7:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, kyungmin.park, myungjoo.ham
This patchset does:
1. Bugfix on IRQ handling
The current version does not initialize IRQ handling part properly.
This patch adds max8997-irq init and allows to handle interrupts
correctly.
2. Suspend-to-RAM Wakeup Source
The current version is missing wakeup-source feature.
Changes from v1:
- Removed a patch from the patchset.
(v2 is basically a "resubmit" without the undesired part)
MyungJoo Ham (2):
MFD: MAX8997: IRQ Handling Bugfix
MFD: MAX8997: Support Wake-up from Suspend
drivers/mfd/max8997.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] MFD: MAX8997: IRQ Handling Bugfix
2011-08-18 7:37 [PATCH v2 0/2] MFD: MAX8997 Driver Update MyungJoo Ham
@ 2011-08-18 7:37 ` MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend MyungJoo Ham
2011-08-22 14:41 ` [PATCH v2 0/2] MFD: MAX8997 Driver Update Samuel Ortiz
2 siblings, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2011-08-18 7:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, kyungmin.park, myungjoo.ham
Required platform information is not handed to max8997-irq.c properly.
This patch enables to hand over such information to max8997-irq.c so
that max8997-irq functions properly.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/mfd/max8997.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index 5d1fca0..f83103b 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -135,10 +135,13 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
max8997->dev = &i2c->dev;
max8997->i2c = i2c;
max8997->type = id->driver_data;
+ max8997->irq = i2c->irq;
if (!pdata)
goto err;
+ max8997->irq_base = pdata->irq_base;
+ max8997->ono = pdata->ono;
max8997->wakeup = pdata->wakeup;
mutex_init(&max8997->iolock);
@@ -152,6 +155,8 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
pm_runtime_set_active(max8997->dev);
+ max8997_irq_init(max8997);
+
mfd_add_devices(max8997->dev, -1, max8997_devs,
ARRAY_SIZE(max8997_devs),
NULL, 0);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend
2011-08-18 7:37 [PATCH v2 0/2] MFD: MAX8997 Driver Update MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 1/2] MFD: MAX8997: IRQ Handling Bugfix MyungJoo Ham
@ 2011-08-18 7:37 ` MyungJoo Ham
2011-08-19 0:59 ` Mark Brown
2011-08-22 14:41 ` [PATCH v2 0/2] MFD: MAX8997 Driver Update Samuel Ortiz
2 siblings, 1 reply; 7+ messages in thread
From: MyungJoo Ham @ 2011-08-18 7:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, kyungmin.park, myungjoo.ham
- Support wake-up from suspend-to-ram.
- Handle pending interrupt after a resume.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/mfd/max8997.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index f83103b..4ae42c6 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
+#include <linux/interrupt.h>
#include <linux/pm_runtime.h>
#include <linux/mutex.h>
#include <linux/mfd/core.h>
@@ -398,7 +399,29 @@ static int max8997_restore(struct device *dev)
return 0;
}
+static int max8997_suspend(struct device *dev)
+{
+ struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+ struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
+
+ if (max8997->wakeup && max8997->irq)
+ irq_set_irq_wake(max8997->irq, 1);
+ return 0;
+}
+
+static int max8997_resume(struct device *dev)
+{
+ struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+ struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
+
+ if (max8997->wakeup && max8997->irq)
+ irq_set_irq_wake(max8997->irq, 0);
+ return max8997_irq_resume(max8997);
+}
+
const struct dev_pm_ops max8997_pm = {
+ .suspend = max8997_suspend,
+ .resume = max8997_resume,
.freeze = max8997_freeze,
.restore = max8997_restore,
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend
2011-08-18 7:37 ` [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend MyungJoo Ham
@ 2011-08-19 0:59 ` Mark Brown
2011-08-19 5:38 ` MyungJoo Ham
2011-08-19 5:39 ` [PATCH v2 2/2-resubmit] " MyungJoo Ham
0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2011-08-19 0:59 UTC (permalink / raw)
To: MyungJoo Ham; +Cc: linux-kernel, Samuel Ortiz, kyungmin.park, myungjoo.ham
On Thu, Aug 18, 2011 at 04:37:36PM +0900, MyungJoo Ham wrote:
> + if (max8997->wakeup && max8997->irq)
> + irq_set_irq_wake(max8997->irq, 1);
There's supposed to be userspace control of this stuff (see
device_may_wake_up() and friends) though that can always be added in a
second pass).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend
2011-08-19 0:59 ` Mark Brown
@ 2011-08-19 5:38 ` MyungJoo Ham
2011-08-19 5:39 ` [PATCH v2 2/2-resubmit] " MyungJoo Ham
1 sibling, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2011-08-19 5:38 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Samuel Ortiz, kyungmin.park
On Fri, Aug 19, 2011 at 9:59 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Thu, Aug 18, 2011 at 04:37:36PM +0900, MyungJoo Ham wrote:
>
>> + if (max8997->wakeup && max8997->irq)
>> + irq_set_irq_wake(max8997->irq, 1);
>
> There's supposed to be userspace control of this stuff (see
> device_may_wake_up() and friends) though that can always be added in a
> second pass).
>
Ok, I'm resubmitting this part of the patchset. Thanks.
Cheers.
MyungJoo
--
MyungJoo Ham (함명주), Ph.D.
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: 82-10-6714-2858
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2-resubmit] MFD: MAX8997: Support Wake-up from Suspend
2011-08-19 0:59 ` Mark Brown
2011-08-19 5:38 ` MyungJoo Ham
@ 2011-08-19 5:39 ` MyungJoo Ham
1 sibling, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2011-08-19 5:39 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, kyungmin.park, myungjoo.ham
- Support wake-up from suspend-to-ram.
- Handle pending interrupt after a resume.
- If pdata->wakeup is enabled, by default, the device is assumed to be
capable of wakeup (the interrupt pin is connected to a wakeup-source GPIO)
and may wakeup the system (MAX8997 has a power button input pin).
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Resubmitted to use wakeup interfaces as commented by Mark Brown.
---
drivers/mfd/max8997.c | 27 ++++++++++++++++++++++++++-
include/linux/mfd/max8997-private.h | 1 -
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index f83103b..dc58750 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -23,6 +23,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
+#include <linux/interrupt.h>
#include <linux/pm_runtime.h>
#include <linux/mutex.h>
#include <linux/mfd/core.h>
@@ -142,7 +143,6 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
max8997->irq_base = pdata->irq_base;
max8997->ono = pdata->ono;
- max8997->wakeup = pdata->wakeup;
mutex_init(&max8997->iolock);
@@ -169,6 +169,9 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
if (ret < 0)
goto err_mfd;
+ /* MAX8997 has a power button input. */
+ device_init_wakeup(max8997->dev, pdata->wakeup);
+
return ret;
err_mfd:
@@ -398,7 +401,29 @@ static int max8997_restore(struct device *dev)
return 0;
}
+static int max8997_suspend(struct device *dev)
+{
+ struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+ struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
+
+ if (device_may_wakeup(dev))
+ irq_set_irq_wake(max8997->irq, 1);
+ return 0;
+}
+
+static int max8997_resume(struct device *dev)
+{
+ struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+ struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
+
+ if (device_may_wakeup(dev))
+ irq_set_irq_wake(max8997->irq, 0);
+ return max8997_irq_resume(max8997);
+}
+
const struct dev_pm_ops max8997_pm = {
+ .suspend = max8997_suspend,
+ .resume = max8997_resume,
.freeze = max8997_freeze,
.restore = max8997_restore,
};
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 5ff2400..3f4deb6 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -326,7 +326,6 @@ struct max8997_dev {
int irq;
int ono;
int irq_base;
- bool wakeup;
struct mutex irqlock;
int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] MFD: MAX8997 Driver Update
2011-08-18 7:37 [PATCH v2 0/2] MFD: MAX8997 Driver Update MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 1/2] MFD: MAX8997: IRQ Handling Bugfix MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend MyungJoo Ham
@ 2011-08-22 14:41 ` Samuel Ortiz
2 siblings, 0 replies; 7+ messages in thread
From: Samuel Ortiz @ 2011-08-22 14:41 UTC (permalink / raw)
To: MyungJoo Ham; +Cc: linux-kernel, kyungmin.park, myungjoo.ham
Hi,
On Thu, Aug 18, 2011 at 04:37:34PM +0900, MyungJoo Ham wrote:
> This patchset does:
>
> 1. Bugfix on IRQ handling
> The current version does not initialize IRQ handling part properly.
> This patch adds max8997-irq init and allows to handle interrupts
> correctly.
>
> 2. Suspend-to-RAM Wakeup Source
> The current version is missing wakeup-source feature.
>
> Changes from v1:
> - Removed a patch from the patchset.
> (v2 is basically a "resubmit" without the undesired part)
>
> MyungJoo Ham (2):
> MFD: MAX8997: IRQ Handling Bugfix
> MFD: MAX8997: Support Wake-up from Suspend
Thanks, both patches (I took patch #2 second version) applied.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-08-22 14:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-18 7:37 [PATCH v2 0/2] MFD: MAX8997 Driver Update MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 1/2] MFD: MAX8997: IRQ Handling Bugfix MyungJoo Ham
2011-08-18 7:37 ` [PATCH v2 2/2] MFD: MAX8997: Support Wake-up from Suspend MyungJoo Ham
2011-08-19 0:59 ` Mark Brown
2011-08-19 5:38 ` MyungJoo Ham
2011-08-19 5:39 ` [PATCH v2 2/2-resubmit] " MyungJoo Ham
2011-08-22 14:41 ` [PATCH v2 0/2] MFD: MAX8997 Driver Update Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox