From patchwork Wed Sep 4 06:59:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhoujie wu X-Patchwork-Id: 2853534 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A01E6C0AB5 for ; Wed, 4 Sep 2013 07:00:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D06632011E for ; Wed, 4 Sep 2013 07:00:12 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6693B200DA for ; Wed, 4 Sep 2013 07:00:11 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VH74O-00058Y-Pt; Wed, 04 Sep 2013 07:00:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VH74M-0004cM-Am; Wed, 04 Sep 2013 07:00:02 +0000 Received: from mail-we0-f174.google.com ([74.125.82.174]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VH74I-0004bk-SO for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2013 06:59:59 +0000 Received: by mail-we0-f174.google.com with SMTP id q54so5689022wes.33 for ; Tue, 03 Sep 2013 23:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Kx0vLuHqHDKNmnkkpQOr+J+ZLGFDFnvhETczzm5uga0=; b=A8AyqXv7xGx6c1S4hMSpyYz5PtZLC4JB43PP7bncxjCTmzCdBO98RGcQ8PMSrEsPte 2NEnfjFWBzV7/mYnuofC7cM05upYRCIG3BwPZh3ZYVg5Xx/sz7uu6KCTc4o0uc7160ir mt865eFwhyoQLamJwD1qJlvvm+LRS6+JhtCCogXPQv+EOv7xhO7nL70OxG5EBW5fUVub r7Sfsh44s0Cs0j4QoI04bZ/MCgQmzx+ONoLnBiwZDg80DRvyRTm7MI33+c1xiRGHOnxO b52RWw0yDxRg/GfpQyZY5N+QgQ4ap0NRsD5JWf7lT6JZx69lHYO6nQsqWBt8p1OXGbt6 dylQ== MIME-Version: 1.0 X-Received: by 10.194.122.99 with SMTP id lr3mr1108061wjb.21.1378277974219; Tue, 03 Sep 2013 23:59:34 -0700 (PDT) Received: by 10.194.169.137 with HTTP; Tue, 3 Sep 2013 23:59:34 -0700 (PDT) Date: Wed, 4 Sep 2013 14:59:34 +0800 Message-ID: Subject: question about clk notifier in common clock tree From: zhoujie wu To: Mike Turquette X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130904_025959_045180_F160B87F X-CRM114-Status: UNSURE ( 7.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) Cc: Chao Xie , Zhoujie Wu , Raul Xiong , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Mike, Now in our platform, we are using clk notifer to adjust voltage before clock rate change or after rate change. But for some clock modules, it even have to adjust voltage when clock enable and disable. For example, when it is working(clock enabled), it requires voltage 1.2V. When it finished its work, it could release it's voltage requirement. Do you think if it is ok we also send out notifier in __clk_prepare and __clk_unprepare as below? Thanks. diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 54a191c..2f64f1e 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -34,6 +34,9 @@ static HLIST_HEAD(clk_root_list); static HLIST_HEAD(clk_orphan_list); static LIST_HEAD(clk_notifier_list); +static int __clk_notify(struct clk *clk, unsigned long msg, + unsigned long old_rate, unsigned long new_rate); + /*** locking ***/ static void clk_prepare_lock(void) { @@ -697,6 +700,9 @@ void __clk_unprepare(struct clk *clk) if (clk->ops->unprepare) clk->ops->unprepare(clk->hw); + /* send out notifier for dvfs */ + __clk_notify(clk, POST_RATE_CHANGE, clk->rate, 0); + __clk_unprepare(clk->parent); } @@ -738,6 +744,9 @@ int __clk_prepare(struct clk *clk) return ret; } } + + /* send out notifier for dvfs */ + __clk_notify(clk, PRE_RATE_CHANGE, 0, clk->rate); } clk->prepare_count++;