From patchwork Thu Nov 27 14:51:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 41622 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C92A92486D for ; Thu, 27 Nov 2014 14:52:09 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id c13sf3277699eek.2 for ; Thu, 27 Nov 2014 06:52:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=f9y6CkKeWWIpkshQ8lTtYHN43U+bGzo/Osqz+F0h32w=; b=kiK7LYHMMUYBW/V/8YkZbyQjpGju8110Ohk4nf+fmqXTCCmBKx+N1pQcFQvds+wMHS MwJH+uuaT0LkT2ib/rZNwbt1ykwbqNMuNbRrr0J0ezAbvSXRvfgf/rN9foXSKnEFyAEO lDeTcL849L/MjwWAM6WFOK7Mo4qcBtypOQZO6wZT0FlkrQ2pV91L/O/a1pBBXyDQm9np o4a6f5LCd76oS9TsIYBYn7CwdFr3Z1VC1JpCw2tRwCpEewvXrhE7sE+C4hOfBwG1V7Zw MhQoBPPQU32ntSOAva8x1LMT/+LhbFyETzPRnzqtn0rBIX3q60WzwWet43Ki2mSJHI5w yDYg== X-Gm-Message-State: ALoCoQlBDMmbYfBXhtezpGpmcftnyhQ0KM/FTDPCQP2XKyg6OnQh6JcmyDlyUPp/ErsoWXV4zGAy X-Received: by 10.152.29.226 with SMTP id n2mr505312lah.9.1417099929023; Thu, 27 Nov 2014 06:52:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.197 with SMTP id q5ls877336lal.39.gmail; Thu, 27 Nov 2014 06:52:08 -0800 (PST) X-Received: by 10.152.36.165 with SMTP id r5mr38664687laj.91.1417099928887; Thu, 27 Nov 2014 06:52:08 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ax5si1618054lbc.9.2014.11.27.06.52.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Nov 2014 06:52:08 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id hs14so4149994lab.8 for ; Thu, 27 Nov 2014 06:52:08 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr39427785laa.56.1417099928768; Thu, 27 Nov 2014 06:52:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp808783lbc; Thu, 27 Nov 2014 06:52:08 -0800 (PST) X-Received: by 10.194.61.168 with SMTP id q8mr52405291wjr.53.1417099927907; Thu, 27 Nov 2014 06:52:07 -0800 (PST) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com. [209.85.212.178]) by mx.google.com with ESMTPS id bl1si12256269wjb.144.2014.11.27.06.52.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Nov 2014 06:52:07 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.212.178 as permitted sender) client-ip=209.85.212.178; Received: by mail-wi0-f178.google.com with SMTP id hi2so8570421wib.5 for ; Thu, 27 Nov 2014 06:52:07 -0800 (PST) X-Received: by 10.194.62.144 with SMTP id y16mr3869394wjr.117.1417099927645; Thu, 27 Nov 2014 06:52:07 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id l3sm11047581wje.12.2014.11.27.06.52.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Nov 2014 06:52:06 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Simon Horman , Magnus Damm , Russell King , Dmitry Torokhov , Sylwester Nawrocki , Grygorii Strashko , Arnd Bergmann , Ulf Hansson Subject: [PATCH V2 1/3] PM / Domains: Initial PM clock support for genpd Date: Thu, 27 Nov 2014 15:51:49 +0100 Message-Id: <1417099911-12688-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417099911-12688-1-git-send-email-ulf.hansson@linaro.org> References: <1417099911-12688-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 PM_DOMAIN_PM_CLK bit can then be set at initialization. Signed-off-by: Ulf Hansson --- Changes in v2: Set ->start() callback to pm_clk_resume() and fixed comment. --- drivers/base/power/domain.c | 7 +++++++ include/linux/pm_domain.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 735c473..42ba5a0 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 & PM_DOMAIN_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..4ba06a4f 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,8 @@ 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 */ +#define PM_DOMAIN_PM_CLK BIT(0) /* PM domain uses PM clk */ }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)