From: Takashi Iwai Subject: Re: [PATCH v2 2/3] ASoC: Intel: Skylake: Add enum control for mic selection Date: Tue, 30 May 2017 14:44:20 +0200 Message-ID: References: <1496145781-23434-1-git-send-email-subhransu.s.prusty@intel.com> <1496145781-23434-3-git-send-email-subhransu.s.prusty@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DEBDE266E30 for ; Tue, 30 May 2017 14:44:21 +0200 (CEST) In-Reply-To: <1496145781-23434-3-git-send-email-subhransu.s.prusty@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: "Subhransu S. Prusty" Cc: alsa-devel@alsa-project.org, Dharageswari R , patches.audio@intel.com, lgirdwood@gmail.com, Vinod Koul , broonie@kernel.org List-Id: alsa-devel@alsa-project.org 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. 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. thanks, Takashi