From patchwork Thu Apr 30 10:55:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Haslam X-Patchwork-Id: 6301741 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3DC389F326 for ; Thu, 30 Apr 2015 10:57:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B750201CD for ; Thu, 30 Apr 2015 10:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EEC992018E for ; Thu, 30 Apr 2015 10:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbbD3K5F (ORCPT ); Thu, 30 Apr 2015 06:57:05 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:36096 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbbD3K5A (ORCPT ); Thu, 30 Apr 2015 06:57:00 -0400 Received: by wizk4 with SMTP id k4so14349797wiz.1 for ; Thu, 30 Apr 2015 03:56:59 -0700 (PDT) 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=+Dqt1/ABx4ESUSlOEMUV4tZ+2alJzPlBzxkk/67GHMo=; b=KgQffXfwt+bQy7Z341xtMf3ioe6u6SCWvo/Sqhp6chx+vOWtszu0dX+MBEA5AusQ6H YZi1GRoFxcnnJ5RviEG6a6qIpXVP+WWamrOIR8HI69VqvV/7cjEOF/W8iicro7je26pv 58WzegD0YEldwvlhbcnFMXK87fFFFxAO61k5gGuhgJn0u3+/LVViSLnd0erzm24VTdnE EcA+XZ4Ssl35iLXEsOtYsISObCO30WpxBNwAz/ttg2gnoi46+wqa1HAZbcIcVaenTfXG y9ePCkjoGd6Oxw1zSW6Y2CfmORnzt7hrIoz1/ek6ZERtZ0ZgCfrPbkk76B7QDhkxrr3B YREQ== X-Gm-Message-State: ALoCoQmM/xpMvDLv1wSMvINgskt/qQFgGWeyCpRPFshPNwUhAuVpGXDaC3q48Ub45D8tkwSCjTlg X-Received: by 10.180.97.164 with SMTP id eb4mr4521714wib.3.1430391419614; Thu, 30 Apr 2015 03:56:59 -0700 (PDT) Received: from axelh-ThinkPad-T440s.home (LPoitiers-656-1-62-228.w90-63.abo.wanadoo.fr. [90.63.143.228]) by mx.google.com with ESMTPSA id ha4sm1922482wib.0.2015.04.30.03.56.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 03:56:58 -0700 (PDT) From: ahaslam@baylibre.com To: ulf.hansson@linaro.org, khilman@linaro.org, k.kozlowski.k@gmail.com, geert@linux-m68k.org, rjw@rjwysocki.net Cc: bcousson@baylibre.com, linux-pm@vger.kernel.org, Axel Haslam Subject: [PATCH v7 1/5] PM / Domains: prepare for multiple states Date: Thu, 30 Apr 2015 12:55:31 +0200 Message-Id: <1430391335-7588-2-git-send-email-ahaslam@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430391335-7588-1-git-send-email-ahaslam@baylibre.com> References: <1430391335-7588-1-git-send-email-ahaslam@baylibre.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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=ham 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 From: Axel Haslam prepare generic power domain init function parameters to accept a pointer to the states structure that describes the possible states that a power domain can enter. There is no functional change, as support for multiple domains will be added in subsequent patches. Signed-off-by: Axel Haslam Acked-by: Krzysztof Kozlowski --- arch/arm/mach-exynos/pm_domains.c | 2 +- arch/arm/mach-imx/gpc.c | 2 +- arch/arm/mach-s3c64xx/pm.c | 5 +++-- arch/arm/mach-shmobile/pm-r8a7779.c | 2 +- arch/arm/mach-shmobile/pm-rmobile.c | 2 +- arch/arm/mach-ux500/pm_domains.c | 2 +- drivers/base/power/domain.c | 6 +++++- include/linux/pm_domain.h | 14 ++++++++++++-- 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index cbe56b3..3c68239 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -176,7 +176,7 @@ static __init int exynos4_pm_init_power_domain(void) no_clk: on = __raw_readl(pd->base + 0x4) & INT_LOCAL_PWR_EN; - pm_genpd_init(&pd->pd, NULL, !on); + pm_genpd_init(&pd->pd, NULL, NULL, 0, !on); of_genpd_add_provider_simple(np, &pd->pd); } diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c index 4d60005..092b4ae 100644 --- a/arch/arm/mach-imx/gpc.c +++ b/arch/arm/mach-imx/gpc.c @@ -421,7 +421,7 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) imx6q_pm_pu_power_on(&imx6q_pu_domain.base); } - pm_genpd_init(&imx6q_pu_domain.base, NULL, is_off); + pm_genpd_init(&imx6q_pu_domain.base, NULL, NULL, 0, is_off); return of_genpd_add_provider_onecell(dev->of_node, &imx_gpc_onecell_data); diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c index 75b14e7..0e79375 100644 --- a/arch/arm/mach-s3c64xx/pm.c +++ b/arch/arm/mach-s3c64xx/pm.c @@ -317,10 +317,11 @@ int __init s3c64xx_pm_init(void) for (i = 0; i < ARRAY_SIZE(s3c64xx_always_on_pm_domains); i++) pm_genpd_init(&s3c64xx_always_on_pm_domains[i]->pd, - &pm_domain_always_on_gov, false); + &pm_domain_always_on_gov, NULL, 0, false); for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++) - pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false); + pm_genpd_init(&s3c64xx_pm_domains[i]->pd, + NULL, NULL, 0, false); #ifdef CONFIG_S3C_DEV_FB if (dev_get_platdata(&s3c_device_fb.dev)) diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c index 44a74c4..a89a94f 100644 --- a/arch/arm/mach-shmobile/pm-r8a7779.c +++ b/arch/arm/mach-shmobile/pm-r8a7779.c @@ -84,7 +84,7 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) struct generic_pm_domain *genpd = &r8a7779_pd->genpd; genpd->flags = GENPD_FLAG_PM_CLK; - pm_genpd_init(genpd, NULL, false); + pm_genpd_init(genpd, NULL, NULL, 0, false); genpd->dev_ops.active_wakeup = pd_active_wakeup; genpd->power_off = pd_power_down; genpd->power_on = pd_power_up; diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index 9501820..18f87c5 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c @@ -154,7 +154,7 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) struct dev_power_governor *gov = rmobile_pd->gov; genpd->flags = GENPD_FLAG_PM_CLK; - pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); + pm_genpd_init(genpd, gov ? : &simple_qos_governor, NULL, 0, false); genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; genpd->power_off = rmobile_pd_power_down; genpd->power_on = rmobile_pd_power_up; diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c index 4d71c90..7bd4d98 100644 --- a/arch/arm/mach-ux500/pm_domains.c +++ b/arch/arm/mach-ux500/pm_domains.c @@ -72,7 +72,7 @@ int __init ux500_pm_domains_init(void) genpd_data->num_domains = ARRAY_SIZE(ux500_pm_domains); for (i = 0; i < ARRAY_SIZE(ux500_pm_domains); ++i) - pm_genpd_init(ux500_pm_domains[i], NULL, false); + pm_genpd_init(ux500_pm_domains[i], NULL, NULL, 0, false); of_genpd_add_provider_onecell(np, genpd_data); return 0; diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 2327613..b30a42f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1882,10 +1882,14 @@ static int pm_genpd_default_restore_state(struct device *dev) * pm_genpd_init - Initialize a generic I/O PM domain object. * @genpd: PM domain object to initialize. * @gov: PM domain governor to associate with the domain (may be NULL). + * @states: Array of possible low power states when powering off. + * @state_count: Number of low power states. * @is_off: Initial value of the domain's power_is_off field. */ void pm_genpd_init(struct generic_pm_domain *genpd, - struct dev_power_governor *gov, bool is_off) + struct dev_power_governor *gov, + const struct genpd_power_state *states, + unsigned int state_count, bool is_off) { if (IS_ERR_OR_NULL(genpd)) return; diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 681ccb0..6b4802e 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -46,6 +46,12 @@ struct gpd_cpuidle_data { struct cpuidle_state *idle_state; }; +struct genpd_power_state { + char *name; + s64 power_off_latency_ns; + s64 power_on_latency_ns; +}; + struct generic_pm_domain { struct dev_pm_domain domain; /* PM domain operations */ struct list_head gpd_list_node; /* Node in the global PM domains list */ @@ -149,7 +155,9 @@ extern int pm_genpd_name_attach_cpuidle(const char *name, int state); extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd); extern int pm_genpd_name_detach_cpuidle(const char *name); extern void pm_genpd_init(struct generic_pm_domain *genpd, - struct dev_power_governor *gov, bool is_off); + struct dev_power_governor *gov, + const struct genpd_power_state *states, + unsigned int state_count, bool is_off); extern int pm_genpd_poweron(struct generic_pm_domain *genpd); extern int pm_genpd_name_poweron(const char *domain_name); @@ -216,7 +224,9 @@ static inline int pm_genpd_name_detach_cpuidle(const char *name) return -ENOSYS; } static inline void pm_genpd_init(struct generic_pm_domain *genpd, - struct dev_power_governor *gov, bool is_off) + struct dev_power_governor *gov, + const struct genpd_power_state *states, + unsigned int state_count, bool is_off) { } static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)