Skip to content

Commit 9cde5b7

Browse files
committed
mmc: core: Replace MMC_CAP2_BROKEN_VOLTAGE with test for fixed regulator
Before this patch, we were using MMC_CAP2_BROKEN_VOLTAGE as a way to avoid calling regulator_set_voltage() on a fixed regulator, but that's just duplicating information that already exists -- we should test whether the regulator is fixed directly, instead of via a capability. This patch implements that test. We can't reclaim the capability bit just yet, since there are still boards in arch/arm/ that reference it; those references can be removed now. Reported-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent f4f24ad commit 9cde5b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/mmc/core/core.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,8 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
11131113
int tmp;
11141114
int voltage;
11151115

1116-
/* REVISIT mmc_vddrange_to_ocrmask() may have set some
1116+
/*
1117+
* REVISIT mmc_vddrange_to_ocrmask() may have set some
11171118
* bits this regulator doesn't quite support ... don't
11181119
* be too picky, most cards and regulators are OK with
11191120
* a 0.1V range goof (it's a small error percentage).
@@ -1127,12 +1128,13 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
11271128
max_uV = min_uV + 100 * 1000;
11281129
}
11291130

1130-
/* avoid needless changes to this voltage; the regulator
1131-
* might not allow this operation
1131+
/*
1132+
* If we're using a fixed/static regulator, don't call
1133+
* regulator_set_voltage; it would fail.
11321134
*/
11331135
voltage = regulator_get_voltage(supply);
11341136

1135-
if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
1137+
if (regulator_count_voltages(supply) == 1)
11361138
min_uV = max_uV = voltage;
11371139

11381140
if (voltage < 0)

0 commit comments

Comments
 (0)