* [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
@ 2023-08-01 11:45 Anvesh Jain P
2023-08-01 12:40 ` Alexandre Belloni
0 siblings, 1 reply; 9+ messages in thread
From: Anvesh Jain P @ 2023-08-01 11:45 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: linux-rtc, linux-kernel, Venkata Rao Kakani, Anvesh Jain P
Enable & disable rtc alarm wake up capability based on
default parameter passed from device tree.
Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
---
drivers/rtc/rtc-pm8xxx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index f6b779c12ca7..bed57be602b6 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
if (rc)
return rc;
+ if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
+ device_set_wakeup_capable(&pdev->dev, false);
+
rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
if (rc)
return rc;
base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-01 11:45 [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability Anvesh Jain P
@ 2023-08-01 12:40 ` Alexandre Belloni
2023-08-01 12:48 ` Anvesh Jain P
0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2023-08-01 12:40 UTC (permalink / raw)
To: Anvesh Jain P
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
> Enable & disable rtc alarm wake up capability based on
> default parameter passed from device tree.
>
I see what you are doing but not why this is necessary, NAK.
> Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
> Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
> ---
> drivers/rtc/rtc-pm8xxx.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> index f6b779c12ca7..bed57be602b6 100644
> --- a/drivers/rtc/rtc-pm8xxx.c
> +++ b/drivers/rtc/rtc-pm8xxx.c
> @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
> if (rc)
> return rc;
>
> + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
> + device_set_wakeup_capable(&pdev->dev, false);
> +
> rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
> if (rc)
> return rc;
>
> base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
> --
> 2.17.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-01 12:40 ` Alexandre Belloni
@ 2023-08-01 12:48 ` Anvesh Jain P
2023-08-01 19:34 ` Alexandre Belloni
0 siblings, 1 reply; 9+ messages in thread
From: Anvesh Jain P @ 2023-08-01 12:48 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
In automotive systems, RTC should not wake up the device when it is
parked or when it is garage to avoid leakage current. providing a
control from device tree to avoid RTC wake up based on the use case is
reason for this patch.
On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
> On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
>> Enable & disable rtc alarm wake up capability based on
>> default parameter passed from device tree.
>>
>
> I see what you are doing but not why this is necessary, NAK.
>
>> Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
>> Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
>> ---
>> drivers/rtc/rtc-pm8xxx.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
>> index f6b779c12ca7..bed57be602b6 100644
>> --- a/drivers/rtc/rtc-pm8xxx.c
>> +++ b/drivers/rtc/rtc-pm8xxx.c
>> @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
>> if (rc)
>> return rc;
>>
>> + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
>> + device_set_wakeup_capable(&pdev->dev, false);
>> +
>> rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
>> if (rc)
>> return rc;
>>
>> base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
>> --
>> 2.17.1
>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-01 12:48 ` Anvesh Jain P
@ 2023-08-01 19:34 ` Alexandre Belloni
2023-08-03 13:31 ` Anvesh Jain P
0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2023-08-01 19:34 UTC (permalink / raw)
To: Anvesh Jain P
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 01/08/2023 18:18:46+0530, Anvesh Jain P wrote:
> In automotive systems, RTC should not wake up the device when it is parked
> or when it is garage to avoid leakage current. providing a control from
> device tree to avoid RTC wake up based on the use case is reason for this
> patch.
>
Then simply avoid providing an IRQ or setting an alarm.
> On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
> > On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
> > > Enable & disable rtc alarm wake up capability based on
> > > default parameter passed from device tree.
> > >
> >
> > I see what you are doing but not why this is necessary, NAK.
> >
> > > Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
> > > Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
> > > ---
> > > drivers/rtc/rtc-pm8xxx.c | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> > > index f6b779c12ca7..bed57be602b6 100644
> > > --- a/drivers/rtc/rtc-pm8xxx.c
> > > +++ b/drivers/rtc/rtc-pm8xxx.c
> > > @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
> > > if (rc)
> > > return rc;
> > > + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
> > > + device_set_wakeup_capable(&pdev->dev, false);
> > > +
> > > rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
> > > if (rc)
> > > return rc;
> > >
> > > base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
> > > --
> > > 2.17.1
> > >
> >
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-01 19:34 ` Alexandre Belloni
@ 2023-08-03 13:31 ` Anvesh Jain P
2023-08-03 13:39 ` Alexandre Belloni
0 siblings, 1 reply; 9+ messages in thread
From: Anvesh Jain P @ 2023-08-03 13:31 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 8/2/2023 1:04 AM, Alexandre Belloni wrote:
> On 01/08/2023 18:18:46+0530, Anvesh Jain P wrote:
>> In automotive systems, RTC should not wake up the device when it is parked
>> or when it is garage to avoid leakage current. providing a control from
>> device tree to avoid RTC wake up based on the use case is reason for this
>> patch.
>>
>
> Then simply avoid providing an IRQ or setting an alarm.
The purpose of the change is just to block alarms/notifications waking
up the target when it is in Suspend2ram(low power) mode.
if we disable IRQ, alarms/notifications won't come even when the target
is in active mode.
This change will just stop the wake up capability of the alarm when
target is in suspend 2 ram mode based on flag passed from device tree.
Use case of this patch is,
In mobile targets where alarms / notifications will need to wake up the
target when there is a reminder as per user expectation.
where as in automotive targets, when driver is not in Car and target is
in suspend state, alarms/notifications would have no meaning and waking
up the target of no use as there is no user to attend the message. hence
blocking them in automotive use cases based on device tree is the use of
this patch.
>
>> On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
>>> On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
>>>> Enable & disable rtc alarm wake up capability based on
>>>> default parameter passed from device tree.
>>>>
>>>
>>> I see what you are doing but not why this is necessary, NAK.
>>>
>>>> Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
>>>> Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
>>>> ---
>>>> drivers/rtc/rtc-pm8xxx.c | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
>>>> index f6b779c12ca7..bed57be602b6 100644
>>>> --- a/drivers/rtc/rtc-pm8xxx.c
>>>> +++ b/drivers/rtc/rtc-pm8xxx.c
>>>> @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
>>>> if (rc)
>>>> return rc;
>>>> + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
>>>> + device_set_wakeup_capable(&pdev->dev, false);
>>>> +
>>>> rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
>>>> if (rc)
>>>> return rc;
>>>>
>>>> base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
>>>> --
>>>> 2.17.1
>>>>
>>>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-03 13:31 ` Anvesh Jain P
@ 2023-08-03 13:39 ` Alexandre Belloni
2023-08-03 13:40 ` Alexandre Belloni
0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2023-08-03 13:39 UTC (permalink / raw)
To: Anvesh Jain P
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 03/08/2023 19:01:51+0530, Anvesh Jain P wrote:
>
>
> On 8/2/2023 1:04 AM, Alexandre Belloni wrote:
> > On 01/08/2023 18:18:46+0530, Anvesh Jain P wrote:
> > > In automotive systems, RTC should not wake up the device when it is parked
> > > or when it is garage to avoid leakage current. providing a control from
> > > device tree to avoid RTC wake up based on the use case is reason for this
> > > patch.
> > >
> >
> > Then simply avoid providing an IRQ or setting an alarm.
> The purpose of the change is just to block alarms/notifications waking up
> the target when it is in Suspend2ram(low power) mode.
> if we disable IRQ, alarms/notifications won't come even when the target is
> in active mode.
> This change will just stop the wake up capability of the alarm when target
> is in suspend 2 ram mode based on flag passed from device tree.
> Use case of this patch is,
> In mobile targets where alarms / notifications will need to wake up the
> target when there is a reminder as per user expectation.
> where as in automotive targets, when driver is not in Car and target is in
> suspend state, alarms/notifications would have no meaning and waking up the
> target of no use as there is no user to attend the message. hence blocking
> them in automotive use cases based on device tree is the use of this patch.
Simply remove the alarm before going to suspend, this is a userspace
policy, it has nothing to do in the device or kernel.
> >
> > > On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
> > > > On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
> > > > > Enable & disable rtc alarm wake up capability based on
> > > > > default parameter passed from device tree.
> > > > >
> > > >
> > > > I see what you are doing but not why this is necessary, NAK.
> > > >
> > > > > Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
> > > > > Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
> > > > > ---
> > > > > drivers/rtc/rtc-pm8xxx.c | 3 +++
> > > > > 1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> > > > > index f6b779c12ca7..bed57be602b6 100644
> > > > > --- a/drivers/rtc/rtc-pm8xxx.c
> > > > > +++ b/drivers/rtc/rtc-pm8xxx.c
> > > > > @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
> > > > > if (rc)
> > > > > return rc;
> > > > > + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
> > > > > + device_set_wakeup_capable(&pdev->dev, false);
> > > > > +
> > > > > rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
> > > > > if (rc)
> > > > > return rc;
> > > > >
> > > > > base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
> > > > > --
> > > > > 2.17.1
> > > > >
> > > >
> >
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-03 13:39 ` Alexandre Belloni
@ 2023-08-03 13:40 ` Alexandre Belloni
2023-08-07 4:56 ` Anvesh Jain P
0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2023-08-03 13:40 UTC (permalink / raw)
To: Anvesh Jain P
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 03/08/2023 15:39:41+0200, Alexandre Belloni wrote:
> On 03/08/2023 19:01:51+0530, Anvesh Jain P wrote:
> >
> >
> > On 8/2/2023 1:04 AM, Alexandre Belloni wrote:
> > > On 01/08/2023 18:18:46+0530, Anvesh Jain P wrote:
> > > > In automotive systems, RTC should not wake up the device when it is parked
> > > > or when it is garage to avoid leakage current. providing a control from
> > > > device tree to avoid RTC wake up based on the use case is reason for this
> > > > patch.
> > > >
> > >
> > > Then simply avoid providing an IRQ or setting an alarm.
> > The purpose of the change is just to block alarms/notifications waking up
> > the target when it is in Suspend2ram(low power) mode.
> > if we disable IRQ, alarms/notifications won't come even when the target is
> > in active mode.
> > This change will just stop the wake up capability of the alarm when target
> > is in suspend 2 ram mode based on flag passed from device tree.
> > Use case of this patch is,
> > In mobile targets where alarms / notifications will need to wake up the
> > target when there is a reminder as per user expectation.
> > where as in automotive targets, when driver is not in Car and target is in
> > suspend state, alarms/notifications would have no meaning and waking up the
> > target of no use as there is no user to attend the message. hence blocking
> > them in automotive use cases based on device tree is the use of this patch.
>
> Simply remove the alarm before going to suspend, this is a userspace
> policy, it has nothing to do in the device or kernel.
s/device/device tree/ obviously.
>
> > >
> > > > On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
> > > > > On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
> > > > > > Enable & disable rtc alarm wake up capability based on
> > > > > > default parameter passed from device tree.
> > > > > >
> > > > >
> > > > > I see what you are doing but not why this is necessary, NAK.
> > > > >
> > > > > > Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
> > > > > > Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
> > > > > > ---
> > > > > > drivers/rtc/rtc-pm8xxx.c | 3 +++
> > > > > > 1 file changed, 3 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> > > > > > index f6b779c12ca7..bed57be602b6 100644
> > > > > > --- a/drivers/rtc/rtc-pm8xxx.c
> > > > > > +++ b/drivers/rtc/rtc-pm8xxx.c
> > > > > > @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
> > > > > > if (rc)
> > > > > > return rc;
> > > > > > + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
> > > > > > + device_set_wakeup_capable(&pdev->dev, false);
> > > > > > +
> > > > > > rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
> > > > > > if (rc)
> > > > > > return rc;
> > > > > >
> > > > > > base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
> > > > > > --
> > > > > > 2.17.1
> > > > > >
> > > > >
> > >
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-03 13:40 ` Alexandre Belloni
@ 2023-08-07 4:56 ` Anvesh Jain P
2023-08-08 12:44 ` Alexandre Belloni
0 siblings, 1 reply; 9+ messages in thread
From: Anvesh Jain P @ 2023-08-07 4:56 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 8/3/2023 7:10 PM, Alexandre Belloni wrote:
> On 03/08/2023 15:39:41+0200, Alexandre Belloni wrote:
>> On 03/08/2023 19:01:51+0530, Anvesh Jain P wrote:
>>>
>>>
>>> On 8/2/2023 1:04 AM, Alexandre Belloni wrote:
>>>> On 01/08/2023 18:18:46+0530, Anvesh Jain P wrote:
>>>>> In automotive systems, RTC should not wake up the device when it is parked
>>>>> or when it is garage to avoid leakage current. providing a control from
>>>>> device tree to avoid RTC wake up based on the use case is reason for this
>>>>> patch.
>>>>>
>>>>
>>>> Then simply avoid providing an IRQ or setting an alarm.
>>> The purpose of the change is just to block alarms/notifications waking up
>>> the target when it is in Suspend2ram(low power) mode.
>>> if we disable IRQ, alarms/notifications won't come even when the target is
>>> in active mode.
>>> This change will just stop the wake up capability of the alarm when target
>>> is in suspend 2 ram mode based on flag passed from device tree.
>>> Use case of this patch is,
>>> In mobile targets where alarms / notifications will need to wake up the
>>> target when there is a reminder as per user expectation.
>>> where as in automotive targets, when driver is not in Car and target is in
>>> suspend state, alarms/notifications would have no meaning and waking up the
>>> target of no use as there is no user to attend the message. hence blocking
>>> them in automotive use cases based on device tree is the use of this patch.
>>
>> Simply remove the alarm before going to suspend, this is a userspace
>> policy, it has nothing to do in the device or kernel.
> s/device/device tree/ obviously.
>
How to remove from userspace?, if we remove all alarms from userspace,
will the alarms expiring after wake up would be restored while target
resumes from suspend 2 ram?
The change would not change alarms behavior. it blocks all notifications
causing wake up if "disable-alarm-wakeup" property defined in device
tree. if it is not defined, current behavior of alarm won't change.
>>
>>>>
>>>>> On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
>>>>>> On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
>>>>>>> Enable & disable rtc alarm wake up capability based on
>>>>>>> default parameter passed from device tree.
>>>>>>>
>>>>>>
>>>>>> I see what you are doing but not why this is necessary, NAK.
>>>>>>
>>>>>>> Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
>>>>>>> Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
>>>>>>> ---
>>>>>>> drivers/rtc/rtc-pm8xxx.c | 3 +++
>>>>>>> 1 file changed, 3 insertions(+)
>>>>>>>
>>>>>>> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
>>>>>>> index f6b779c12ca7..bed57be602b6 100644
>>>>>>> --- a/drivers/rtc/rtc-pm8xxx.c
>>>>>>> +++ b/drivers/rtc/rtc-pm8xxx.c
>>>>>>> @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
>>>>>>> if (rc)
>>>>>>> return rc;
>>>>>>> + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
>>>>>>> + device_set_wakeup_capable(&pdev->dev, false);
>>>>>>> +
>>>>>>> rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
>>>>>>> if (rc)
>>>>>>> return rc;
>>>>>>>
>>>>>>> base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
>>>>>>> --
>>>>>>> 2.17.1
>>>>>>>
>>>>>>
>>>>
>>
>> --
>> Alexandre Belloni, co-owner and COO, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability
2023-08-07 4:56 ` Anvesh Jain P
@ 2023-08-08 12:44 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2023-08-08 12:44 UTC (permalink / raw)
To: Anvesh Jain P
Cc: Alessandro Zummo, linux-rtc, linux-kernel, Venkata Rao Kakani
On 07/08/2023 10:26:37+0530, Anvesh Jain P wrote:
>
>
> On 8/3/2023 7:10 PM, Alexandre Belloni wrote:
> > On 03/08/2023 15:39:41+0200, Alexandre Belloni wrote:
> > > On 03/08/2023 19:01:51+0530, Anvesh Jain P wrote:
> > > >
> > > >
> > > > On 8/2/2023 1:04 AM, Alexandre Belloni wrote:
> > > > > On 01/08/2023 18:18:46+0530, Anvesh Jain P wrote:
> > > > > > In automotive systems, RTC should not wake up the device when it is parked
> > > > > > or when it is garage to avoid leakage current. providing a control from
> > > > > > device tree to avoid RTC wake up based on the use case is reason for this
> > > > > > patch.
> > > > > >
> > > > >
> > > > > Then simply avoid providing an IRQ or setting an alarm.
> > > > The purpose of the change is just to block alarms/notifications waking up
> > > > the target when it is in Suspend2ram(low power) mode.
> > > > if we disable IRQ, alarms/notifications won't come even when the target is
> > > > in active mode.
> > > > This change will just stop the wake up capability of the alarm when target
> > > > is in suspend 2 ram mode based on flag passed from device tree.
> > > > Use case of this patch is,
> > > > In mobile targets where alarms / notifications will need to wake up the
> > > > target when there is a reminder as per user expectation.
> > > > where as in automotive targets, when driver is not in Car and target is in
> > > > suspend state, alarms/notifications would have no meaning and waking up the
> > > > target of no use as there is no user to attend the message. hence blocking
> > > > them in automotive use cases based on device tree is the use of this patch.
> > >
> > > Simply remove the alarm before going to suspend, this is a userspace
> > > policy, it has nothing to do in the device or kernel.
> > s/device/device tree/ obviously.
> >
> How to remove from userspace?, if we remove all alarms from userspace, will
> the alarms expiring after wake up would be restored while target resumes
> from suspend 2 ram?
> The change would not change alarms behavior. it blocks all notifications
> causing wake up if "disable-alarm-wakeup" property defined in device tree.
> if it is not defined, current behavior of alarm won't change.
The goal of the RTC alarm is to wakeup or poweron. If you don't want to
wakeup, you simply don't set an alarm. If it is already set, then you
simply unset it. If you want an application to do something at a
particular time, I hope you are not using the rtc but a timer with
TIMER_ABSTIME. This will do exactly what you want.
> > >
> > > > >
> > > > > > On 8/1/2023 6:10 PM, Alexandre Belloni wrote:
> > > > > > > On 01/08/2023 17:15:49+0530, Anvesh Jain P wrote:
> > > > > > > > Enable & disable rtc alarm wake up capability based on
> > > > > > > > default parameter passed from device tree.
> > > > > > > >
> > > > > > >
> > > > > > > I see what you are doing but not why this is necessary, NAK.
> > > > > > >
> > > > > > > > Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
> > > > > > > > Signed-off-by: Anvesh Jain P <quic_ajainp@quicinc.com>
> > > > > > > > ---
> > > > > > > > drivers/rtc/rtc-pm8xxx.c | 3 +++
> > > > > > > > 1 file changed, 3 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> > > > > > > > index f6b779c12ca7..bed57be602b6 100644
> > > > > > > > --- a/drivers/rtc/rtc-pm8xxx.c
> > > > > > > > +++ b/drivers/rtc/rtc-pm8xxx.c
> > > > > > > > @@ -523,6 +523,9 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
> > > > > > > > if (rc)
> > > > > > > > return rc;
> > > > > > > > + if (of_property_read_bool(pdev->dev.of_node, "disable-alarm-wakeup"))
> > > > > > > > + device_set_wakeup_capable(&pdev->dev, false);
> > > > > > > > +
> > > > > > > > rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
> > > > > > > > if (rc)
> > > > > > > > return rc;
> > > > > > > >
> > > > > > > > base-commit: 0a8db05b571ad5b8d5c8774a004c0424260a90bd
> > > > > > > > --
> > > > > > > > 2.17.1
> > > > > > > >
> > > > > > >
> > > > >
> > >
> > > --
> > > Alexandre Belloni, co-owner and COO, Bootlin
> > > Embedded Linux and Kernel engineering
> > > https://bootlin.com
> >
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-08-08 19:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 11:45 [PATCH] rtc: rtc-pm8xxx: control default alarm wake up capability Anvesh Jain P
2023-08-01 12:40 ` Alexandre Belloni
2023-08-01 12:48 ` Anvesh Jain P
2023-08-01 19:34 ` Alexandre Belloni
2023-08-03 13:31 ` Anvesh Jain P
2023-08-03 13:39 ` Alexandre Belloni
2023-08-03 13:40 ` Alexandre Belloni
2023-08-07 4:56 ` Anvesh Jain P
2023-08-08 12:44 ` Alexandre Belloni
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).