[alsa-devel] 答复: [PATCH 7/16] ALSA: VIA HDA: Modify notify_aa_path_ctls() function
tiwai at suse.de
Thu Mar 24 08:55:39 CET 2011
At Thu, 24 Mar 2011 15:32:51 +0800,
<LydiaWang at viatech.com.cn> wrote:
> > -----邮件原件-----
> > 发件人: Takashi Iwai [mailto:tiwai at suse.de]
> > 发送时间: 2011年3月21日 19:08
> > 收件人: Jaroslav Kysela
> > 抄送: Lydia Wang; alsa-devel at alsa-project.org; Harald Welte
> > 主题: Re: [alsa-devel] [PATCH 7/16] ALSA: VIA HDA: Modify notify_aa_path_ctls()
> > function
> > At Mon, 21 Mar 2011 08:32:43 +0100 (CET),
> > Jaroslav Kysela wrote:
> > >
> > > On Mon, 21 Mar 2011, Lydia Wang wrote:
> > >
> > > > From: Lydia Wang <lydiawang at viatech.com.cn>
> > > > Subject: ALSA: VIA HDA: Modify notify_aa_path_ctls() function.
> > > >
> > > > Modify notify_aa_path_ctls() function to get volume control items name
> > > > dynamically instead of by giving static item name.
> > >
> > > This code looks ugly to me. If you like to have a dynamic set of notified
> > > controls, create one using snd_array in via_spec.
> > Agreed. The current code is too fragile.
> > thanks,
> > Takashi
> I've created such control type of snd_array. When I want to update a-a path volume and mute control, I must find out the controls among all such ones. But in new alsa driver, I found the mic's a-a path name will be mic, or rear mic according to its pin position. In old driver, the a-a path name is static, but now it's dynamic. So I write this function to find out the actual name of controls. I'm not very clear why it's ugly. Please tell me. Thank you!
First off, looking over all controls of the card instance isn't
considered as a valid task for the local codec driver. If such a
feature is inevitably necessary, we should implement a helper function
in ALSA core.
Secondly, the controls you look at might not belong to your codec.
HD-audio bus can contain multiple codecs, and it might come from some
HD-audio codec has already an array of mixer elements. codec->mixers
is an array for struct hda_nid_item. You can use this instead for
look-up. If more performance optimization is needed, create another
local array to point only the needed kctls.
More information about the Alsa-devel