From patchwork Wed Sep 18 02:17:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhoujie wu X-Patchwork-Id: 2904451 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 83D23BFF05 for ; Wed, 18 Sep 2013 02:18:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93FDB2024C for ; Wed, 18 Sep 2013 02:18:17 +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 96D2120240 for ; Wed, 18 Sep 2013 02:18:16 +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 1VM7LH-0004Pt-JH; Wed, 18 Sep 2013 02:18:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM7LF-00065i-9e; Wed, 18 Sep 2013 02:18:09 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VM7LA-00065F-Cf for linux-arm-kernel@lists.infradead.org; Wed, 18 Sep 2013 02:18:05 +0000 Received: by mail-wi0-f170.google.com with SMTP id cb5so5738479wib.5 for ; Tue, 17 Sep 2013 19:17:42 -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=Ks0rsW+nknTomQvLdoPBKvDL6A7CnM24LRmIEaxnX6ueDQbrYAEenoIPbqu+iYnfxq aTu9PDnCxkDOuS1tjrGlcr9QbyIhrGxg9y8N4cluxoKgmelOjSg87eeFA+ROn0Hk+w1t g+vaiYBvPPNmyFJzhmFqxIZCO4AhStQlU180SsgNQkBeTPo7SS9MGhHLB7BouszqNeaY Dggb1TVB5pl9XpoK+lBax3Lm/Bg7Mm3MbXV+i1mG1UxJAqqGQt2XiF5dkaUG5ZviUf5S nGjvIYfimXnpnfayNr94aNh39MOhVu0TfpnXmK7sNy4GWxiOJ8NarkYuA0bGLDyMaWM6 k/dw== MIME-Version: 1.0 X-Received: by 10.180.100.202 with SMTP id fa10mr4943377wib.8.1379470662336; Tue, 17 Sep 2013 19:17:42 -0700 (PDT) Received: by 10.194.169.137 with HTTP; Tue, 17 Sep 2013 19:17:42 -0700 (PDT) Date: Wed, 18 Sep 2013 10:17:42 +0800 Message-ID: Subject: question about clk notifier in common clock tree From: zhoujie wu To: mturquette@linaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130917_221804_574971_AF0DEBD7 X-CRM114-Status: UNSURE ( 7.62 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) Cc: "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=-4.7 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. --- Zhoujie Wu 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++;