* [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled
@ 2020-03-21 11:50 韩科才
2020-03-21 13:21 ` Alexandre Belloni
2020-03-22 21:33 ` Alexandre Belloni
0 siblings, 2 replies; 5+ messages in thread
From: 韩科才 @ 2020-03-21 11:50 UTC (permalink / raw)
To: a.zummo, alexandre.belloni, linux-rtc, linux-kernel; +Cc: trivial, kernel
Clear alarm register when alarm is not enabled otherwise the consumer
may still start alarm timer if it find the alarm register is not zero.
Signed-off-by: hankecai <hankecai@vivo.com>
---
drivers/rtc/rtc-pm8xxx.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 07ea1be3abb9..3fa5416ad90d 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -301,6 +301,7 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
const struct pm8xxx_rtc_regs *regs = rtc_dd->regs;
unsigned int ctrl_reg;
+ u8 value[NUM_8_BIT_RTC_REGS] = {0};
spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
@@ -319,6 +320,16 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
goto rtc_rw_fail;
}
+ /* Clear Alarm register */
+ if (!enable) {
+ rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
+ sizeof(value));
+ if (rc) {
+ dev_err(dev, "Clear RTC ALARM register failed\n");
+ goto rtc_rw_fail;
+ }
+ }
+
rtc_rw_fail:
spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
return rc;
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled
2020-03-21 11:50 [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled 韩科才
@ 2020-03-21 13:21 ` Alexandre Belloni
2020-03-21 13:53 ` 韩科才
2020-03-22 21:33 ` Alexandre Belloni
1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2020-03-21 13:21 UTC (permalink / raw)
To: 韩科才
Cc: a.zummo, linux-rtc, linux-kernel, trivial, kernel
Hi,
Isn't that the same as:
https://patchwork.ozlabs.org/patch/1257381/ ?
On 21/03/2020 19:50:17+0800, 韩科才 wrote:
> Clear alarm register when alarm is not enabled otherwise the consumer
> may still start alarm timer if it find the alarm register is not zero.
>
> Signed-off-by: hankecai <hankecai@vivo.com>
> ---
> drivers/rtc/rtc-pm8xxx.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> index 07ea1be3abb9..3fa5416ad90d 100644
> --- a/drivers/rtc/rtc-pm8xxx.c
> +++ b/drivers/rtc/rtc-pm8xxx.c
> @@ -301,6 +301,7 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
> struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
> const struct pm8xxx_rtc_regs *regs = rtc_dd->regs;
> unsigned int ctrl_reg;
> + u8 value[NUM_8_BIT_RTC_REGS] = {0};
>
> spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
>
> @@ -319,6 +320,16 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
> goto rtc_rw_fail;
> }
>
> + /* Clear Alarm register */
> + if (!enable) {
> + rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
> + sizeof(value));
> + if (rc) {
> + dev_err(dev, "Clear RTC ALARM register failed\n");
> + goto rtc_rw_fail;
> + }
> + }
> +
> rtc_rw_fail:
> spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
> return rc;
> --
> 2.21.0
>
>
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re: [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled
2020-03-21 13:21 ` Alexandre Belloni
@ 2020-03-21 13:53 ` 韩科才
0 siblings, 0 replies; 5+ messages in thread
From: 韩科才 @ 2020-03-21 13:53 UTC (permalink / raw)
To: alexandre.belloni; +Cc: a.zummo, linux-rtc, linux-kernel, trivial, kernel
Hi,
It's the same as https://patchwork.ozlabs.org/patch/1257381/, so both commit is fine.
thanks
发件人:Alexandre Belloni <alexandre.belloni@bootlin.com>
发送日期:2020-03-21 21:21:25
收件人:"韩科才" <hankecai@vivo.com>
抄送人:a.zummo@towertech.it,linux-rtc@vger.kernel.org,linux-kernel@vger.kernel.org,trivial@kernel.org,kernel@vivo.com
主题:Re: [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled>Hi,
>
>Isn't that the same as:
>https://patchwork.ozlabs.org/patch/1257381/ ?
>
>On 21/03/2020 19:50:17+0800, 韩科才 wrote:
>> Clear alarm register when alarm is not enabled otherwise the consumer
>> may still start alarm timer if it find the alarm register is not zero.
>>
>> Signed-off-by: hankecai <hankecai@vivo.com>
>> ---
>> drivers/rtc/rtc-pm8xxx.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
>> index 07ea1be3abb9..3fa5416ad90d 100644
>> --- a/drivers/rtc/rtc-pm8xxx.c
>> +++ b/drivers/rtc/rtc-pm8xxx.c
>> @@ -301,6 +301,7 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>> struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
>> const struct pm8xxx_rtc_regs *regs = rtc_dd->regs;
>> unsigned int ctrl_reg;
>> + u8 value[NUM_8_BIT_RTC_REGS] = {0};
>>
>> spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
>>
>> @@ -319,6 +320,16 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
>> goto rtc_rw_fail;
>> }
>>
>> + /* Clear Alarm register */
>> + if (!enable) {
>> + rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
>> + sizeof(value));
>> + if (rc) {
>> + dev_err(dev, "Clear RTC ALARM register failed\n");
>> + goto rtc_rw_fail;
>> + }
>> + }
>> +
>> rtc_rw_fail:
>> spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
>> return rc;
>> --
>> 2.21.0
>>
>>
>>
>
>--
>Alexandre Belloni, Bootlin
>Embedded Linux and Kernel engineering
>https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled
2020-03-21 11:50 [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled 韩科才
2020-03-21 13:21 ` Alexandre Belloni
@ 2020-03-22 21:33 ` Alexandre Belloni
2020-03-23 10:53 ` 韩科才
1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2020-03-22 21:33 UTC (permalink / raw)
To: 韩科才
Cc: a.zummo, linux-rtc, linux-kernel, trivial, kernel
On 21/03/2020 19:50:17+0800, 韩科才 wrote:
> Clear alarm register when alarm is not enabled otherwise the consumer
> may still start alarm timer if it find the alarm register is not zero.
>
> Signed-off-by: hankecai <hankecai@vivo.com>
> ---
> drivers/rtc/rtc-pm8xxx.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
Because the other one doesn't apply, I've applied that one.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re: [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled
2020-03-22 21:33 ` Alexandre Belloni
@ 2020-03-23 10:53 ` 韩科才
0 siblings, 0 replies; 5+ messages in thread
From: 韩科才 @ 2020-03-23 10:53 UTC (permalink / raw)
To: alexandre.belloni; +Cc: a.zummo, linux-rtc, linux-kernel, trivial, kernel
Hi,
Sure, thanks for your confirmation.
发件人:Alexandre Belloni <alexandre.belloni@bootlin.com>
发送日期:2020-03-23 05:33:31
收件人:"韩科才" <hankecai@vivo.com>
抄送人:a.zummo@towertech.it,linux-rtc@vger.kernel.org,linux-kernel@vger.kernel.org,trivial@kernel.org,kernel@vivo.com
主题:Re: [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled>On 21/03/2020 19:50:17+0800, 韩科才 wrote:
>> Clear alarm register when alarm is not enabled otherwise the consumer
>> may still start alarm timer if it find the alarm register is not zero.
>>
>> Signed-off-by: hankecai <hankecai@vivo.com>
>> ---
>> drivers/rtc/rtc-pm8xxx.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
>
>Because the other one doesn't apply, I've applied that one.
>
>--
>Alexandre Belloni, Bootlin
>Embedded Linux and Kernel engineering
>https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-23 10:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21 11:50 [PATCH] rtc: pm8xxx: clear alarm register when alarm is not enabled 韩科才
2020-03-21 13:21 ` Alexandre Belloni
2020-03-21 13:53 ` 韩科才
2020-03-22 21:33 ` Alexandre Belloni
2020-03-23 10:53 ` 韩科才
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).