linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* commit c368e5fc2a190923b786f2de3e79430ea3566a25 regresses MMC
@ 2013-11-20 17:58 Felipe Balbi
  2013-11-20 20:34 ` Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2013-11-20 17:58 UTC (permalink / raw)
  To: ldewangan, broonie, lgirdwood, Linux Kernel Mailing List,
	Linux OMAP Mailing List

[-- Attachment #1: Type: text/plain, Size: 2652 bytes --]

Hi,

commit c368e5fc2a190923b786f2de3e79430ea3566a25 (regulator: fixed: get
rid of {get|list}_voltage()) regresses any MMC host controller which
uses fixed regulator for functionality.

Note that mmc core uses regulator_list_voltage() to setup OCR mask and
that has a check for missing ->list_voltage() method.

Reverting that commit makes beablebone black and white work with today's
Linus' HEAD.

That commit should either be reverted or regulator_list_voltages()
should be fixed up accordingly.

Proposed patch below:

8<------------------------ cut here -----------------------------------

From 807bb4e91eea46390f184b737f7f8dc634e62a01 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <balbi@ti.com>
Date: Wed, 20 Nov 2013 11:52:33 -0600
Subject: [PATCH] regulator: core: fix regulator_list_voltage()

commit c368e5f (regulator: fixed: get rid of
{get|list}_voltage()) caused a regression
for any MMC host which uses a fixed regulator.

MMC core uses regulator_list_voltage() to
setup card's OCR mask. Unfortunately, said
commit missed the fact that regulator_list_voltage()
would bail out early if ->list_voltage()
implementation is missing.

This was not a problem before, since fixed
regulator implemented that callback.

The best solution is to patch regulator_list_voltage()
itself, since MMC core shouldn't have to know
which regulator type it's using.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/regulator/core.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6382f0a..0da48ae 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2181,15 +2181,21 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages);
 int regulator_list_voltage(struct regulator *regulator, unsigned selector)
 {
 	struct regulator_dev	*rdev = regulator->rdev;
-	struct regulator_ops	*ops = rdev->desc->ops;
+	const struct regulator_desc *desc = rdev->desc;
+	struct regulator_ops	*ops = desc->ops;
 	int			ret;
 
-	if (!ops->list_voltage || selector >= rdev->desc->n_voltages)
+	if ((!ops->list_voltage && !desc->fixed_uV) ||
+			selector >= rdev->desc->n_voltages)
 		return -EINVAL;
 
-	mutex_lock(&rdev->mutex);
-	ret = ops->list_voltage(rdev, selector);
-	mutex_unlock(&rdev->mutex);
+	if (ops->list_voltage) {
+		mutex_lock(&rdev->mutex);
+		ret = ops->list_voltage(rdev, selector);
+		mutex_unlock(&rdev->mutex);
+	} else /* if (desc->fixed_uV) */ {
+		ret = desc->fixed_uV;
+	}
 
 	if (ret > 0) {
 		if (ret < rdev->constraints->min_uV)
-- 
1.8.4.GIT


-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-11-22  1:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 17:58 commit c368e5fc2a190923b786f2de3e79430ea3566a25 regresses MMC Felipe Balbi
2013-11-20 20:34 ` Mark Brown
2013-11-20 20:51   ` Felipe Balbi
2013-11-21  2:48     ` Felipe Balbi
2013-11-21 10:49       ` Mark Brown
2013-11-21 12:58         ` Felipe Balbi
2013-11-21 16:43         ` Stephen Warren
2013-11-21 18:36           ` Mark Brown
2013-11-21 18:44             ` Stephen Warren
2013-11-21 19:28               ` Mark Brown
2013-11-21 20:27         ` Olof Johansson
2013-11-21 20:50           ` Mark Brown
2013-11-22  1:56             ` Felipe Balbi

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).