linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>, Chris Ball <cjb@laptop.org>
Subject: [PATCH v2] regulator: treat regulators with constant volatage as fixed
Date: Tue, 13 Nov 2012 10:35:34 +0100	[thread overview]
Message-ID: <1352799334-13898-1-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20121113090007.GS18224@opensource.wolfsonmicro.com>

Some drivers has additional logic for fixed regulators. Let regulator core
to treat regulators which cannot change their voltage due to applied
constraints as fixed.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/regulator/core.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 042c1ff..78b34b7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1872,7 +1872,11 @@ int regulator_count_voltages(struct regulator *regulator)
 {
 	struct regulator_dev	*rdev = regulator->rdev;
 
-	return rdev->desc->n_voltages ? : -EINVAL;
+	if (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)
+		return rdev->desc->n_voltages ? rdev->desc->n_voltages :
+		       -EINVAL;
+	else
+		return 1;
 }
 EXPORT_SYMBOL_GPL(regulator_count_voltages);
 
-- 
1.7.9.5


  reply	other threads:[~2012-11-13  9:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13  8:48 [PATCH 0/3] Fix fixed regulators support Marek Szyprowski
2012-11-13  8:48 ` [PATCH 1/3] regulator: fix voltage check in regulator_is_supported_voltage() Marek Szyprowski
2012-11-13  9:01   ` Mark Brown
2012-11-13  8:48 ` [PATCH 2/3] regulator: threat regulators with constant volatage as fixed Marek Szyprowski
2012-11-13  9:00   ` Mark Brown
2012-11-13  9:35     ` Marek Szyprowski [this message]
2012-11-13  9:42       ` [PATCH v2] regulator: treat " Mark Brown
2012-11-13  9:49         ` [PATCH v3] " Marek Szyprowski
2012-11-14  2:01           ` Mark Brown
2012-11-20 13:20             ` Marek Szyprowski
2012-11-13  8:48 ` [PATCH 3/3] mmc: sdhci: apply voltage range check only for non-fixed regulators Marek Szyprowski
2012-11-13 12:45   ` Chris Ball
2012-11-13 13:32     ` [PATCH v2] " Marek Szyprowski
2012-11-13 13:45       ` Chris Ball
2012-11-13 14:09         ` Marek Szyprowski
2012-11-13 14:14           ` Chris Ball
2012-11-13 21:23             ` Philip Rakity
2012-11-20  8:42               ` Marek Szyprowski
2012-11-14  1:10     ` [PATCH 3/3] " Mark Brown

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=1352799334-13898-1-git-send-email-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cjb@laptop.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=lrg@ti.com \
    /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).