linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: k.konieczny@partner.samsung.com
To: k.konieczny@partner.samsung.com
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Kukjin Kim <kgene@kernel.org>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Mark Rutland <mark.rutland@arm.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Nishanth Menon <nm@ti.com>, Rob Herring <robh+dt@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Viresh Kumar <vireshk@kernel.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org
Subject: [PATCH 1/3] opp: core: add regulators enable and disable
Date: Mon,  8 Jul 2019 16:11:38 +0200	[thread overview]
Message-ID: <20190708141140.24379-2-k.konieczny@partner.samsung.com> (raw)
In-Reply-To: <20190708141140.24379-1-k.konieczny@partner.samsung.com>

From: Kamil Konieczny <k.konieczny@partner.samsung.com>

Add enable regulators to dev_pm_opp_set_regulators() and disable
regulators to dev_pm_opp_put_regulators(). This prepares for
converting exynos-bus devfreq driver to use dev_pm_opp_set_rate().

Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
---
 drivers/opp/core.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 0e7703fe733f..947cac452854 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1580,8 +1580,19 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
 	if (ret)
 		goto free_regulators;
 
+	for (i = 0; i < opp_table->regulator_count; i++) {
+		ret = regulator_enable(opp_table->regulators[i]);
+		if (ret < 0)
+			goto disable;
+	}
+
 	return opp_table;
 
+disable:
+	while (i != 0)
+		regulator_disable(opp_table->regulators[--i]);
+
+	i = opp_table->regulator_count;
 free_regulators:
 	while (i != 0)
 		regulator_put(opp_table->regulators[--i]);
@@ -1609,6 +1620,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
 
 	/* Make sure there are no concurrent readers while updating opp_table */
 	WARN_ON(!list_empty(&opp_table->opp_list));
+	for (i = opp_table->regulator_count - 1; i >= 0; i--)
+		regulator_disable(opp_table->regulators[i]);
 
 	for (i = opp_table->regulator_count - 1; i >= 0; i--)
 		regulator_put(opp_table->regulators[i]);
-- 
2.22.0


  parent reply	other threads:[~2019-07-08 14:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190708141158eucas1p17d4b50978dbe1e5c876ce6d8f433cc95@eucas1p1.samsung.com>
2019-07-08 14:11 ` [PATCH 0/3] add coupled regulators for Exynos5422/5800 k.konieczny
     [not found]   ` <CGME20190708141159eucas1p1751506975ff96a436e14940916623722@eucas1p1.samsung.com>
2019-07-08 14:11     ` k.konieczny [this message]
2019-07-09  5:40       ` [PATCH 1/3] opp: core: add regulators enable and disable Viresh Kumar
2019-07-10 10:16         ` Kamil Konieczny
2019-07-10 10:42           ` Kamil Konieczny
2019-07-10 10:43         ` Kamil Konieczny
2019-07-10 13:52           ` Kamil Konieczny
2019-07-10 17:01       ` Krzysztof Kozlowski
2019-07-11  6:22       ` Viresh Kumar
2019-07-11 12:58         ` Kamil Konieczny
     [not found]   ` <CGME20190708141200eucas1p144ca3b2a5b4019aaa5773d23c0236f31@eucas1p1.samsung.com>
2019-07-08 14:11     ` [PATCH 2/3] devfreq: exynos-bus: convert to use dev_pm_opp_set_rate() k.konieczny
2019-07-10 17:04       ` Krzysztof Kozlowski
2019-07-11 13:36         ` Kamil Konieczny
     [not found]   ` <CGME20190708141200eucas1p12bf901a2589efe92b133b357d2cbc57e@eucas1p1.samsung.com>
2019-07-08 14:11     ` [PATCH 3/3] ARM: dts: exynos: add initial data for coupled regulators for Exynos5422/5800 k.konieczny
2019-07-10  9:02       ` Krzysztof Kozlowski
2019-07-10  9:00   ` [PATCH 0/3] add " Krzysztof Kozlowski
2019-07-10 10:03     ` Kamil Konieczny
2019-07-10 10:14       ` Krzysztof Kozlowski
2019-07-10 13:51         ` Kamil Konieczny
2019-07-10 17:01           ` Krzysztof Kozlowski

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=20190708141140.24379-2-k.konieczny@partner.samsung.com \
    --to=k.konieczny@partner.samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=nm@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vireshk@kernel.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).