* [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
@ 2011-03-29 5:51 wni
2011-03-29 5:58 ` Varun Wadekar
0 siblings, 1 reply; 9+ messages in thread
From: wni @ 2011-03-29 5:51 UTC (permalink / raw)
To: sameo, linux-kernel; +Cc: ccross, vwadekar, Wei Ni
From: Wei Ni <wni@nvidia.com>
When use rtc tps6586x wakealarm to suspend/resume system,
it will show a lot error messages:
"tps6586x 4-0034: failed to read interrupt status
tps6586x 4-0034: failed reading from 0xb5"
After resume, the system will call the mfd tps6586x driver's interrupt handle
tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
that time the i2c driver didn't resume yet, so the reading will be failed.
I call the disble_irq in the suspend, and enable_irq in the resume, which will
delay the delivery of the irq until the i2c driver has been resumed.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/mfd/tps6586x.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index b600808..1842b98 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,6 +569,20 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ disable_irq(client->irq);
+ return 0;
+}
+
+static int tps6586x_resume(struct i2c_client *client)
+{
+ enable_irq(client->irq);
+ return 0;
+}
+#endif
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
@@ -577,6 +591,10 @@ static struct i2c_driver tps6586x_driver = {
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
.id_table = tps6586x_id_table,
+#ifdef CONFIG_PM
+ .suspend = tps6586x_suspend,
+ .resume = tps6586x_resume,
+#endif
};
static int __init tps6586x_init(void)
--
1.7.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-03-29 5:51 wni
@ 2011-03-29 5:58 ` Varun Wadekar
2011-03-29 6:04 ` Wei Ni
0 siblings, 1 reply; 9+ messages in thread
From: Varun Wadekar @ 2011-03-29 5:58 UTC (permalink / raw)
To: Wei Ni
Cc: sameo@linux.intel.com, linux-kernel@vger.kernel.org,
ccross@android.com
+static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ disable_irq(client->irq);
+ return 0;
+}
+
+static int tps6586x_resume(struct i2c_client *client)
+{
+ enable_irq(client->irq);
+ return 0;
+}
disable_irq and enable_irq should be under "if (client->irq)".
On Tuesday 29 March 2011 11:21 AM, Wei Ni wrote:
> From: Wei Ni <wni@nvidia.com>
>
> When use rtc tps6586x wakealarm to suspend/resume system,
> it will show a lot error messages:
> "tps6586x 4-0034: failed to read interrupt status
> tps6586x 4-0034: failed reading from 0xb5"
> After resume, the system will call the mfd tps6586x driver's interrupt handle
> tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
> that time the i2c driver didn't resume yet, so the reading will be failed.
> I call the disble_irq in the suspend, and enable_irq in the resume, which will
> delay the delivery of the irq until the i2c driver has been resumed.
>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
> drivers/mfd/tps6586x.c | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
> index b600808..1842b98 100644
> --- a/drivers/mfd/tps6586x.c
> +++ b/drivers/mfd/tps6586x.c
> @@ -569,6 +569,20 @@ static const struct i2c_device_id tps6586x_id_table[] = {
> };
> MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
>
> +#ifdef CONFIG_PM
> +static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
> +{
> + disable_irq(client->irq);
> + return 0;
> +}
> +
> +static int tps6586x_resume(struct i2c_client *client)
> +{
> + enable_irq(client->irq);
> + return 0;
> +}
> +#endif
> +
> static struct i2c_driver tps6586x_driver = {
> .driver = {
> .name = "tps6586x",
> @@ -577,6 +591,10 @@ static struct i2c_driver tps6586x_driver = {
> .probe = tps6586x_i2c_probe,
> .remove = __devexit_p(tps6586x_i2c_remove),
> .id_table = tps6586x_id_table,
> +#ifdef CONFIG_PM
> + .suspend = tps6586x_suspend,
> + .resume = tps6586x_resume,
> +#endif
> };
>
> static int __init tps6586x_init(void)
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-03-29 5:58 ` Varun Wadekar
@ 2011-03-29 6:04 ` Wei Ni
0 siblings, 0 replies; 9+ messages in thread
From: Wei Ni @ 2011-03-29 6:04 UTC (permalink / raw)
To: Varun Wadekar
Cc: sameo@linux.intel.com, linux-kernel@vger.kernel.org,
ccross@android.com
Oh, sorry, it's my mistake.
I will create a new patch.
Thanks
Wei.
-----Original Message-----
From: Varun Wadekar [mailto:vwadekar@nvidia.com]
Sent: Tuesday, March 29, 2011 1:59 PM
To: Wei Ni
Cc: sameo@linux.intel.com; linux-kernel@vger.kernel.org; ccross@android.com
Subject: Re: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
+static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ disable_irq(client->irq);
+ return 0;
+}
+
+static int tps6586x_resume(struct i2c_client *client)
+{
+ enable_irq(client->irq);
+ return 0;
+}
disable_irq and enable_irq should be under "if (client->irq)".
On Tuesday 29 March 2011 11:21 AM, Wei Ni wrote:
> From: Wei Ni <wni@nvidia.com>
>
> When use rtc tps6586x wakealarm to suspend/resume system,
> it will show a lot error messages:
> "tps6586x 4-0034: failed to read interrupt status
> tps6586x 4-0034: failed reading from 0xb5"
> After resume, the system will call the mfd tps6586x driver's interrupt handle
> tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
> that time the i2c driver didn't resume yet, so the reading will be failed.
> I call the disble_irq in the suspend, and enable_irq in the resume, which will
> delay the delivery of the irq until the i2c driver has been resumed.
>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
> drivers/mfd/tps6586x.c | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
> index b600808..1842b98 100644
> --- a/drivers/mfd/tps6586x.c
> +++ b/drivers/mfd/tps6586x.c
> @@ -569,6 +569,20 @@ static const struct i2c_device_id tps6586x_id_table[] = {
> };
> MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
>
> +#ifdef CONFIG_PM
> +static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
> +{
> + disable_irq(client->irq);
> + return 0;
> +}
> +
> +static int tps6586x_resume(struct i2c_client *client)
> +{
> + enable_irq(client->irq);
> + return 0;
> +}
> +#endif
> +
> static struct i2c_driver tps6586x_driver = {
> .driver = {
> .name = "tps6586x",
> @@ -577,6 +591,10 @@ static struct i2c_driver tps6586x_driver = {
> .probe = tps6586x_i2c_probe,
> .remove = __devexit_p(tps6586x_i2c_remove),
> .id_table = tps6586x_id_table,
> +#ifdef CONFIG_PM
> + .suspend = tps6586x_suspend,
> + .resume = tps6586x_resume,
> +#endif
> };
>
> static int __init tps6586x_init(void)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
@ 2011-03-29 6:16 wni
2011-03-30 6:19 ` Wei Ni
0 siblings, 1 reply; 9+ messages in thread
From: wni @ 2011-03-29 6:16 UTC (permalink / raw)
To: sameo, linux-kernel; +Cc: ccross, vwadekar, Wei Ni
From: Wei Ni <wni@nvidia.com>
When use rtc tps6586x wakealarm to suspend/resume system,
it will show a lot error messages:
"tps6586x 4-0034: failed to read interrupt status
tps6586x 4-0034: failed reading from 0xb5"
After resume, the system will call the mfd tps6586x driver's interrupt handle
tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
that time the i2c driver didn't resume yet, so the reading will be failed.
I call the disble_irq in the suspend, and enable_irq in the resume, which will
delay the delivery of the irq until the i2c driver has been resumed.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/mfd/tps6586x.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index b600808..c7bd96b 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,6 +569,22 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ if (client->irq)
+ disable_irq(client->irq);
+ return 0;
+}
+
+static int tps6586x_resume(struct i2c_client *client)
+{
+ if (client->irq)
+ enable_irq(client->irq);
+ return 0;
+}
+#endif
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
@@ -577,6 +593,10 @@ static struct i2c_driver tps6586x_driver = {
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
.id_table = tps6586x_id_table,
+#ifdef CONFIG_PM
+ .suspend = tps6586x_suspend,
+ .resume = tps6586x_resume,
+#endif
};
static int __init tps6586x_init(void)
--
1.7.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-03-29 6:16 [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume wni
@ 2011-03-30 6:19 ` Wei Ni
2011-04-18 9:57 ` Wei Ni
0 siblings, 1 reply; 9+ messages in thread
From: Wei Ni @ 2011-03-30 6:19 UTC (permalink / raw)
To: sameo@linux.intel.com, linux-kernel@vger.kernel.org
Cc: ccross@android.com, Varun Wadekar, Wei Ni, Emily Jiang
Hi, all
Could anyone review this patch?
Thanks
Wei.
-----Original Message-----
From: Wei Ni
Sent: Tuesday, March 29, 2011 2:17 PM
To: sameo@linux.intel.com; linux-kernel@vger.kernel.org
Cc: ccross@android.com; Varun Wadekar; Wei Ni
Subject: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
From: Wei Ni <wni@nvidia.com>
When use rtc tps6586x wakealarm to suspend/resume system,
it will show a lot error messages:
"tps6586x 4-0034: failed to read interrupt status
tps6586x 4-0034: failed reading from 0xb5"
After resume, the system will call the mfd tps6586x driver's interrupt handle
tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
that time the i2c driver didn't resume yet, so the reading will be failed.
I call the disble_irq in the suspend, and enable_irq in the resume, which will
delay the delivery of the irq until the i2c driver has been resumed.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/mfd/tps6586x.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index b600808..c7bd96b 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,6 +569,22 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ if (client->irq)
+ disable_irq(client->irq);
+ return 0;
+}
+
+static int tps6586x_resume(struct i2c_client *client)
+{
+ if (client->irq)
+ enable_irq(client->irq);
+ return 0;
+}
+#endif
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
@@ -577,6 +593,10 @@ static struct i2c_driver tps6586x_driver = {
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
.id_table = tps6586x_id_table,
+#ifdef CONFIG_PM
+ .suspend = tps6586x_suspend,
+ .resume = tps6586x_resume,
+#endif
};
static int __init tps6586x_init(void)
--
1.7.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-03-30 6:19 ` Wei Ni
@ 2011-04-18 9:57 ` Wei Ni
2011-05-02 13:16 ` Samuel Ortiz
0 siblings, 1 reply; 9+ messages in thread
From: Wei Ni @ 2011-04-18 9:57 UTC (permalink / raw)
To: sameo@linux.intel.com, linux-kernel@vger.kernel.org
Cc: ccross@android.com, Varun Wadekar, Emily Jiang
Hi, all
Does there have any updates for this patch?
Thanks
Wei.
-----Original Message-----
From: Wei Ni
Sent: Wednesday, March 30, 2011 2:20 PM
To: sameo@linux.intel.com; linux-kernel@vger.kernel.org
Cc: ccross@android.com; Varun Wadekar; Wei Ni; Emily Jiang
Subject: RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
Hi, all
Could anyone review this patch?
Thanks
Wei.
-----Original Message-----
From: Wei Ni
Sent: Tuesday, March 29, 2011 2:17 PM
To: sameo@linux.intel.com; linux-kernel@vger.kernel.org
Cc: ccross@android.com; Varun Wadekar; Wei Ni
Subject: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
From: Wei Ni <wni@nvidia.com>
When use rtc tps6586x wakealarm to suspend/resume system,
it will show a lot error messages:
"tps6586x 4-0034: failed to read interrupt status
tps6586x 4-0034: failed reading from 0xb5"
After resume, the system will call the mfd tps6586x driver's interrupt handle
tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
that time the i2c driver didn't resume yet, so the reading will be failed.
I call the disble_irq in the suspend, and enable_irq in the resume, which will
delay the delivery of the irq until the i2c driver has been resumed.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/mfd/tps6586x.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index b600808..c7bd96b 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,6 +569,22 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+ if (client->irq)
+ disable_irq(client->irq);
+ return 0;
+}
+
+static int tps6586x_resume(struct i2c_client *client)
+{
+ if (client->irq)
+ enable_irq(client->irq);
+ return 0;
+}
+#endif
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
@@ -577,6 +593,10 @@ static struct i2c_driver tps6586x_driver = {
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
.id_table = tps6586x_id_table,
+#ifdef CONFIG_PM
+ .suspend = tps6586x_suspend,
+ .resume = tps6586x_resume,
+#endif
};
static int __init tps6586x_init(void)
--
1.7.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-04-18 9:57 ` Wei Ni
@ 2011-05-02 13:16 ` Samuel Ortiz
2011-05-04 6:49 ` Wei Ni
0 siblings, 1 reply; 9+ messages in thread
From: Samuel Ortiz @ 2011-05-02 13:16 UTC (permalink / raw)
To: Wei Ni
Cc: linux-kernel@vger.kernel.org, ccross@android.com, Varun Wadekar,
Emily Jiang
Hi Wei,
> When use rtc tps6586x wakealarm to suspend/resume system,
> it will show a lot error messages:
> "tps6586x 4-0034: failed to read interrupt status
> tps6586x 4-0034: failed reading from 0xb5"
> After resume, the system will call the mfd tps6586x driver's interrupt handle
> tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
> that time the i2c driver didn't resume yet, so the reading will be failed.
> I call the disble_irq in the suspend, and enable_irq in the resume, which will
> delay the delivery of the irq until the i2c driver has been resumed.
I think something like this would make more sense:
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index bba26d9..a5feeb5 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,10 +569,36 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct device *dev)
+{
+ struct i2c_client *i2c = to_i2c_client(dev);
+
+ if (device_may_wakeup(&i2c->dev) && i2c->irq)
+ enable_irq_wake(i2c->irq);
+
+ return 0;
+}
+
+static int tps6586x_resume(struct device *dev)
+{
+ struct i2c_client *i2c = to_i2c_client(dev);
+
+ if (device_may_wakeup(&i2c->dev) && i2c->irq)
+ disable_irq_wake(i2c->irq);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_suspend, tps6586x_resume,
+ NULL);
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
.owner = THIS_MODULE,
+ .pm = tps6586x_pm_ops,
},
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
Could you please try ?
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-05-02 13:16 ` Samuel Ortiz
@ 2011-05-04 6:49 ` Wei Ni
2011-05-10 8:23 ` Wei Ni
0 siblings, 1 reply; 9+ messages in thread
From: Wei Ni @ 2011-05-04 6:49 UTC (permalink / raw)
To: 'Samuel Ortiz'
Cc: linux-kernel@vger.kernel.org, ccross@android.com, Varun Wadekar
Hi, Samuel
I tried your codes, it looks ok, the error messages disappeared.
Could you submit your patch?
BTW, what kernel version do you use?
In my 2.6.39, the SIMPLE_DEV_PM_OPS only have 3 arguments,
and it should be" .pm = &tps6586x_pm_ops,"
Thanks
Wei.
-----Original Message-----
From: Samuel Ortiz [mailto:sameo@linux.intel.com]
Sent: Monday, May 02, 2011 9:16 PM
To: Wei Ni
Cc: linux-kernel@vger.kernel.org; ccross@android.com; Varun Wadekar; Emily Jiang
Subject: Re: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
Hi Wei,
> When use rtc tps6586x wakealarm to suspend/resume system,
> it will show a lot error messages:
> "tps6586x 4-0034: failed to read interrupt status
> tps6586x 4-0034: failed reading from 0xb5"
> After resume, the system will call the mfd tps6586x driver's interrupt handle
> tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
> that time the i2c driver didn't resume yet, so the reading will be failed.
> I call the disble_irq in the suspend, and enable_irq in the resume, which will
> delay the delivery of the irq until the i2c driver has been resumed.
I think something like this would make more sense:
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index bba26d9..a5feeb5 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,10 +569,36 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct device *dev)
+{
+ struct i2c_client *i2c = to_i2c_client(dev);
+
+ if (device_may_wakeup(&i2c->dev) && i2c->irq)
+ enable_irq_wake(i2c->irq);
+
+ return 0;
+}
+
+static int tps6586x_resume(struct device *dev)
+{
+ struct i2c_client *i2c = to_i2c_client(dev);
+
+ if (device_may_wakeup(&i2c->dev) && i2c->irq)
+ disable_irq_wake(i2c->irq);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_suspend, tps6586x_resume,
+ NULL);
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
.owner = THIS_MODULE,
+ .pm = tps6586x_pm_ops,
},
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
Could you please try ?
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
2011-05-04 6:49 ` Wei Ni
@ 2011-05-10 8:23 ` Wei Ni
0 siblings, 0 replies; 9+ messages in thread
From: Wei Ni @ 2011-05-10 8:23 UTC (permalink / raw)
To: 'Samuel Ortiz'; +Cc: 'linux-kernel@vger.kernel.org'
Hi, Samuel
I tried your codes again, it seems have some problems, it still have
the error message when resume.
My changes works fine on my side.
The enable_irq_wake/disable_irq_wake will call desc->irq_data.chip->irq_set_wake()
But it seems the tps6586x didn't define the irq_set_wake(), so this function will
not affect the irq.
Thanks
Wei.
-----Original Message-----
From: Wei Ni
Sent: Wednesday, May 04, 2011 2:49 PM
To: 'Samuel Ortiz'
Cc: linux-kernel@vger.kernel.org; ccross@android.com; Varun Wadekar
Subject: RE: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
Hi, Samuel
I tried your codes, it looks ok, the error messages disappeared.
Could you submit your patch?
BTW, what kernel version do you use?
In my 2.6.39, the SIMPLE_DEV_PM_OPS only have 3 arguments,
and it should be" .pm = &tps6586x_pm_ops,"
Thanks
Wei.
-----Original Message-----
From: Samuel Ortiz [mailto:sameo@linux.intel.com]
Sent: Monday, May 02, 2011 9:16 PM
To: Wei Ni
Cc: linux-kernel@vger.kernel.org; ccross@android.com; Varun Wadekar; Emily Jiang
Subject: Re: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
Hi Wei,
> When use rtc tps6586x wakealarm to suspend/resume system,
> it will show a lot error messages:
> "tps6586x 4-0034: failed to read interrupt status
> tps6586x 4-0034: failed reading from 0xb5"
> After resume, the system will call the mfd tps6586x driver's interrupt handle
> tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
> that time the i2c driver didn't resume yet, so the reading will be failed.
> I call the disble_irq in the suspend, and enable_irq in the resume, which will
> delay the delivery of the irq until the i2c driver has been resumed.
I think something like this would make more sense:
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index bba26d9..a5feeb5 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,10 +569,36 @@ static const struct i2c_device_id tps6586x_id_table[] = {
};
MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct device *dev)
+{
+ struct i2c_client *i2c = to_i2c_client(dev);
+
+ if (device_may_wakeup(&i2c->dev) && i2c->irq)
+ enable_irq_wake(i2c->irq);
+
+ return 0;
+}
+
+static int tps6586x_resume(struct device *dev)
+{
+ struct i2c_client *i2c = to_i2c_client(dev);
+
+ if (device_may_wakeup(&i2c->dev) && i2c->irq)
+ disable_irq_wake(i2c->irq);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_suspend, tps6586x_resume,
+ NULL);
+
static struct i2c_driver tps6586x_driver = {
.driver = {
.name = "tps6586x",
.owner = THIS_MODULE,
+ .pm = tps6586x_pm_ops,
},
.probe = tps6586x_i2c_probe,
.remove = __devexit_p(tps6586x_i2c_remove),
Could you please try ?
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-05-10 8:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29 6:16 [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume wni
2011-03-30 6:19 ` Wei Ni
2011-04-18 9:57 ` Wei Ni
2011-05-02 13:16 ` Samuel Ortiz
2011-05-04 6:49 ` Wei Ni
2011-05-10 8:23 ` Wei Ni
-- strict thread matches above, loose matches on Subject: below --
2011-03-29 5:51 wni
2011-03-29 5:58 ` Varun Wadekar
2011-03-29 6:04 ` Wei Ni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox