lkml.org 
[lkml]   [2013]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectcommit c368e5fc2a190923b786f2de3e79430ea3566a25 regresses MMC
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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-11-20 20:01    [W:0.457 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site