diff options
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r-- | sound/soc/davinci/Kconfig | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 3 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 14 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-pcm.c | 2 | ||||
-rw-r--r-- | sound/soc/davinci/davinci-sffsdr.c | 43 |
5 files changed, 42 insertions, 22 deletions
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig index b502741692d6..bd7392c9657e 100644 --- a/sound/soc/davinci/Kconfig +++ b/sound/soc/davinci/Kconfig | |||
@@ -20,7 +20,7 @@ config SND_DAVINCI_SOC_EVM | |||
20 | 20 | ||
21 | config SND_DAVINCI_SOC_SFFSDR | 21 | config SND_DAVINCI_SOC_SFFSDR |
22 | tristate "SoC Audio support for SFFSDR" | 22 | tristate "SoC Audio support for SFFSDR" |
23 | depends on SND_DAVINCI_SOC && MACH_DAVINCI_SFFSDR | 23 | depends on SND_DAVINCI_SOC && MACH_SFFSDR |
24 | select SND_DAVINCI_SOC_I2S | 24 | select SND_DAVINCI_SOC_I2S |
25 | select SND_SOC_PCM3008 | 25 | select SND_SOC_PCM3008 |
26 | select SFFSDR_FPGA | 26 | select SFFSDR_FPGA |
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 54851f318568..9b90b347007c 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -186,7 +186,8 @@ static int __init evm_init(void) | |||
186 | 186 | ||
187 | platform_set_drvdata(evm_snd_device, &evm_snd_devdata); | 187 | platform_set_drvdata(evm_snd_device, &evm_snd_devdata); |
188 | evm_snd_devdata.dev = &evm_snd_device->dev; | 188 | evm_snd_devdata.dev = &evm_snd_device->dev; |
189 | evm_snd_device->dev.platform_data = &evm_snd_data; | 189 | platform_device_add_data(evm_snd_device, &evm_snd_data, |
190 | sizeof(evm_snd_data)); | ||
190 | 191 | ||
191 | ret = platform_device_add_resources(evm_snd_device, evm_snd_resources, | 192 | ret = platform_device_add_resources(evm_snd_device, evm_snd_resources, |
192 | ARRAY_SIZE(evm_snd_resources)); | 193 | ARRAY_SIZE(evm_snd_resources)); |
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 0fee779e3c76..ffdb9439d3d8 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -499,6 +499,13 @@ static void davinci_i2s_remove(struct platform_device *pdev, | |||
499 | 499 | ||
500 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 | 500 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 |
501 | 501 | ||
502 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | ||
503 | .startup = davinci_i2s_startup, | ||
504 | .trigger = davinci_i2s_trigger, | ||
505 | .hw_params = davinci_i2s_hw_params, | ||
506 | .set_fmt = davinci_i2s_set_dai_fmt, | ||
507 | }; | ||
508 | |||
502 | struct snd_soc_dai davinci_i2s_dai = { | 509 | struct snd_soc_dai davinci_i2s_dai = { |
503 | .name = "davinci-i2s", | 510 | .name = "davinci-i2s", |
504 | .id = 0, | 511 | .id = 0, |
@@ -514,12 +521,7 @@ struct snd_soc_dai davinci_i2s_dai = { | |||
514 | .channels_max = 2, | 521 | .channels_max = 2, |
515 | .rates = DAVINCI_I2S_RATES, | 522 | .rates = DAVINCI_I2S_RATES, |
516 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 523 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, |
517 | .ops = { | 524 | .ops = &davinci_i2s_dai_ops, |
518 | .startup = davinci_i2s_startup, | ||
519 | .trigger = davinci_i2s_trigger, | ||
520 | .hw_params = davinci_i2s_hw_params, | ||
521 | .set_fmt = davinci_i2s_set_dai_fmt, | ||
522 | }, | ||
523 | }; | 525 | }; |
524 | EXPORT_SYMBOL_GPL(davinci_i2s_dai); | 526 | EXPORT_SYMBOL_GPL(davinci_i2s_dai); |
525 | 527 | ||
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 366049d8578c..7af3b5b3a53d 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c | |||
@@ -286,7 +286,7 @@ static int davinci_pcm_mmap(struct snd_pcm_substream *substream, | |||
286 | runtime->dma_bytes); | 286 | runtime->dma_bytes); |
287 | } | 287 | } |
288 | 288 | ||
289 | struct snd_pcm_ops davinci_pcm_ops = { | 289 | static struct snd_pcm_ops davinci_pcm_ops = { |
290 | .open = davinci_pcm_open, | 290 | .open = davinci_pcm_open, |
291 | .close = davinci_pcm_close, | 291 | .close = davinci_pcm_close, |
292 | .ioctl = snd_pcm_lib_ioctl, | 292 | .ioctl = snd_pcm_lib_ioctl, |
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index 4935d1bcbd8d..40eccfe9e358 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c | |||
@@ -25,7 +25,9 @@ | |||
25 | 25 | ||
26 | #include <asm/dma.h> | 26 | #include <asm/dma.h> |
27 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
28 | #ifdef CONFIG_SFFSDR_FPGA | ||
28 | #include <asm/plat-sffsdr/sffsdr-fpga.h> | 29 | #include <asm/plat-sffsdr/sffsdr-fpga.h> |
30 | #endif | ||
29 | 31 | ||
30 | #include <mach/mcbsp.h> | 32 | #include <mach/mcbsp.h> |
31 | #include <mach/edma.h> | 33 | #include <mach/edma.h> |
@@ -34,31 +36,45 @@ | |||
34 | #include "davinci-pcm.h" | 36 | #include "davinci-pcm.h" |
35 | #include "davinci-i2s.h" | 37 | #include "davinci-i2s.h" |
36 | 38 | ||
39 | /* | ||
40 | * CLKX and CLKR are the inputs for the Sample Rate Generator. | ||
41 | * FSX and FSR are outputs, driven by the sample Rate Generator. | ||
42 | */ | ||
43 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | ||
44 | SND_SOC_DAIFMT_CBM_CFS | \ | ||
45 | SND_SOC_DAIFMT_IB_NF) | ||
46 | |||
37 | static int sffsdr_hw_params(struct snd_pcm_substream *substream, | 47 | static int sffsdr_hw_params(struct snd_pcm_substream *substream, |
38 | struct snd_pcm_hw_params *params, | 48 | struct snd_pcm_hw_params *params) |
39 | struct snd_soc_dai *dai) | ||
40 | { | 49 | { |
41 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 50 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
42 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 51 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
43 | int fs; | 52 | int fs; |
44 | int ret = 0; | 53 | int ret = 0; |
45 | 54 | ||
46 | /* Set cpu DAI configuration: | ||
47 | * CLKX and CLKR are the inputs for the Sample Rate Generator. | ||
48 | * FSX and FSR are outputs, driven by the sample Rate Generator. */ | ||
49 | ret = snd_soc_dai_set_fmt(cpu_dai, | ||
50 | SND_SOC_DAIFMT_RIGHT_J | | ||
51 | SND_SOC_DAIFMT_CBM_CFS | | ||
52 | SND_SOC_DAIFMT_IB_NF); | ||
53 | if (ret < 0) | ||
54 | return ret; | ||
55 | |||
56 | /* Fsref can be 32000, 44100 or 48000. */ | 55 | /* Fsref can be 32000, 44100 or 48000. */ |
57 | fs = params_rate(params); | 56 | fs = params_rate(params); |
58 | 57 | ||
58 | #ifndef CONFIG_SFFSDR_FPGA | ||
59 | /* Without the FPGA module, the Fs is fixed at 44100 Hz */ | ||
60 | if (fs != 44100) { | ||
61 | pr_debug("warning: only 44.1 kHz is supported without SFFSDR FPGA module\n"); | ||
62 | return -EINVAL; | ||
63 | } | ||
64 | #endif | ||
65 | |||
66 | /* set cpu DAI configuration */ | ||
67 | ret = snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); | ||
68 | if (ret < 0) | ||
69 | return ret; | ||
70 | |||
59 | pr_debug("sffsdr_hw_params: rate = %d Hz\n", fs); | 71 | pr_debug("sffsdr_hw_params: rate = %d Hz\n", fs); |
60 | 72 | ||
73 | #ifndef CONFIG_SFFSDR_FPGA | ||
74 | return 0; | ||
75 | #else | ||
61 | return sffsdr_fpga_set_codec_fs(fs); | 76 | return sffsdr_fpga_set_codec_fs(fs); |
77 | #endif | ||
62 | } | 78 | } |
63 | 79 | ||
64 | static struct snd_soc_ops sffsdr_ops = { | 80 | static struct snd_soc_ops sffsdr_ops = { |
@@ -127,7 +143,8 @@ static int __init sffsdr_init(void) | |||
127 | 143 | ||
128 | platform_set_drvdata(sffsdr_snd_device, &sffsdr_snd_devdata); | 144 | platform_set_drvdata(sffsdr_snd_device, &sffsdr_snd_devdata); |
129 | sffsdr_snd_devdata.dev = &sffsdr_snd_device->dev; | 145 | sffsdr_snd_devdata.dev = &sffsdr_snd_device->dev; |
130 | sffsdr_snd_device->dev.platform_data = &sffsdr_snd_data; | 146 | platform_device_add_data(sffsdr_snd_device, &sffsdr_snd_data, |
147 | sizeof(sffsdr_snd_data)); | ||
131 | 148 | ||
132 | ret = platform_device_add_resources(sffsdr_snd_device, | 149 | ret = platform_device_add_resources(sffsdr_snd_device, |
133 | sffsdr_snd_resources, | 150 | sffsdr_snd_resources, |