* [PATCH 01/10] imx-ssi: Fix AC97 rates
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-03-10 18:33 ` Markus Pargmann
[not found] ` <1362940391-8338-2-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure Markus Pargmann
` (8 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Sascha Hauer,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
This device supports multiple rates as described in later AC97
standards. This patch allows playback of different sample frequencies
without conversion.
Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/imx-ssi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 55464a5..7ee0147 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -400,7 +400,7 @@ static struct snd_soc_dai_driver imx_ac97_dai = {
.stream_name = "AC97 Playback",
.channels_min = 2,
.channels_max = 2,
- .rates = SNDRV_PCM_RATE_48000,
+ .rates = SNDRV_PCM_RATE_8000_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
.capture = {
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 01/10] imx-ssi: Fix AC97 rates Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
2013-03-12 18:53 ` Mark Brown
2013-03-10 18:33 ` [PATCH 03/10] mx-ssi: flush fifos Markus Pargmann
` (7 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Sascha Hauer,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/imx-ssi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 7ee0147..0e3fc8d 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -496,6 +496,8 @@ static void imx_ssi_ac97_reset(struct snd_ac97 *ac97)
if (imx_ssi->ac97_reset)
imx_ssi->ac97_reset(ac97);
+ /* First read sometimes fails, do a dummy read */
+ imx_ssi_ac97_read(ac97, 0);
}
static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
@@ -504,6 +506,9 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
if (imx_ssi->ac97_warm_reset)
imx_ssi->ac97_warm_reset(ac97);
+
+ /* First read sometimes fails, do a dummy read */
+ imx_ssi_ac97_read(ac97, 0);
}
struct snd_ac97_bus_ops soc_ac97_ops = {
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure
2013-03-10 18:33 ` [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure Markus Pargmann
@ 2013-03-12 18:53 ` Mark Brown
0 siblings, 0 replies; 35+ messages in thread
From: Mark Brown @ 2013-03-12 18:53 UTC (permalink / raw)
To: Markus Pargmann
Cc: Fabio Estevam, alsa-devel, Sascha Hauer, devicetree-discuss,
Liam Girdwood, Grant Likely, Sascha Hauer, Shawn Guo, Timur Tabi,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 412 bytes --]
On Sun, Mar 10, 2013 at 07:33:03PM +0100, Markus Pargmann wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Applied but *always* use subject lines appropriate to the subsystem and
bugfixes like this should be pulled to the front of the series as they
should be sent to mainline earlier.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 03/10] mx-ssi: flush fifos
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 01/10] imx-ssi: Fix AC97 rates Markus Pargmann
2013-03-10 18:33 ` [PATCH 02/10] imx-ssi: Fix occasional AC97 reset failure Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
[not found] ` <1362940391-8338-4-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 04/10] ASoC: Kconfig: imx-ssi needs imx-fiq and imx-dma Markus Pargmann
` (6 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Sascha Hauer,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/imx-ssi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 0e3fc8d..96e24a3 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -347,6 +347,11 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
/* rx/tx are always enabled to access ac97 registers */
writel(scr, ssi->base + SSI_SCR);
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ writel(SSI_SOR_TX_CLR, ssi->base + SSI_SOR);
+ else
+ writel(SSI_SOR_RX_CLR, ssi->base + SSI_SOR);
+
writel(sier, ssi->base + SSI_SIER);
return 0;
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 04/10] ASoC: Kconfig: imx-ssi needs imx-fiq and imx-dma
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (2 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 03/10] mx-ssi: flush fifos Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
[not found] ` <1362940391-8338-5-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 05/10] ASoC: pcm030 audio fabric: remove __init from probe Markus Pargmann
` (5 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 3b98159..42d3047 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -106,6 +106,8 @@ menuconfig SND_IMX_SOC
if SND_IMX_SOC
config SND_SOC_IMX_SSI
+ select SND_SOC_IMX_PCM_DMA
+ select SND_SOC_IMX_PCM_FIQ
tristate
config SND_SOC_IMX_PCM
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 05/10] ASoC: pcm030 audio fabric: remove __init from probe
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (3 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 04/10] ASoC: Kconfig: imx-ssi needs imx-fiq and imx-dma Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
[not found] ` <1362940391-8338-6-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order Markus Pargmann
` (4 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Remove probe function from the init section.
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/pcm030-audio-fabric.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 8e52c14..eb43738 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -51,7 +51,7 @@ static struct snd_soc_card pcm030_card = {
.num_links = ARRAY_SIZE(pcm030_fabric_dai),
};
-static int __init pcm030_fabric_probe(struct platform_device *op)
+static int pcm030_fabric_probe(struct platform_device *op)
{
struct device_node *np = op->dev.of_node;
struct device_node *platform_np;
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (4 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 05/10] ASoC: pcm030 audio fabric: remove __init from probe Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
2013-03-11 11:10 ` Mark Brown
2013-03-10 18:33 ` [PATCH 07/10] ASoC: phycore-ac97: Add DT support Markus Pargmann
` (3 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Adding a soc-audio sound driver internally uses snd_soc_register_device,
which tries to bind it with the codec. The adding of the driver is
deferred because the codec driver is not loaded.
This patch changes the order of registration. The codec driver is there
before the ac97 driver, so the snd_soc_register_device call is
successfull.
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/phycore-ac97.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
index f8da6dd..d146cec 100644
--- a/sound/soc/fsl/phycore-ac97.c
+++ b/sound/soc/fsl/phycore-ac97.c
@@ -79,35 +79,40 @@ static int __init imx_phycore_init(void)
return 0;
}
- imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
- if (!imx_phycore_snd_ac97_device)
+
+ /*
+ * First add codec driver, otherwise soc-audio may be deferred and fails
+ * to load.
+ */
+ imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
+ if (!imx_phycore_snd_device)
return -ENOMEM;
- platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
- ret = platform_device_add(imx_phycore_snd_ac97_device);
- if (ret)
+ ret = platform_device_add(imx_phycore_snd_device);
+ if (ret) {
+ printk(KERN_ERR "ASoC: Platform device allocation failed\n");
goto fail1;
+ }
- imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
- if (!imx_phycore_snd_device) {
+ imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
+ if (!imx_phycore_snd_ac97_device) {
ret = -ENOMEM;
goto fail2;
}
- ret = platform_device_add(imx_phycore_snd_device);
- if (ret) {
- printk(KERN_ERR "ASoC: Platform device allocation failed\n");
+ platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
+ ret = platform_device_add(imx_phycore_snd_ac97_device);
+ if (ret)
goto fail3;
- }
return 0;
fail3:
- platform_device_put(imx_phycore_snd_device);
+ platform_device_put(imx_phycore_snd_ac97_device);
fail2:
- platform_device_del(imx_phycore_snd_ac97_device);
+ platform_device_del(imx_phycore_snd_device);
fail1:
- platform_device_put(imx_phycore_snd_ac97_device);
+ platform_device_put(imx_phycore_snd_device);
return ret;
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order
2013-03-10 18:33 ` [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order Markus Pargmann
@ 2013-03-11 11:10 ` Mark Brown
[not found] ` <20130311111011.GA10617-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 35+ messages in thread
From: Mark Brown @ 2013-03-11 11:10 UTC (permalink / raw)
To: Markus Pargmann
Cc: Fabio Estevam, alsa-devel, devicetree-discuss, Liam Girdwood,
Grant Likely, Sascha Hauer, Shawn Guo, Timur Tabi,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 471 bytes --]
On Sun, Mar 10, 2013 at 07:33:07PM +0100, Markus Pargmann wrote:
> Adding a soc-audio sound driver internally uses snd_soc_register_device,
> which tries to bind it with the codec. The adding of the driver is
> deferred because the codec driver is not loaded.
> This patch changes the order of registration. The codec driver is there
> before the ac97 driver, so the snd_soc_register_device call is
> successfull.
You shouldn't be using soc-audio in the first place...
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 07/10] ASoC: phycore-ac97: Add DT support
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (5 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 06/10] ARM: soc-audio phycore-ac97: fix driver init order Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
[not found] ` <1362940391-8338-8-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-03-10 18:33 ` [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request Markus Pargmann
` (2 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Add devicetree support for this audio soc fabric driver.
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/phycore-ac97.c | 148 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 125 insertions(+), 23 deletions(-)
diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
index d146cec..a898ce3 100644
--- a/sound/soc/fsl/phycore-ac97.c
+++ b/sound/soc/fsl/phycore-ac97.c
@@ -21,6 +21,8 @@
#include "imx-audmux.h"
+#define DRV_NAME "phycore-audio-fabric"
+
static struct snd_soc_card imx_phycore;
static struct snd_soc_ops imx_phycore_hifi_ops = {
@@ -32,8 +34,13 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
.stream_name = "HiFi",
.codec_dai_name = "wm9712-hifi",
.codec_name = "wm9712-codec",
+#ifdef CONFIG_MACH_IMX27_DT
+ .cpu_dai_name = "10010000.ssi",
+ .platform_name = "imx-fiq-pcm-audio",
+#else
.cpu_dai_name = "imx-ssi.0",
.platform_name = "imx-fiq-pcm-audio.0",
+#endif
.ops = &imx_phycore_hifi_ops,
},
};
@@ -45,41 +52,53 @@ static struct snd_soc_card imx_phycore = {
.num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
};
-static struct platform_device *imx_phycore_snd_ac97_device;
+static void phycore_ac97_pca100_audmux(void)
+{
+ imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
+ IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
+ IMX_AUDMUX_V1_PCR_TFCSEL(3) |
+ IMX_AUDMUX_V1_PCR_TCLKDIR | /* clock is output */
+ IMX_AUDMUX_V1_PCR_RXDSEL(3));
+ imx_audmux_v1_configure_port(3,
+ IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
+ IMX_AUDMUX_V1_PCR_TFCSEL(0) |
+ IMX_AUDMUX_V1_PCR_TFSDIR |
+ IMX_AUDMUX_V1_PCR_RXDSEL(0));
+}
+
+static void phycore_ac97_pcm043_audmux(void)
+{
+ imx_audmux_v2_configure_port(3,
+ IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
+ IMX_AUDMUX_V2_PTCR_TFSEL(0) |
+ IMX_AUDMUX_V2_PTCR_TFSDIR,
+ IMX_AUDMUX_V2_PDCR_RXDSEL(0));
+ imx_audmux_v2_configure_port(0,
+ IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
+ IMX_AUDMUX_V2_PTCR_TCSEL(3) |
+ IMX_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
+ IMX_AUDMUX_V2_PDCR_RXDSEL(3));
+}
+
static struct platform_device *imx_phycore_snd_device;
+#ifndef CONFIG_MACH_IMX27_DT
+
+static struct platform_device *imx_phycore_snd_ac97_device;
+
static int __init imx_phycore_init(void)
{
int ret;
if (machine_is_pca100()) {
- imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
- IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
- IMX_AUDMUX_V1_PCR_TFCSEL(3) |
- IMX_AUDMUX_V1_PCR_TCLKDIR | /* clock is output */
- IMX_AUDMUX_V1_PCR_RXDSEL(3));
- imx_audmux_v1_configure_port(3,
- IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
- IMX_AUDMUX_V1_PCR_TFCSEL(0) |
- IMX_AUDMUX_V1_PCR_TFSDIR |
- IMX_AUDMUX_V1_PCR_RXDSEL(0));
+ phycore_ac97_pca100_audmux();
} else if (machine_is_pcm043()) {
- imx_audmux_v2_configure_port(3,
- IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
- IMX_AUDMUX_V2_PTCR_TFSEL(0) |
- IMX_AUDMUX_V2_PTCR_TFSDIR,
- IMX_AUDMUX_V2_PDCR_RXDSEL(0));
- imx_audmux_v2_configure_port(0,
- IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
- IMX_AUDMUX_V2_PTCR_TCSEL(3) |
- IMX_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
- IMX_AUDMUX_V2_PDCR_RXDSEL(3));
+ phycore_ac97_pcm043_audmux();
} else {
/* return happy. We might run on a totally different machine */
return 0;
}
-
/*
* First add codec driver, otherwise soc-audio may be deferred and fails
* to load.
@@ -125,6 +144,89 @@ static void __exit imx_phycore_exit(void)
late_initcall(imx_phycore_init);
module_exit(imx_phycore_exit);
+#else /* !CONFIG_MACH_IMX27_DT */
+
+enum dev_type {
+ MX27_PCA100,
+ MX27_PCM043,
+};
+
+static const struct of_device_id imx_phycore_ac97_of_dev_id[] = {
+ {
+ .compatible = "phytec,imx27-pca100-ac97",
+ .data = (void *)MX27_PCA100,
+ }, {
+ .compatible = "phytec,imx27-pcm043-ac97",
+ .data = (void *)MX27_PCM043
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(of, imx_phycore_ac97_of_dev_id);
+
+static int phycore_ac97_setup_devices(struct platform_device *pdev)
+{
+ int ret;
+
+ imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
+ if (!imx_phycore_snd_device)
+ return -ENOMEM;
+
+ ret = platform_device_add(imx_phycore_snd_device);
+ if (ret) {
+ dev_err(&pdev->dev, "ASoC: Platform device allocation failed\n");
+ goto fail1;
+ }
+
+ ret = snd_soc_register_card(&imx_phycore);
+ if (ret) {
+ dev_err(&pdev->dev, "ASoC: soc card registration failed\n");
+ goto fail2;
+ }
+ return 0;
+
+fail2:
+ platform_device_del(imx_phycore_snd_device);
+fail1:
+ platform_device_put(imx_phycore_snd_device);
+ return ret;
+}
+
+static int imx_phycore_ac97_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ imx_phycore.dev = &pdev->dev;
+
+ if (pdev->dev.of_node->data == MX27_PCA100)
+ phycore_ac97_pca100_audmux();
+ else
+ phycore_ac97_pcm043_audmux();
+
+ ret = phycore_ac97_setup_devices(pdev);
+ return ret;
+}
+
+static int imx_phycore_ac97_remove(struct platform_device *pdev)
+{
+ platform_device_unregister(imx_phycore_snd_device);
+ return 0;
+}
+
+static struct platform_driver imx_phycore_ac97_driver = {
+ .probe = imx_phycore_ac97_probe,
+ .remove = imx_phycore_ac97_remove,
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
+ .of_match_table = imx_phycore_ac97_of_dev_id,
+ },
+};
+
+module_platform_driver(imx_phycore_ac97_driver);
+
+#endif /* CONFIG_MACH_IMX27_DT */
+
MODULE_AUTHOR("Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>");
-MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
+MODULE_DESCRIPTION(DRV_NAME ": PhyCORE ALSA SoC fabric driver");
MODULE_LICENSE("GPL");
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (6 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 07/10] ASoC: phycore-ac97: Add DT support Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
2013-03-12 19:02 ` Mark Brown
2013-03-10 18:33 ` [PATCH 09/10] ASoC: imx-pcm-dma: Add support for DMA init by device node Markus Pargmann
2013-03-10 18:33 ` [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support Markus Pargmann
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Add a function to open a DMA PCM substream using devicetree data
provided via the client device node. The patch introduces a public
function and a private subfunction that is called by both open
functions.
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
include/sound/dmaengine_pcm.h | 2 +
sound/soc/soc-dmaengine-pcm.c | 89 ++++++++++++++++++++++++++++++++++---------
2 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index b877334..358951a 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -43,6 +43,8 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream
int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
dma_filter_fn filter_fn, void *filter_data);
+int of_snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
+ struct device_node *client_node, const char *name);
int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream);
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
index 111b7d92..017b691 100644
--- a/sound/soc/soc-dmaengine-pcm.c
+++ b/sound/soc/soc-dmaengine-pcm.c
@@ -20,6 +20,8 @@
*/
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/of_dma.h>
#include <linux/dmaengine.h>
#include <linux/slab.h>
#include <sound/pcm.h>
@@ -260,24 +262,21 @@ static int dmaengine_pcm_request_channel(struct dmaengine_pcm_runtime_data *prtd
return 0;
}
-/**
- * snd_dmaengine_pcm_open - Open a dmaengine based PCM substream
- * @substream: PCM substream
- * @filter_fn: Filter function used to request the DMA channel
- * @filter_data: Data passed to the DMA filter function
- *
- * Returns 0 on success, a negative error code otherwise.
- *
- * This function will request a DMA channel using the passed filter function and
- * data. The function should usually be called from the pcm open callback.
- *
- * Note that this function will use private_data field of the substream's
- * runtime. So it is not availabe to your pcm driver implementation. If you need
- * to keep additional data attached to a substream use
- * snd_dmaengine_pcm_{set,get}_data.
- */
-int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
- dma_filter_fn filter_fn, void *filter_data)
+static int of_dmaengine_pcm_request_channel(
+ struct dmaengine_pcm_runtime_data *prtd, struct device_node *np,
+ const char *name)
+{
+ prtd->dma_chan = of_dma_request_slave_channel(np, name);
+
+ if (!prtd->dma_chan)
+ return -ENXIO;
+
+ return 0;
+}
+
+static int _snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
+ dma_filter_fn filter_fn, void *filter_data,
+ struct device_node *np, const char *slave_name)
{
struct dmaengine_pcm_runtime_data *prtd;
int ret;
@@ -291,7 +290,11 @@ int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
if (!prtd)
return -ENOMEM;
- ret = dmaengine_pcm_request_channel(prtd, filter_fn, filter_data);
+ if (np)
+ ret = of_dmaengine_pcm_request_channel(prtd, np, slave_name);
+ else
+ ret = dmaengine_pcm_request_channel(prtd, filter_fn,
+ filter_data);
if (ret < 0) {
kfree(prtd);
return ret;
@@ -301,9 +304,57 @@ int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
return 0;
}
+
+/**
+ * snd_dmaengine_pcm_open - Open a dmaengine based PCM substream
+ * @substream: PCM substream
+ * @filter_fn: Filter function used to request the DMA channel
+ * @filter_data: Data passed to the DMA filter function
+ *
+ * Returns 0 on success, a negative error code otherwise.
+ *
+ * This function will request a DMA channel using the passed filter function and
+ * data. The function should usually be called from the pcm open callback.
+ *
+ * Note that this function will use private_data field of the substream's
+ * runtime. So it is not availabe to your pcm driver implementation. If you need
+ * to keep additional data attached to a substream use
+ * snd_dmaengine_pcm_{set,get}_data.
+ */
+int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
+ dma_filter_fn filter_fn, void *filter_data)
+{
+ return _snd_dmaengine_pcm_open(substream, filter_fn, filter_data, NULL,
+ NULL);
+}
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open);
/**
+ * of_snd_dmaengine_pcm_open - Open a dmaengine based PCM substream using oftree data
+ * @substream: PCM substream
+ * @client_node: DMA client oftree node used to request a DMA channel
+ * @name: DMA request name
+ *
+ * Returns 0 on success, a negative error code otherwise.
+ *
+ * This function will request a DMA channel using devicetree data.
+ *
+ * Note that this function will use private_data field of the substream's
+ * runtime. So it is not availabe to your pcm driver implementation. If you need
+ * to keep additional data attached to a substream use
+ * snd_dmaengine_pcm_{set,get}_data.
+ *
+ * Use the normal snd_dmaengine_pcm_close function to close the substream.
+ */
+int of_snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
+ struct device_node *client_node, const char *name)
+{
+ return _snd_dmaengine_pcm_open(substream, NULL, NULL, client_node,
+ name);
+}
+EXPORT_SYMBOL_GPL(of_snd_dmaengine_pcm_open);
+
+/**
* snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
* @substream: PCM substream
*/
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request
2013-03-10 18:33 ` [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request Markus Pargmann
@ 2013-03-12 19:02 ` Mark Brown
[not found] ` <20130312190206.GY19942-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 35+ messages in thread
From: Mark Brown @ 2013-03-12 19:02 UTC (permalink / raw)
To: Markus Pargmann
Cc: Fabio Estevam, alsa-devel, devicetree-discuss, Liam Girdwood,
Grant Likely, Sascha Hauer, Shawn Guo, Timur Tabi,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 543 bytes --]
On Sun, Mar 10, 2013 at 07:33:09PM +0100, Markus Pargmann wrote:
> Add a function to open a DMA PCM substream using devicetree data
> provided via the client device node. The patch introduces a public
> function and a private subfunction that is called by both open
> functions.
Someone (I think it was Shawn) sent a very similar patch just recently
which appears to have fallen out of my inbox unfortunately - can you
please check what's going on there and coordinate with them? Let me
know if you can't find the patch and I'll dig it out.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 09/10] ASoC: imx-pcm-dma: Add support for DMA init by device node
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (7 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 08/10] ASoC: dmaengine_pcm: Add open function for DT DMA request Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
2013-03-10 18:33 ` [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support Markus Pargmann
9 siblings, 0 replies; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Add support for DMA initialization using devicetree node.
This patch adds two fields to imx_pcm_dma_params to pass device node
information from other imx drivers to this one. If the dma_node is set,
this driver tries to initialize a PCM DMA substream based on the
dma_node and name.
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
sound/soc/fsl/imx-pcm-dma.c | 31 ++++++++++++++++++++-----------
sound/soc/fsl/imx-pcm.h | 6 ++++++
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 500f8ce..794103b 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -101,26 +101,35 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct imx_pcm_dma_params *dma_params;
- struct imx_dma_data *dma_data;
+ struct imx_dma_data *dma_data = NULL;
int ret;
snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL);
- if (!dma_data)
- return -ENOMEM;
+ if (dma_params->dma_client_node) {
+ ret = of_snd_dmaengine_pcm_open(substream,
+ dma_params->dma_client_node,
+ dma_params->dma_req_name);
+ if (ret)
+ return ret;
+ } else {
+ dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL);
+ if (!dma_data)
+ return -ENOMEM;
- dma_data->peripheral_type = dma_params->shared_peripheral ?
+ dma_data->peripheral_type = dma_params->shared_peripheral ?
IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI;
- dma_data->priority = DMA_PRIO_HIGH;
- dma_data->dma_request = dma_params->dma;
+ dma_data->priority = DMA_PRIO_HIGH;
+ dma_data->dma_request = dma_params->dma;
- ret = snd_dmaengine_pcm_open(substream, filter, dma_data);
- if (ret) {
- kfree(dma_data);
- return ret;
+ ret = snd_dmaengine_pcm_open(substream, filter, dma_data);
+
+ if (ret) {
+ kfree(dma_data);
+ return ret;
+ }
}
snd_dmaengine_pcm_set_data(substream, dma_data);
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 5ae13a1..d281fe2 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -23,6 +23,12 @@ struct imx_pcm_dma_params {
unsigned long dma_addr;
int burstsize;
bool shared_peripheral; /* The peripheral is on SPBA bus */
+
+ /* If set, the DMA channel is requested using this devicetree node while
+ * ignoring fields 'dma' and 'shared_peripheral'. They have to be set
+ * in devicetree according to the DMA Controller devicetree bindings. */
+ struct device_node *dma_client_node;
+ const char *dma_req_name; /* DMA Request name from devicetree */
};
int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support
[not found] ` <1362940391-8338-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
` (8 preceding siblings ...)
2013-03-10 18:33 ` [PATCH 09/10] ASoC: imx-pcm-dma: Add support for DMA init by device node Markus Pargmann
@ 2013-03-10 18:33 ` Markus Pargmann
2013-03-10 18:55 ` Alexander Shiyan
9 siblings, 1 reply; 35+ messages in thread
From: Markus Pargmann @ 2013-03-10 18:33 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Fabio Estevam, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mark Brown,
Liam Girdwood, Sascha Hauer, Timur Tabi
Add devicetree bindings for generic imx-ssi support and specifically for
pca100 with two custom reset functions. At the moment those functions
are defined in mach-pca100.c. So until DT is the only method for
booting, the ac97 reset functions have to be exported in mach-pca100.c.
Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
.../devicetree/bindings/sound/fsl-imx-ssi | 34 +++++++++
arch/arm/mach-imx/mach-pca100.c | 7 +-
sound/soc/fsl/imx-ssi.c | 85 +++++++++++++++++++---
3 files changed, 115 insertions(+), 11 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/fsl-imx-ssi
diff --git a/Documentation/devicetree/bindings/sound/fsl-imx-ssi b/Documentation/devicetree/bindings/sound/fsl-imx-ssi
new file mode 100644
index 0000000..853afeb
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/fsl-imx-ssi
@@ -0,0 +1,34 @@
+Freescale imx ssi driver
+
+Required properties:
+- compatible : "fsl,imx27-ssi" or "phytec,imx27-pca100-ssi"
+- reg : Should contain registers location and length
+- interrupts : Should be the ssi interrupt
+- clocks : Define at least one clock to be used.
+
+Optional properties:
+- dmas : DMA client request phandle list with arguements as defined by the DMA
+ controller used. See generic DMA devicetree bindings for more information.
+- dma-names : Names of the defined DMA client requests. "rx0" and "tx0" have to
+ be defined.
+- imx-ssi-ac97 : Use AC97
+- imx-ssi-i2s-slave : Use I2S slave
+- imx-ssi-net
+- imx-ssi-syn
+
+
+Example:
+ssi1: ssi@10010000 {
+ compatible = "fsl,imx27-ssi";
+ reg = <0x10010000 0x1000>;
+ interrupts = <14>;
+ dmas = <&dma 8
+ &dma 9
+ &dma 10
+ &dma 11>;
+ dma-names = "rx0", "tx0", "rx1", "tx1";
+ clocks = <&clks 25>;
+ clock-names = "ipg";
+ imx-ssi-ac97;
+ status = "disabled";
+};
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb..0d54921 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -25,6 +25,7 @@
#include <linux/spi/spi.h>
#include <linux/spi/eeprom.h>
#include <linux/irq.h>
+#include <linux/export.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/usb/otg.h>
@@ -208,7 +209,7 @@ static const struct spi_imx_master pca100_spi0_data __initconst = {
.num_chipselect = ARRAY_SIZE(pca100_spi_cs),
};
-static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
+void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
{
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);
gpio_set_value(GPIO_PORTC + 20, 1);
@@ -217,8 +218,9 @@ static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC20_PF_SSI1_FS);
msleep(2);
}
+EXPORT_SYMBOL(pca100_ac97_warm_reset);
-static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
+void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
{
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT); /* FS */
gpio_set_value(GPIO_PORTC + 20, 0);
@@ -232,6 +234,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC22_PF_SSI1_TXD);
msleep(2);
}
+EXPORT_SYMBOL(pca100_ac97_cold_reset);
static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
.ac97_reset = pca100_ac97_cold_reset,
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 96e24a3..58de760 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -38,6 +38,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -53,6 +54,46 @@
#define SSI_SACNT_DEFAULT (SSI_SACNT_AC97EN | SSI_SACNT_FV)
+#ifdef CONFIG_MACH_PCA100
+extern void pca100_ac97_cold_reset(struct snd_ac97 *ac97);
+extern void pca100_ac97_warm_reset(struct snd_ac97 *ac97);
+#else
+void pca100_ac97_cold_reset(struct snd_ac97 *ac97) { }
+void pca100_ac97_warm_reset(struct snd_ac97 *ac97) { }
+#endif
+
+
+enum imx_ssi_type {
+ IMX27_SSI = 0,
+ IMX27_PCA100_SSI,
+};
+
+static const struct imx_ssi_platform_data imx_ssi_devtype[] = {
+ {
+ .ac97_reset = NULL,
+ .ac97_warm_reset = NULL,
+ },
+ {
+ .ac97_reset = pca100_ac97_cold_reset,
+ .ac97_warm_reset = pca100_ac97_warm_reset,
+ }, {
+ /* sentinel */
+ }
+};
+
+static const struct of_device_id imx_ssi_of_dev_id[] = {
+ {
+ .compatible = "fsl,imx27-ssi",
+ .data = &imx_ssi_devtype[IMX27_SSI],
+ }, {
+ .compatible = "phytec,imx27-pca100-ssi",
+ .data = &imx_ssi_devtype[IMX27_PCA100_SSI],
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(of, imx_ssi_of_dev_id);
+
/*
* SSI Network Mode or TDM slots configuration.
* Should only be called when port is inactive (i.e. SSIEN = 0).
@@ -528,9 +569,12 @@ static int imx_ssi_probe(struct platform_device *pdev)
{
struct resource *res;
struct imx_ssi *ssi;
- struct imx_ssi_platform_data *pdata = pdev->dev.platform_data;
+ const struct imx_ssi_platform_data *pdata = pdev->dev.platform_data;
int ret = 0;
struct snd_soc_dai_driver *dai;
+ const struct of_device_id *of_id;
+
+ of_id = of_match_device(imx_ssi_of_dev_id, &pdev->dev);
ssi = devm_kzalloc(&pdev->dev, sizeof(*ssi), GFP_KERNEL);
if (!ssi)
@@ -538,10 +582,25 @@ static int imx_ssi_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, ssi);
if (pdata) {
- ssi->ac97_reset = pdata->ac97_reset;
- ssi->ac97_warm_reset = pdata->ac97_warm_reset;
ssi->flags = pdata->flags;
+ } else {
+ pdata = of_id->data;
+ ssi->flags = 0;
+
+ if (of_property_read_bool(pdev->dev.of_node, "dmas"))
+ ssi->flags |= IMX_SSI_DMA;
+ if (of_property_read_bool(pdev->dev.of_node, "imx-ssi-ac97"))
+ ssi->flags |= IMX_SSI_USE_AC97;
+ if (of_property_read_bool(pdev->dev.of_node, "imx-ssi-net"))
+ ssi->flags |= IMX_SSI_NET;
+ if (of_property_read_bool(pdev->dev.of_node, "imx-ssi-syn"))
+ ssi->flags |= IMX_SSI_SYN;
+ if (of_property_read_bool(pdev->dev.of_node,
+ "imx-ssi-i2s-slave"))
+ ssi->flags |= IMX_SSI_USE_I2S_SLAVE;
}
+ ssi->ac97_reset = pdata->ac97_reset;
+ ssi->ac97_warm_reset = pdata->ac97_warm_reset;
ssi->irq = platform_get_irq(pdev, 0);
@@ -586,13 +645,20 @@ static int imx_ssi_probe(struct platform_device *pdev)
ssi->dma_params_tx.burstsize = 6;
ssi->dma_params_rx.burstsize = 4;
- res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0");
- if (res)
- ssi->dma_params_tx.dma = res->start;
+ if (pdev->dev.platform_data) {
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0");
+ if (res)
+ ssi->dma_params_tx.dma = res->start;
- res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0");
- if (res)
- ssi->dma_params_rx.dma = res->start;
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0");
+ if (res)
+ ssi->dma_params_rx.dma = res->start;
+ } else {
+ ssi->dma_params_rx.dma_client_node = pdev->dev.of_node;
+ ssi->dma_params_rx.dma_req_name = "rx0";
+ ssi->dma_params_tx.dma_client_node = pdev->dev.of_node;
+ ssi->dma_params_tx.dma_req_name = "tx0";
+ }
platform_set_drvdata(pdev, ssi);
@@ -673,6 +739,7 @@ static struct platform_driver imx_ssi_driver = {
.driver = {
.name = "imx-ssi",
.owner = THIS_MODULE,
+ .of_match_table = imx_ssi_of_dev_id,
},
};
--
1.8.1.5
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support
2013-03-10 18:33 ` [PATCH 10/10] ASoC: imx-ssi: Add imx27 and pca100 DT support Markus Pargmann
@ 2013-03-10 18:55 ` Alexander Shiyan
0 siblings, 0 replies; 35+ messages in thread
From: Alexander Shiyan @ 2013-03-10 18:55 UTC (permalink / raw)
To: Markus Pargmann
Cc: Fabio Estevam, alsa-devel, devicetree-discuss, Mark Brown,
Liam Girdwood, Grant Likely, Sascha Hauer, Shawn Guo, Timur Tabi,
linux-arm-kernel
Hello.
> Add devicetree bindings for generic imx-ssi support and specifically for
> pca100 with two custom reset functions. At the moment those functions
> are defined in mach-pca100.c. So until DT is the only method for
> booting, the ac97 reset functions have to be exported in mach-pca100.c.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
...
> + if (of_property_read_bool(pdev->dev.of_node, "imx-ssi-net"))
> + ssi->flags |= IMX_SSI_NET;
This line does not make sense until the patch is not applied:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/106482.html
---
^ permalink raw reply [flat|nested] 35+ messages in thread