[alsa-devel] [PATCH v2 2/3] ASoC: Intel: Skylake: Add enum control for mic selection
Subhransu S. Prusty
subhransu.s.prusty at intel.com
Tue May 30 15:41:08 CEST 2017
On Tue, May 30, 2017 at 02:44:20PM +0200, Takashi Iwai wrote:
> On Tue, 30 May 2017 14:03:00 +0200,
> Subhransu S. Prusty wrote:
> >
> > +static int skl_tplg_mic_control_get(struct snd_kcontrol *kcontrol,
> > + struct snd_ctl_elem_value *ucontrol)
> > +{
> > + struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol);
> > + struct skl_module_cfg *mconfig = w->priv;
> > + struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value;
> > + u32 ch_type = *((u32 *)ec->dobj.private);
> > +
> > + if (mconfig->dmic_ch_type == ch_type)
> > + ucontrol->value.integer.value[0] = mconfig->dmic_ch_combo_index;
> > + else
> > + ucontrol->value.integer.value[0] = 0;
>
> Is this enum kctl or not? If it is, you're accessing to the wrong
> field, as already mentioned. ucontrol->value.integer.xxx is for
> volumes and switches.
Sent the wrong patches. Fixed it in a different branch. Sorry for
inconvinience. Will resend it.
>
> Ditto for skl_tplg_mic_control_set().
>
> > +static const struct snd_soc_tplg_kcontrol_ops skl_tplg_kcontrol_ops[] = {
> > + {SKL_CONTROL_TYPE_MIC_SELECT, skl_tplg_mic_control_get,
> > + skl_tplg_mic_control_set},
> > +};
>
> Better to do in C99 init style.
Sure.
Regards,
Subhransu
>
>
> thanks,
>
> Takashi
--
More information about the Alsa-devel
mailing list