[alsa-devel] [PATCH] Add TLV support for UDA1380

Takashi Iwai tiwai at suse.de
Tue Nov 20 12:07:48 CET 2007


At Tue, 20 Nov 2007 09:25:44 +0000,
Mark Brown wrote:
> 
> From: Philipp Zabel <philipp.zabel at gmail.com>
> 
> Signed-off-by: Philipp Zabel <philipp.zabel at gmail.com>

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


More information about the Alsa-devel mailing list