mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-20 16:30:53 +00:00
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>
This commit is contained in:
parent
2dc00213b0
commit
7ca3a18b05
@ -2137,48 +2137,21 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
|
||||
case snd_soc_dapm_switch:
|
||||
case snd_soc_dapm_mixer:
|
||||
case snd_soc_dapm_mixer_named_ctl:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
dapm_new_mixer(w);
|
||||
break;
|
||||
case snd_soc_dapm_mux:
|
||||
case snd_soc_dapm_virt_mux:
|
||||
case snd_soc_dapm_value_mux:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
dapm_new_mux(w);
|
||||
break;
|
||||
case snd_soc_dapm_adc:
|
||||
case snd_soc_dapm_aif_out:
|
||||
w->power_check = dapm_adc_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_dac:
|
||||
case snd_soc_dapm_aif_in:
|
||||
w->power_check = dapm_dac_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_pga:
|
||||
case snd_soc_dapm_out_drv:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
dapm_new_pga(w);
|
||||
break;
|
||||
case snd_soc_dapm_input:
|
||||
case snd_soc_dapm_output:
|
||||
case snd_soc_dapm_micbias:
|
||||
case snd_soc_dapm_spk:
|
||||
case snd_soc_dapm_hp:
|
||||
case snd_soc_dapm_mic:
|
||||
case snd_soc_dapm_line:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_supply:
|
||||
w->power_check = dapm_supply_check_power;
|
||||
case snd_soc_dapm_vmid:
|
||||
case snd_soc_dapm_pre:
|
||||
case snd_soc_dapm_post:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!w->power_check)
|
||||
w->power_check = dapm_always_on_check_power;
|
||||
|
||||
/* Read the initial power state from the device */
|
||||
if (w->reg >= 0) {
|
||||
val = soc_widget_read(w, w->reg);
|
||||
@ -2667,6 +2640,44 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
|
||||
else
|
||||
snprintf(w->name, name_len, "%s", widget->name);
|
||||
|
||||
switch (w->id) {
|
||||
case snd_soc_dapm_switch:
|
||||
case snd_soc_dapm_mixer:
|
||||
case snd_soc_dapm_mixer_named_ctl:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_mux:
|
||||
case snd_soc_dapm_virt_mux:
|
||||
case snd_soc_dapm_value_mux:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_adc:
|
||||
case snd_soc_dapm_aif_out:
|
||||
w->power_check = dapm_adc_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_dac:
|
||||
case snd_soc_dapm_aif_in:
|
||||
w->power_check = dapm_dac_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_pga:
|
||||
case snd_soc_dapm_out_drv:
|
||||
case snd_soc_dapm_input:
|
||||
case snd_soc_dapm_output:
|
||||
case snd_soc_dapm_micbias:
|
||||
case snd_soc_dapm_spk:
|
||||
case snd_soc_dapm_hp:
|
||||
case snd_soc_dapm_mic:
|
||||
case snd_soc_dapm_line:
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_supply:
|
||||
w->power_check = dapm_supply_check_power;
|
||||
break;
|
||||
default:
|
||||
w->power_check = dapm_always_on_check_power;
|
||||
break;
|
||||
}
|
||||
|
||||
dapm->n_widgets++;
|
||||
w->dapm = dapm;
|
||||
w->codec = dapm->codec;
|
||||
|
Loading…
Reference in New Issue
Block a user