aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-08 09:04:50 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-08 12:55:55 -0400
commit7ca3a18b055ac6667f4e7e34eae6637270002402 (patch)
treee9d7bbf688f01976f881cbe40b605ceaba5ae680 /sound/soc/soc-dapm.c
parent2dc00213b03669010a67454d6448d91f3af06435 (diff)
ASoC: Assign power_check when we allocate DAPM widgets
This ensures none of the rest of the code ever encounters a widget which does not have a power check function. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c67
1 files changed, 39 insertions, 28 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index e49c56d4951e..22fb7355b134 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2137,48 +2137,21 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
2137 case snd_soc_dapm_switch: 2137 case snd_soc_dapm_switch:
2138 case snd_soc_dapm_mixer: 2138 case snd_soc_dapm_mixer:
2139 case snd_soc_dapm_mixer_named_ctl: 2139 case snd_soc_dapm_mixer_named_ctl:
2140 w->power_check = dapm_generic_check_power;
2141 dapm_new_mixer(w); 2140 dapm_new_mixer(w);
2142 break; 2141 break;
2143 case snd_soc_dapm_mux: 2142 case snd_soc_dapm_mux:
2144 case snd_soc_dapm_virt_mux: 2143 case snd_soc_dapm_virt_mux:
2145 case snd_soc_dapm_value_mux: 2144 case snd_soc_dapm_value_mux:
2146 w->power_check = dapm_generic_check_power;
2147 dapm_new_mux(w); 2145 dapm_new_mux(w);
2148 break; 2146 break;
2149 case snd_soc_dapm_adc:
2150 case snd_soc_dapm_aif_out:
2151 w->power_check = dapm_adc_check_power;
2152 break;
2153 case snd_soc_dapm_dac:
2154 case snd_soc_dapm_aif_in:
2155 w->power_check = dapm_dac_check_power;
2156 break;
2157 case snd_soc_dapm_pga: 2147 case snd_soc_dapm_pga:
2158 case snd_soc_dapm_out_drv: 2148 case snd_soc_dapm_out_drv:
2159 w->power_check = dapm_generic_check_power;
2160 dapm_new_pga(w); 2149 dapm_new_pga(w);
2161 break; 2150 break;
2162 case snd_soc_dapm_input: 2151 default:
2163 case snd_soc_dapm_output:
2164 case snd_soc_dapm_micbias:
2165 case snd_soc_dapm_spk:
2166 case snd_soc_dapm_hp:
2167 case snd_soc_dapm_mic:
2168 case snd_soc_dapm_line:
2169 w->power_check = dapm_generic_check_power;
2170 break;
2171 case snd_soc_dapm_supply:
2172 w->power_check = dapm_supply_check_power;
2173 case snd_soc_dapm_vmid:
2174 case snd_soc_dapm_pre:
2175 case snd_soc_dapm_post:
2176 break; 2152 break;
2177 } 2153 }
2178 2154
2179 if (!w->power_check)
2180 w->power_check = dapm_always_on_check_power;
2181
2182 /* Read the initial power state from the device */ 2155 /* Read the initial power state from the device */
2183 if (w->reg >= 0) { 2156 if (w->reg >= 0) {
2184 val = soc_widget_read(w, w->reg); 2157 val = soc_widget_read(w, w->reg);
@@ -2667,6 +2640,44 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
2667 else 2640 else
2668 snprintf(w->name, name_len, "%s", widget->name); 2641 snprintf(w->name, name_len, "%s", widget->name);
2669 2642
2643 switch (w->id) {
2644 case snd_soc_dapm_switch:
2645 case snd_soc_dapm_mixer:
2646 case snd_soc_dapm_mixer_named_ctl:
2647 w->power_check = dapm_generic_check_power;
2648 break;
2649 case snd_soc_dapm_mux:
2650 case snd_soc_dapm_virt_mux:
2651 case snd_soc_dapm_value_mux:
2652 w->power_check = dapm_generic_check_power;
2653 break;
2654 case snd_soc_dapm_adc:
2655 case snd_soc_dapm_aif_out:
2656 w->power_check = dapm_adc_check_power;
2657 break;
2658 case snd_soc_dapm_dac:
2659 case snd_soc_dapm_aif_in:
2660 w->power_check = dapm_dac_check_power;
2661 break;
2662 case snd_soc_dapm_pga:
2663 case snd_soc_dapm_out_drv:
2664 case snd_soc_dapm_input:
2665 case snd_soc_dapm_output:
2666 case snd_soc_dapm_micbias:
2667 case snd_soc_dapm_spk:
2668 case snd_soc_dapm_hp:
2669 case snd_soc_dapm_mic:
2670 case snd_soc_dapm_line:
2671 w->power_check = dapm_generic_check_power;
2672 break;
2673 case snd_soc_dapm_supply:
2674 w->power_check = dapm_supply_check_power;
2675 break;
2676 default:
2677 w->power_check = dapm_always_on_check_power;
2678 break;
2679 }
2680
2670 dapm->n_widgets++; 2681 dapm->n_widgets++;
2671 w->dapm = dapm; 2682 w->dapm = dapm;
2672 w->codec = dapm->codec; 2683 w->codec = dapm->codec;