From patchwork Wed Mar 25 17:27:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fuchs X-Patchwork-Id: 25096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from yw-out-2122.google.com (yw-out-2122.google.com [74.125.46.27]) by ozlabs.org (Postfix) with ESMTP id EC46BDDED6 for ; Thu, 26 Mar 2009 05:17:45 +1100 (EST) Received: by yw-out-2122.google.com with SMTP id 4so50097ywc.11 for ; Wed, 25 Mar 2009 11:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received :received:received:x-dkim:received:from:to:subject:date:user-agent :cc:references:in-reply-to:organization:mime-version:content-type :message-id:reply-to:sender:precedence:x-google-loop:mailing-list :list-id:list-post:list-help:list-unsubscribe:x-beenthere-env :x-beenthere; bh=rbC9nmTvE/8jF+B/ZVYJtXeZVvRuIjp2G3gH9QACS1I=; b=5tqvm1ZSFTsIbQGjvH7db2X8/8++Rx7gzBuVtqgypXgnGP8S61qVXUvJskSTToI8hW XQLiPgg6S5+47I0XN9D+SKc/JtsDggupLf6e5+fKJNnskVAxfiQ6ApYINaw2xwMOmmoS 4NQmur6c6EUMXQdMiRLPSHlrdik6IN8cWkM9w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:x-dkim :from:to:subject:date:user-agent:cc:references:in-reply-to :organization:mime-version:content-type:message-id:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=MESsg7TEB2uWVVdbRSznt3OIdoRMNiA0dMAyop7oTWSWCGEJtf+RbJFT7V0qNs1MmD 9h4FUoWfHzxYPqCw5Zz1nVsMRZrHxAq14vCqEXJTrMoXVdhNefp8vob/ci/lj37ahwcH YqTLKsIT+JCeQB747JZdsz6iyKscv6cV7+YK8= Received: by 10.90.49.3 with SMTP id w3mr1729236agw.4.1238005061420; Wed, 25 Mar 2009 11:17:41 -0700 (PDT) Received: by 10.176.233.6 with SMTP id f6gr2041yqh.0; Wed, 25 Mar 2009 11:17:41 -0700 (PDT) X-Sender: matthias.fuchs@esd-electronics.com X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.204.77.100 with SMTP id f36mr241537bkk.13.1238002058077; Wed, 25 Mar 2009 10:27:38 -0700 (PDT) Received: from mail-in-05.arcor-online.net (mail-in-05.arcor-online.net [151.189.21.45]) by gmr-mx.google.com with ESMTP id 15si516609bwz.2.2009.03.25.10.27.37; Wed, 25 Mar 2009 10:27:37 -0700 (PDT) Received-SPF: neutral (google.com: 151.189.21.45 is neither permitted nor denied by best guess record for domain of matthias.fuchs@esd-electronics.com) client-ip=151.189.21.45; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 151.189.21.45 is neither permitted nor denied by best guess record for domain of matthias.fuchs@esd-electronics.com) smtp.mail=matthias.fuchs@esd-electronics.com Received: from mail-in-16-z2.arcor-online.net (mail-in-16-z2.arcor-online.net [151.189.8.33]) by mx.arcor.de (Postfix) with ESMTP id B00A0332F27; Wed, 25 Mar 2009 18:27:37 +0100 (CET) Received: from mail-in-13.arcor-online.net (mail-in-13.arcor-online.net [151.189.21.53]) by mail-in-16-z2.arcor-online.net (Postfix) with ESMTP id 7CDD2254EC8; Wed, 25 Mar 2009 18:27:37 +0100 (CET) Received: from bunny.home (dslb-088-070-073-165.pools.arcor-ip.net [88.70.73.165]) by mail-in-13.arcor-online.net (Postfix) with ESMTPS id BFAB22BAE7F; Wed, 25 Mar 2009 18:27:36 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-13.arcor-online.net BFAB22BAE7F Received: from fox.localnet (fox.home [192.168.2.13]) by bunny.home (Postfix) with ESMTPS id 5841DEE4001; Wed, 25 Mar 2009 18:27:36 +0100 (CET) From: Matthias Fuchs To: Wolfgang Grandegger , Yuri Tikhonov Subject: [rtc-linux] Re: [PATCH] RTC: Add stand-alone driver for RX8025 chip Date: Wed, 25 Mar 2009 18:27:34 +0100 User-Agent: KMail/1.10.4 (Linux/2.6.27-11-generic; KDE/4.1.4; i686; ; ) Cc: rtc-linux@googlegroups.com References: <49BFAF20.2050009@grandegger.com> In-Reply-To: <49BFAF20.2050009@grandegger.com> Organization: esd gmbh Mime-Version: 1.0 Message-Id: <200903251827.35232.matthias.fuchs@esd-electronics.com> Reply-To: rtc-linux@googlegroups.com Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.com > This patch adds support for the Epson RX-8025SA/NB RTC chips. It > includes support for alarms, periodic interrupts (1 Hz) and clock > precision adjustment. > > For clock precision adjustment, the SYSFS file "clock_adjust_ppb" gets > created in "/sys/class/rtc/rtcX/device". It permits to set and get the > clock adjustment in ppb (parts per billion), e.g.: > > # echo -183000 > /sys/class/rtc/rtc0/device/clock_adjust_ppb > # cat /sys/class/rtc/rtc0/device/clock_adjust_ppb > -183000 > > This allows to compensate temperature dependent clock drifts. According > to the RX8025 SA/NB application manual, the frequency and temperature > characteristics can be approximated using the following equation: > > df = a * (ut - t)**2 > > df: Frequency deviation in any temperature > a : Coefficient = (-35 +-5) * 10**-9 > ut: Ultimate temperature in degree = +25 +-5 degree > t : Any temperature in degree > > > Signed-off-by: Wolfgang Grandegger > Signed-off-by: Sergei Poselenov > Signed-off-by: Yuri Tikhonov > Signed-off-by: Dmitry Rakhchev Hi Wolfgang, your drivers works fine on my powerpc system after one tiny fixup. Please take a look. I am not sure if there is a better way to do this. Matthias [PATCH] rtc: Fix RX8025 rtc driver without interrupt This patch fixes the RX8025 rtc driver in case no interrupt is passed. Checking for irq < 0 is not suitable on all platforms. At least on powerpc systems irq == 0 means NO irq. So check against NO_IRQ. Signed-off-by: Matthias Fuchs --- drivers/rtc/rtc-rx8025.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c index e274db8..1d068a4 100644 --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c @@ -28,6 +28,10 @@ #include #include +#ifndef NO_IRQ +#define NO_IRQ (-1) +#endif + /* registers */ #define RX8025_REG_SEC 0x00 #define RX8025_REG_MIN 0x01 @@ -799,7 +803,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, } dev_info(&client->dev, "IRQ %d supplied\n", client->irq); - if (client->irq >= 0) { + if (client->irq != NO_IRQ) { err = request_irq(client->irq, rx8025_irq, 0, "rx8025", client); if (err) { @@ -831,7 +835,7 @@ static int __devinit rx8025_probe(struct i2c_client *client, rtc_device_unregister(rx8025->rtc); errout_irq: - if (client->irq >= 0) + if (client->irq != NO_IRQ) free_irq(client->irq, client); errout_free: @@ -846,7 +850,7 @@ static int __devexit rx8025_remove(struct i2c_client *client) { struct rx8025_data *rx8025 = i2c_get_clientdata(client); - if (client->irq >= 0) { + if (client->irq != NO_IRQ) { mutex_lock(&rx8025->mutex); rx8025->exiting = 1; mutex_unlock(&rx8025->mutex);