* [PATCH] rtc: ds1307: call the platform's logic for handle IRQs.
@ 2017-08-24 10:30 Enric Balletbo i Serra
2017-12-15 11:44 ` Enric Balletbo Serra
0 siblings, 1 reply; 4+ messages in thread
From: Enric Balletbo i Serra @ 2017-08-24 10:30 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni, linux-rtc, linux-kernel
On some systems the nIRQ pin is often connect to a GPIO, then, if a given
interrupt line is supposed to wake up the system, the corresponding input
of that interrupt controller need to be enabled to receive signal from the
line in question. Before this commit such systems would not wake up
because are not marked as wakeup IRQs in the IRQ subsystem.
This commit calls enable_irq_wake() on suspend and disables that input to
prevent the dedicated controller from triggering interrupts unnecessarily
after wakeup.
After this commit a system composed by a RTC DS1339 chip connected to a
GPIO line on a AM335x SoC is able to wakeup from suspend-to-RAM, otherwise
the line is ignored.
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/rtc/rtc-ds1307.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 4b43aa6..c4b0f6a 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1711,11 +1711,36 @@ static int ds1307_probe(struct i2c_client *client,
return err;
}
+#ifdef CONFIG_PM_SLEEP
+static int ds1307_suspend(struct device *dev)
+{
+ struct ds1307 *ds1307 = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ enable_irq_wake(ds1307->irq);
+
+ return 0;
+}
+
+static int ds1307_resume(struct device *dev)
+{
+ struct ds1307 *ds1307 = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ disable_irq_wake(ds1307->irq);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(ds1307_pm_ops, ds1307_suspend, ds1307_resume);
+
static struct i2c_driver ds1307_driver = {
.driver = {
.name = "rtc-ds1307",
.of_match_table = of_match_ptr(ds1307_of_match),
.acpi_match_table = ACPI_PTR(ds1307_acpi_ids),
+ .pm = &ds1307_pm_ops,
},
.probe = ds1307_probe,
.id_table = ds1307_id,
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] rtc: ds1307: call the platform's logic for handle IRQs.
2017-08-24 10:30 [PATCH] rtc: ds1307: call the platform's logic for handle IRQs Enric Balletbo i Serra
@ 2017-12-15 11:44 ` Enric Balletbo Serra
2017-12-15 13:04 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Enric Balletbo Serra @ 2017-12-15 11:44 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Alessandro Zummo, Alexandre Belloni, linux-rtc, linux-kernel
Hi,
2017-08-24 12:30 GMT+02:00 Enric Balletbo i Serra
<enric.balletbo@collabora.com>:
> On some systems the nIRQ pin is often connect to a GPIO, then, if a given
> interrupt line is supposed to wake up the system, the corresponding input
> of that interrupt controller need to be enabled to receive signal from the
> line in question. Before this commit such systems would not wake up
> because are not marked as wakeup IRQs in the IRQ subsystem.
>
> This commit calls enable_irq_wake() on suspend and disables that input to
> prevent the dedicated controller from triggering interrupts unnecessarily
> after wakeup.
>
> After this commit a system composed by a RTC DS1339 chip connected to a
> GPIO line on a AM335x SoC is able to wakeup from suspend-to-RAM, otherwise
> the line is ignored.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> drivers/rtc/rtc-ds1307.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 4b43aa6..c4b0f6a 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -1711,11 +1711,36 @@ static int ds1307_probe(struct i2c_client *client,
> return err;
> }
>
> +#ifdef CONFIG_PM_SLEEP
> +static int ds1307_suspend(struct device *dev)
> +{
> + struct ds1307 *ds1307 = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev))
> + enable_irq_wake(ds1307->irq);
> +
> + return 0;
> +}
> +
> +static int ds1307_resume(struct device *dev)
> +{
> + struct ds1307 *ds1307 = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev))
> + disable_irq_wake(ds1307->irq);
> +
> + return 0;
> +}
> +#endif
> +
> +static SIMPLE_DEV_PM_OPS(ds1307_pm_ops, ds1307_suspend, ds1307_resume);
> +
> static struct i2c_driver ds1307_driver = {
> .driver = {
> .name = "rtc-ds1307",
> .of_match_table = of_match_ptr(ds1307_of_match),
> .acpi_match_table = ACPI_PTR(ds1307_acpi_ids),
> + .pm = &ds1307_pm_ops,
> },
> .probe = ds1307_probe,
> .id_table = ds1307_id,
> --
> 2.9.3
>
A gentle ping, any comments on this?
Thanks,
Enric
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rtc: ds1307: call the platform's logic for handle IRQs.
2017-12-15 11:44 ` Enric Balletbo Serra
@ 2017-12-15 13:04 ` Alexandre Belloni
2017-12-15 13:32 ` Enric Balletbo Serra
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2017-12-15 13:04 UTC (permalink / raw)
To: Enric Balletbo Serra
Cc: Enric Balletbo i Serra, Alessandro Zummo, linux-rtc, linux-kernel
Hi,
On 15/12/2017 at 12:44:49 +0100, Enric Balletbo Serra wrote:
> Hi,
>
> 2017-08-24 12:30 GMT+02:00 Enric Balletbo i Serra
> <enric.balletbo@collabora.com>:
> > On some systems the nIRQ pin is often connect to a GPIO, then, if a given
> > interrupt line is supposed to wake up the system, the corresponding input
> > of that interrupt controller need to be enabled to receive signal from the
> > line in question. Before this commit such systems would not wake up
> > because are not marked as wakeup IRQs in the IRQ subsystem.
> >
> > This commit calls enable_irq_wake() on suspend and disables that input to
> > prevent the dedicated controller from triggering interrupts unnecessarily
> > after wakeup.
> >
> > After this commit a system composed by a RTC DS1339 chip connected to a
> > GPIO line on a AM335x SoC is able to wakeup from suspend-to-RAM, otherwise
> > the line is ignored.
> >
> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> > ---
> > drivers/rtc/rtc-ds1307.c | 25 +++++++++++++++++++++++++
> > 1 file changed, 25 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> > index 4b43aa6..c4b0f6a 100644
> > --- a/drivers/rtc/rtc-ds1307.c
> > +++ b/drivers/rtc/rtc-ds1307.c
> > @@ -1711,11 +1711,36 @@ static int ds1307_probe(struct i2c_client *client,
> > return err;
> > }
> >
> > +#ifdef CONFIG_PM_SLEEP
> > +static int ds1307_suspend(struct device *dev)
> > +{
> > + struct ds1307 *ds1307 = dev_get_drvdata(dev);
> > +
> > + if (device_may_wakeup(dev))
> > + enable_irq_wake(ds1307->irq);
> > +
> > + return 0;
> > +}
> > +
> > +static int ds1307_resume(struct device *dev)
> > +{
> > + struct ds1307 *ds1307 = dev_get_drvdata(dev);
> > +
> > + if (device_may_wakeup(dev))
> > + disable_irq_wake(ds1307->irq);
> > +
> > + return 0;
> > +}
> > +#endif
> > +
> > +static SIMPLE_DEV_PM_OPS(ds1307_pm_ops, ds1307_suspend, ds1307_resume);
> > +
> > static struct i2c_driver ds1307_driver = {
> > .driver = {
> > .name = "rtc-ds1307",
> > .of_match_table = of_match_ptr(ds1307_of_match),
> > .acpi_match_table = ACPI_PTR(ds1307_acpi_ids),
> > + .pm = &ds1307_pm_ops,
> > },
> > .probe = ds1307_probe,
> > .id_table = ds1307_id,
> > --
> > 2.9.3
> >
>
> A gentle ping, any comments on this?
>
It was rejected following the discussion you had with Heiner and your
email of the 25/08.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rtc: ds1307: call the platform's logic for handle IRQs.
2017-12-15 13:04 ` Alexandre Belloni
@ 2017-12-15 13:32 ` Enric Balletbo Serra
0 siblings, 0 replies; 4+ messages in thread
From: Enric Balletbo Serra @ 2017-12-15 13:32 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Enric Balletbo i Serra, Alessandro Zummo, linux-rtc, linux-kernel
Hi Alexandre,
2017-12-15 14:04 GMT+01:00 Alexandre Belloni
<alexandre.belloni@free-electrons.com>:
> Hi,
>
> On 15/12/2017 at 12:44:49 +0100, Enric Balletbo Serra wrote:
>> Hi,
>>
>> 2017-08-24 12:30 GMT+02:00 Enric Balletbo i Serra
>> <enric.balletbo@collabora.com>:
>> > On some systems the nIRQ pin is often connect to a GPIO, then, if a given
>> > interrupt line is supposed to wake up the system, the corresponding input
>> > of that interrupt controller need to be enabled to receive signal from the
>> > line in question. Before this commit such systems would not wake up
>> > because are not marked as wakeup IRQs in the IRQ subsystem.
>> >
>> > This commit calls enable_irq_wake() on suspend and disables that input to
>> > prevent the dedicated controller from triggering interrupts unnecessarily
>> > after wakeup.
>> >
>> > After this commit a system composed by a RTC DS1339 chip connected to a
>> > GPIO line on a AM335x SoC is able to wakeup from suspend-to-RAM, otherwise
>> > the line is ignored.
>> >
>> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> > ---
>> > drivers/rtc/rtc-ds1307.c | 25 +++++++++++++++++++++++++
>> > 1 file changed, 25 insertions(+)
>> >
>> > diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
>> > index 4b43aa6..c4b0f6a 100644
>> > --- a/drivers/rtc/rtc-ds1307.c
>> > +++ b/drivers/rtc/rtc-ds1307.c
>> > @@ -1711,11 +1711,36 @@ static int ds1307_probe(struct i2c_client *client,
>> > return err;
>> > }
>> >
>> > +#ifdef CONFIG_PM_SLEEP
>> > +static int ds1307_suspend(struct device *dev)
>> > +{
>> > + struct ds1307 *ds1307 = dev_get_drvdata(dev);
>> > +
>> > + if (device_may_wakeup(dev))
>> > + enable_irq_wake(ds1307->irq);
>> > +
>> > + return 0;
>> > +}
>> > +
>> > +static int ds1307_resume(struct device *dev)
>> > +{
>> > + struct ds1307 *ds1307 = dev_get_drvdata(dev);
>> > +
>> > + if (device_may_wakeup(dev))
>> > + disable_irq_wake(ds1307->irq);
>> > +
>> > + return 0;
>> > +}
>> > +#endif
>> > +
>> > +static SIMPLE_DEV_PM_OPS(ds1307_pm_ops, ds1307_suspend, ds1307_resume);
>> > +
>> > static struct i2c_driver ds1307_driver = {
>> > .driver = {
>> > .name = "rtc-ds1307",
>> > .of_match_table = of_match_ptr(ds1307_of_match),
>> > .acpi_match_table = ACPI_PTR(ds1307_acpi_ids),
>> > + .pm = &ds1307_pm_ops,
>> > },
>> > .probe = ds1307_probe,
>> > .id_table = ds1307_id,
>> > --
>> > 2.9.3
>> >
>>
>> A gentle ping, any comments on this?
>>
>
> It was rejected following the discussion you had with Heiner and your
> email of the 25/08.
>
Oops, right, very sorry to take your time, for some reason I had this
patch tagged as 'waiting for an answer' but this was already
discussed, so my bad.
Thanks,
Enric
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-12-15 13:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 10:30 [PATCH] rtc: ds1307: call the platform's logic for handle IRQs Enric Balletbo i Serra
2017-12-15 11:44 ` Enric Balletbo Serra
2017-12-15 13:04 ` Alexandre Belloni
2017-12-15 13:32 ` Enric Balletbo Serra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox