linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Benson Leung <bleung@chromium.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Brian Norris <briannorris@chromium.org>
Subject: Re: [PATCH v2 1/7] rtc: Add support for limited alarm timer offsets
Date: Thu, 24 Aug 2023 00:51:29 +0200	[thread overview]
Message-ID: <20230823225129d2bc7dcd@mail.local> (raw)
In-Reply-To: <b07b19ce-7f04-409c-bcb9-6deba059f57a@roeck-us.net>

Hello,

On 23/08/2023 09:50:47-0700, Guenter Roeck wrote:
> Hi Alexandre,
> 
> On Thu, Aug 17, 2023 at 03:55:31PM -0700, Guenter Roeck wrote:
> > Some alarm timers are based on time offsets, not on absolute times.
> > In some situations, the amount of time that can be scheduled in the
> > future is limited. This may result in a refusal to suspend the system,
> > causing substantial battery drain.
> > 
> > Some RTC alarm drivers remedy the situation by setting the alarm time
> > to the maximum supported time if a request for an out-of-range timeout
> > is made. This is not really desirable since it may result in unexpected
> > early wakeups.
> > 
> > To reduce the impact of this problem, let RTC drivers report the maximum
> > supported alarm timer offset. The code setting alarm timers can then
> > decide if it wants to reject setting alarm timers to a larger value, if it
> > wants to implement recurring alarms until the actually requested alarm
> > time is met, or if it wants to accept the limited alarm time.
> > 
> > Only introduce the necessary variable into struct rtc_device.
> > Code to set and use the variable will follow with subsequent patches.
> > 
> > Cc: Brian Norris <briannorris@chromium.org>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> 
> I guess it is a bit late to get the series into v6.6, but would it be
> possible to apply it to a -next branch to get some more test coverage ?
> 

I'm probably going to take 1 and 3-7 for 6.6 once I get a reliable
internet access. I can't take 2/7 without a review or ack from the time
maintainers.

> Either case, do you have any additional comments / feedback ?
> 

The main issue that remains is that after 2/7, the rtc_device structure
is not opaque anymore to its user as alarmtimer_suspend now directly
accesses one of the members. But I'd have to find which RTCs have an
absolute limit so we can design a proper API. I may also decide that it
is good enough to require that the alarm range must cover the registered
RTC range.

> Thanks,
> Guenter
> 
> > ---
> > v2: Rename range_max_offset -> alarm_offset_max
> > 
> >  include/linux/rtc.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> > index 1fd9c6a21ebe..4c0bcbeb1f00 100644
> > --- a/include/linux/rtc.h
> > +++ b/include/linux/rtc.h
> > @@ -146,6 +146,7 @@ struct rtc_device {
> >  
> >  	time64_t range_min;
> >  	timeu64_t range_max;
> > +	timeu64_t alarm_offset_max;
> >  	time64_t start_secs;
> >  	time64_t offset_secs;
> >  	bool set_start_time;

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

  reply	other threads:[~2023-08-23 22:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 22:55 [PATCH v2 0/7] rtc: Add support for limited alarm timer offsets Guenter Roeck
2023-08-17 22:55 ` [PATCH v2 1/7] " Guenter Roeck
2023-08-23 16:50   ` Guenter Roeck
2023-08-23 22:51     ` Alexandre Belloni [this message]
2023-08-24  3:26       ` Guenter Roeck
2023-08-17 22:55 ` [PATCH v2 2/7] rtc: alarmtimer: Use maximum alarm time offset Guenter Roeck
2023-08-25  3:52   ` John Stultz
2023-08-25  5:46     ` Guenter Roeck
2023-08-26 11:15     ` Guenter Roeck
2023-08-29 21:50   ` Stephen Boyd
2023-08-30  7:13     ` Guenter Roeck
2023-08-30 21:16       ` Stephen Boyd
2023-08-31  4:23         ` Guenter Roeck
2023-09-06 21:06           ` Stephen Boyd
2023-08-17 22:55 ` [PATCH v2 3/7] rtc: cros-ec: Detect and report supported alarm window size Guenter Roeck
2023-08-17 22:55 ` [PATCH v2 4/7] rtc: cmos: Report supported alarm limit to rtc infrastructure Guenter Roeck
2023-08-17 22:55 ` [PATCH v2 5/7] rtc: tps6586x: Report maximum alarm limit to rtc core Guenter Roeck
2023-08-17 22:55 ` [PATCH v2 6/7] rtc: ds1305: " Guenter Roeck
2023-08-17 22:55 ` [PATCH v2 7/7] rtc: rzn1: " Guenter Roeck
2023-08-18  7:32   ` Miquel Raynal
2023-08-27 21:51 ` (subset) [PATCH v2 0/7] rtc: Add support for limited alarm timer offsets 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=20230823225129d2bc7dcd@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=bleung@chromium.org \
    --cc=briannorris@chromium.org \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=miquel.raynal@bootlin.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).