mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liu Dalin <liudalin@kylinsec.com.cn>
To: alexandre.belloni@bootlin.com, zhoubinbin@loongson.cn,
	wangming01@loongson.cn
Cc: chenhuacai@kernel.org, gaojuxin@loongson.cn, git@xen0n.name,
	jiaxun.yang@flygoat.com, keguang.zhang@gmail.com,
	lixuefeng@loongson.cn, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH V1] rtc: loongson: Add missing alarm notifications for ACPI RTC events
Date: Fri,  9 May 2025 09:40:46 +0800	[thread overview]
Message-ID: <20250509014046.7399-1-liudalin@kylinsec.com.cn> (raw)
In-Reply-To: <20250429062736.982039-1-liudalin@kylinsec.com.cn>

When an application sets and enables an alarm on Loongson RTC devices,
the alarm notification fails to propagate to userspace because the
ACPI event handler omits calling rtc_update_irq().

As a result, processes waiting via select() or poll() on RTC device
files fail to receive alarm notifications.

Fixes: 1b733a9ebc3d ("rtc: Add rtc driver for the Loongson family chips")
Signed-off-by: Liu Dalin <liudalin@kylinsec.com.cn>
---
 drivers/rtc/rtc-loongson.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/rtc/rtc-loongson.c b/drivers/rtc/rtc-loongson.c
index 97e5625c064c..2ca7ffd5d7a9 100644
--- a/drivers/rtc/rtc-loongson.c
+++ b/drivers/rtc/rtc-loongson.c
@@ -129,6 +129,14 @@ static u32 loongson_rtc_handler(void *id)
 {
 	struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id;
 
+	rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF);
+
+	/*
+	 * The TOY_MATCH0_REG should be cleared 0 here,
+	 * otherwise the interrupt cannot be cleared.
+	 */
+	regmap_write(priv->regmap, TOY_MATCH0_REG, 0);
+
 	spin_lock(&priv->lock);
 	/* Disable RTC alarm wakeup and interrupt */
 	writel(readl(priv->pm_base + PM1_EN_REG) & ~RTC_EN,
-- 
2.33.0


  parent reply	other threads:[~2025-05-09  1:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29  6:27 [PATCH] " Liu Dalin
2025-05-08  3:12 ` Binbin Zhou
2025-05-08  6:43   ` liudalin
     [not found]   ` <58BBF92742F0D0E1+2025050814202393211321@kylinos.com.cn>
2025-05-08  6:48     ` Binbin Zhou
2025-05-09  1:40 ` Liu Dalin [this message]
2025-05-09  7:12   ` [PATCH V1] " Binbin Zhou
2025-05-09  8:06     ` Liu Dalin
2025-05-09  8:27       ` Binbin Zhou
2025-05-09  8:44 ` [PATCH V2] " Liu Dalin
2025-05-13  7:32   ` Binbin Zhou
2025-05-24 22:28   ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250509014046.7399-1-liudalin@kylinsec.com.cn \
    --to=liudalin@kylinsec.com.cn \
    --cc=alexandre.belloni@bootlin.com \
    --cc=chenhuacai@kernel.org \
    --cc=gaojuxin@loongson.cn \
    --cc=git@xen0n.name \
    --cc=jiaxun.yang@flygoat.com \
    --cc=keguang.zhang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=wangming01@loongson.cn \
    --cc=zhoubinbin@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®