From: Takashi Iwai Subject: Re: [PATCH v2 3/5] snd-usb-6fire: add individual volume control for analog channels Date: Wed, 22 Feb 2012 14:37:42 +0100 Message-ID: References: <20120222140714.40e2e872ebcba2a6c226f6d0@zoho.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 mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DBC4E103F1A for ; Wed, 22 Feb 2012 14:37:42 +0100 (CET) In-Reply-To: <20120222140714.40e2e872ebcba2a6c226f6d0@zoho.com> 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: Torsten Schenk Cc: ALSA development , Clemens Ladisch List-Id: alsa-devel@alsa-project.org At Wed, 22 Feb 2012 14:07:14 +0100, Torsten Schenk wrote: > > -static void usb6fire_control_master_vol_update(struct control_runtime *rt) > +static void usb6fire_control_output_vol_update(struct control_runtime *rt) > { > struct comm_runtime *comm_rt = rt->chip->comm; > - if (comm_rt) { > - /* set volume */ > - comm_rt->write8(comm_rt, 0x12, 0x0f, 180 - rt->master_vol); > - /* unmute */ > - comm_rt->write8(comm_rt, 0x12, 0x0e, 0x00); > - } > + int i; > + > + if (comm_rt) > + for (i = 0; i < 6; i++) > + comm_rt->write8(comm_rt, 0x12, 0x0f + i, > + 180 - rt->output_vol[i]); > } Would be better to update only the affected channel, but it's just a minor thing. Not need to change at this time. > -static struct __devinitdata snd_kcontrol_new elements[] = { > +static struct __devinitdata snd_kcontrol_new vol_elements[] = { > { > .iface = SNDRV_CTL_ELEM_IFACE_MIXER, > - .name = "Master Playback Volume", > - .index = 0, > + .name = "Analog Playback Volume", > + .index = 1, The index should start also from zero. > @@ -310,6 +365,39 @@ > {} > }; > > +static int usb6fire_control_add_virtual( > + struct control_runtime *rt, > + struct snd_card *card, > + char *name, > + struct snd_kcontrol_new *elems) > +{ > + int ret; > + int i; > + struct snd_kcontrol *vmaster = snd_ctl_make_virtual_master(name, NULL); Pass tlv_output here. thanks, Takashi