[PATCH v3 2/3] ASoC: Intel: Multiple I/O PCM format support for pipe

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Thu Apr 23 17:49:54 CEST 2020



> +static int skl_tplg_multi_config_get(struct snd_kcontrol *kcontrol,
> +			struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *component =
> +		snd_soc_kcontrol_component(kcontrol);
> +	struct hdac_bus *bus = snd_soc_component_get_drvdata(component);
> +	struct skl_dev *skl = bus_to_skl(bus);
> +	struct skl_pipeline *ppl;
> +	struct skl_pipe *pipe = NULL;
> +	u32 *pipe_id;
> +	struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value;
> +
> +	if (!ec)
> +		return -EINVAL;
> +
> +	pipe_id = ec->dobj.private;
> +
> +	list_for_each_entry(ppl, &skl->ppl_list, node) {
> +		if (ppl->pipe->ppl_id == *pipe_id) {
> +			pipe = ppl->pipe;
> +			break;
> +		}
> +	}
> +	if (!pipe)
> +		return -EIO;
> +
> +	ucontrol->value.enumerated.item[0]  =  pipe->pipe_config_idx;

maybe one nit-pick is that there is a one-line difference between the 
_set and _get functions, and it might be simpler to use a common helper 
with a boolean flag used at the end to do this:

 > +	ucontrol->value.enumerated.item[0]  =  pipe->pipe_config_idx;

or that:

 > +	pipe->pipe_config_idx = ucontrol->value.enumerated.item[0];


More information about the Alsa-devel mailing list