Search
SailfishOS Open Build Service
>
Projects
>
home:sledge
:
beagle
>
kernel-adaptation-dm3730
> 0015-sound-enabled-microphone-on-omap3evm-soc.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0015-sound-enabled-microphone-on-omap3evm-soc.patch of Package kernel-adaptation-dm3730
From a39d628c687a03a7abdb0e7926781934484d3b57 Mon Sep 17 00:00:00 2001 From: MediStream-Devel-VM <info@berlinux-solutions.de> Date: Wed, 15 Aug 2012 20:11:30 +0200 Subject: [PATCH 1/2] sound: -enabled microphone on omap3evm-soc --- sound/soc/omap/omap3evm.c | 86 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 85 insertions(+), 1 deletions(-) diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c index 112cdd5..3b70466 100644 --- a/sound/soc/omap/omap3evm.c +++ b/sound/soc/omap/omap3evm.c @@ -54,8 +54,75 @@ static struct snd_soc_ops omap3evm_ops = { .hw_params = omap3evm_hw_params, }; +/******************** new******/ +static const struct snd_soc_dapm_widget omap3evm_twl4030_dapm_widgets[] = { + SND_SOC_DAPM_MIC("Ext Mic", NULL), + SND_SOC_DAPM_SPK("Ext Spk", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_HP("Headset Stereophone", NULL), + SND_SOC_DAPM_LINE("Aux In", NULL), +}; + +static const struct snd_soc_dapm_route audio_map[] = { + /* External Mics: MAINMIC, SUBMIC with bias*/ + {"MAINMIC", NULL, "Mic Bias 1"}, + {"SUBMIC", NULL, "Mic Bias 2"}, + {"Mic Bias 1", NULL, "Ext Mic"}, + {"Mic Bias 2", NULL, "Ext Mic"}, + + /* External Speakers: HFL, HFR */ + {"Ext Spk", NULL, "HFL"}, + {"Ext Spk", NULL, "HFR"}, + + /* Headset Stereophone: HSOL, HSOR */ + {"Headset Stereophone", NULL, "HSOL"}, + {"Headset Stereophone", NULL, "HSOR"}, + + /* Headset Mic: HSMIC with bias */ + {"HSMIC", NULL, "Headset Mic Bias"}, + {"Headset Mic Bias", NULL, "Headset Mic"}, + + /* Aux In: AUXL, AUXR */ + {"Aux In", NULL, "AUXL"}, + {"Aux In", NULL, "AUXR"}, +}; + +static int omap3evm_twl4030_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_dapm_context *dapm = &codec->dapm; + + /* TWL4030 not connected pins */ + snd_soc_dapm_nc_pin(dapm, "CARKITMIC"); + snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); + snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); + snd_soc_dapm_nc_pin(dapm, "EARPIECE"); + snd_soc_dapm_nc_pin(dapm, "PREDRIVEL"); + snd_soc_dapm_nc_pin(dapm, "PREDRIVER"); + snd_soc_dapm_nc_pin(dapm, "CARKITL"); + snd_soc_dapm_nc_pin(dapm, "CARKITR"); + + return 0; +} + +static int omap3evm_twl4030_voice_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_codec *codec = rtd->codec; + unsigned short reg; + + /* Enable voice interface */ +// reg = codec->driver->read(codec, TWL4030_REG_VOICE_IF); +// reg |= TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN; +// codec->driver->write(codec, TWL4030_REG_VOICE_IF, reg); + + return 0; +} + +/*************new end******************************/ + /* Digital audio interface glue - connects codec <--> CPU */ -static struct snd_soc_dai_link omap3evm_dai = { +static struct snd_soc_dai_link omap3evm_dai[] = { + { .name = "TWL4030", .stream_name = "TWL4030", .cpu_dai_name = "omap-mcbsp.2", @@ -65,6 +132,19 @@ static struct snd_soc_dai_link omap3evm_dai = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .ops = &omap3evm_ops, + }, + { + .name = "TWL4030 PCM", + .stream_name = "TWL4030 Voice", + .cpu_dai_name = "omap-mcbsp.3", + .codec_dai_name = "twl4030-voice", + .platform_name = "omap-pcm-audio", + .codec_name = "twl4030-codec", + .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | + SND_SOC_DAIFMT_CBM_CFM, + .init = omap3evm_twl4030_voice_init, + .ops = &omap3evm_ops, + }, }; /* Audio machine driver */ @@ -77,6 +157,10 @@ static struct snd_soc_card snd_soc_omap3evm = { .owner = THIS_MODULE, .dai_link = &omap3evm_dai, .num_links = 1, + .dapm_widgets = omap3evm_twl4030_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(omap3evm_twl4030_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), }; static struct platform_device *omap3evm_snd_device; -- 1.7.5.4