[alsa-devel] [PATCH] ASoC: tpa6130a2: Define output pins with SND_SOC_DAPM_OUTPUT

Peter Ujfalusi peter.ujfalusi at nokia.com
Wed May 19 14:00:14 CEST 2010


On Wednesday 19 May 2010 13:55:26 ext Jarkko Nikula wrote:
> Codec output pin should be defined with SND_SOC_DAPM_OUTPUT as otherwise
> external widgets doesn't alter the output state.
> 
> Signed-off-by: Jarkko Nikula <jhnikula at gmail.com>
> Cc: Peter Ujfalusi <peter.ujfalusi at nokia.com>
> ---
> I noticed this with a widget and audio map below where state of
> "Headphone Jack" wasn't changing the codec output.

This is intentional.
TPA is _not_ a codec, it is amplifier.

> SND_SOC_DAPM_HP("Headphone Jack", NULL),
> 
> {"Headphone Jack", NULL, "TPA6130A2 Headphone Left"},
> {"Headphone Jack", NULL, "TPA6130A2 Headphone Right"},
> {"TPA6130A2 Left", NULL, "LLOUT"},
> {"TPA6130A2 Right", NULL, "RLOUT"}

And this is how you should use it in a machine driver:
Connect the codec's outputs to TPA. The TPA code adds the HPs for you already, 
so you don't need to care about it...

 {"TPA6130A2 Left", NULL, "LLOUT"},
 {"TPA6130A2 Right", NULL, "RLOUT"}

If you want to turn off the headset path, which I suppose you want to do here, 
than within the same kcontrol you will have for HS mute you can do this:

	if (jack_state) {
		snd_soc_dapm_enable_pin(codec, "TPA6130A2 Headphone Left");
		snd_soc_dapm_enable_pin(codec, "TPA6130A2 Headphone Right");
	} else {
		snd_soc_dapm_disable_pin(codec, "TPA6130A2 Headphone Left");
		snd_soc_dapm_disable_pin(codec, "TPA6130A2 Headphone Right");
	}

> ---
>  sound/soc/codecs/tpa6130a2.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index 100a747..99b70e5 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -359,8 +359,8 @@ static const struct snd_soc_dapm_widget
> tpa6130a2_dapm_widgets[] = { 0, 0, tpa6130a2_supply_event,
>  			SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
>  	/* Outputs */
> -	SND_SOC_DAPM_HP("TPA6130A2 Headphone Left", NULL),
> -	SND_SOC_DAPM_HP("TPA6130A2 Headphone Right", NULL),
> +	SND_SOC_DAPM_OUTPUT("TPA6130A2 Headphone Left"),
> +	SND_SOC_DAPM_OUTPUT("TPA6130A2 Headphone Right"),
>  };
> 
>  static const struct snd_soc_dapm_route audio_map[] = {

For now I'm not acking this.

-- 
Péter


More information about the Alsa-devel mailing list