Linux RTC
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: linux-rtc@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v1 2/2] rtc: cmos: Do not require IRQ if ACPI alarm is used
Date: Sat, 14 Mar 2026 13:12:44 +0100	[thread overview]
Message-ID: <6168746.MhkbZ0Pkbq@rafael.j.wysocki> (raw)
In-Reply-To: <3964452.kQq0lBPeGt@rafael.j.wysocki>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

If the ACPI RTC fixed event is used, a dedicated IRQ is not required
for the CMOS RTC alarm to work, so allow the driver to use the alarm
without a valid IRQ in that case.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/rtc/rtc-cmos.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -216,6 +216,11 @@ static inline void cmos_write_bank2(unsi
 
 /*----------------------------------------------------------------*/
 
+static bool cmos_no_alarm(struct cmos_rtc *cmos)
+{
+	return !is_valid_irq(cmos->irq) && !cmos_use_acpi_alarm();
+}
+
 static int cmos_read_time(struct device *dev, struct rtc_time *t)
 {
 	int ret;
@@ -287,7 +292,7 @@ static int cmos_read_alarm(struct device
 	};
 
 	/* This not only a rtc_op, but also called directly */
-	if (!is_valid_irq(cmos->irq))
+	if (cmos_no_alarm(cmos))
 		return -ETIMEDOUT;
 
 	/* Basic alarms only support hour, minute, and seconds fields.
@@ -520,7 +525,7 @@ static int cmos_set_alarm(struct device
 	int ret;
 
 	/* This not only a rtc_op, but also called directly */
-	if (!is_valid_irq(cmos->irq))
+	if (cmos_no_alarm(cmos))
 		return -EIO;
 
 	ret = cmos_validate_alarm(dev, t);
@@ -1096,7 +1101,7 @@ cmos_do_probe(struct device *dev, struct
 			dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq);
 			goto cleanup1;
 		}
-	} else {
+	} else if (!cmos_use_acpi_alarm()) {
 		clear_bit(RTC_FEATURE_ALARM, cmos_rtc.rtc->features);
 	}
 
@@ -1121,7 +1126,7 @@ cmos_do_probe(struct device *dev, struct
 		acpi_rtc_event_setup(dev);
 
 	dev_info(dev, "%s%s, %d bytes nvram%s\n",
-		 !is_valid_irq(rtc_irq) ? "no alarms" :
+		 cmos_no_alarm(&cmos_rtc) ? "no alarms" :
 		 cmos_rtc.mon_alrm ? "alarms up to one year" :
 		 cmos_rtc.day_alrm ? "alarms up to one month" :
 		 "alarms up to one day",
@@ -1147,7 +1152,7 @@ cleanup0:
 static void cmos_do_shutdown(int rtc_irq)
 {
 	spin_lock_irq(&rtc_lock);
-	if (is_valid_irq(rtc_irq))
+	if (!cmos_no_alarm(&cmos_rtc))
 		cmos_irq_disable(&cmos_rtc, RTC_IRQMASK);
 	spin_unlock_irq(&rtc_lock);
 }




  parent reply	other threads:[~2026-03-14 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14 12:09 [PATCH v1 0/2] rtc: cmos: Do not require IRQ if ACPI alarm is used Rafael J. Wysocki
2026-03-14 12:11 ` [PATCH v1 1/2] rtc: cmos: Enable ACPI alarm if advertised in ACPI FADT Rafael J. Wysocki
2026-03-20 18:00   ` Alexandre Belloni
2026-03-20 19:26   ` Mario Limonciello (AMD) (kernel.org)
2026-03-14 12:12 ` Rafael J. Wysocki [this message]
2026-03-20 18:00   ` [PATCH v1 2/2] rtc: cmos: Do not require IRQ if ACPI alarm is used Alexandre Belloni
2026-03-20 19:27     ` Mario Limonciello (AMD) (kernel.org)
2026-03-20 15:56 ` [PATCH v1 0/2] " Rafael J. Wysocki

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=6168746.MhkbZ0Pkbq@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    /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