[alsa-devel] [PATCH REPOST] sound: codec: tlv320aic3x: remove mono controls

Mark Brown broonie at opensource.wolfsonmicro.com
Fri Jul 15 17:46:31 CEST 2011


On Fri, Jul 15, 2011 at 05:40:54PM +0200, Jan Weitzel wrote:
> if codec driver is used for AIC3X_MODEL_3007 the mono iout controls overwrite
> registers for class-d amplifier.
> classd amplifier controls are only used for AIC3X_MODEL_3007.

> Removing all mono snd_kcontrol_new, snd_soc_dapm_widget, snd_soc_dapm_route
> and aic3x_init stuff from common code and call only for not AIC3X_MODEL_3007
> codecs.

This is clearly not what your subject line says...

>  	if (aic3x->model == AIC3X_MODEL_3007) {
>  		aic3x_init_3007(codec);
>  		snd_soc_write(codec, CLASSD_CTRL, 0);
> +
> +		return 0;
>  	}
> +	/* Not on AIC3X_MODEL_3007 init */
> +

This is really not great legibility and it's going to get terribly
confusing if someone comes up with some other device that also needs
custom init.  A similar issue applied to some of the other stuff but
this is the most obvious example.  I'd suggest restructuring this to
have all the mono-specific code in an if statement that postively
selects for the feature.

>  	if (aic3x->model == AIC3X_MODEL_3007)
>  		snd_soc_add_controls(codec, &aic3x_classd_amp_gain_ctrl, 1);
> -
> +	else
> +		snd_soc_add_controls(codec, aic3x_mono_controls,
> +					ARRAY_SIZE(aic3x_mono_controls));

This if ... else should really be a switch.


More information about the Alsa-devel mailing list