From: Takashi Iwai Subject: Re: [PATCH 1/5] Unify M-Audio Fast Track Ultra and Ebox-44 mixer quirks. Date: Tue, 24 Apr 2012 08:20:37 +0200 Message-ID: References: <1335205467-12650-1-git-send-email-linuxaudio@showlabor.de> <1335205467-12650-2-git-send-email-linuxaudio@showlabor.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Mark Hills Cc: alsa-devel@alsa-project.org, patch@alsa-project.org, Felix Homann List-Id: alsa-devel@alsa-project.org At Mon, 23 Apr 2012 19:36:06 +0100 (BST), Mark Hills wrote: > > On Mon, 23 Apr 2012, Felix Homann wrote: > > > +/* This function allows for the creation of standard UAC controls. > > + * See the quirks for M-Audio FTUs or Ebox-44. > > + * If you don't want to set a TLV callback pass NULL. > > + * > > + * Since there doesn't seem to be a devices that needs a multichannel > > + * version, we keep it mono for simplicity. > > + */ > > +static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer, > > + unsigned int unitid, > > + unsigned int control, > > + unsigned int cmask, > > + int val_type, > > + const char *name, > > + snd_kcontrol_tlv_rw_t *tlv_callback) > > +{ > > + int err; > > + struct usb_mixer_elem_info *cval; > > + struct snd_kcontrol *kctl; > > + > > + cval = kzalloc(sizeof(*cval), GFP_KERNEL); > > + if (!cval) > > + return -ENOMEM; > > + > > + cval->id = unitid; > > + cval->mixer = mixer; > > + cval->val_type = val_type; > > + cval->channels = 1; > > + cval->control = control; > > + cval->cmask = cmask; > > + > > + /* FIXME: Do we need this? > > + * The following values are for compatibility with > > + * Ebox-44 mixer. > > + * But the corresponding ebox-44 function says: > > + * "Volume controls will override these values" > > + * > > + * These values don't have any effect at all for > > + * M-Audio FTUs. > > + * So I think, we can safely omit the range settings here. > > + */ > > + cval->min = 0; > > + cval->max = 1; > > + cval->res = 0; > > + cval->dBmin = 0; > > + cval->dBmax = 0; > > When implementing the Ebox44 quirk, I found I needed this. The min and max > would be automatically completed for the S16 values, but not for the mute > buttons, so I defaulted to the range required for the BOOLEAN. > > I was really hoping some one would explain this when I RFC'd the patch. > But at that time the code was not part of some general-purpose function so > it wasn't really an issue. The reason is because get_min_max*() isn't called in the place you created these controls, and get_min_max() would be called only for integer volumes later even if uninitialized. A short cut for booleans. Takashi