diff options
author | Mark Brown <broonie@linaro.org> | 2013-06-17 12:20:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-06-17 12:20:20 -0400 |
commit | 0d664db6221e7f9f5649c3041f98adde00de2d97 (patch) | |
tree | b1a39a17f9b7ee6370323085e0868847377e8ba6 | |
parent | 5ec393bcda83c880005532bee0c5e0e97ea6596c (diff) | |
parent | 8de2ae2a7f1fd71dc56d6b014029f93093e9c5d5 (diff) |
Merge remote-tracking branch 'asoc/topic/fsl' into asoc-next
-rw-r--r-- | Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt | 46 | ||||
-rw-r--r-- | sound/soc/fsl/Kconfig | 17 | ||||
-rw-r--r-- | sound/soc/fsl/Makefile | 13 | ||||
-rw-r--r-- | sound/soc/fsl/eukrea-tlv320.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 13 | ||||
-rw-r--r-- | sound/soc/fsl/imx-audmux.c | 8 | ||||
-rw-r--r-- | sound/soc/fsl/imx-mc13783.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-dma.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-fiq.c | 92 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm.c | 145 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm.h | 10 | ||||
-rw-r--r-- | sound/soc/fsl/imx-sgtl5000.c | 7 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.c | 44 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.h | 3 | ||||
-rw-r--r-- | sound/soc/fsl/imx-wm8962.c | 323 | ||||
-rw-r--r-- | sound/soc/fsl/mx27vis-aic32x4.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/phycore-ac97.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/wm1133-ev1.c | 2 | ||||
-rw-r--r-- | sound/soc/mxs/mxs-sgtl5000.c | 10 |
19 files changed, 512 insertions, 231 deletions
diff --git a/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt b/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt new file mode 100644 index 000000000000..f49450a87890 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | Freescale i.MX audio complex with WM8962 codec | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "fsl,imx-audio-wm8962" | ||
5 | - model : The user-visible name of this sound complex | ||
6 | - ssi-controller : The phandle of the i.MX SSI controller | ||
7 | - audio-codec : The phandle of the WM8962 audio codec | ||
8 | - audio-routing : A list of the connections between audio components. | ||
9 | Each entry is a pair of strings, the first being the connection's sink, | ||
10 | the second being the connection's source. Valid names could be power | ||
11 | supplies, WM8962 pins, and the jacks on the board: | ||
12 | |||
13 | Power supplies: | ||
14 | * Mic Bias | ||
15 | |||
16 | Board connectors: | ||
17 | * Mic Jack | ||
18 | * Headphone Jack | ||
19 | * Ext Spk | ||
20 | |||
21 | - mux-int-port : The internal port of the i.MX audio muxer (AUDMUX) | ||
22 | - mux-ext-port : The external port of the i.MX audio muxer | ||
23 | |||
24 | Note: The AUDMUX port numbering should start at 1, which is consistent with | ||
25 | hardware manual. | ||
26 | |||
27 | Example: | ||
28 | |||
29 | sound { | ||
30 | compatible = "fsl,imx6q-sabresd-wm8962", | ||
31 | "fsl,imx-audio-wm8962"; | ||
32 | model = "wm8962-audio"; | ||
33 | ssi-controller = <&ssi2>; | ||
34 | audio-codec = <&codec>; | ||
35 | audio-routing = | ||
36 | "Headphone Jack", "HPOUTL", | ||
37 | "Headphone Jack", "HPOUTR", | ||
38 | "Ext Spk", "SPKOUTL", | ||
39 | "Ext Spk", "SPKOUTR", | ||
40 | "MICBIAS", "AMIC", | ||
41 | "IN3R", "MICBIAS", | ||
42 | "DMIC", "MICBIAS", | ||
43 | "DMICDAT", "DMIC"; | ||
44 | mux-int-port = <2>; | ||
45 | mux-ext-port = <3>; | ||
46 | }; | ||
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 3843a18d4e56..aa438546c912 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -108,18 +108,13 @@ if SND_IMX_SOC | |||
108 | config SND_SOC_IMX_SSI | 108 | config SND_SOC_IMX_SSI |
109 | tristate | 109 | tristate |
110 | 110 | ||
111 | config SND_SOC_IMX_PCM | ||
112 | tristate | ||
113 | |||
114 | config SND_SOC_IMX_PCM_FIQ | 111 | config SND_SOC_IMX_PCM_FIQ |
115 | bool | 112 | bool |
116 | select FIQ | 113 | select FIQ |
117 | select SND_SOC_IMX_PCM | ||
118 | 114 | ||
119 | config SND_SOC_IMX_PCM_DMA | 115 | config SND_SOC_IMX_PCM_DMA |
120 | bool | 116 | bool |
121 | select SND_SOC_GENERIC_DMAENGINE_PCM | 117 | select SND_SOC_GENERIC_DMAENGINE_PCM |
122 | select SND_SOC_IMX_PCM | ||
123 | 118 | ||
124 | config SND_SOC_IMX_AUDMUX | 119 | config SND_SOC_IMX_AUDMUX |
125 | tristate | 120 | tristate |
@@ -173,6 +168,18 @@ config SND_SOC_EUKREA_TLV320 | |||
173 | Enable I2S based access to the TLV320AIC23B codec attached | 168 | Enable I2S based access to the TLV320AIC23B codec attached |
174 | to the SSI interface | 169 | to the SSI interface |
175 | 170 | ||
171 | config SND_SOC_IMX_WM8962 | ||
172 | tristate "SoC Audio support for i.MX boards with wm8962" | ||
173 | depends on OF && I2C | ||
174 | select SND_SOC_WM8962 | ||
175 | select SND_SOC_IMX_PCM_DMA | ||
176 | select SND_SOC_IMX_AUDMUX | ||
177 | select SND_SOC_FSL_SSI | ||
178 | select SND_SOC_FSL_UTILS | ||
179 | help | ||
180 | Say Y if you want to add support for SoC audio on an i.MX board with | ||
181 | a wm8962 codec. | ||
182 | |||
176 | config SND_SOC_IMX_SGTL5000 | 183 | config SND_SOC_IMX_SGTL5000 |
177 | tristate "SoC Audio support for i.MX boards with sgtl5000" | 184 | tristate "SoC Audio support for i.MX boards with sgtl5000" |
178 | depends on OF && I2C | 185 | depends on OF && I2C |
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile index afd34794db53..d4b4aa8b5649 100644 --- a/sound/soc/fsl/Makefile +++ b/sound/soc/fsl/Makefile | |||
@@ -30,18 +30,11 @@ obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o | |||
30 | # i.MX Platform Support | 30 | # i.MX Platform Support |
31 | snd-soc-imx-ssi-objs := imx-ssi.o | 31 | snd-soc-imx-ssi-objs := imx-ssi.o |
32 | snd-soc-imx-audmux-objs := imx-audmux.o | 32 | snd-soc-imx-audmux-objs := imx-audmux.o |
33 | snd-soc-imx-pcm-objs := imx-pcm.o | ||
34 | ifneq ($(CONFIG_SND_SOC_IMX_PCM_FIQ),) | ||
35 | snd-soc-imx-pcm-objs += imx-pcm-fiq.o | ||
36 | endif | ||
37 | ifneq ($(CONFIG_SND_SOC_IMX_PCM_DMA),) | ||
38 | snd-soc-imx-pcm-objs += imx-pcm-dma.o | ||
39 | endif | ||
40 | |||
41 | obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o | 33 | obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o |
42 | obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o | 34 | obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o |
43 | 35 | ||
44 | obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o | 36 | obj-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += imx-pcm-fiq.o |
37 | obj-$(CONFIG_SND_SOC_IMX_PCM_DMA) += imx-pcm-dma.o | ||
45 | 38 | ||
46 | # i.MX Machine Support | 39 | # i.MX Machine Support |
47 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o | 40 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o |
@@ -49,6 +42,7 @@ snd-soc-phycore-ac97-objs := phycore-ac97.o | |||
49 | snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o | 42 | snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o |
50 | snd-soc-wm1133-ev1-objs := wm1133-ev1.o | 43 | snd-soc-wm1133-ev1-objs := wm1133-ev1.o |
51 | snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o | 44 | snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o |
45 | snd-soc-imx-wm8962-objs := imx-wm8962.o | ||
52 | snd-soc-imx-mc13783-objs := imx-mc13783.o | 46 | snd-soc-imx-mc13783-objs := imx-mc13783.o |
53 | 47 | ||
54 | obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o | 48 | obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o |
@@ -56,4 +50,5 @@ obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o | |||
56 | obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o | 50 | obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o |
57 | obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o | 51 | obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o |
58 | obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o | 52 | obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o |
53 | obj-$(CONFIG_SND_SOC_IMX_WM8962) += snd-soc-imx-wm8962.o | ||
59 | obj-$(CONFIG_SND_SOC_IMX_MC13783) += snd-soc-imx-mc13783.o | 54 | obj-$(CONFIG_SND_SOC_IMX_MC13783) += snd-soc-imx-mc13783.o |
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c index 75ffdf0e2aad..9a4a0ca2c1de 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c | |||
@@ -80,7 +80,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { | |||
80 | .name = "tlv320aic23", | 80 | .name = "tlv320aic23", |
81 | .stream_name = "TLV320AIC23", | 81 | .stream_name = "TLV320AIC23", |
82 | .codec_dai_name = "tlv320aic23-hifi", | 82 | .codec_dai_name = "tlv320aic23-hifi", |
83 | .platform_name = "imx-fiq-pcm-audio.0", | 83 | .platform_name = "imx-ssi.0", |
84 | .codec_name = "tlv320aic23-codec.0-001a", | 84 | .codec_name = "tlv320aic23-codec.0-001a", |
85 | .cpu_dai_name = "imx-ssi.0", | 85 | .cpu_dai_name = "imx-ssi.0", |
86 | .ops = &eukrea_tlv320_snd_ops, | 86 | .ops = &eukrea_tlv320_snd_ops, |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 0f0bed6def9e..2f2d837df07f 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -122,7 +122,6 @@ struct fsl_ssi_private { | |||
122 | bool new_binding; | 122 | bool new_binding; |
123 | bool ssi_on_imx; | 123 | bool ssi_on_imx; |
124 | struct clk *clk; | 124 | struct clk *clk; |
125 | struct platform_device *imx_pcm_pdev; | ||
126 | struct snd_dmaengine_dai_dma_data dma_params_tx; | 125 | struct snd_dmaengine_dai_dma_data dma_params_tx; |
127 | struct snd_dmaengine_dai_dma_data dma_params_rx; | 126 | struct snd_dmaengine_dai_dma_data dma_params_rx; |
128 | struct imx_dma_data filter_data_tx; | 127 | struct imx_dma_data filter_data_tx; |
@@ -809,13 +808,9 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
809 | } | 808 | } |
810 | 809 | ||
811 | if (ssi_private->ssi_on_imx) { | 810 | if (ssi_private->ssi_on_imx) { |
812 | ssi_private->imx_pcm_pdev = | 811 | ret = imx_pcm_dma_init(pdev); |
813 | platform_device_register_simple("imx-pcm-audio", | 812 | if (ret) |
814 | -1, NULL, 0); | ||
815 | if (IS_ERR(ssi_private->imx_pcm_pdev)) { | ||
816 | ret = PTR_ERR(ssi_private->imx_pcm_pdev); | ||
817 | goto error_dev; | 813 | goto error_dev; |
818 | } | ||
819 | } | 814 | } |
820 | 815 | ||
821 | /* | 816 | /* |
@@ -854,7 +849,7 @@ done: | |||
854 | 849 | ||
855 | error_dai: | 850 | error_dai: |
856 | if (ssi_private->ssi_on_imx) | 851 | if (ssi_private->ssi_on_imx) |
857 | platform_device_unregister(ssi_private->imx_pcm_pdev); | 852 | imx_pcm_dma_exit(pdev); |
858 | snd_soc_unregister_component(&pdev->dev); | 853 | snd_soc_unregister_component(&pdev->dev); |
859 | 854 | ||
860 | error_dev: | 855 | error_dev: |
@@ -889,7 +884,7 @@ static int fsl_ssi_remove(struct platform_device *pdev) | |||
889 | if (!ssi_private->new_binding) | 884 | if (!ssi_private->new_binding) |
890 | platform_device_unregister(ssi_private->pdev); | 885 | platform_device_unregister(ssi_private->pdev); |
891 | if (ssi_private->ssi_on_imx) { | 886 | if (ssi_private->ssi_on_imx) { |
892 | platform_device_unregister(ssi_private->imx_pcm_pdev); | 887 | imx_pcm_dma_exit(pdev); |
893 | clk_disable_unprepare(ssi_private->clk); | 888 | clk_disable_unprepare(ssi_private->clk); |
894 | clk_put(ssi_private->clk); | 889 | clk_put(ssi_private->clk); |
895 | } | 890 | } |
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index 47f046a8fdab..e260f1f899db 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/of_device.h> | 26 | #include <linux/of_device.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/pinctrl/consumer.h> | ||
30 | 29 | ||
31 | #include "imx-audmux.h" | 30 | #include "imx-audmux.h" |
32 | 31 | ||
@@ -247,7 +246,6 @@ EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port); | |||
247 | static int imx_audmux_probe(struct platform_device *pdev) | 246 | static int imx_audmux_probe(struct platform_device *pdev) |
248 | { | 247 | { |
249 | struct resource *res; | 248 | struct resource *res; |
250 | struct pinctrl *pinctrl; | ||
251 | const struct of_device_id *of_id = | 249 | const struct of_device_id *of_id = |
252 | of_match_device(imx_audmux_dt_ids, &pdev->dev); | 250 | of_match_device(imx_audmux_dt_ids, &pdev->dev); |
253 | 251 | ||
@@ -256,12 +254,6 @@ static int imx_audmux_probe(struct platform_device *pdev) | |||
256 | if (IS_ERR(audmux_base)) | 254 | if (IS_ERR(audmux_base)) |
257 | return PTR_ERR(audmux_base); | 255 | return PTR_ERR(audmux_base); |
258 | 256 | ||
259 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
260 | if (IS_ERR(pinctrl)) { | ||
261 | dev_err(&pdev->dev, "setup pinctrl failed!"); | ||
262 | return PTR_ERR(pinctrl); | ||
263 | } | ||
264 | |||
265 | audmux_clk = devm_clk_get(&pdev->dev, "audmux"); | 257 | audmux_clk = devm_clk_get(&pdev->dev, "audmux"); |
266 | if (IS_ERR(audmux_clk)) { | 258 | if (IS_ERR(audmux_clk)) { |
267 | dev_dbg(&pdev->dev, "cannot get clock: %ld\n", | 259 | dev_dbg(&pdev->dev, "cannot get clock: %ld\n", |
diff --git a/sound/soc/fsl/imx-mc13783.c b/sound/soc/fsl/imx-mc13783.c index 4ae30f21fdb5..9df173c091a6 100644 --- a/sound/soc/fsl/imx-mc13783.c +++ b/sound/soc/fsl/imx-mc13783.c | |||
@@ -64,7 +64,7 @@ static struct snd_soc_dai_link imx_mc13783_dai_mc13783[] = { | |||
64 | .codec_dai_name = "mc13783-hifi", | 64 | .codec_dai_name = "mc13783-hifi", |
65 | .codec_name = "mc13783-codec", | 65 | .codec_name = "mc13783-codec", |
66 | .cpu_dai_name = "imx-ssi.0", | 66 | .cpu_dai_name = "imx-ssi.0", |
67 | .platform_name = "imx-pcm-audio.0", | 67 | .platform_name = "imx-ssi.0", |
68 | .ops = &imx_mc13783_hifi_ops, | 68 | .ops = &imx_mc13783_hifi_ops, |
69 | .symmetric_rates = 1, | 69 | .symmetric_rates = 1, |
70 | .dai_fmt = FMT_SSI, | 70 | .dai_fmt = FMT_SSI, |
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index c246fb514930..fde4d2ea68c8 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c | |||
@@ -67,8 +67,10 @@ int imx_pcm_dma_init(struct platform_device *pdev) | |||
67 | SND_DMAENGINE_PCM_FLAG_NO_DT | | 67 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
68 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 68 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
69 | } | 69 | } |
70 | EXPORT_SYMBOL_GPL(imx_pcm_dma_init); | ||
70 | 71 | ||
71 | void imx_pcm_dma_exit(struct platform_device *pdev) | 72 | void imx_pcm_dma_exit(struct platform_device *pdev) |
72 | { | 73 | { |
73 | snd_dmaengine_pcm_unregister(&pdev->dev); | 74 | snd_dmaengine_pcm_unregister(&pdev->dev); |
74 | } | 75 | } |
76 | EXPORT_SYMBOL_GPL(imx_pcm_dma_exit); | ||
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c index 670b96b0ce2f..310d90290320 100644 --- a/sound/soc/fsl/imx-pcm-fiq.c +++ b/sound/soc/fsl/imx-pcm-fiq.c | |||
@@ -225,6 +225,22 @@ static int snd_imx_close(struct snd_pcm_substream *substream) | |||
225 | return 0; | 225 | return 0; |
226 | } | 226 | } |
227 | 227 | ||
228 | static int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | ||
229 | struct vm_area_struct *vma) | ||
230 | { | ||
231 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
232 | int ret; | ||
233 | |||
234 | ret = dma_mmap_writecombine(substream->pcm->card->dev, vma, | ||
235 | runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); | ||
236 | |||
237 | pr_debug("%s: ret: %d %p 0x%08x 0x%08x\n", __func__, ret, | ||
238 | runtime->dma_area, | ||
239 | runtime->dma_addr, | ||
240 | runtime->dma_bytes); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
228 | static struct snd_pcm_ops imx_pcm_ops = { | 244 | static struct snd_pcm_ops imx_pcm_ops = { |
229 | .open = snd_imx_open, | 245 | .open = snd_imx_open, |
230 | .close = snd_imx_close, | 246 | .close = snd_imx_close, |
@@ -236,6 +252,54 @@ static struct snd_pcm_ops imx_pcm_ops = { | |||
236 | .mmap = snd_imx_pcm_mmap, | 252 | .mmap = snd_imx_pcm_mmap, |
237 | }; | 253 | }; |
238 | 254 | ||
255 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | ||
256 | { | ||
257 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | ||
258 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
259 | size_t size = IMX_SSI_DMABUF_SIZE; | ||
260 | |||
261 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | ||
262 | buf->dev.dev = pcm->card->dev; | ||
263 | buf->private_data = NULL; | ||
264 | buf->area = dma_alloc_writecombine(pcm->card->dev, size, | ||
265 | &buf->addr, GFP_KERNEL); | ||
266 | if (!buf->area) | ||
267 | return -ENOMEM; | ||
268 | buf->bytes = size; | ||
269 | |||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static u64 imx_pcm_dmamask = DMA_BIT_MASK(32); | ||
274 | |||
275 | static int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) | ||
276 | { | ||
277 | struct snd_card *card = rtd->card->snd_card; | ||
278 | struct snd_pcm *pcm = rtd->pcm; | ||
279 | int ret = 0; | ||
280 | |||
281 | if (!card->dev->dma_mask) | ||
282 | card->dev->dma_mask = &imx_pcm_dmamask; | ||
283 | if (!card->dev->coherent_dma_mask) | ||
284 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
285 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { | ||
286 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
287 | SNDRV_PCM_STREAM_PLAYBACK); | ||
288 | if (ret) | ||
289 | goto out; | ||
290 | } | ||
291 | |||
292 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { | ||
293 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
294 | SNDRV_PCM_STREAM_CAPTURE); | ||
295 | if (ret) | ||
296 | goto out; | ||
297 | } | ||
298 | |||
299 | out: | ||
300 | return ret; | ||
301 | } | ||
302 | |||
239 | static int ssi_irq = 0; | 303 | static int ssi_irq = 0; |
240 | 304 | ||
241 | static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) | 305 | static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) |
@@ -268,6 +332,27 @@ static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) | |||
268 | return 0; | 332 | return 0; |
269 | } | 333 | } |
270 | 334 | ||
335 | static void imx_pcm_free(struct snd_pcm *pcm) | ||
336 | { | ||
337 | struct snd_pcm_substream *substream; | ||
338 | struct snd_dma_buffer *buf; | ||
339 | int stream; | ||
340 | |||
341 | for (stream = 0; stream < 2; stream++) { | ||
342 | substream = pcm->streams[stream].substream; | ||
343 | if (!substream) | ||
344 | continue; | ||
345 | |||
346 | buf = &substream->dma_buffer; | ||
347 | if (!buf->area) | ||
348 | continue; | ||
349 | |||
350 | dma_free_writecombine(pcm->card->dev, buf->bytes, | ||
351 | buf->area, buf->addr); | ||
352 | buf->area = NULL; | ||
353 | } | ||
354 | } | ||
355 | |||
271 | static void imx_pcm_fiq_free(struct snd_pcm *pcm) | 356 | static void imx_pcm_fiq_free(struct snd_pcm *pcm) |
272 | { | 357 | { |
273 | mxc_set_irq_fiq(ssi_irq, 0); | 358 | mxc_set_irq_fiq(ssi_irq, 0); |
@@ -314,3 +399,10 @@ failed_register: | |||
314 | 399 | ||
315 | return ret; | 400 | return ret; |
316 | } | 401 | } |
402 | EXPORT_SYMBOL_GPL(imx_pcm_fiq_init); | ||
403 | |||
404 | void imx_pcm_fiq_exit(struct platform_device *pdev) | ||
405 | { | ||
406 | snd_soc_unregister_platform(&pdev->dev); | ||
407 | } | ||
408 | EXPORT_SYMBOL_GPL(imx_pcm_fiq_exit); | ||
diff --git a/sound/soc/fsl/imx-pcm.c b/sound/soc/fsl/imx-pcm.c deleted file mode 100644 index c49896442d8e..000000000000 --- a/sound/soc/fsl/imx-pcm.c +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de> | ||
3 | * | ||
4 | * This code is based on code copyrighted by Freescale, | ||
5 | * Liam Girdwood, Javier Martin and probably others. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/dma-mapping.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <sound/pcm.h> | ||
16 | #include <sound/soc.h> | ||
17 | #include "imx-pcm.h" | ||
18 | |||
19 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | ||
20 | struct vm_area_struct *vma) | ||
21 | { | ||
22 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
23 | int ret; | ||
24 | |||
25 | ret = dma_mmap_writecombine(substream->pcm->card->dev, vma, | ||
26 | runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); | ||
27 | |||
28 | pr_debug("%s: ret: %d %p 0x%08x 0x%08x\n", __func__, ret, | ||
29 | runtime->dma_area, | ||
30 | runtime->dma_addr, | ||
31 | runtime->dma_bytes); | ||
32 | return ret; | ||
33 | } | ||
34 | EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap); | ||
35 | |||
36 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | ||
37 | { | ||
38 | struct snd_pcm_substream *substream = pcm->streams[stream].substream; | ||
39 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
40 | size_t size = IMX_SSI_DMABUF_SIZE; | ||
41 | |||
42 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | ||
43 | buf->dev.dev = pcm->card->dev; | ||
44 | buf->private_data = NULL; | ||
45 | buf->area = dma_alloc_writecombine(pcm->card->dev, size, | ||
46 | &buf->addr, GFP_KERNEL); | ||
47 | if (!buf->area) | ||
48 | return -ENOMEM; | ||
49 | buf->bytes = size; | ||
50 | |||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static u64 imx_pcm_dmamask = DMA_BIT_MASK(32); | ||
55 | |||
56 | int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) | ||
57 | { | ||
58 | struct snd_card *card = rtd->card->snd_card; | ||
59 | struct snd_pcm *pcm = rtd->pcm; | ||
60 | int ret = 0; | ||
61 | |||
62 | if (!card->dev->dma_mask) | ||
63 | card->dev->dma_mask = &imx_pcm_dmamask; | ||
64 | if (!card->dev->coherent_dma_mask) | ||
65 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
66 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { | ||
67 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
68 | SNDRV_PCM_STREAM_PLAYBACK); | ||
69 | if (ret) | ||
70 | goto out; | ||
71 | } | ||
72 | |||
73 | if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { | ||
74 | ret = imx_pcm_preallocate_dma_buffer(pcm, | ||
75 | SNDRV_PCM_STREAM_CAPTURE); | ||
76 | if (ret) | ||
77 | goto out; | ||
78 | } | ||
79 | |||
80 | out: | ||
81 | return ret; | ||
82 | } | ||
83 | EXPORT_SYMBOL_GPL(imx_pcm_new); | ||
84 | |||
85 | void imx_pcm_free(struct snd_pcm *pcm) | ||
86 | { | ||
87 | struct snd_pcm_substream *substream; | ||
88 | struct snd_dma_buffer *buf; | ||
89 | int stream; | ||
90 | |||
91 | for (stream = 0; stream < 2; stream++) { | ||
92 | substream = pcm->streams[stream].substream; | ||
93 | if (!substream) | ||
94 | continue; | ||
95 | |||
96 | buf = &substream->dma_buffer; | ||
97 | if (!buf->area) | ||
98 | continue; | ||
99 | |||
100 | dma_free_writecombine(pcm->card->dev, buf->bytes, | ||
101 | buf->area, buf->addr); | ||
102 | buf->area = NULL; | ||
103 | } | ||
104 | } | ||
105 | EXPORT_SYMBOL_GPL(imx_pcm_free); | ||
106 | |||
107 | static int imx_pcm_probe(struct platform_device *pdev) | ||
108 | { | ||
109 | if (strcmp(pdev->id_entry->name, "imx-fiq-pcm-audio") == 0) | ||
110 | return imx_pcm_fiq_init(pdev); | ||
111 | |||
112 | return imx_pcm_dma_init(pdev); | ||
113 | } | ||
114 | |||
115 | static int imx_pcm_remove(struct platform_device *pdev) | ||
116 | { | ||
117 | if (strcmp(pdev->id_entry->name, "imx-fiq-pcm-audio") == 0) | ||
118 | snd_soc_unregister_platform(&pdev->dev); | ||
119 | else | ||
120 | imx_pcm_dma_exit(pdev); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static struct platform_device_id imx_pcm_devtype[] = { | ||
126 | { .name = "imx-pcm-audio", }, | ||
127 | { .name = "imx-fiq-pcm-audio", }, | ||
128 | { /* sentinel */ } | ||
129 | }; | ||
130 | MODULE_DEVICE_TABLE(platform, imx_pcm_devtype); | ||
131 | |||
132 | static struct platform_driver imx_pcm_driver = { | ||
133 | .driver = { | ||
134 | .name = "imx-pcm", | ||
135 | .owner = THIS_MODULE, | ||
136 | }, | ||
137 | .id_table = imx_pcm_devtype, | ||
138 | .probe = imx_pcm_probe, | ||
139 | .remove = imx_pcm_remove, | ||
140 | }; | ||
141 | module_platform_driver(imx_pcm_driver); | ||
142 | |||
143 | MODULE_DESCRIPTION("Freescale i.MX PCM driver"); | ||
144 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); | ||
145 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h index b7fa0d75c687..67f656c7c320 100644 --- a/sound/soc/fsl/imx-pcm.h +++ b/sound/soc/fsl/imx-pcm.h | |||
@@ -32,11 +32,6 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data, | |||
32 | dma_data->peripheral_type = IMX_DMATYPE_SSI; | 32 | dma_data->peripheral_type = IMX_DMATYPE_SSI; |
33 | } | 33 | } |
34 | 34 | ||
35 | int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, | ||
36 | struct vm_area_struct *vma); | ||
37 | int imx_pcm_new(struct snd_soc_pcm_runtime *rtd); | ||
38 | void imx_pcm_free(struct snd_pcm *pcm); | ||
39 | |||
40 | #ifdef CONFIG_SND_SOC_IMX_PCM_DMA | 35 | #ifdef CONFIG_SND_SOC_IMX_PCM_DMA |
41 | int imx_pcm_dma_init(struct platform_device *pdev); | 36 | int imx_pcm_dma_init(struct platform_device *pdev); |
42 | void imx_pcm_dma_exit(struct platform_device *pdev); | 37 | void imx_pcm_dma_exit(struct platform_device *pdev); |
@@ -53,11 +48,16 @@ static inline void imx_pcm_dma_exit(struct platform_device *pdev) | |||
53 | 48 | ||
54 | #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ | 49 | #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ |
55 | int imx_pcm_fiq_init(struct platform_device *pdev); | 50 | int imx_pcm_fiq_init(struct platform_device *pdev); |
51 | void imx_pcm_fiq_exit(struct platform_device *pdev); | ||
56 | #else | 52 | #else |
57 | static inline int imx_pcm_fiq_init(struct platform_device *pdev) | 53 | static inline int imx_pcm_fiq_init(struct platform_device *pdev) |
58 | { | 54 | { |
59 | return -ENODEV; | 55 | return -ENODEV; |
60 | } | 56 | } |
57 | |||
58 | static inline void imx_pcm_fiq_exit(struct platform_device *pdev) | ||
59 | { | ||
60 | } | ||
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #endif /* _IMX_PCM_H */ | 63 | #endif /* _IMX_PCM_H */ |
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 9584e78858df..a60aaa053d28 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c | |||
@@ -149,7 +149,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) | |||
149 | data->dai.codec_dai_name = "sgtl5000"; | 149 | data->dai.codec_dai_name = "sgtl5000"; |
150 | data->dai.codec_of_node = codec_np; | 150 | data->dai.codec_of_node = codec_np; |
151 | data->dai.cpu_of_node = ssi_np; | 151 | data->dai.cpu_of_node = ssi_np; |
152 | data->dai.platform_name = "imx-pcm-audio"; | 152 | data->dai.platform_of_node = ssi_np; |
153 | data->dai.init = &imx_sgtl5000_dai_init; | 153 | data->dai.init = &imx_sgtl5000_dai_init; |
154 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 154 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
155 | SND_SOC_DAIFMT_CBM_CFM; | 155 | SND_SOC_DAIFMT_CBM_CFM; |
@@ -174,6 +174,11 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | platform_set_drvdata(pdev, data); | 176 | platform_set_drvdata(pdev, data); |
177 | of_node_put(ssi_np); | ||
178 | of_node_put(codec_np); | ||
179 | |||
180 | return 0; | ||
181 | |||
177 | clk_fail: | 182 | clk_fail: |
178 | clk_put(data->codec_clk); | 183 | clk_put(data->codec_clk); |
179 | fail: | 184 | fail: |
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index c6fa03e2114a..a8362be3cd18 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c | |||
@@ -590,41 +590,19 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
590 | goto failed_register; | 590 | goto failed_register; |
591 | } | 591 | } |
592 | 592 | ||
593 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); | 593 | ret = imx_pcm_fiq_init(pdev); |
594 | if (!ssi->soc_platform_pdev_fiq) { | 594 | if (ret) |
595 | ret = -ENOMEM; | 595 | goto failed_pcm_fiq; |
596 | goto failed_pdev_fiq_alloc; | ||
597 | } | ||
598 | |||
599 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); | ||
600 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); | ||
601 | if (ret) { | ||
602 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
603 | goto failed_pdev_fiq_add; | ||
604 | } | ||
605 | 596 | ||
606 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); | 597 | ret = imx_pcm_dma_init(pdev); |
607 | if (!ssi->soc_platform_pdev) { | 598 | if (ret) |
608 | ret = -ENOMEM; | 599 | goto failed_pcm_dma; |
609 | goto failed_pdev_alloc; | ||
610 | } | ||
611 | |||
612 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | ||
613 | ret = platform_device_add(ssi->soc_platform_pdev); | ||
614 | if (ret) { | ||
615 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
616 | goto failed_pdev_add; | ||
617 | } | ||
618 | 600 | ||
619 | return 0; | 601 | return 0; |
620 | 602 | ||
621 | failed_pdev_add: | 603 | failed_pcm_dma: |
622 | platform_device_put(ssi->soc_platform_pdev); | 604 | imx_pcm_fiq_exit(pdev); |
623 | failed_pdev_alloc: | 605 | failed_pcm_fiq: |
624 | platform_device_del(ssi->soc_platform_pdev_fiq); | ||
625 | failed_pdev_fiq_add: | ||
626 | platform_device_put(ssi->soc_platform_pdev_fiq); | ||
627 | failed_pdev_fiq_alloc: | ||
628 | snd_soc_unregister_component(&pdev->dev); | 606 | snd_soc_unregister_component(&pdev->dev); |
629 | failed_register: | 607 | failed_register: |
630 | release_mem_region(res->start, resource_size(res)); | 608 | release_mem_region(res->start, resource_size(res)); |
@@ -639,8 +617,8 @@ static int imx_ssi_remove(struct platform_device *pdev) | |||
639 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 617 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
640 | struct imx_ssi *ssi = platform_get_drvdata(pdev); | 618 | struct imx_ssi *ssi = platform_get_drvdata(pdev); |
641 | 619 | ||
642 | platform_device_unregister(ssi->soc_platform_pdev); | 620 | imx_pcm_dma_exit(pdev); |
643 | platform_device_unregister(ssi->soc_platform_pdev_fiq); | 621 | imx_pcm_fiq_exit(pdev); |
644 | 622 | ||
645 | snd_soc_unregister_component(&pdev->dev); | 623 | snd_soc_unregister_component(&pdev->dev); |
646 | 624 | ||
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h index bb6b3dbb13fd..d5003cefca8d 100644 --- a/sound/soc/fsl/imx-ssi.h +++ b/sound/soc/fsl/imx-ssi.h | |||
@@ -211,9 +211,6 @@ struct imx_ssi { | |||
211 | struct imx_dma_data filter_data_rx; | 211 | struct imx_dma_data filter_data_rx; |
212 | 212 | ||
213 | int enabled; | 213 | int enabled; |
214 | |||
215 | struct platform_device *soc_platform_pdev; | ||
216 | struct platform_device *soc_platform_pdev_fiq; | ||
217 | }; | 214 | }; |
218 | 215 | ||
219 | #endif /* _IMX_SSI_H */ | 216 | #endif /* _IMX_SSI_H */ |
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c new file mode 100644 index 000000000000..52a36a90f4f4 --- /dev/null +++ b/sound/soc/fsl/imx-wm8962.c | |||
@@ -0,0 +1,323 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * Based on imx-sgtl5000.c | ||
5 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
6 | * Copyright 2012 Linaro Ltd. | ||
7 | * | ||
8 | * The code contained herein is licensed under the GNU General Public | ||
9 | * License. You may obtain a copy of the GNU General Public License | ||
10 | * Version 2 or later at the following locations: | ||
11 | * | ||
12 | * http://www.opensource.org/licenses/gpl-license.html | ||
13 | * http://www.gnu.org/copyleft/gpl.html | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/of_platform.h> | ||
18 | #include <linux/of_i2c.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <sound/soc.h> | ||
22 | #include <sound/pcm_params.h> | ||
23 | #include <sound/soc-dapm.h> | ||
24 | #include <linux/pinctrl/consumer.h> | ||
25 | |||
26 | #include "../codecs/wm8962.h" | ||
27 | #include "imx-audmux.h" | ||
28 | |||
29 | #define DAI_NAME_SIZE 32 | ||
30 | |||
31 | struct imx_wm8962_data { | ||
32 | struct snd_soc_dai_link dai; | ||
33 | struct snd_soc_card card; | ||
34 | char codec_dai_name[DAI_NAME_SIZE]; | ||
35 | char platform_name[DAI_NAME_SIZE]; | ||
36 | struct clk *codec_clk; | ||
37 | unsigned int clk_frequency; | ||
38 | }; | ||
39 | |||
40 | struct imx_priv { | ||
41 | struct platform_device *pdev; | ||
42 | }; | ||
43 | static struct imx_priv card_priv; | ||
44 | |||
45 | static const struct snd_soc_dapm_widget imx_wm8962_dapm_widgets[] = { | ||
46 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | ||
47 | SND_SOC_DAPM_SPK("Ext Spk", NULL), | ||
48 | SND_SOC_DAPM_MIC("AMIC", NULL), | ||
49 | SND_SOC_DAPM_MIC("DMIC", NULL), | ||
50 | }; | ||
51 | |||
52 | static int sample_rate = 44100; | ||
53 | static snd_pcm_format_t sample_format = SNDRV_PCM_FORMAT_S16_LE; | ||
54 | |||
55 | static int imx_hifi_hw_params(struct snd_pcm_substream *substream, | ||
56 | struct snd_pcm_hw_params *params) | ||
57 | { | ||
58 | sample_rate = params_rate(params); | ||
59 | sample_format = params_format(params); | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static struct snd_soc_ops imx_hifi_ops = { | ||
65 | .hw_params = imx_hifi_hw_params, | ||
66 | }; | ||
67 | |||
68 | static int imx_wm8962_set_bias_level(struct snd_soc_card *card, | ||
69 | struct snd_soc_dapm_context *dapm, | ||
70 | enum snd_soc_bias_level level) | ||
71 | { | ||
72 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | ||
73 | struct imx_priv *priv = &card_priv; | ||
74 | struct imx_wm8962_data *data = platform_get_drvdata(priv->pdev); | ||
75 | struct device *dev = &priv->pdev->dev; | ||
76 | unsigned int pll_out; | ||
77 | int ret; | ||
78 | |||
79 | if (dapm->dev != codec_dai->dev) | ||
80 | return 0; | ||
81 | |||
82 | switch (level) { | ||
83 | case SND_SOC_BIAS_PREPARE: | ||
84 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { | ||
85 | if (sample_format == SNDRV_PCM_FORMAT_S24_LE) | ||
86 | pll_out = sample_rate * 384; | ||
87 | else | ||
88 | pll_out = sample_rate * 256; | ||
89 | |||
90 | ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, | ||
91 | WM8962_FLL_MCLK, data->clk_frequency, | ||
92 | pll_out); | ||
93 | if (ret < 0) { | ||
94 | dev_err(dev, "failed to start FLL: %d\n", ret); | ||
95 | return ret; | ||
96 | } | ||
97 | |||
98 | ret = snd_soc_dai_set_sysclk(codec_dai, | ||
99 | WM8962_SYSCLK_FLL, pll_out, | ||
100 | SND_SOC_CLOCK_IN); | ||
101 | if (ret < 0) { | ||
102 | dev_err(dev, "failed to set SYSCLK: %d\n", ret); | ||
103 | return ret; | ||
104 | } | ||
105 | } | ||
106 | break; | ||
107 | |||
108 | case SND_SOC_BIAS_STANDBY: | ||
109 | if (dapm->bias_level == SND_SOC_BIAS_PREPARE) { | ||
110 | ret = snd_soc_dai_set_sysclk(codec_dai, | ||
111 | WM8962_SYSCLK_MCLK, data->clk_frequency, | ||
112 | SND_SOC_CLOCK_IN); | ||
113 | if (ret < 0) { | ||
114 | dev_err(dev, | ||
115 | "failed to switch away from FLL: %d\n", | ||
116 | ret); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, | ||
121 | 0, 0, 0); | ||
122 | if (ret < 0) { | ||
123 | dev_err(dev, "failed to stop FLL: %d\n", ret); | ||
124 | return ret; | ||
125 | } | ||
126 | } | ||
127 | break; | ||
128 | |||
129 | default: | ||
130 | break; | ||
131 | } | ||
132 | |||
133 | dapm->bias_level = level; | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static int imx_wm8962_late_probe(struct snd_soc_card *card) | ||
139 | { | ||
140 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | ||
141 | struct imx_priv *priv = &card_priv; | ||
142 | struct imx_wm8962_data *data = platform_get_drvdata(priv->pdev); | ||
143 | struct device *dev = &priv->pdev->dev; | ||
144 | int ret; | ||
145 | |||
146 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, | ||
147 | data->clk_frequency, SND_SOC_CLOCK_IN); | ||
148 | if (ret < 0) | ||
149 | dev_err(dev, "failed to set sysclk in %s\n", __func__); | ||
150 | |||
151 | return ret; | ||
152 | } | ||
153 | |||
154 | static int imx_wm8962_probe(struct platform_device *pdev) | ||
155 | { | ||
156 | struct device_node *np = pdev->dev.of_node; | ||
157 | struct device_node *ssi_np, *codec_np; | ||
158 | struct platform_device *ssi_pdev; | ||
159 | struct imx_priv *priv = &card_priv; | ||
160 | struct i2c_client *codec_dev; | ||
161 | struct imx_wm8962_data *data; | ||
162 | int int_port, ext_port; | ||
163 | int ret; | ||
164 | |||
165 | priv->pdev = pdev; | ||
166 | |||
167 | ret = of_property_read_u32(np, "mux-int-port", &int_port); | ||
168 | if (ret) { | ||
169 | dev_err(&pdev->dev, "mux-int-port missing or invalid\n"); | ||
170 | return ret; | ||
171 | } | ||
172 | ret = of_property_read_u32(np, "mux-ext-port", &ext_port); | ||
173 | if (ret) { | ||
174 | dev_err(&pdev->dev, "mux-ext-port missing or invalid\n"); | ||
175 | return ret; | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * The port numbering in the hardware manual starts at 1, while | ||
180 | * the audmux API expects it starts at 0. | ||
181 | */ | ||
182 | int_port--; | ||
183 | ext_port--; | ||
184 | ret = imx_audmux_v2_configure_port(int_port, | ||
185 | IMX_AUDMUX_V2_PTCR_SYN | | ||
186 | IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) | | ||
187 | IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) | | ||
188 | IMX_AUDMUX_V2_PTCR_TFSDIR | | ||
189 | IMX_AUDMUX_V2_PTCR_TCLKDIR, | ||
190 | IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port)); | ||
191 | if (ret) { | ||
192 | dev_err(&pdev->dev, "audmux internal port setup failed\n"); | ||
193 | return ret; | ||
194 | } | ||
195 | imx_audmux_v2_configure_port(ext_port, | ||
196 | IMX_AUDMUX_V2_PTCR_SYN, | ||
197 | IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); | ||
198 | if (ret) { | ||
199 | dev_err(&pdev->dev, "audmux external port setup failed\n"); | ||
200 | return ret; | ||
201 | } | ||
202 | |||
203 | ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0); | ||
204 | codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); | ||
205 | if (!ssi_np || !codec_np) { | ||
206 | dev_err(&pdev->dev, "phandle missing or invalid\n"); | ||
207 | ret = -EINVAL; | ||
208 | goto fail; | ||
209 | } | ||
210 | |||
211 | ssi_pdev = of_find_device_by_node(ssi_np); | ||
212 | if (!ssi_pdev) { | ||
213 | dev_err(&pdev->dev, "failed to find SSI platform device\n"); | ||
214 | ret = -EINVAL; | ||
215 | goto fail; | ||
216 | } | ||
217 | codec_dev = of_find_i2c_device_by_node(codec_np); | ||
218 | if (!codec_dev || !codec_dev->driver) { | ||
219 | dev_err(&pdev->dev, "failed to find codec platform device\n"); | ||
220 | return -EINVAL; | ||
221 | } | ||
222 | |||
223 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
224 | if (!data) { | ||
225 | ret = -ENOMEM; | ||
226 | goto fail; | ||
227 | } | ||
228 | |||
229 | data->codec_clk = devm_clk_get(&codec_dev->dev, NULL); | ||
230 | if (IS_ERR(data->codec_clk)) { | ||
231 | ret = PTR_ERR(data->codec_clk); | ||
232 | dev_err(&codec_dev->dev, "failed to get codec clk: %d\n", ret); | ||
233 | goto fail; | ||
234 | } | ||
235 | |||
236 | data->clk_frequency = clk_get_rate(data->codec_clk); | ||
237 | ret = clk_prepare_enable(data->codec_clk); | ||
238 | if (ret) { | ||
239 | dev_err(&codec_dev->dev, "failed to enable codec clk: %d\n", ret); | ||
240 | goto fail; | ||
241 | } | ||
242 | |||
243 | data->dai.name = "HiFi"; | ||
244 | data->dai.stream_name = "HiFi"; | ||
245 | data->dai.codec_dai_name = "wm8962"; | ||
246 | data->dai.codec_of_node = codec_np; | ||
247 | data->dai.cpu_dai_name = dev_name(&ssi_pdev->dev); | ||
248 | data->dai.platform_of_node = ssi_np; | ||
249 | data->dai.ops = &imx_hifi_ops; | ||
250 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
251 | SND_SOC_DAIFMT_CBM_CFM; | ||
252 | |||
253 | data->card.dev = &pdev->dev; | ||
254 | ret = snd_soc_of_parse_card_name(&data->card, "model"); | ||
255 | if (ret) | ||
256 | goto clk_fail; | ||
257 | ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing"); | ||
258 | if (ret) | ||
259 | goto clk_fail; | ||
260 | data->card.num_links = 1; | ||
261 | data->card.dai_link = &data->dai; | ||
262 | data->card.dapm_widgets = imx_wm8962_dapm_widgets; | ||
263 | data->card.num_dapm_widgets = ARRAY_SIZE(imx_wm8962_dapm_widgets); | ||
264 | |||
265 | data->card.late_probe = imx_wm8962_late_probe; | ||
266 | data->card.set_bias_level = imx_wm8962_set_bias_level; | ||
267 | |||
268 | ret = snd_soc_register_card(&data->card); | ||
269 | if (ret) { | ||
270 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); | ||
271 | goto clk_fail; | ||
272 | } | ||
273 | |||
274 | platform_set_drvdata(pdev, data); | ||
275 | of_node_put(ssi_np); | ||
276 | of_node_put(codec_np); | ||
277 | |||
278 | return 0; | ||
279 | |||
280 | clk_fail: | ||
281 | if (!IS_ERR(data->codec_clk)) | ||
282 | clk_disable_unprepare(data->codec_clk); | ||
283 | fail: | ||
284 | if (ssi_np) | ||
285 | of_node_put(ssi_np); | ||
286 | if (codec_np) | ||
287 | of_node_put(codec_np); | ||
288 | |||
289 | return ret; | ||
290 | } | ||
291 | |||
292 | static int imx_wm8962_remove(struct platform_device *pdev) | ||
293 | { | ||
294 | struct imx_wm8962_data *data = platform_get_drvdata(pdev); | ||
295 | |||
296 | if (!IS_ERR(data->codec_clk)) | ||
297 | clk_disable_unprepare(data->codec_clk); | ||
298 | snd_soc_unregister_card(&data->card); | ||
299 | |||
300 | return 0; | ||
301 | } | ||
302 | |||
303 | static const struct of_device_id imx_wm8962_dt_ids[] = { | ||
304 | { .compatible = "fsl,imx-audio-wm8962", }, | ||
305 | { /* sentinel */ } | ||
306 | }; | ||
307 | MODULE_DEVICE_TABLE(of, imx_wm8962_dt_ids); | ||
308 | |||
309 | static struct platform_driver imx_wm8962_driver = { | ||
310 | .driver = { | ||
311 | .name = "imx-wm8962", | ||
312 | .owner = THIS_MODULE, | ||
313 | .of_match_table = imx_wm8962_dt_ids, | ||
314 | }, | ||
315 | .probe = imx_wm8962_probe, | ||
316 | .remove = imx_wm8962_remove, | ||
317 | }; | ||
318 | module_platform_driver(imx_wm8962_driver); | ||
319 | |||
320 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | ||
321 | MODULE_DESCRIPTION("Freescale i.MX WM8962 ASoC machine driver"); | ||
322 | MODULE_LICENSE("GPL v2"); | ||
323 | MODULE_ALIAS("platform:imx-wm8962"); | ||
diff --git a/sound/soc/fsl/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c index 3d1074179057..f4c3bda5e69e 100644 --- a/sound/soc/fsl/mx27vis-aic32x4.c +++ b/sound/soc/fsl/mx27vis-aic32x4.c | |||
@@ -161,7 +161,7 @@ static struct snd_soc_dai_link mx27vis_aic32x4_dai = { | |||
161 | .name = "tlv320aic32x4", | 161 | .name = "tlv320aic32x4", |
162 | .stream_name = "TLV320AIC32X4", | 162 | .stream_name = "TLV320AIC32X4", |
163 | .codec_dai_name = "tlv320aic32x4-hifi", | 163 | .codec_dai_name = "tlv320aic32x4-hifi", |
164 | .platform_name = "imx-pcm-audio.0", | 164 | .platform_name = "imx-ssi.0", |
165 | .codec_name = "tlv320aic32x4.0-0018", | 165 | .codec_name = "tlv320aic32x4.0-0018", |
166 | .cpu_dai_name = "imx-ssi.0", | 166 | .cpu_dai_name = "imx-ssi.0", |
167 | .ops = &mx27vis_aic32x4_snd_ops, | 167 | .ops = &mx27vis_aic32x4_snd_ops, |
diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c index f8da6dd115ed..ae403c29688f 100644 --- a/sound/soc/fsl/phycore-ac97.c +++ b/sound/soc/fsl/phycore-ac97.c | |||
@@ -33,7 +33,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { | |||
33 | .codec_dai_name = "wm9712-hifi", | 33 | .codec_dai_name = "wm9712-hifi", |
34 | .codec_name = "wm9712-codec", | 34 | .codec_name = "wm9712-codec", |
35 | .cpu_dai_name = "imx-ssi.0", | 35 | .cpu_dai_name = "imx-ssi.0", |
36 | .platform_name = "imx-fiq-pcm-audio.0", | 36 | .platform_name = "imx-ssi.0", |
37 | .ops = &imx_phycore_hifi_ops, | 37 | .ops = &imx_phycore_hifi_ops, |
38 | }, | 38 | }, |
39 | }; | 39 | }; |
diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c index fe54a69073e5..fce63252bdbb 100644 --- a/sound/soc/fsl/wm1133-ev1.c +++ b/sound/soc/fsl/wm1133-ev1.c | |||
@@ -245,7 +245,7 @@ static struct snd_soc_dai_link wm1133_ev1_dai = { | |||
245 | .stream_name = "Audio", | 245 | .stream_name = "Audio", |
246 | .cpu_dai_name = "imx-ssi.0", | 246 | .cpu_dai_name = "imx-ssi.0", |
247 | .codec_dai_name = "wm8350-hifi", | 247 | .codec_dai_name = "wm8350-hifi", |
248 | .platform_name = "imx-fiq-pcm-audio.0", | 248 | .platform_name = "imx-ssi.0", |
249 | .codec_name = "wm8350-codec.0-0x1a", | 249 | .codec_name = "wm8350-codec.0-0x1a", |
250 | .init = wm1133_ev1_init, | 250 | .init = wm1133_ev1_init, |
251 | .ops = &wm1133_ev1_ops, | 251 | .ops = &wm1133_ev1_ops, |
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index b1d9b5ebeeeb..1b134d72f120 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c | |||
@@ -90,17 +90,11 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = { | |||
90 | .name = "HiFi Tx", | 90 | .name = "HiFi Tx", |
91 | .stream_name = "HiFi Playback", | 91 | .stream_name = "HiFi Playback", |
92 | .codec_dai_name = "sgtl5000", | 92 | .codec_dai_name = "sgtl5000", |
93 | .codec_name = "sgtl5000.0-000a", | ||
94 | .cpu_dai_name = "mxs-saif.0", | ||
95 | .platform_name = "mxs-saif.0", | ||
96 | .ops = &mxs_sgtl5000_hifi_ops, | 93 | .ops = &mxs_sgtl5000_hifi_ops, |
97 | }, { | 94 | }, { |
98 | .name = "HiFi Rx", | 95 | .name = "HiFi Rx", |
99 | .stream_name = "HiFi Capture", | 96 | .stream_name = "HiFi Capture", |
100 | .codec_dai_name = "sgtl5000", | 97 | .codec_dai_name = "sgtl5000", |
101 | .codec_name = "sgtl5000.0-000a", | ||
102 | .cpu_dai_name = "mxs-saif.1", | ||
103 | .platform_name = "mxs-saif.1", | ||
104 | .ops = &mxs_sgtl5000_hifi_ops, | 98 | .ops = &mxs_sgtl5000_hifi_ops, |
105 | }, | 99 | }, |
106 | }; | 100 | }; |
@@ -116,7 +110,7 @@ static int mxs_sgtl5000_probe_dt(struct platform_device *pdev) | |||
116 | { | 110 | { |
117 | struct device_node *np = pdev->dev.of_node; | 111 | struct device_node *np = pdev->dev.of_node; |
118 | struct device_node *saif_np[2], *codec_np; | 112 | struct device_node *saif_np[2], *codec_np; |
119 | int i, ret = 0; | 113 | int i; |
120 | 114 | ||
121 | if (!np) | 115 | if (!np) |
122 | return 1; /* no device tree */ | 116 | return 1; /* no device tree */ |
@@ -142,7 +136,7 @@ static int mxs_sgtl5000_probe_dt(struct platform_device *pdev) | |||
142 | of_node_put(saif_np[0]); | 136 | of_node_put(saif_np[0]); |
143 | of_node_put(saif_np[1]); | 137 | of_node_put(saif_np[1]); |
144 | 138 | ||
145 | return ret; | 139 | return 0; |
146 | } | 140 | } |
147 | 141 | ||
148 | static int mxs_sgtl5000_probe(struct platform_device *pdev) | 142 | static int mxs_sgtl5000_probe(struct platform_device *pdev) |