public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-rtc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: Re: [PATCH v1 2/2] rtc: cmos: Do not require IRQ if ACPI alarm is used
Date: Fri, 20 Mar 2026 19:00:31 +0100	[thread overview]
Message-ID: <20260320180031928c3da5@mail.local> (raw)
In-Reply-To: <6168746.MhkbZ0Pkbq@rafael.j.wysocki>

On 14/03/2026 13:12:44+0100, Rafael J. Wysocki wrote:
> 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>

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.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);
>  }
> 
> 
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2026-03-20 18:00 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 ` [PATCH v1 2/2] rtc: cmos: Do not require IRQ if ACPI alarm is used Rafael J. Wysocki
2026-03-20 18:00   ` Alexandre Belloni [this message]
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=20260320180031928c3da5@mail.local \
    --to=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 \
    --cc=rafael@kernel.org \
    /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