diff mbox series

[v3,1/2] rtc: rtc-pm8xxx: clear the interrupt in probe

Message ID 20240314033344.10775-1-quic_jianbinz@quicinc.com
State Changes Requested
Headers show
Series [v3,1/2] rtc: rtc-pm8xxx: clear the interrupt in probe | expand

Commit Message

jianbin zhang March 14, 2024, 3:33 a.m. UTC
If the alarm is triggered before the driver gets probed, the alarm
interrupt will be missed and it won't be detected, so clear the
stale interrupt in probe.

Changes in v3:
*clear the interrupt in driver probe

Changes in v2:
*Adapt the V1 patch according to the newest rtc-pm8xxx
link to v2: https://lore.kernel.org/linux-rtc/20240124024023df15ef6e@mail.local/

Changes in v1:
*During driver probe: read ALARM_EN, read ALARM_DATA, read RTC_RDATA,
if (ALARM_DATA < RTC_DATA), Trigger the alarm event and clear the alarm settins
Link to v1:https://lore.kernel.org/linux-rtc/20220321090514.4523-1-quic_jianbinz@quicinc.com/

Changes in original:
link to original: https://lore.kernel.org/linux-rtc/YTusgJlMUdXOKQaL@piout.net/

Signed-off-by: jianbinz <quic_jianbinz@quicinc.com>
---
 drivers/rtc/rtc-pm8xxx.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bjorn Andersson March 19, 2024, 7:10 p.m. UTC | #1
On Thu, Mar 14, 2024 at 11:33:44AM +0800, jianbinz wrote:
> If the alarm is triggered before the driver gets probed, the alarm
> interrupt will be missed and it won't be detected, so clear the
> stale interrupt in probe.
> 
> Changes in v3:

The change log goes below the '---' line below.

> *clear the interrupt in driver probe
> 
> Changes in v2:
> *Adapt the V1 patch according to the newest rtc-pm8xxx
> link to v2: https://lore.kernel.org/linux-rtc/20240124024023df15ef6e@mail.local/
> 
> Changes in v1:
> *During driver probe: read ALARM_EN, read ALARM_DATA, read RTC_RDATA,
> if (ALARM_DATA < RTC_DATA), Trigger the alarm event and clear the alarm settins
> Link to v1:https://lore.kernel.org/linux-rtc/20220321090514.4523-1-quic_jianbinz@quicinc.com/
> 
> Changes in original:
> link to original: https://lore.kernel.org/linux-rtc/YTusgJlMUdXOKQaL@piout.net/
> 
> Signed-off-by: jianbinz <quic_jianbinz@quicinc.com>

Please use your full name, both for authorship and signed-off.

Your two patches are not sent as a series, and you don't have a
cover-letter, which is expected.

Please read through go/upstream, and start using b4 for preparing your
patches, as this will help you with the practicalities.

> ---
>  drivers/rtc/rtc-pm8xxx.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
> index f6b779c12ca7..1b5a96924e57 100644
> --- a/drivers/rtc/rtc-pm8xxx.c
> +++ b/drivers/rtc/rtc-pm8xxx.c
> @@ -527,6 +527,10 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
>  	if (rc)
>  		return rc;
>  
> +	rc = regmap_update_bits(rtc_dd->regmap, rtc_dd->regs->alarm_ctrl2, PM8xxx_RTC_ALARM_CLEAR, 1);

Unless I'm mistaken, this line is over 100 characters, please wrap it.


Please also Cc: linux-arm-msm@vger.kernel.org on your next version.

Regards,
Bjorn

> +	if (rc)
> +		return rc;
> +
>  	return 0;
>  }
>  
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index f6b779c12ca7..1b5a96924e57 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -527,6 +527,10 @@  static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
+	rc = regmap_update_bits(rtc_dd->regmap, rtc_dd->regs->alarm_ctrl2, PM8xxx_RTC_ALARM_CLEAR, 1);
+	if (rc)
+		return rc;
+
 	return 0;
 }