diff options
Diffstat (limited to 'sound/soc/pxa/raumfeld.c')
-rw-r--r-- | sound/soc/pxa/raumfeld.c | 114 |
1 files changed, 36 insertions, 78 deletions
diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c index 7e3f41696c4..2cda82bc5d2 100644 --- a/sound/soc/pxa/raumfeld.c +++ b/sound/soc/pxa/raumfeld.c @@ -26,9 +26,6 @@ #include <asm/mach-types.h> -#include "../codecs/cs4270.h" -#include "../codecs/ak4104.h" -#include "pxa2xx-pcm.h" #include "pxa-ssp.h" #define GPIO_SPDIF_RESET (38) @@ -71,7 +68,7 @@ static void raumfeld_enable_audio(bool en) static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; /* set freq to 0 to enable all possible codec sample rates */ return snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); @@ -80,7 +77,7 @@ static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream) static void raumfeld_cs4270_shutdown(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; /* set freq to 0 to enable all possible codec sample rates */ snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); @@ -90,8 +87,8 @@ static int raumfeld_cs4270_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 fmt, clk = 0; int ret = 0; @@ -167,32 +164,14 @@ static int raumfeld_line_resume(struct platform_device *pdev) return 0; } -static struct snd_soc_dai_link raumfeld_line_dai = { - .name = "CS4270", - .stream_name = "CS4270", - .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP1], - .codec_dai = &cs4270_dai, - .ops = &raumfeld_cs4270_ops, -}; - -static struct snd_soc_card snd_soc_line_raumfeld = { - .name = "Raumfeld analog", - .platform = &pxa2xx_soc_platform, - .dai_link = &raumfeld_line_dai, - .suspend_post = raumfeld_line_suspend, - .resume_pre = raumfeld_line_resume, - .num_links = 1, -}; - - /* AK4104 */ static int raumfeld_ak4104_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; int fmt, ret = 0, clk = 0; switch (params_rate(params)) { @@ -247,34 +226,35 @@ static struct snd_soc_ops raumfeld_ak4104_ops = { .hw_params = raumfeld_ak4104_hw_params, }; -static struct snd_soc_dai_link raumfeld_spdif_dai = { +static struct snd_soc_dai_link raumfeld_dai[] = { +{ .name = "ak4104", .stream_name = "Playback", - .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP2], - .codec_dai = &ak4104_dai, + .cpu_dai_name = "pxa-ssp-dai.1", + .codec_dai_name = "ak4104-hifi", + .platform_name = "pxa-pcm-audio", .ops = &raumfeld_ak4104_ops, -}; - -static struct snd_soc_card snd_soc_spdif_raumfeld = { - .name = "Raumfeld S/PDIF", - .platform = &pxa2xx_soc_platform, - .dai_link = &raumfeld_spdif_dai, - .num_links = 1 -}; - -/* raumfeld_audio audio subsystem */ -static struct snd_soc_device raumfeld_line_devdata = { - .card = &snd_soc_line_raumfeld, - .codec_dev = &soc_codec_device_cs4270, -}; + .codec_name = "ak4104-codec.0", +}, +{ + .name = "CS4270", + .stream_name = "CS4270", + .cpu_dai_name = "pxa-ssp-dai.0", + .platform_name = "pxa-pcm-audio", + .codec_dai_name = "cs4270-hifi", + .codec_name = "cs4270-codec.0-0048", + .ops = &raumfeld_cs4270_ops, +},}; -static struct snd_soc_device raumfeld_spdif_devdata = { - .card = &snd_soc_spdif_raumfeld, - .codec_dev = &soc_codec_device_ak4104, +static struct snd_soc_card snd_soc_raumfeld = { + .name = "Raumfeld", + .dai_link = raumfeld_dai, + .suspend_post = raumfeld_line_suspend, + .resume_pre = raumfeld_line_resume, + .num_links = ARRAY_SIZE(raumfeld_dai), }; -static struct platform_device *raumfeld_audio_line_device; -static struct platform_device *raumfeld_audio_spdif_device; +static struct platform_device *raumfeld_audio_device; static int __init raumfeld_audio_init(void) { @@ -292,38 +272,19 @@ static int __init raumfeld_audio_init(void) set_max9485_clk(MAX9485_MCLK_FREQ_122880); - /* LINE */ - raumfeld_audio_line_device = platform_device_alloc("soc-audio", 0); - if (!raumfeld_audio_line_device) + /* Register LINE and SPDIF */ + raumfeld_audio_device = platform_device_alloc("soc-audio", 0); + if (!raumfeld_audio_device) return -ENOMEM; - platform_set_drvdata(raumfeld_audio_line_device, - &raumfeld_line_devdata); - raumfeld_line_devdata.dev = &raumfeld_audio_line_device->dev; - ret = platform_device_add(raumfeld_audio_line_device); - if (ret) - platform_device_put(raumfeld_audio_line_device); + platform_set_drvdata(raumfeld_audio_device, + &snd_soc_raumfeld); + ret = platform_device_add(raumfeld_audio_device); /* no S/PDIF on Speakers */ if (machine_is_raumfeld_speaker()) return ret; - /* S/PDIF */ - raumfeld_audio_spdif_device = platform_device_alloc("soc-audio", 1); - if (!raumfeld_audio_spdif_device) { - platform_device_put(raumfeld_audio_line_device); - return -ENOMEM; - } - - platform_set_drvdata(raumfeld_audio_spdif_device, - &raumfeld_spdif_devdata); - raumfeld_spdif_devdata.dev = &raumfeld_audio_spdif_device->dev; - ret = platform_device_add(raumfeld_audio_spdif_device); - if (ret) { - platform_device_put(raumfeld_audio_line_device); - platform_device_put(raumfeld_audio_spdif_device); - } - raumfeld_enable_audio(true); return ret; @@ -333,10 +294,7 @@ static void __exit raumfeld_audio_exit(void) { raumfeld_enable_audio(false); - platform_device_unregister(raumfeld_audio_line_device); - - if (machine_is_raumfeld_connector()) - platform_device_unregister(raumfeld_audio_spdif_device); + platform_device_unregister(raumfeld_audio_device); i2c_unregister_device(max9486_client); |