10 Mar
2015
10 Mar
'15
9:37 p.m.
On Tue, Mar 10, 2015 at 10:41:23AM +0800, han.lu@intel.com wrote:
+static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
+{
- struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
- struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
- struct sst_hsw *hsw = pdata->hsw;
- int ret = 0;
- enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
- bool switch_on = (bool)ucontrol->value.integer.value[0];
- if (sst_hsw_is_module_loaded(hsw, id)) {
if (switch_on == sst_hsw_is_module_active(hsw, id))
return 0;
/* ipc is valid only when module is loaded */
if (switch_on)
ret = sst_hsw_module_enable(hsw, id, 0);
else
ret = sst_hsw_module_disable(hsw, id, 0);
- }
I'm not clear how this setting is saved when the module is not in RAM on the DSP. If the module enable/disable calls do that that's fine but I'd expect the function to return an error if the module isn't loaded (or better yet for the control not to be made visible to userspace at all) - we shouldn't be silently ignoring what the user is setting.