From: rnayak@codeaurora.org (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 10/11] clk: qcom: gdsc: Enable an RCG before turning on the gdsc
Date: Tue, 14 Apr 2015 18:42:16 +0530 [thread overview]
Message-ID: <1429017137-20218-11-git-send-email-rnayak@codeaurora.org> (raw)
In-Reply-To: <1429017137-20218-1-git-send-email-rnayak@codeaurora.org>
Some gdsc instances require a certain root clock (RCG) to be turned on *before*
the power domain itself can be turned on. Handle this as part of the gdsc
enable/disable callbacks.
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
drivers/clk/qcom/gdsc.c | 20 +++++++++++++++++++-
drivers/clk/qcom/gdsc.h | 3 +++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index ab55310..480ebf6 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -83,6 +83,9 @@ static int gdsc_enable(struct generic_pm_domain *domain)
struct gdsc *sc = domain_to_gdsc(domain);
int ret;
+ if (sc->root_clk)
+ clk_prepare_enable(sc->root_clk);
+
ret = gdsc_toggle_logic(sc, true);
if (ret)
return ret;
@@ -100,9 +103,15 @@ static int gdsc_enable(struct generic_pm_domain *domain)
static int gdsc_disable(struct generic_pm_domain *domain)
{
+ int ret;
struct gdsc *sc = domain_to_gdsc(domain);
- return gdsc_toggle_logic(sc, false);
+ ret = gdsc_toggle_logic(sc, false);
+
+ if (sc->root_clk)
+ clk_disable_unprepare(sc->root_clk);
+
+ return ret;
}
static int gdsc_attach(struct generic_pm_domain *domain, struct device *dev)
@@ -127,6 +136,15 @@ static int gdsc_attach(struct generic_pm_domain *domain, struct device *dev)
goto fail;
}
}
+
+ if (sc->root_con_id) {
+ sc->root_clk = clk_get(dev, sc->root_con_id);
+ if (IS_ERR(sc->root_clk)) {
+ dev_err(dev, "failed to get root clock\n");
+ return PTR_ERR(sc->root_clk);
+ }
+ }
+
return 0;
fail:
pm_clk_destroy(dev);
diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h
index 734f341..1ad9d53 100644
--- a/drivers/clk/qcom/gdsc.h
+++ b/drivers/clk/qcom/gdsc.h
@@ -14,6 +14,7 @@
#ifndef __QCOM_GDSC_H__
#define __QCOM_GDSC_H__
+#include <linux/clk.h>
#include <linux/pm_domain.h>
#include <linux/regmap.h>
@@ -28,6 +29,8 @@ struct gdsc {
struct generic_pm_domain pd;
struct regmap *regmap;
unsigned int gdscr;
+ char *root_con_id;
+ struct clk *root_clk;
char *con_ids[];
};
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2015-04-14 13:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 13:12 [PATCH v5 00/11] Add support for QCOM GDSCs Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 01/11] clk: qcom: Add support for GDSCs Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 02/11] clk: qcom: gdsc: Prepare common clk probe to register gdscs Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 03/11] clk: qcom: gdsc: Add GDSCs in msm8916 GCC Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 04/11] clk: qcom: gdsc: Add GDSCs in msm8974 GCC Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 05/11] clk: qcom: gdsc: Add GDSCs in msm8974 MMCC Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 06/11] clk: qcom: gdsc: Add GDSCs in apq8084 GCC Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 07/11] clk: qcom: gdsc: Add GDSCs in apq8084 MMCC Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 08/11] arm: dts: qcom: Add #power-domain-cells property Rajendra Nayak
2015-04-24 9:45 ` Ulf Hansson
2015-04-24 10:55 ` Rajendra Nayak
2015-04-24 11:00 ` Rajendra Nayak
2015-04-24 15:43 ` Ulf Hansson
2015-04-27 2:32 ` Rajendra Nayak
2015-04-27 7:52 ` Ulf Hansson
2015-04-27 9:33 ` Rajendra Nayak
2015-04-14 13:12 ` [PATCH v5 09/11] clk: qcom: gdsc: Use PM clocks to control gdsc clocks Rajendra Nayak
2015-04-30 15:26 ` Stanimir Varbanov
2015-05-12 3:02 ` Rajendra Nayak
2015-04-14 13:12 ` Rajendra Nayak [this message]
2015-04-14 13:12 ` [PATCH v5 11/11] clk: qcom: gdsc: Add oxili GDSC for msm8916 Rajendra Nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429017137-20218-11-git-send-email-rnayak@codeaurora.org \
--to=rnayak@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).