From: Takashi Iwai Subject: Re: [PATCH] Add TLV support for UDA1380 Date: Tue, 20 Nov 2007 12:07:48 +0100 Message-ID: References: <1195550746-6892-1-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-2-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-3-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-4-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-5-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-6-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-7-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-8-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-9-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-10-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-11-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-12-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-13-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-14-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-15-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-16-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-17-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-18-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-19-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-20-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-21-git-send-email-broonie@opensource.wolfsonmicro.com> <1195550746-6892-22-git-send-email-broonie@opensource.wolfsonmicro.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 (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 12201249E5 for ; Tue, 20 Nov 2007 12:35:39 +0100 (CET) In-Reply-To: <1195550746-6892-22-git-send-email-broonie@opensource.wolfsonmicro.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: Mark Brown Cc: liam.girdwood@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org, Philipp Zabel List-Id: alsa-devel@alsa-project.org At Tue, 20 Nov 2007 09:25:44 +0000, Mark Brown wrote: > > From: Philipp Zabel > > Signed-off-by: Philipp Zabel Apparently this patch does much more than the subject says. If so, please add a proper changelog here, not only in the comment lines. > +/** > + * snd_soc_info_volsw - single mixer info callback > + * @kcontrol: mixer control > + * @uinfo: control element information > + * > + * Callback to provide information about a single mixer control. > + * > + * Returns 0 for success. > + */ > +int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_info *uinfo) > +{ > + int max = (kcontrol->private_value >> 16) & 0xff; > + int min = (kcontrol->private_value >> 24) & 0xff; > + > + /* 00000000 (0) ...(-0.25 dB)... 11111000 (-78 dB), 11111100 -INF */ > + > + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; > + uinfo->count = 2; > + uinfo->value.integer.min = min; > + uinfo->value.integer.max = max; > + return 0; > +} This can be static, no? The other two, too. > + > +DECLARE_TLV_DB_SCALE(amix_tlv, -4950, 150, 1); /* from -48 dB in 1.5 dB steps (mute instead of -49.5 dB) */ Define as static. DECLARE_TLV_DB_SCALE() itself doesn't contain static prefix. > +static const unsigned int mvol_tlv[] = { > + TLV_DB_RANGE_HEAD(3), > + 0,15, TLV_DB_SCALE_ITEM(-8200, 100, 1), /* from -78 dB in 1 dB steps (3 dB steps, really) */ > + 16,43, TLV_DB_SCALE_ITEM(-6600, 50, 0), /* from -66 dB in 0.5 dB steps (2 dB steps, really) */ > + 44,252, TLV_DB_SCALE_ITEM(-5200, 25, 0), /* from -52 dB in 0.25 dB steps */ > +}; > > -static const struct soc_enum uda1380_enum[] = { > - SOC_ENUM_DOUBLE(UDA1380_DEEMP, 0, 8, 5, uda1380_deemp), > - SOC_ENUM_SINGLE(UDA1380_ADC, 3, 2, uda1380_input_sel), > - SOC_ENUM_SINGLE(UDA1380_MODE, 14, 4, uda1380_spf_mode), > - SOC_ENUM_SINGLE(UDA1380_PM, 7, 2, uda1380_output_sel), /* R02_EN_AVC */ > +static const unsigned int vc_tlv[] = { > + TLV_DB_RANGE_HEAD(4), > + 0,7, TLV_DB_SCALE_ITEM(-7800, 150, 1), /* from -72 dB in 1.5 dB steps (6 dB steps really) */ > + 8,15, TLV_DB_SCALE_ITEM(-6600, 75, 0), /* from -66 dB in 0.75 dB steps (3 dB steps really) */ > + 16,43, TLV_DB_SCALE_ITEM(-6000, 50, 0), /* from -60 dB in 0.5 dB steps (2 dB steps really) */ > + 44,228, TLV_DB_SCALE_ITEM(-4600, 25, 0),/* from -46 dB in 0.25 dB steps */ > }; > > +DECLARE_TLV_DB_SCALE(tr_tlv, 0, 200, 0); /* from 0 dB to 6 dB in 2 dB steps, if SPF mode != flat */ > +DECLARE_TLV_DB_SCALE(bb_tlv, 0, 200, 0); /* from 0 dB to 24 dB in 2 dB steps, if SPF mode == maximum */ > + /* (SPF mode == flat cuts off at 18 dB max */ Ditto. > + > +static const unsigned int dec_tlv[] = { > + TLV_DB_RANGE_HEAD(1), > + -128,48, TLV_DB_SCALE_ITEM(-6350, 50, 1), > + /* 0011000 (48 dB) ...(0.5 dB)... 10000001 (-63 dB) 10000000 -INF */ > +}; > + > +DECLARE_TLV_DB_SCALE(pga_tlv, 0, 300, 0); /* from 0 dB to 24 dB in 3 dB steps */ > +DECLARE_TLV_DB_SCALE(vga_tlv, 0, 200, 0); /* from 0 dB to 30 dB in 2 dB steps */ Ditto. Takashi