diff options
Diffstat (limited to 'sound/soc/pxa/z2.c')
| -rw-r--r-- | sound/soc/pxa/z2.c | 73 |
1 files changed, 29 insertions, 44 deletions
diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c index 4e4d2fa8ddc..76ccb172d0a 100644 --- a/sound/soc/pxa/z2.c +++ b/sound/soc/pxa/z2.c @@ -21,7 +21,6 @@ #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> -#include <sound/soc-dapm.h> #include <sound/jack.h> #include <asm/mach-types.h> @@ -30,7 +29,6 @@ #include <mach/z2.h> #include "../codecs/wm8750.h" -#include "pxa2xx-pcm.h" #include "pxa2xx-i2s.h" static struct snd_soc_card snd_soc_z2; @@ -39,8 +37,8 @@ static int z2_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 *codec_dai = rtd->dai->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; unsigned int clk = 0; int ret = 0; @@ -58,18 +56,6 @@ static int z2_hw_params(struct snd_pcm_substream *substream, break; } - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - /* set the codec system clock for DAC and ADC */ ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk, SND_SOC_CLOCK_IN); @@ -97,6 +83,11 @@ static struct snd_soc_jack_pin hs_jack_pins[] = { .pin = "Headphone Jack", .mask = SND_JACK_HEADPHONE, }, + { + .pin = "Ext Spk", + .mask = SND_JACK_HEADPHONE, + .invert = 1 + }, }; /* Headset jack detection gpios */ @@ -106,6 +97,7 @@ static struct snd_soc_jack_gpio hs_jack_gpios[] = { .name = "hsdet-gpio", .report = SND_JACK_HEADSET, .debounce_time = 200, + .invert = 1, }, }; @@ -120,7 +112,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { }; /* Z2 machine audio_map */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route z2_audio_map[] = { /* headphone connected to LOUT1, ROUT1 */ {"Headphone Jack", NULL, "LOUT1"}, @@ -138,29 +130,20 @@ static const struct snd_soc_dapm_route audio_map[] = { /* * Logic for a wm8750 as connected on a Z2 Device */ -static int z2_wm8750_init(struct snd_soc_codec *codec) +static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) { + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; /* NC codec pins */ - snd_soc_dapm_disable_pin(codec, "LINPUT3"); - snd_soc_dapm_disable_pin(codec, "RINPUT3"); - snd_soc_dapm_disable_pin(codec, "OUT3"); - snd_soc_dapm_disable_pin(codec, "MONO"); - - /* Add z2 specific widgets */ - snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, - ARRAY_SIZE(wm8750_dapm_widgets)); - - /* Set up z2 specific audio paths */ - snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); - - ret = snd_soc_dapm_sync(codec); - if (ret) - goto err; + snd_soc_dapm_disable_pin(dapm, "LINPUT3"); + snd_soc_dapm_disable_pin(dapm, "RINPUT3"); + snd_soc_dapm_disable_pin(dapm, "OUT3"); + snd_soc_dapm_disable_pin(dapm, "MONO1"); /* Jack detection API stuff */ - ret = snd_soc_jack_new(&snd_soc_z2, "Headset Jack", SND_JACK_HEADSET, + ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) goto err; @@ -189,24 +172,27 @@ static struct snd_soc_ops z2_ops = { static struct snd_soc_dai_link z2_dai = { .name = "wm8750", .stream_name = "WM8750", - .cpu_dai = &pxa_i2s_dai, - .codec_dai = &wm8750_dai, + .cpu_dai_name = "pxa2xx-i2s", + .codec_dai_name = "wm8750-hifi", + .platform_name = "pxa-pcm-audio", + .codec_name = "wm8750.0-001b", .init = z2_wm8750_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &z2_ops, }; /* z2 audio machine driver */ static struct snd_soc_card snd_soc_z2 = { .name = "Z2", - .platform = &pxa2xx_soc_platform, + .owner = THIS_MODULE, .dai_link = &z2_dai, .num_links = 1, -}; -/* z2 audio subsystem */ -static struct snd_soc_device z2_snd_devdata = { - .card = &snd_soc_z2, - .codec_dev = &soc_codec_dev_wm8750, + .dapm_widgets = wm8750_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), + .dapm_routes = z2_audio_map, + .num_dapm_routes = ARRAY_SIZE(z2_audio_map), }; static struct platform_device *z2_snd_device; @@ -222,8 +208,7 @@ static int __init z2_init(void) if (!z2_snd_device) return -ENOMEM; - platform_set_drvdata(z2_snd_device, &z2_snd_devdata); - z2_snd_devdata.dev = &z2_snd_device->dev; + platform_set_drvdata(z2_snd_device, &snd_soc_z2); ret = platform_device_add(z2_snd_device); if (ret) |
