From patchwork Wed Nov 19 14:00:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5337511 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 27C459F2F1 for ; Wed, 19 Nov 2014 14:00:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A7B1201FB for ; Wed, 19 Nov 2014 14:00:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50A35201FE for ; Wed, 19 Nov 2014 14:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752736AbaKSOAv (ORCPT ); Wed, 19 Nov 2014 09:00:51 -0500 Received: from mail-la0-f47.google.com ([209.85.215.47]:36480 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbaKSOAu (ORCPT ); Wed, 19 Nov 2014 09:00:50 -0500 Received: by mail-la0-f47.google.com with SMTP id hz20so541095lab.34 for ; Wed, 19 Nov 2014 06:00:49 -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=SLx5sHqB9Mon/kC7hcZkgn9QO3NEnU+NlQbncJ4PKGA=; b=TS32iZ3Z9YYv40aX+qBlMbZsw4E1bONFu+d9tjuijbJBQbxXGry0qrNP72iY01tDoS +WqycY+Jtveeh40vEqa62pI3zwsHhaMudwZLtX7M+gRTK0HGKGT5Qm27E0RHUjZTUf0F +PC/SaSAZQGQV58O5sHo37nUO8Cak229UEOuiVBYBkILn8Qs7BpcXB12I6e1M5szaCkY 5rw6F2hxmj+PtEjA9k+iH3lDZGRrVhKtgBFfH+5g/GS8+aD6/RR7ykfpPLFl2+G4UJsx 08xxRNcU92kCWGAtvSoZxLsXtt5aUeACyRm4qlxCdp10mzmZo/Ji8i33v5E2xlgc2HQt ZyUQ== X-Gm-Message-State: ALoCoQn/GbHQx/qoS6jwc/8zuGgE+cVwognEyqlEcW8YdFIAlfrFd7pocnV55kTv11+xzDOQ8ngt X-Received: by 10.152.43.97 with SMTP id v1mr42522046lal.3.1416405649466; Wed, 19 Nov 2014 06:00:49 -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 ar4sm451435lbc.48.2014.11.19.06.00.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Nov 2014 06:00:48 -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 1/3] PM / Domains: Initial PM clock support for genpd Date: Wed, 19 Nov 2014 15:00:36 +0100 Message-Id: <1416405638-18812-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416405638-18812-1-git-send-email-ulf.hansson@linaro.org> References: <1416405638-18812-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 PM_DOMAIN_PM_CLK bit can then be set at initialization. Signed-off-by: Ulf Hansson --- 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 3989eb6..42e328c 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1948,6 +1949,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_suspend; + } + 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 9d254e2..44c6931 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 use PM clk */ }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)