From patchwork Tue Sep 16 18:48:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 4919121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3021A9F32F for ; Tue, 16 Sep 2014 18:50:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1AD42015D for ; Tue, 16 Sep 2014 18:52:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08A462010E for ; Tue, 16 Sep 2014 18:52:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTxpM-0001tX-P3; Tue, 16 Sep 2014 18:50:12 +0000 Received: from xavier.telenet-ops.be ([195.130.132.52]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTxow-0000je-8y for linux-arm-kernel@lists.infradead.org; Tue, 16 Sep 2014 18:49:48 +0000 Received: from ayla.of.borg ([84.193.84.167]) by xavier.telenet-ops.be with bizsmtp id rup71o0103cczKo01up8D1; Tue, 16 Sep 2014 20:49:19 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.76) (envelope-from ) id 1XTxoJ-0001jg-Aw; Tue, 16 Sep 2014 20:49:07 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1XTxoP-0001fs-RM; Tue, 16 Sep 2014 20:49:13 +0200 From: Geert Uytterhoeven To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Simon Horman , Magnus Damm , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala Subject: [PATCH/RFC v2 07/12] ARM: shmobile: R-Mobile: Use generic_pm_domain.attach_dev() for pm_clk setup Date: Tue, 16 Sep 2014 20:48:54 +0200 Message-Id: <1410893339-6361-8-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410893339-6361-1-git-send-email-geert+renesas@glider.be> References: <1410893339-6361-1-git-send-email-geert+renesas@glider.be> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140916_114946_538360_77FFBAC8 X-CRM114-Status: GOOD ( 10.72 ) X-Spam-Score: -0.4 (/) Cc: devicetree@vger.kernel.org, Ulf Hansson , Kevin Hilman , Geert Uytterhoeven , linux-pm@vger.kernel.org, linux-sh@vger.kernel.org, Tomasz Figa , linux-kernel@vger.kernel.org, Grygorii Strashko , Philipp Zabel , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, 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 Use the just introduced genpd attach/detach callbacks to register the devices' module clocks, instead of doing it directly, to make it DT-proof. Signed-off-by: Geert Uytterhoeven --- v2: - New --- arch/arm/mach-shmobile/pm-rmobile.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index 717e6413d29cb998..4c8e47179fdd333b 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c @@ -101,6 +101,22 @@ static bool rmobile_pd_active_wakeup(struct device *dev) return true; } +static int rmobile_pd_attach_dev(struct generic_pm_domain *genpd, + struct device *dev) +{ + if (pm_clk_no_clocks(dev)) + pm_clk_add(dev, NULL); + + return 0; +} + +static int rmobile_pd_detach_dev(struct generic_pm_domain *genpd, + struct device *dev) +{ + pm_clk_remove(dev, NULL); + return 0; +} + static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) { struct generic_pm_domain *genpd = &rmobile_pd->genpd; @@ -112,6 +128,8 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; genpd->power_off = rmobile_pd_power_down; genpd->power_on = rmobile_pd_power_up; + genpd->attach_dev = rmobile_pd_attach_dev; + genpd->detach_dev = rmobile_pd_detach_dev; __rmobile_pd_power_up(rmobile_pd, false); } @@ -130,8 +148,6 @@ void rmobile_add_device_to_domain_td(const char *domain_name, struct device *dev = &pdev->dev; __pm_genpd_name_add_device(domain_name, dev, td); - if (pm_clk_no_clocks(dev)) - pm_clk_add(dev, NULL); } void rmobile_add_devices_to_domains(struct pm_domain_device data[],