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: 41762 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8E5524001 for ; Mon, 1 Dec 2014 11:50:32 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf6563825eek.0 for ; Mon, 01 Dec 2014 03:50:31 -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=DWtN8u08IQW9f0ZiQYVQ+V5fMZDD8OQlF+iCO9xJjig=; b=kYiTgY343Vz2S8GKf8/c8ZhsGPqklFJaF+IrktwyFvN5ZKsnGVSh5YIF3WtNn3Q2Rp i5OerEo/993/hsbhgGz8TAz2U1MywMjnXJwJvuB6upJjddZ8lHCl+oFm4NNJ3EXbyd1/ miGvnKfoWRa2U++0W4fX0h9A81pwK54i5mgufri5cl/W/COVHcf13GTBewGLL7CFWDgE ORuq92K1l4zqgzPPH87vGdwb4Ou4qZyWZKwrxOGQVUTWOLROF2YWtZjaiRMhFXEJqCkJ cE2shkM55fXJE3WaZeyJaJkNBac4NR2M1In5YI62QVDp2JKGPBx/+lppRzH495kEodQy GBXQ== X-Gm-Message-State: ALoCoQnpXHEX4bMEWcJXjuVIrLenb2ke5d3IjX/nU7A2mPFsi7GxAwNFuD2gBDXcUZYjOLhijVcE X-Received: by 10.112.138.234 with SMTP id qt10mr15884906lbb.4.1417434631922; Mon, 01 Dec 2014 03:50:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.5 with SMTP id r5ls130631lae.47.gmail; Mon, 01 Dec 2014 03:50:31 -0800 (PST) X-Received: by 10.152.37.201 with SMTP id a9mr54937891lak.53.1417434631598; Mon, 01 Dec 2014 03:50:31 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id df8si17460191lac.23.2014.12.01.03.50.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 03:50:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id 10so8484601lbg.36 for ; Mon, 01 Dec 2014 03:50:31 -0800 (PST) X-Received: by 10.152.43.12 with SMTP id s12mr3601943lal.67.1417434631516; Mon, 01 Dec 2014 03:50:31 -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 ew9csp270158lbc; Mon, 1 Dec 2014 03:50:31 -0800 (PST) X-Received: by 10.112.168.201 with SMTP id zy9mr56454064lbb.77.1417434630926; Mon, 01 Dec 2014 03:50:30 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id li1si17386494lab.112.2014.12.01.03.50.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Dec 2014 03:50:30 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gm9so8735639lab.12 for ; Mon, 01 Dec 2014 03:50:30 -0800 (PST) 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 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 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-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.217.177 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 GENDP_FLAG_PM_CLK bit for it. Signed-off-by: Ulf Hansson Acked-by: Geert Uytterhoeven --- 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)