Re: [alsa-devel] Help with adding mic bias to omap-twl4030 audio driver
Hi Neil,
On 12/18/2012 12:18 AM, NeilBrown wrote:
Hi Peter, I recently discovered your omap-twl4030 driver and thought to use it to replace the hacked-around driver I'm using for the GTA04 mobile phone platform.
It works fine for playing sound out the speaker, but the microphone doesn't work - I think because there is no mechanism to enable the microphone bias.
I copied some bits out of the old driver - just enough to make it work. However this probably makes the code specific to my platform.
So I'm wondering if you could give me some guidelines on how this "should" be done. Should these tables be passed in with the platform_data (I haven't graduated to device-tree yet)?
I'm going to send a series soon to update the omap-twl4030 machine driver. This update going to add support for microphones and all other routings as well. With the upcoming series the omap-twl4030 will support zoom2 and sdp3430. I'll CC you with the series so you can take a look if it is going to help with your board.
My 'hacked-up' driver has a few more entries in this table than just those few, but I wanted to strip it down to what is needed for the main microphone to work.
Thanks for any help you can provide, NeilBrown
P.S is there some good reason to use the name struct omap_tw4030_pdata rather than struct omap_twl4030_pdata
(i.e. with the 'l')??
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c index 3b97b879..aa4d866 100644 --- a/sound/soc/omap/omap-twl4030.c +++ b/sound/soc/omap/omap-twl4030.c @@ -87,6 +87,32 @@ static struct snd_soc_ops omap_twl4030_ops = { .hw_params = omap_twl4030_hw_params, };
+static const struct snd_soc_dapm_widget gta04_dapm_widgets[] = {
- SND_SOC_DAPM_MIC("Internal Mic", NULL),
+};
+static const struct snd_soc_dapm_route audio_map[] = {
- {"MAINMIC", NULL, "Mic Bias 1"},
- {"Mic Bias 1", NULL, "Internal Mic"},
+};
+static int omap3gta04_init(struct snd_soc_pcm_runtime *runtime) +{
- int ret;
- struct snd_soc_codec *codec = runtime->codec;
- struct snd_soc_dapm_context *dapm = &codec->dapm;
- ret = snd_soc_dapm_new_controls(dapm, gta04_dapm_widgets,
ARRAY_SIZE(gta04_dapm_widgets));
- if (ret < 0)
return ret;
- snd_soc_dapm_add_routes(dapm, audio_map,
ARRAY_SIZE(audio_map));
- return snd_soc_dapm_sync(dapm);
+}
/* Digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link omap_twl4030_dai_links[] = { { @@ -97,6 +123,7 @@ static struct snd_soc_dai_link omap_twl4030_dai_links[] = { .platform_name = "omap-pcm-audio", .codec_name = "twl4030-codec", .ops = &omap_twl4030_ops,
},.init = &omap3gta04_init,
};
participants (1)
-
Peter Ujfalusi