* [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony
@ 2011-01-13 22:22 Stephen Warren
2011-01-13 22:38 ` Mark Brown
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stephen Warren @ 2011-01-13 22:22 UTC (permalink / raw)
To: broonie, lrg; +Cc: linux-tegra, alsa-devel, Stephen Warren
With this change, I can capture from a microphone plugged into the
mic jack on Harmony (after unmuting Left Input PGA, and maybe turning
up the gain there too).
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Question: Harmony has a mono mic attached to the left input channel.
However, the I2S controller only supports stereo. Is it possible to
duplicate the mic input to both channels in ALSA? I know the WM8903
can do it via the WM8903_AUDIO_INTERFACE_0 register, but I'm not
sure how to request that in ALSA-speak. It looks like this same setup
applies to many other platforms, but I couldn't see how the issue was
solved, if at all.
sound/soc/tegra/harmony.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
index bf0dbaf..b160b71 100644
--- a/sound/soc/tegra/harmony.c
+++ b/sound/soc/tegra/harmony.c
@@ -107,6 +107,36 @@ static struct snd_soc_ops harmony_asoc_ops = {
.hw_params = harmony_asoc_hw_params,
};
+static const struct snd_soc_dapm_widget harmony_dapm_widgets[] = {
+ SND_SOC_DAPM_HP("Headphone Jack", NULL),
+ SND_SOC_DAPM_MIC("Mic Jack", NULL),
+};
+
+static const struct snd_soc_dapm_route harmony_audio_map[] = {
+ {"Headphone Jack", NULL, "HPOUTR"},
+ {"Headphone Jack", NULL, "HPOUTL"},
+ {"Mic Bias", NULL, "Mic Jack"},
+ {"IN1L", NULL, "Mic Bias"},
+};
+
+static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_codec *codec = rtd->codec;
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
+
+ snd_soc_dapm_new_controls(dapm, harmony_dapm_widgets,
+ ARRAY_SIZE(harmony_dapm_widgets));
+
+ snd_soc_dapm_add_routes(dapm, harmony_audio_map,
+ ARRAY_SIZE(harmony_audio_map));
+
+ snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
+ snd_soc_dapm_enable_pin(dapm, "Mic Jack");
+ snd_soc_dapm_sync(dapm);
+
+ return 0;
+}
+
static struct snd_soc_dai_link harmony_wm8903_dai = {
.name = "WM8903",
.stream_name = "WM8903 PCM",
@@ -114,6 +144,7 @@ static struct snd_soc_dai_link harmony_wm8903_dai = {
.platform_name = "tegra-pcm-audio",
.cpu_dai_name = "tegra-i2s.0",
.codec_dai_name = "wm8903-hifi",
+ .init = harmony_asoc_init,
.ops = &harmony_asoc_ops,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony
2011-01-13 22:22 [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony Stephen Warren
@ 2011-01-13 22:38 ` Mark Brown
2011-01-14 11:05 ` Liam Girdwood
2011-01-14 12:32 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2011-01-13 22:38 UTC (permalink / raw)
To: Stephen Warren; +Cc: linux-tegra, alsa-devel, lrg
On Thu, Jan 13, 2011 at 03:22:08PM -0700, Stephen Warren wrote:
> Question: Harmony has a mono mic attached to the left input channel.
> However, the I2S controller only supports stereo. Is it possible to
> duplicate the mic input to both channels in ALSA? I know the WM8903
> can do it via the WM8903_AUDIO_INTERFACE_0 register, but I'm not
> sure how to request that in ALSA-speak. It looks like this same setup
> applies to many other platforms, but I couldn't see how the issue was
> solved, if at all.
It needs implementing it in the CODEC driver, it's not currently
supported as the feature is very rarely used. I'll add it to the list
to look at, like I say I'm holding off until the merge window closes so
that the clock changes (and hopefully SD card support) get a chance to
merge into the tree and allow things to work out of the box as far as
possible.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony
2011-01-13 22:22 [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony Stephen Warren
2011-01-13 22:38 ` Mark Brown
@ 2011-01-14 11:05 ` Liam Girdwood
2011-01-14 12:32 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2011-01-14 11:05 UTC (permalink / raw)
To: Stephen Warren; +Cc: linux-tegra, alsa-devel, broonie
On Thu, 2011-01-13 at 15:22 -0700, Stephen Warren wrote:
> With this change, I can capture from a microphone plugged into the
> mic jack on Harmony (after unmuting Left Input PGA, and maybe turning
> up the gain there too).
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by Liam Girdwood <lrg@slimlogic.co.uk>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony
2011-01-13 22:22 [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony Stephen Warren
2011-01-13 22:38 ` Mark Brown
2011-01-14 11:05 ` Liam Girdwood
@ 2011-01-14 12:32 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2011-01-14 12:32 UTC (permalink / raw)
To: Stephen Warren; +Cc: linux-tegra, alsa-devel, lrg
On Thu, Jan 13, 2011 at 03:22:08PM -0700, Stephen Warren wrote:
> With this change, I can capture from a microphone plugged into the
> mic jack on Harmony (after unmuting Left Input PGA, and maybe turning
> up the gain there too).
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-14 12:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 22:22 [PATCH] ASoC: tegra: Add DAPM widgets/routes for Harmony Stephen Warren
2011-01-13 22:38 ` Mark Brown
2011-01-14 11:05 ` Liam Girdwood
2011-01-14 12:32 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).