From patchwork Wed Mar 9 02:21:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Ni X-Patchwork-Id: 86054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-yi0-f56.google.com (mail-yi0-f56.google.com [209.85.218.56]) (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 932B5B70F0 for ; Wed, 9 Mar 2011 13:21:21 +1100 (EST) Received: by yib17 with SMTP id 17sf19410yib.11 for ; Tue, 08 Mar 2011 18:21:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:x-beenthere:mime-version:date:in-reply-to:x-ip :references:user-agent:x-http-useragent:message-id:subject:from:to :x-original-sender:reply-to:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=Jp73jPkMr5JBioPVdgUYGW5iloz7GepofE0dxsUYb34=; b=V0eteXTP/EeBBvY/KS4/5A+x1P+TLG41/h4ZZacsuLP/fz7Xnn1gQWBi3LOB+U/9zl VQ6PFWxIVEUqb4/kGkFtdw2+Q1Vzka0iSdafzZrTqKbmdaXTSfOlFX2gjH+s7ZM7d0Le qmccRCSQpqzybcy5dxmbFzc/670nXrn8CAQis= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:mime-version:date:in-reply-to:x-ip:references :user-agent:x-http-useragent:message-id:subject:from:to :x-original-sender:reply-to:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; b=zT9EzgEf/NBR9nKdpSnupECPxPZZwW/6HcSpSYz9iBANIvdAwnX9ufhC+nBm6B0wu6 aN4DmYfzjJ7+w7JRKX9DmTni8kMLuBmHVrEGYJgl7mdR8bIuB7sRy+90Kp0nvx13+Nh6 6yy6zY9J+54XI6kC/swsOcY1SppDsEwVOov2A= Received: by 10.91.23.19 with SMTP id a19mr664672agj.19.1299637277877; Tue, 08 Mar 2011 18:21:17 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.91.208.35 with SMTP id k35ls64338agq.5.p; Tue, 08 Mar 2011 18:21:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.90.11.27 with SMTP id 27mr660937agk.56.1299637277649; Tue, 08 Mar 2011 18:21:17 -0800 (PST) Received: by o21g2000prh.googlegroups.com with HTTP; Tue, 8 Mar 2011 18:21:17 -0800 (PST) Date: Tue, 8 Mar 2011 18:21:17 -0800 (PST) In-Reply-To: <738e2c6d-2b72-4754-9187-db599e827cbb@17g2000prr.googlegroups.com> X-IP: 203.18.50.4 References: <1297762485-29648-1-git-send-email-vwadekar@nvidia.com> <667d6d0c-0e95-470c-b99d-6d036933dd91@s18g2000prg.googlegroups.com> <738e2c6d-2b72-4754-9187-db599e827cbb@17g2000prr.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13, gzip(gfe) Message-ID: Subject: [rtc-linux] Re: mfd: tps6586x: add RTC driver for TI TPS6586x From: niwei To: rtc-linux X-Original-Sender: wni@nvidia.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: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , I use "diff -u" to generate diff patch again. Please check it. Thanks Wei. --- rtc-tps6586x.c-orig 2011-03-08 15:58:40.000000000 +0800 +++ rtc-tps6586x.c 2011-03-09 10:15:27.310598802 +0800 @@ -90,14 +90,6 @@ dev_err(dev, "requested time unsupported\n"); return -EINVAL; } - - if (alrm->enabled && !rtc->irq_en) { - enable_irq(rtc->irq); - rtc->irq_en = true; - } else if (!alrm->enabled && rtc->irq_en) { - disable_irq(rtc->irq); - rtc->irq_en = false; - } seconds -= rtc->epoch_start; @@ -147,6 +139,11 @@ dev_err(dev, "can't set alarm to requested time\n"); return -EINVAL; } + + if (rtc->irq_en && rtc->irq_en && (rtc->irq != -1)) { + disable_irq(rtc->irq); + rtc->irq_en = false; + } seconds -= rtc->epoch_start; ticks = (unsigned long long)seconds << 10; @@ -156,8 +153,15 @@ buff[2] = ticks & 0xff; err = tps6586x_writes(tps_dev, RTC_ALARM1_HI, sizeof(buff), buff); - if (err) + if (err) { dev_err(tps_dev, "unable to program alarm\n"); + return err; + } + + if (alrm->enabled && (rtc->irq != -1)) { + enable_irq(rtc->irq); + rtc->irq_en = true; + } return err; } @@ -272,6 +276,9 @@ epoch = &pdata->start; + epoch->year = 2009; + epoch->month = 1; + epoch->day = 1; rtc->epoch_start = mktime(epoch->year, epoch->month, epoch->day, epoch->hour, epoch->min, epoch->sec);