From patchwork Fri Nov 28 08:30:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5401851 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 10CFBBEEA8 for ; Fri, 28 Nov 2014 08:30:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 248ED20138 for ; Fri, 28 Nov 2014 08:30:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 315972013A for ; Fri, 28 Nov 2014 08:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751144AbaK1IaO (ORCPT ); Fri, 28 Nov 2014 03:30:14 -0500 Received: from mail-la0-f52.google.com ([209.85.215.52]:57253 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750984AbaK1IaN (ORCPT ); Fri, 28 Nov 2014 03:30:13 -0500 Received: by mail-la0-f52.google.com with SMTP id hs14so563649lab.39 for ; Fri, 28 Nov 2014 00:30:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KliPalJ/feLQyIMqAyYq5l5OZu1E9YjSjAdrd4qZgDg=; b=l7YKJlJDj0Ipt7bUU7hjmWR/9oLe2d0Ql/nBVzig58aOKnHtZcPe56KmZY2XUuBI2g zeIkOs8OGBysAhyX3tHLJqGe9xZ2aFzeAqll8di+YuTSXQt4BQLXX+wIREo2PdJRsmdz OYNULHeCa/qOPq1r4KuAdEdvk6bjDYXL/vCFiJKUpt5grJQ3h6oEeK6+SlEOMP8CYKaY Ikh1M+AWk81ez7LmSqTawc+IuXAxgW7RB5vg3QUNK/MA+eLhEEAdGLAVaRcS8j/NDU/w ApPwU4glnnCfN+zZZ6fLhxzOk8wGxTMvYxFI1JJcbHxoL2QJcz60kCQV863imqdCVo4t +r8w== X-Gm-Message-State: ALoCoQm9Ni+01Z719eq7znHcmFTuTWfjxNbENpSnuH6aPDVZB7U4BPmge+YbJv+SykKZwsPy2mpR X-Received: by 10.152.2.41 with SMTP id 9mr41769218lar.47.1417163411426; Fri, 28 Nov 2014 00:30:11 -0800 (PST) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id z1sm2419274lad.40.2014.11.28.00.30.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Nov 2014 00:30:10 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Kevin Hilman , Simon Horman , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven , Magnus Damm , Russell King , Dmitry Torokhov , Sylwester Nawrocki , Grygorii Strashko , Arnd Bergmann , Ulf Hansson Subject: [PATCH V3 1/3] PM / Domains: Initial PM clock support for genpd Date: Fri, 28 Nov 2014 09:30:01 +0100 Message-Id: <1417163403-7070-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417163403-7070-1-git-send-email-ulf.hansson@linaro.org> References: <1417163403-7070-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 It's quite common for PM domains to use PM clocks. Typically from SOC specific code, the per device PM clock list is created and pm_clk_suspend|resume() are invoked to handle clock gating/ungating. A step towards consolidation is to integrate PM clock support into genpd, which is what this patch does. In this initial step, the calls to the pm_clk_suspend|resume() are handled within genpd, but the per device PM clock list still needs to be created from SOC specific code. It seems reasonable to have gendp to handle that as well, but that left to future patches to address. It's not every users of genpd that are keen on using PM clocks, thus we need to provide this a configuration option for genpd. Therefore let's add flag field in the genpd struct to keep this information and define a new GENDP_PM_CLK bit for it. Signed-off-by: Ulf Hansson --- Changes in v3: Moved define out of struct definition. Don't use bitops.h Rename define to GENDP_PM_CLK. Changes in v2: Set ->start() callback to pm_clk_resume() and fixed comment. --- drivers/base/power/domain.c | 7 +++++++ include/linux/pm_domain.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 735c473..a2424a7 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1928,6 +1929,12 @@ void pm_genpd_init(struct generic_pm_domain *genpd, genpd->domain.ops.complete = pm_genpd_complete; genpd->dev_ops.save_state = pm_genpd_default_save_state; genpd->dev_ops.restore_state = pm_genpd_default_restore_state; + + if (genpd->flags & GENPD_PM_CLK) { + genpd->dev_ops.stop = pm_clk_suspend; + genpd->dev_ops.start = pm_clk_resume; + } + mutex_lock(&gpd_list_lock); list_add(&genpd->gpd_list_node, &gpd_list); mutex_unlock(&gpd_list_lock); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 8cbd32e..173cc67 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -17,6 +17,9 @@ #include #include +/* Defines used for the flags field in the struct generic_pm_domain */ +#define GENPD_PM_CLK (1U << 0) /* PM domain uses PM clk */ + enum gpd_status { GPD_STATE_ACTIVE = 0, /* PM domain is active */ GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */ @@ -76,6 +79,7 @@ struct generic_pm_domain { struct device *dev); void (*detach_dev)(struct generic_pm_domain *domain, struct device *dev); + unsigned int flags; /* Bit field of configs for genpd */ }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)