aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/sdp4430.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/sdp4430.c')
-rw-r--r--sound/soc/omap/sdp4430.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index b80efb02bfca..03d9fa4192fe 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -22,6 +22,7 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/mfd/twl6040.h> 24#include <linux/mfd/twl6040.h>
25#include <linux/module.h>
25 26
26#include <sound/core.h> 27#include <sound/core.h>
27#include <sound/pcm.h> 28#include <sound/pcm.h>
@@ -32,7 +33,7 @@
32#include <plat/hardware.h> 33#include <plat/hardware.h>
33#include <plat/mux.h> 34#include <plat/mux.h>
34 35
35#include "mcpdm.h" 36#include "omap-mcpdm.h"
36#include "omap-pcm.h" 37#include "omap-pcm.h"
37#include "../codecs/twl6040.h" 38#include "../codecs/twl6040.h"
38 39
@@ -88,7 +89,7 @@ static const struct snd_soc_dapm_widget sdp4430_twl6040_dapm_widgets[] = {
88 SND_SOC_DAPM_MIC("Headset Mic", NULL), 89 SND_SOC_DAPM_MIC("Headset Mic", NULL),
89 SND_SOC_DAPM_HP("Headset Stereophone", NULL), 90 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
90 SND_SOC_DAPM_SPK("Earphone Spk", NULL), 91 SND_SOC_DAPM_SPK("Earphone Spk", NULL),
91 SND_SOC_DAPM_INPUT("Aux/FM Stereo In"), 92 SND_SOC_DAPM_INPUT("FM Stereo In"),
92}; 93};
93 94
94static const struct snd_soc_dapm_route audio_map[] = { 95static const struct snd_soc_dapm_route audio_map[] = {
@@ -113,36 +114,22 @@ static const struct snd_soc_dapm_route audio_map[] = {
113 {"Earphone Spk", NULL, "EP"}, 114 {"Earphone Spk", NULL, "EP"},
114 115
115 /* Aux/FM Stereo In: AFML, AFMR */ 116 /* Aux/FM Stereo In: AFML, AFMR */
116 {"AFML", NULL, "Aux/FM Stereo In"}, 117 {"AFML", NULL, "FM Stereo In"},
117 {"AFMR", NULL, "Aux/FM Stereo In"}, 118 {"AFMR", NULL, "FM Stereo In"},
118}; 119};
119 120
120static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) 121static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
121{ 122{
122 struct snd_soc_codec *codec = rtd->codec; 123 struct snd_soc_codec *codec = rtd->codec;
123 struct snd_soc_dapm_context *dapm = &codec->dapm; 124 int ret, hs_trim;
124 int ret;
125
126 /* Add SDP4430 specific widgets */
127 ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets,
128 ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
129 if (ret)
130 return ret;
131
132 /* Set up SDP4430 specific audio path audio_map */
133 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
134 125
135 /* SDP4430 connected pins */ 126 /*
136 snd_soc_dapm_enable_pin(dapm, "Ext Mic"); 127 * Configure McPDM offset cancellation based on the HSOTRIM value from
137 snd_soc_dapm_enable_pin(dapm, "Ext Spk"); 128 * twl6040.
138 snd_soc_dapm_enable_pin(dapm, "AFML"); 129 */
139 snd_soc_dapm_enable_pin(dapm, "AFMR"); 130 hs_trim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM);
140 snd_soc_dapm_enable_pin(dapm, "Headset Mic"); 131 omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim),
141 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone"); 132 TWL6040_HSF_TRIM_RIGHT(hs_trim));
142
143 ret = snd_soc_dapm_sync(dapm);
144 if (ret)
145 return ret;
146 133
147 /* Headset jack detection */ 134 /* Headset jack detection */
148 ret = snd_soc_jack_new(codec, "Headset Jack", 135 ret = snd_soc_jack_new(codec, "Headset Jack",
@@ -165,8 +152,8 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
165static struct snd_soc_dai_link sdp4430_dai = { 152static struct snd_soc_dai_link sdp4430_dai = {
166 .name = "TWL6040", 153 .name = "TWL6040",
167 .stream_name = "TWL6040", 154 .stream_name = "TWL6040",
168 .cpu_dai_name ="omap-mcpdm-dai", 155 .cpu_dai_name = "omap-mcpdm",
169 .codec_dai_name = "twl6040-hifi", 156 .codec_dai_name = "twl6040-legacy",
170 .platform_name = "omap-pcm-audio", 157 .platform_name = "omap-pcm-audio",
171 .codec_name = "twl6040-codec", 158 .codec_name = "twl6040-codec",
172 .init = sdp4430_twl6040_init, 159 .init = sdp4430_twl6040_init,
@@ -178,6 +165,11 @@ static struct snd_soc_card snd_soc_sdp4430 = {
178 .name = "SDP4430", 165 .name = "SDP4430",
179 .dai_link = &sdp4430_dai, 166 .dai_link = &sdp4430_dai,
180 .num_links = 1, 167 .num_links = 1,
168
169 .dapm_widgets = sdp4430_twl6040_dapm_widgets,
170 .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets),
171 .dapm_routes = audio_map,
172 .num_dapm_routes = ARRAY_SIZE(audio_map),
181}; 173};
182 174
183static struct platform_device *sdp4430_snd_device; 175static struct platform_device *sdp4430_snd_device;