diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2013-12-13 14:43:03 +0800 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-18 18:49:17 +0000 |
commit | 11db0da831b1e6ae3c1f8743599434281db294db (patch) | |
tree | f71ee7cb739714ef6553fa8e6560bb3c0fa555f5 /net/sched | |
parent | 252e91ff1094eefacd25b401c3b77e549803cae6 (diff) |
ASoC: sgtl5000: clean up sgtl5000_enable_regulators()
Function sgtl5000_enable_regulators() is somehow odd in handling the
optional external VDDD supply. The driver can only enable this supply
on SGTL5000 chip before revision 0x11, and of course when this external
VDDD is present. It currently does something like below.
1. Check if regulator_bulk_get() on VDDA, VDDIO and VDDD will fail. If
it fails, VDDD must be absent and it falls on internal LDO by calling
sgtl5000_replace_vddd_with_ldo(). Otherwise, VDDD is used. And in
either case, regulator_bulk_enable() will be called to enable
3 supplies.
2. In case that SGTL5000 revision is later than 0x11, even if external
VDDD is present, it has to roll back the 'enable' and 'get' calls
with regulator_bulk_disable() and regulator_bulk_free(), and starts
over again by calling sgtl5000_replace_vddd_with_ldo() and
regulator_bulk_enable().
Such back and forth calls sequence is complicated and unnecessary.
Also, since commit 4ddfebd (regulator: core: Provide a dummy regulator
with full constraints), regulator_bulk_get() will always succeeds
because of the dummy regulator. Thus the VDDD detection is broken.
The patch changes the flow to something like the following, which should
be more reasonable and clear, and also fix the VDDD detection breakage.
1. Check if we're running a chip before revision 0x11, on which an
external VDDD can possibly be an option.
2. If it is an early revision, call regulator_get_optional() to detect
whether an external VDDD supply is available.
3. If external VDDD is present, call sgtl5000_replace_vddd_with_ldo() to
update sgtl5000->supplies info.
4. Drop regulator_bulk_get() call in sgtl5000_replace_vddd_with_ldo(),
and call it in sgtl5000_enable_regulators() no matter it's an
external VDDD or internal LDO.
5. Call regulator_bulk_enable() to enable these 3 regulators.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'net/sched')
0 files changed, 0 insertions, 0 deletions