[alsa-devel] [PATCH v2 4/8] ASoC: Intel: add kcontrol to enable/disable sound effect module waves

Mark Brown broonie at kernel.org
Tue Mar 10 21:37:30 CET 2015


On Tue, Mar 10, 2015 at 10:41:23AM +0800, han.lu at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150310/f9eac1e6/attachment.sig>


More information about the Alsa-devel mailing list