Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1207909yba; Tue, 2 Apr 2019 04:41:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSzUE4ZXs1qHwPqurlsuxnVzkDQzz4++1iUEXmwPw0iuAkJmI9pZ3bwN62NqLoqHODfELG X-Received: by 2002:a17:902:868e:: with SMTP id g14mr5327862plo.183.1554205305977; Tue, 02 Apr 2019 04:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554205305; cv=none; d=google.com; s=arc-20160816; b=SBTcbLoUvv01LMOI7hDXCNcGgT+mVTg0Sj/94B07ypHnXXf7RM6tVZmSN1p8uGUuMM i9+KFtIkUG96J7DjiAGuKhpyBC8uCbY34TeNRxjuNE6kYX6yYnUTIrDP77OTV9xrY0B+ 0lsg1cVJ76iIAu40eeQRto0PGB2JjjM4hYFRgTaQbWGqR6Lt34OSHMMuppMYW1/KWlrU eLbM+/9lKhkfqykhNpIKNi54+9VUG1wcZzxcBr6ZfAgSZUDjs8O+W/Y5nFx54BE/PUkj HTJp4zFb8ATNFr+83p3KuB58cHTfenFaLZ9nX4hfvHtYNN+aNN2Wn8X2o7bI0i0SUZqb BOCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CumA2sIpLzNEjWI00EMY7IwhN5w6pzIgR689WOTQEfA=; b=FnaCWibn5sfhYu0C0x7WbwZPBeJkdIpDKk0V3XK6SeQJeO+VOq/t6sEvgEEsjQdhbj BFBS/yjhQ9Sm/DnWceiW2PFIMfVleYSfOueX6qyjSMKltEZFowvscIDkUcSmcGTNGsY8 wymqo6t7GgwBUrxVx4DbA5BgDVGJBYi30DMii2WKF6/EgwuHG+5zKB9E/37GmUd3VAcU vjq3zIvZ5AFnMidM0SqhLSA9u/85SCcNoWNZRhQsRkRex6Xt4VCR6zxUzfShh93v/CRn jYG1OrSg0otIs/FfDDF2pG6IFOX/xADX+DHparfQuTqU3qS31/q/HidYbJysL530+FJB eCAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si4982827pge.81.2019.04.02.04.41.28; Tue, 02 Apr 2019 04:41:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729958AbfDBKmg (ORCPT + 99 others); Tue, 2 Apr 2019 06:42:36 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:37455 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729813AbfDBKme (ORCPT ); Tue, 2 Apr 2019 06:42:34 -0400 X-Originating-IP: 109.213.83.19 Received: from localhost (alyon-652-1-60-19.w109-213.abo.wanadoo.fr [109.213.83.19]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id F05541BF209; Tue, 2 Apr 2019 10:42:30 +0000 (UTC) Date: Tue, 2 Apr 2019 12:42:30 +0200 From: Alexandre Belloni To: Steve Twiss Cc: Wolfram Sang , Geert Uytterhoeven , Geert Uytterhoeven , "linux-rtc@vger.kernel.org" , Linux Kernel Mailing List , Wolfram Sang , Support Opensource , Linux-Renesas Subject: Re: [PATCH 1/2] rtc: da9063: set range Message-ID: <20190402104230.GY3430@piout.net> References: <20190401150741.vwqzzngnma4jvkid@ninjato> <20190401151628.GK3430@piout.net> <20190401155204.GA5964@kunai> <20190401185346.GP3430@piout.net> <20190401193424.sqnapthocznhjqok@ninjato> <20190402085325.GT3430@piout.net> <20190402093359.GB2960@kunai> <20190402095115.GW3430@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/04/2019 10:33:37+0000, Steve Twiss wrote: > Hi, > > > > > drivers/rtc/rtc-da9063.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c > > > > index 1b792bcea3c7..53e690b0f3a2 100644 > > > > --- a/drivers/rtc/rtc-da9063.c > > > > +++ b/drivers/rtc/rtc-da9063.c > > > > @@ -475,6 +475,9 @@ static int da9063_rtc_probe(struct platform_device *pdev) > > > > da9063_data_to_tm(data, &rtc->alarm_time, rtc); > > > > rtc->rtc_sync = false; > > > > > > > > + if (config->rtc_data_start != RTC_SEC) > > > > + rtc->rtc_dev->uie_unsupported = 1; > > > > + > > > > > > I think we should have a comment here, like: > > > /* FIXME: Make use of the TICK interrupt once the RTC core supports it */ > > Is this TICK interrupt suggestion to use the DA9063 TICK interrupt to simulate > a second granularity in the AD alarm? > > If I remember correctly, the original DA9063 patch set which was for AD silicon > only, and which was sent to LKML before I took over looking at DA9063, used the > DA9063 1-second TICK interrupt to count-down the seconds from the nearest > minute in order to simulate second resolution on the RTC alarm for AD. > > ... yes. Here it is. The original patch was from Krystian Garbaciak and tried to > support RTC alarms on the AD silicon to a second resolution by counting down > the DA9063 TICK interrupt: > > https://marc.info/?l=lm-sensors&m=134613501230005&w=2 > > However, I dropped that patch completely and wrote a new RTC device driver > because it didn't work in my tests. > > The problem was: the TICK interrupt was indistinguishable from the ALARM > interrupt for a wake event and when I tested AD silicon to wake up an Android > device from suspend or power-off using the RTC IRQ, the device woke up on the > ALARM minute (0 seconds), discovered it was not the correct time and immediately > went back to sleep. Then it woke-up and returned back to sleep every TICK IRQ > second until the correct alarm time was reached (up to 59 times!). At which point > it woke up properly. > No, the suggestion is to use the TICK interrupt to have a proper UIE support even if the alarm has a minute granularity. As stated, this is not yet supported by the core and need some work. Some RTCs have the following in their set_alarm: if (tm->time.tm_sec) { time64_t alarm_time = rtc_tm_to_time64(&tm->time); alarm_time += 60 - tm->time.tm_sec; rtc_time64_to_tm(alarm_time, &tm->time); } But my plan is to actually expose the capability to userspace and the core so this doesn't have to be handled in the driver. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com