From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B38C6C41513 for ; Wed, 16 Aug 2023 14:58:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343844AbjHPO6C (ORCPT ); Wed, 16 Aug 2023 10:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343843AbjHPO5f (ORCPT ); Wed, 16 Aug 2023 10:57:35 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E35EB1B2; Wed, 16 Aug 2023 07:57:32 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id A1D9FC0006; Wed, 16 Aug 2023 14:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1692197851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TU5z/ON0bT6BUefnfahNwl9FbNoTsfHur3QkjSZEKjU=; b=MzhLZ7X3PtTqiAozXpxfe8H5qfDOK2+Hk2egf03Y6hEsY+tR7+UN0tGdZz9Pyx2UHbPAQT +8iEBErAp9OhMEb3dBc4lcAeVDFJkGnq/+US6lERZLeaD7Vs57TzKxGgydhnb0Eoe5FqvO +0/erTG91cetirVuxA2ZUJC4eMrIN3r7evfzE0nivSNkvrz1u+m9TdjSwhUULNMEPbNMdQ HLKcGkXo9+XgcOhtKKAYlFd+ZlaMnPnCYYZn1Z3RMlycGC8WM/1GeJC2Ph5y8LsA2JKNyh 59P3RoV7kPKzrgj/dtR6MUrcBJzj/rxY161IWn7VReVJ14KAYDVjsJEVl72HHA== Date: Wed, 16 Aug 2023 16:57:30 +0200 From: Alexandre Belloni To: Guenter Roeck Cc: Alessandro Zummo , Benson Leung , Miquel Raynal , Thomas Gleixner , John Stultz , Stephen Boyd , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Brian Norris Subject: Re: [PATCH 1/7] rtc: Add support for limited alarm timer offsets Message-ID: <202308161457306eecdefb@mail.local> References: <20230816133936.2150294-1-linux@roeck-us.net> <20230816133936.2150294-2-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230816133936.2150294-2-linux@roeck-us.net> X-GND-Sasl: alexandre.belloni@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org On 16/08/2023 06:39:30-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 > Signed-off-by: Guenter Roeck > --- > include/linux/rtc.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/linux/rtc.h b/include/linux/rtc.h > index 1fd9c6a21ebe..b6d000ab1e5e 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 range_max_offset; While range_min and range_max are for the wall clock time, I would prefer using a name that would clearly mark this as an alarm related variable. > time64_t start_secs; > time64_t offset_secs; > bool set_start_time; > -- > 2.39.2 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com