Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283801
b: refs/heads/master
c: 6524c8e
h: refs/heads/master
i:
  283799: e6fae8f
v: v3
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Nov 28, 2011
1 parent 23fd861 commit bf60936
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fd26f9474676bb2232ba9dded148edc41fd02ef4
refs/heads/master: 6524c8e3e6525891d6085c7fb0f7fe5ce18e5b50
2 changes: 2 additions & 0 deletions trunk/sound/soc/omap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ config SND_OMAP_SOC_SDP3430
config SND_OMAP_SOC_SDP4430
tristate "SoC Audio support for Texas Instruments SDP4430"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_4430SDP
select SND_OMAP_SOC_DMIC
select SND_OMAP_SOC_MCPDM
select SND_SOC_TWL6040
select SND_SOC_DMIC
help
Say Y if you want to add support for SoC audio on Texas Instruments
SDP4430.
Expand Down
85 changes: 74 additions & 11 deletions trunk/sound/soc/omap/sdp4430.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <plat/hardware.h>
#include <plat/mux.h>

#include "omap-dmic.h"
#include "omap-mcpdm.h"
#include "omap-pcm.h"
#include "../codecs/twl6040.h"
Expand Down Expand Up @@ -67,6 +68,32 @@ static struct snd_soc_ops sdp4430_ops = {
.hw_params = sdp4430_hw_params,
};

static int sdp4430_dmic_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret = 0;

ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_SYSCLK_PAD_CLKS,
19200000, SND_SOC_CLOCK_IN);
if (ret < 0) {
printk(KERN_ERR "can't set DMIC cpu system clock\n");
return ret;
}
ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_ABE_DMIC_CLK, 2400000,
SND_SOC_CLOCK_OUT);
if (ret < 0) {
printk(KERN_ERR "can't set DMIC output clock\n");
return ret;
}
return 0;
}

static struct snd_soc_ops sdp4430_dmic_ops = {
.hw_params = sdp4430_dmic_hw_params,
};

/* Headset jack */
static struct snd_soc_jack hs_jack;

Expand Down Expand Up @@ -148,23 +175,59 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}

static const struct snd_soc_dapm_widget sdp4430_dmic_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Digital Mic", NULL),
};

static const struct snd_soc_dapm_route dmic_audio_map[] = {
{"DMic", NULL, "Digital Mic1 Bias"},
{"Digital Mic1 Bias", NULL, "Digital Mic"},
};

static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret;

ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets,
ARRAY_SIZE(sdp4430_dmic_dapm_widgets));
if (ret)
return ret;

return snd_soc_dapm_add_routes(dapm, dmic_audio_map,
ARRAY_SIZE(dmic_audio_map));
}

/* Digital audio interface glue - connects codec <--> CPU */
static struct snd_soc_dai_link sdp4430_dai = {
.name = "TWL6040",
.stream_name = "TWL6040",
.cpu_dai_name = "omap-mcpdm",
.codec_dai_name = "twl6040-legacy",
.platform_name = "omap-pcm-audio",
.codec_name = "twl6040-codec",
.init = sdp4430_twl6040_init,
.ops = &sdp4430_ops,
static struct snd_soc_dai_link sdp4430_dai[] = {
{
.name = "TWL6040",
.stream_name = "TWL6040",
.cpu_dai_name = "omap-mcpdm",
.codec_dai_name = "twl6040-legacy",
.platform_name = "omap-pcm-audio",
.codec_name = "twl6040-codec",
.init = sdp4430_twl6040_init,
.ops = &sdp4430_ops,
},
{
.name = "DMIC",
.stream_name = "DMIC Capture",
.cpu_dai_name = "omap-dmic",
.codec_dai_name = "dmic-hifi",
.platform_name = "omap-pcm-audio",
.codec_name = "dmic-codec",
.init = sdp4430_dmic_init,
.ops = &sdp4430_dmic_ops,
},
};

/* Audio machine driver */
static struct snd_soc_card snd_soc_sdp4430 = {
.name = "SDP4430",
.dai_link = &sdp4430_dai,
.num_links = 1,
.dai_link = sdp4430_dai,
.num_links = ARRAY_SIZE(sdp4430_dai),

.dapm_widgets = sdp4430_twl6040_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets),
Expand Down

0 comments on commit bf60936

Please sign in to comment.