From patchwork Mon Dec 1 11:50:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5412031 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 99715BEEA8 for ; Mon, 1 Dec 2014 11:54:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1C2B201C7 for ; Mon, 1 Dec 2014 11:54:37 +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 C81902026C for ; Mon, 1 Dec 2014 11:54:36 +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 1XvPWW-000287-34; Mon, 01 Dec 2014 11:52:12 +0000 Received: from mail-la0-f46.google.com ([209.85.215.46]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XvPVF-00012F-9o for linux-arm-kernel@lists.infradead.org; Mon, 01 Dec 2014 11:50:54 +0000 Received: by mail-la0-f46.google.com with SMTP id q1so3619294lam.5 for ; Mon, 01 Dec 2014 03:50:30 -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=DWtN8u08IQW9f0ZiQYVQ+V5fMZDD8OQlF+iCO9xJjig=; b=G1BDXCcrtD06p1/5dlnw1uxvhlBwOyzTuqbXP4vSZiowvjPX4uGYf07Nxw9q0jKvgp z1y5o3/L5JO7Mq2XKrOKiHerPN9n/zLB6LO2zMkZ53W/1lWxwEnfRy5QW1fimMYPlQO+ ILu70CVxHUMxP9LyiDNpkhhxcS2cjD+V4IUjBpUmgh9mdezWQUKLCoOM9MosGvQDD6YD ziccyonBI6bgYJOOUVku8akipjcWE4/u4kHZOL205bA1uYm29iicL0TZ3MuDDzGXsuit 7QqtGpcsPY4WN3X/U+QdgdbTqLxcA+rixCh5+4SqF646Bsc4XyhxtXq+aGmDSTBYDYN0 ZbJQ== X-Gm-Message-State: ALoCoQnz7IJhHoIP8joERyR3x/9THaG/1nF/GDPfHrO5yqEm7mUrF1w4JVWGmcOJ7ajlh55y9Xpa X-Received: by 10.112.134.193 with SMTP id pm1mr5687644lbb.93.1417434630804; Mon, 01 Dec 2014 03:50:30 -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 j2sm2056926lbs.3.2014.12.01.03.50.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Dec 2014 03:50:29 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Kevin Hilman , Simon Horman , linux-pm@vger.kernel.org Subject: [PATCH V4 1/3] PM / Domains: Initial PM clock support for genpd Date: Mon, 1 Dec 2014 12:50:21 +0100 Message-Id: <1417434623-31301-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417434623-31301-1-git-send-email-ulf.hansson@linaro.org> References: <1417434623-31301-1-git-send-email-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141201_035053_553049_2E68DB89 X-CRM114-Status: GOOD ( 15.51 ) X-Spam-Score: -0.7 (/) Cc: Ulf Hansson , linux-samsung-soc@vger.kernel.org, Russell King , Arnd Bergmann , Geert Uytterhoeven , Dmitry Torokhov , Magnus Damm , Grygorii Strashko , Sylwester Nawrocki , 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_LOW, 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_FLAG_PM_CLK bit for it. Signed-off-by: Ulf Hansson Acked-by: Geert Uytterhoeven Acked-by: Kevin Hilman --- Changes in v4: Rename define. 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..6a103a3 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_FLAG_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..6cd20d5 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_FLAG_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)