Commit 4f3ea08a authored by Timur Tabi's avatar Timur Tabi Committed by Jaroslav Kysela

ALSA: ASoC - fix DMA channel selection in Freescale MPC8610 sound drivers

On the Freescale MPC8610, SSI1 is hard-coded to use DMA channels 0 and 1
for playback and capture, and SSI2 is hard-coded to use DMA channels 2 and 3.
This patch fixes the fabric driver so that it uses the right channels.
Signed-off-by: default avatarTimur Tabi <timur@freescale.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent e88ba015
...@@ -68,10 +68,6 @@ static int mpc8610_hpcd_machine_probe(struct platform_device *sound_device) ...@@ -68,10 +68,6 @@ static int mpc8610_hpcd_machine_probe(struct platform_device *sound_device)
guts_set_pmuxcr_dma(machine_data->guts, machine_data->dma_id, guts_set_pmuxcr_dma(machine_data->guts, machine_data->dma_id,
machine_data->dma_channel_id[1], 0); machine_data->dma_channel_id[1], 0);
guts_set_pmuxcr_dma(machine_data->guts, 1, 0, 0);
guts_set_pmuxcr_dma(machine_data->guts, 1, 3, 0);
guts_set_pmuxcr_dma(machine_data->guts, 0, 3, 0);
switch (machine_data->ssi_id) { switch (machine_data->ssi_id) {
case 0: case 0:
clrsetbits_be32(&machine_data->guts->pmuxcr, clrsetbits_be32(&machine_data->guts->pmuxcr,
...@@ -230,6 +226,8 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev, ...@@ -230,6 +226,8 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
struct fsl_ssi_info ssi_info; struct fsl_ssi_info ssi_info;
struct fsl_dma_info dma_info; struct fsl_dma_info dma_info;
int ret = -ENODEV; int ret = -ENODEV;
unsigned int playback_dma_channel;
unsigned int capture_dma_channel;
machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL); machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL);
if (!machine_data) if (!machine_data)
...@@ -381,8 +379,9 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev, ...@@ -381,8 +379,9 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
goto error; goto error;
} }
/* Find the DMA channels to use. For now, we always use the first DMA /* Find the DMA channels to use. Both SSIs need to use the same DMA
controller. */ * controller, so let's use DMA#1.
*/
for_each_compatible_node(dma_np, NULL, "fsl,mpc8610-dma") { for_each_compatible_node(dma_np, NULL, "fsl,mpc8610-dma") {
iprop = of_get_property(dma_np, "cell-index", NULL); iprop = of_get_property(dma_np, "cell-index", NULL);
if (iprop && (*iprop == 0)) { if (iprop && (*iprop == 0)) {
...@@ -397,14 +396,19 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev, ...@@ -397,14 +396,19 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
} }
machine_data->dma_id = *iprop; machine_data->dma_id = *iprop;
/* SSI1 needs to use DMA Channels 0 and 1, and SSI2 needs to use DMA
* channels 2 and 3. This is just how the MPC8610 is wired
* internally.
*/
playback_dma_channel = (machine_data->ssi_id == 0) ? 0 : 2;
capture_dma_channel = (machine_data->ssi_id == 0) ? 1 : 3;
/* /*
* Find the DMA channels to use. For now, we always use DMA channel 0 * Find the DMA channels to use.
* for playback, and DMA channel 1 for capture.
*/ */
while ((dma_channel_np = of_get_next_child(dma_np, dma_channel_np))) { while ((dma_channel_np = of_get_next_child(dma_np, dma_channel_np))) {
iprop = of_get_property(dma_channel_np, "cell-index", NULL); iprop = of_get_property(dma_channel_np, "cell-index", NULL);
/* Is it DMA channel 0? */ if (iprop && (*iprop == playback_dma_channel)) {
if (iprop && (*iprop == 0)) {
/* dma_channel[0] and dma_irq[0] are for playback */ /* dma_channel[0] and dma_irq[0] are for playback */
dma_info.dma_channel[0] = of_iomap(dma_channel_np, 0); dma_info.dma_channel[0] = of_iomap(dma_channel_np, 0);
dma_info.dma_irq[0] = dma_info.dma_irq[0] =
...@@ -412,7 +416,7 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev, ...@@ -412,7 +416,7 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
machine_data->dma_channel_id[0] = *iprop; machine_data->dma_channel_id[0] = *iprop;
continue; continue;
} }
if (iprop && (*iprop == 1)) { if (iprop && (*iprop == capture_dma_channel)) {
/* dma_channel[1] and dma_irq[1] are for capture */ /* dma_channel[1] and dma_irq[1] are for capture */
dma_info.dma_channel[1] = of_iomap(dma_channel_np, 0); dma_info.dma_channel[1] = of_iomap(dma_channel_np, 0);
dma_info.dma_irq[1] = dma_info.dma_irq[1] =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment