From patchwork Tue Jun 12 18:06:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 164466 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-lpp01m010-f56.google.com (mail-lpp01m010-f56.google.com [209.85.215.56]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D321AB6FE0 for ; Wed, 13 Jun 2012 04:06:48 +1000 (EST) Received: by lagp5 with SMTP id p5sf2871938lag.11 for ; Tue, 12 Jun 2012 11:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:from:to:cc:subject:date:message-id :x-mailer:mime-version:x-original-sender :x-original-authentication-results: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=CYaWG6soq3ynkY60R+P2mj58uTjcXDu4BXglujcLQ2k=; b=m9Js1Sg4NFBuOTSZysBn8nExvgj85qDFKHv0kItjE6HAG60i2l9BA1Emwdeq/ZGNnj VcWEqnQORrRGOHamXqpOtwYNeYYRSgdMKScEr/c2ZX58lk0r2h820OnMAxOMvsUFzdio 7BjHcTh3N79Eh282STp3VUL13Zz40BRWOgtVg= Received: by 10.180.80.40 with SMTP id o8mr806038wix.4.1339524403987; Tue, 12 Jun 2012 11:06:43 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.14.100.69 with SMTP id y45ls291058eef.3.gmail; Tue, 12 Jun 2012 11:06:42 -0700 (PDT) Received: by 10.14.29.66 with SMTP id h42mr5800555eea.13.1339524402347; Tue, 12 Jun 2012 11:06:42 -0700 (PDT) Received: by 10.14.29.66 with SMTP id h42mr5800554eea.13.1339524402319; Tue, 12 Jun 2012 11:06:42 -0700 (PDT) Received: from eu1sys200aog110.obsmtp.com (eu1sys200aog110.obsmtp.com. [207.126.144.129]) by gmr-mx.google.com with SMTP id b15si19265638een.0.2012.06.12.11.06.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 11:06:42 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.129; Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKT9eFKC2nzuTTb3ZitHrM9WdXdYyPiw5A@postini.com; Tue, 12 Jun 2012 18:06:41 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id EBAFEB4; Tue, 12 Jun 2012 17:58:07 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id AA551FC5; Tue, 12 Jun 2012 18:06:26 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 6402624C07C; Tue, 12 Jun 2012 20:06:16 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 12 Jun 2012 20:06:25 +0200 From: Linus Walleij To: Andrew Morton Cc: Alessandro Zummo , , Linus Walleij Subject: [rtc-linux] [PATCH 1/2] rtc: coh901331: use clk_prepare/unprepare Date: Tue, 12 Jun 2012 20:06:17 +0200 Message-ID: <1339524377-5457-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.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: , From: Linus Walleij Make sure we prepare/unprepare the clock for the COH901331 RTC driver as is required by the clk API especially if you use common clock. Signed-off-by: Linus Walleij --- drivers/rtc/rtc-coh901331.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index a5b8a0c..5866502 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c @@ -157,6 +157,7 @@ static int __exit coh901331_remove(struct platform_device *pdev) if (rtap) { free_irq(rtap->irq, rtap); rtc_device_unregister(rtap->rtc); + clk_unprepare(rtap->clk); clk_put(rtap->clk); iounmap(rtap->virtbase); release_mem_region(rtap->phybase, rtap->physize); @@ -213,10 +214,10 @@ static int __init coh901331_probe(struct platform_device *pdev) } /* We enable/disable the clock only to assure it works */ - ret = clk_enable(rtap->clk); + ret = clk_prepare_enable(rtap->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n"); - goto out_no_clk_enable; + goto out_no_clk_prepenable; } clk_disable(rtap->clk); @@ -232,7 +233,8 @@ static int __init coh901331_probe(struct platform_device *pdev) out_no_rtc: platform_set_drvdata(pdev, NULL); - out_no_clk_enable: + clk_unprepare(rtap->clk); + out_no_clk_prepenable: clk_put(rtap->clk); out_no_clk: free_irq(rtap->irq, rtap); @@ -265,6 +267,7 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state) writel(0, rtap->virtbase + COH901331_IRQ_MASK); clk_disable(rtap->clk); } + clk_unprepare(rtap->clk); return 0; } @@ -272,6 +275,7 @@ static int coh901331_resume(struct platform_device *pdev) { struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); + clk_prepare(rtap->clk); if (device_may_wakeup(&pdev->dev)) { disable_irq_wake(rtap->irq); } else { @@ -293,6 +297,7 @@ static void coh901331_shutdown(struct platform_device *pdev) clk_enable(rtap->clk); writel(0, rtap->virtbase + COH901331_IRQ_MASK); clk_disable(rtap->clk); + clk_unprepare(rtap->clk); } static struct platform_driver coh901331_driver = {