aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-09 13:04:11 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-09 17:51:12 -0500
commitb66a70d5e9929f3b0df5a7177bba75652d2f4c3e (patch)
treef5c517d5771badee1c81cfbca8bd6d036cf52a01 /sound
parent6ed8f1485fc82d44ac464bc84a7dcdddd1fa096f (diff)
ASoC: Sync initial widget state with hardware
ASoC generally uses the register defaults for everything, but in some cases the hardware will default to enabling some of the DAPM widgets (clocks for example). Ensure that DAPM knows about the actual widget state at initialisation by reading the enable bits after instantiating the widgets so they don't get left enabled needlessly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-dapm.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8194f150bab7..4df96ec9a813 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1627,6 +1627,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes);
1627int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) 1627int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
1628{ 1628{
1629 struct snd_soc_dapm_widget *w; 1629 struct snd_soc_dapm_widget *w;
1630 unsigned int val;
1630 1631
1631 list_for_each_entry(w, &dapm->card->widgets, list) 1632 list_for_each_entry(w, &dapm->card->widgets, list)
1632 { 1633 {
@@ -1675,6 +1676,18 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
1675 case snd_soc_dapm_post: 1676 case snd_soc_dapm_post:
1676 break; 1677 break;
1677 } 1678 }
1679
1680 /* Read the initial power state from the device */
1681 if (w->reg >= 0) {
1682 val = snd_soc_read(w->codec, w->reg);
1683 val &= 1 << w->shift;
1684 if (w->invert)
1685 val = !val;
1686
1687 if (val)
1688 w->power = 1;
1689 }
1690
1678 w->new = 1; 1691 w->new = 1;
1679 } 1692 }
1680 1693