From patchwork Tue Dec 27 14:37:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 133320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-iy0-f184.google.com (mail-iy0-f184.google.com [209.85.210.184]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 8C564B7010 for ; Wed, 28 Dec 2011 01:37:56 +1100 (EST) Received: by iaeo4 with SMTP id o4sf33294814iae.11 for ; Tue, 27 Dec 2011 06:37:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:sender:in-reply-to:references :from:date:message-id:subject:to:cc:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe:content-type :content-transfer-encoding; bh=QbxUuv7MHBLojtOA9jK/HxI9QoQEo/enZLauvVLkt8k=; b=WftkwsWZufr2Gb1HHlSLOJqFvDSLqBhfkrE8PTZZfSJqjIIAhjH4rp1p+pgnc6dGaG zbnTGSQhWPkXtOLBXsmKngAOUkhEgEBKB2c60LoYyu2gYL5OtMtEdpLYY/IK3StoW15t 1mHc0hORC6nS1MFMKDEuq2yVSLECgYpiqAsB0= Received: by 10.50.40.165 with SMTP id y5mr7856613igk.4.1324996666838; Tue, 27 Dec 2011 06:37:46 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.154.193 with SMTP id vq1ls17070041igb.1.canary; Tue, 27 Dec 2011 06:37:46 -0800 (PST) Received: by 10.50.15.161 with SMTP id y1mr10896135igc.0.1324996666527; Tue, 27 Dec 2011 06:37:46 -0800 (PST) Received: by 10.50.15.161 with SMTP id y1mr10896134igc.0.1324996666515; Tue, 27 Dec 2011 06:37:46 -0800 (PST) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by gmr-mx.google.com with ESMTPS id cg4si1970086igb.0.2011.12.27.06.37.46 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Dec 2011 06:37:46 -0800 (PST) Received-SPF: pass (google.com: domain of rabin.vincent@gmail.com designates 209.85.214.182 as permitted sender) client-ip=209.85.214.182; Received: by mail-tul01m020-f182.google.com with SMTP id wd18so11091544obb.13 for ; Tue, 27 Dec 2011 06:37:46 -0800 (PST) Received: by 10.50.180.138 with SMTP id do10mr31341599igc.20.1324996666272; Tue, 27 Dec 2011 06:37:46 -0800 (PST) MIME-Version: 1.0 Sender: rtc-linux@googlegroups.com Received: by 10.50.89.162 with HTTP; Tue, 27 Dec 2011 06:37:05 -0800 (PST) In-Reply-To: <20111227105708.GA29960@upset.ux.pdb.fsc.net> References: <20111226145841.GA26578@upset.ux.pdb.fsc.net> <20111227105708.GA29960@upset.ux.pdb.fsc.net> From: Rabin Vincent Date: Tue, 27 Dec 2011 20:07:05 +0530 Message-ID: Subject: [rtc-linux] Re: REGRESSION 3.2-rcX: RTC auto poweron after 5 minutes To: Andreas Friedrich Cc: john.stultz@linaro.org, gregkh@suse.de, torvalds@osdl.org, Wolfgang Erig , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com X-Original-Sender: rabinvincent@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of rabin.vincent@gmail.com designates 209.85.214.182 as permitted sender) smtp.mail=rabin.vincent@gmail.com; dkim=pass (test mode) header.i=@gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: List-Subscribe: , List-Unsubscribe: , On Tue, Dec 27, 2011 at 16:27, Andreas Friedrich wrote: > On Mo, Dez 26, 2011 at 03:58:41 +0100, Andreas Friedrich wrote: > the 5 minutes auto-poweron problem was caused by the new function > drivers/rtc/interface.c -> rtc_alarm_disable(): >   ... >   alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm), >                                        ktime_set(300, 0))); >   alarm.enabled = 0; >   ... > > In this function the RTC alarm shall be disabled. Why do you set up a > 5 minutes interval just before disabling the alarm? The 5 minutes is taken from rtc-sysfs.c ("Provide a valid future alarm time" etc.). Although perhaps the "future" part is just to get past the check in __rtc_set_alarm(), which we anyway don't use in rtc_alarm_disable(). > > I have changed >   ktime_set(300, 0))); > to >   ktime_set(0, 0))); > and all worked fine with my notebook. > > Please check if this could be a common solution of the problem. Probably not, because if your hardware really doesn't disable the alarm then you could get the same problem if someone say changes the RTC time to a few minutes earlier after a call to rtc_alarm_disable(). Perhaps we can avoid your five-minute problem by just attempting to disable the irq without setting a new alarm time (not yet tested): btw, if you haven't done so yet, could you please confirm that it's not something in your userspace which is _asking_ for the alarm to be enabled? You could add a printk() of the 'enabled' argument into cmos_alarm_irq_enable() to do this (and one in cmos_set_alarm() wouldn't hurt too). diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 3bcc7cf..54a3b5e 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -778,16 +778,10 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) static void rtc_alarm_disable(struct rtc_device *rtc) { - struct rtc_wkalrm alarm; - struct rtc_time tm; - - __rtc_read_time(rtc, &tm); - - alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm), - ktime_set(300, 0))); - alarm.enabled = 0; + if (!rtc->ops || !rtc->ops->alarm_irq_enable) + return; - ___rtc_set_alarm(rtc, &alarm); + rtc->ops->alarm_irq_enable(rtc->dev.parent, false); }