diff options
Diffstat (limited to 'sound/soc/ux500')
-rw-r--r-- | sound/soc/ux500/mop500.c | 2 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_dai.c | 146 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_i2s.c | 56 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_pcm.c | 65 |
5 files changed, 137 insertions, 134 deletions
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c index 178d1bad6259..b3b66aa98dce 100644 --- a/sound/soc/ux500/mop500.c +++ b/sound/soc/ux500/mop500.c | |||
@@ -91,6 +91,8 @@ static int mop500_of_probe(struct platform_device *pdev, | |||
91 | for (i = 0; i < 2; i++) { | 91 | for (i = 0; i < 2; i++) { |
92 | mop500_dai_links[i].cpu_of_node = msp_np[i]; | 92 | mop500_dai_links[i].cpu_of_node = msp_np[i]; |
93 | mop500_dai_links[i].cpu_dai_name = NULL; | 93 | mop500_dai_links[i].cpu_dai_name = NULL; |
94 | mop500_dai_links[i].platform_of_node = msp_np[i]; | ||
95 | mop500_dai_links[i].platform_name = NULL; | ||
94 | mop500_dai_links[i].codec_of_node = codec_np; | 96 | mop500_dai_links[i].codec_of_node = codec_np; |
95 | mop500_dai_links[i].codec_name = NULL; | 97 | mop500_dai_links[i].codec_name = NULL; |
96 | } | 98 | } |
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index c6fb5cce980e..5f4807b2c007 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c | |||
@@ -17,12 +17,14 @@ | |||
17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/of.h> | ||
20 | #include <linux/regulator/consumer.h> | 21 | #include <linux/regulator/consumer.h> |
21 | #include <linux/mfd/dbx500-prcmu.h> | 22 | #include <linux/mfd/dbx500-prcmu.h> |
22 | #include <linux/platform_data/asoc-ux500-msp.h> | 23 | #include <linux/platform_data/asoc-ux500-msp.h> |
23 | 24 | ||
24 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
25 | #include <sound/soc-dai.h> | 26 | #include <sound/soc-dai.h> |
27 | #include <sound/dmaengine_pcm.h> | ||
26 | 28 | ||
27 | #include "ux500_msp_i2s.h" | 29 | #include "ux500_msp_i2s.h" |
28 | #include "ux500_msp_dai.h" | 30 | #include "ux500_msp_dai.h" |
@@ -654,16 +656,52 @@ static int ux500_msp_dai_trigger(struct snd_pcm_substream *substream, | |||
654 | return ret; | 656 | return ret; |
655 | } | 657 | } |
656 | 658 | ||
659 | static int ux500_msp_dai_of_probe(struct snd_soc_dai *dai) | ||
660 | { | ||
661 | struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); | ||
662 | struct snd_dmaengine_dai_dma_data *playback_dma_data; | ||
663 | struct snd_dmaengine_dai_dma_data *capture_dma_data; | ||
664 | |||
665 | playback_dma_data = devm_kzalloc(dai->dev, | ||
666 | sizeof(*playback_dma_data), | ||
667 | GFP_KERNEL); | ||
668 | if (!playback_dma_data) | ||
669 | return -ENOMEM; | ||
670 | |||
671 | capture_dma_data = devm_kzalloc(dai->dev, | ||
672 | sizeof(*capture_dma_data), | ||
673 | GFP_KERNEL); | ||
674 | if (!capture_dma_data) | ||
675 | return -ENOMEM; | ||
676 | |||
677 | playback_dma_data->addr = drvdata->msp->playback_dma_data.tx_rx_addr; | ||
678 | capture_dma_data->addr = drvdata->msp->capture_dma_data.tx_rx_addr; | ||
679 | |||
680 | playback_dma_data->maxburst = 4; | ||
681 | capture_dma_data->maxburst = 4; | ||
682 | |||
683 | snd_soc_dai_init_dma_data(dai, playback_dma_data, capture_dma_data); | ||
684 | |||
685 | return 0; | ||
686 | } | ||
687 | |||
657 | static int ux500_msp_dai_probe(struct snd_soc_dai *dai) | 688 | static int ux500_msp_dai_probe(struct snd_soc_dai *dai) |
658 | { | 689 | { |
659 | struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); | 690 | struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev); |
691 | struct msp_i2s_platform_data *pdata = dai->dev->platform_data; | ||
692 | int ret; | ||
660 | 693 | ||
661 | dai->playback_dma_data = &drvdata->msp->playback_dma_data; | 694 | if (!pdata) { |
662 | dai->capture_dma_data = &drvdata->msp->capture_dma_data; | 695 | ret = ux500_msp_dai_of_probe(dai); |
696 | return ret; | ||
697 | } | ||
663 | 698 | ||
664 | drvdata->msp->playback_dma_data.data_size = drvdata->slot_width; | 699 | drvdata->msp->playback_dma_data.data_size = drvdata->slot_width; |
665 | drvdata->msp->capture_dma_data.data_size = drvdata->slot_width; | 700 | drvdata->msp->capture_dma_data.data_size = drvdata->slot_width; |
666 | 701 | ||
702 | snd_soc_dai_init_dma_data(dai, | ||
703 | &drvdata->msp->playback_dma_data, | ||
704 | &drvdata->msp->capture_dma_data); | ||
667 | return 0; | 705 | return 0; |
668 | } | 706 | } |
669 | 707 | ||
@@ -680,87 +718,19 @@ static struct snd_soc_dai_ops ux500_msp_dai_ops[] = { | |||
680 | } | 718 | } |
681 | }; | 719 | }; |
682 | 720 | ||
683 | static struct snd_soc_dai_driver ux500_msp_dai_drv[UX500_NBR_OF_DAI] = { | 721 | static struct snd_soc_dai_driver ux500_msp_dai_drv = { |
684 | { | 722 | .probe = ux500_msp_dai_probe, |
685 | .name = "ux500-msp-i2s.0", | 723 | .suspend = NULL, |
686 | .probe = ux500_msp_dai_probe, | 724 | .resume = NULL, |
687 | .id = 0, | 725 | .playback.channels_min = UX500_MSP_MIN_CHANNELS, |
688 | .suspend = NULL, | 726 | .playback.channels_max = UX500_MSP_MAX_CHANNELS, |
689 | .resume = NULL, | 727 | .playback.rates = UX500_I2S_RATES, |
690 | .playback = { | 728 | .playback.formats = UX500_I2S_FORMATS, |
691 | .channels_min = UX500_MSP_MIN_CHANNELS, | 729 | .capture.channels_min = UX500_MSP_MIN_CHANNELS, |
692 | .channels_max = UX500_MSP_MAX_CHANNELS, | 730 | .capture.channels_max = UX500_MSP_MAX_CHANNELS, |
693 | .rates = UX500_I2S_RATES, | 731 | .capture.rates = UX500_I2S_RATES, |
694 | .formats = UX500_I2S_FORMATS, | 732 | .capture.formats = UX500_I2S_FORMATS, |
695 | }, | 733 | .ops = ux500_msp_dai_ops, |
696 | .capture = { | ||
697 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
698 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
699 | .rates = UX500_I2S_RATES, | ||
700 | .formats = UX500_I2S_FORMATS, | ||
701 | }, | ||
702 | .ops = ux500_msp_dai_ops, | ||
703 | }, | ||
704 | { | ||
705 | .name = "ux500-msp-i2s.1", | ||
706 | .probe = ux500_msp_dai_probe, | ||
707 | .id = 1, | ||
708 | .suspend = NULL, | ||
709 | .resume = NULL, | ||
710 | .playback = { | ||
711 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
712 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
713 | .rates = UX500_I2S_RATES, | ||
714 | .formats = UX500_I2S_FORMATS, | ||
715 | }, | ||
716 | .capture = { | ||
717 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
718 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
719 | .rates = UX500_I2S_RATES, | ||
720 | .formats = UX500_I2S_FORMATS, | ||
721 | }, | ||
722 | .ops = ux500_msp_dai_ops, | ||
723 | }, | ||
724 | { | ||
725 | .name = "ux500-msp-i2s.2", | ||
726 | .id = 2, | ||
727 | .probe = ux500_msp_dai_probe, | ||
728 | .suspend = NULL, | ||
729 | .resume = NULL, | ||
730 | .playback = { | ||
731 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
732 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
733 | .rates = UX500_I2S_RATES, | ||
734 | .formats = UX500_I2S_FORMATS, | ||
735 | }, | ||
736 | .capture = { | ||
737 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
738 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
739 | .rates = UX500_I2S_RATES, | ||
740 | .formats = UX500_I2S_FORMATS, | ||
741 | }, | ||
742 | .ops = ux500_msp_dai_ops, | ||
743 | }, | ||
744 | { | ||
745 | .name = "ux500-msp-i2s.3", | ||
746 | .probe = ux500_msp_dai_probe, | ||
747 | .id = 3, | ||
748 | .suspend = NULL, | ||
749 | .resume = NULL, | ||
750 | .playback = { | ||
751 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
752 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
753 | .rates = UX500_I2S_RATES, | ||
754 | .formats = UX500_I2S_FORMATS, | ||
755 | }, | ||
756 | .capture = { | ||
757 | .channels_min = UX500_MSP_MIN_CHANNELS, | ||
758 | .channels_max = UX500_MSP_MAX_CHANNELS, | ||
759 | .rates = UX500_I2S_RATES, | ||
760 | .formats = UX500_I2S_FORMATS, | ||
761 | }, | ||
762 | .ops = ux500_msp_dai_ops, | ||
763 | }, | ||
764 | }; | 734 | }; |
765 | 735 | ||
766 | static const struct snd_soc_component_driver ux500_msp_component = { | 736 | static const struct snd_soc_component_driver ux500_msp_component = { |
@@ -771,10 +741,14 @@ static const struct snd_soc_component_driver ux500_msp_component = { | |||
771 | static int ux500_msp_drv_probe(struct platform_device *pdev) | 741 | static int ux500_msp_drv_probe(struct platform_device *pdev) |
772 | { | 742 | { |
773 | struct ux500_msp_i2s_drvdata *drvdata; | 743 | struct ux500_msp_i2s_drvdata *drvdata; |
744 | struct msp_i2s_platform_data *pdata = pdev->dev.platform_data; | ||
745 | struct device_node *np = pdev->dev.of_node; | ||
774 | int ret = 0; | 746 | int ret = 0; |
775 | 747 | ||
776 | dev_dbg(&pdev->dev, "%s: Enter (pdev->name = %s).\n", __func__, | 748 | if (!pdata && !np) { |
777 | pdev->name); | 749 | dev_err(&pdev->dev, "No platform data or Device Tree found\n"); |
750 | return -ENODEV; | ||
751 | } | ||
778 | 752 | ||
779 | drvdata = devm_kzalloc(&pdev->dev, | 753 | drvdata = devm_kzalloc(&pdev->dev, |
780 | sizeof(struct ux500_msp_i2s_drvdata), | 754 | sizeof(struct ux500_msp_i2s_drvdata), |
@@ -826,7 +800,7 @@ static int ux500_msp_drv_probe(struct platform_device *pdev) | |||
826 | dev_set_drvdata(&pdev->dev, drvdata); | 800 | dev_set_drvdata(&pdev->dev, drvdata); |
827 | 801 | ||
828 | ret = snd_soc_register_component(&pdev->dev, &ux500_msp_component, | 802 | ret = snd_soc_register_component(&pdev->dev, &ux500_msp_component, |
829 | &ux500_msp_dai_drv[drvdata->msp->id], 1); | 803 | &ux500_msp_dai_drv, 1); |
830 | if (ret < 0) { | 804 | if (ret < 0) { |
831 | dev_err(&pdev->dev, "Error: %s: Failed to register MSP%d!\n", | 805 | dev_err(&pdev->dev, "Error: %s: Failed to register MSP%d!\n", |
832 | __func__, drvdata->msp->id); | 806 | __func__, drvdata->msp->id); |
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 1ca8b08ae993..959d7b4edf56 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c | |||
@@ -646,6 +646,34 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) | |||
646 | 646 | ||
647 | } | 647 | } |
648 | 648 | ||
649 | static int ux500_msp_i2s_of_init_msp(struct platform_device *pdev, | ||
650 | struct ux500_msp *msp, | ||
651 | struct msp_i2s_platform_data **platform_data) | ||
652 | { | ||
653 | struct msp_i2s_platform_data *pdata; | ||
654 | |||
655 | *platform_data = devm_kzalloc(&pdev->dev, | ||
656 | sizeof(struct msp_i2s_platform_data), | ||
657 | GFP_KERNEL); | ||
658 | pdata = *platform_data; | ||
659 | if (!pdata) | ||
660 | return -ENOMEM; | ||
661 | |||
662 | msp->playback_dma_data.dma_cfg = devm_kzalloc(&pdev->dev, | ||
663 | sizeof(struct stedma40_chan_cfg), | ||
664 | GFP_KERNEL); | ||
665 | if (!msp->playback_dma_data.dma_cfg) | ||
666 | return -ENOMEM; | ||
667 | |||
668 | msp->capture_dma_data.dma_cfg = devm_kzalloc(&pdev->dev, | ||
669 | sizeof(struct stedma40_chan_cfg), | ||
670 | GFP_KERNEL); | ||
671 | if (!msp->capture_dma_data.dma_cfg) | ||
672 | return -ENOMEM; | ||
673 | |||
674 | return 0; | ||
675 | } | ||
676 | |||
649 | int ux500_msp_i2s_init_msp(struct platform_device *pdev, | 677 | int ux500_msp_i2s_init_msp(struct platform_device *pdev, |
650 | struct ux500_msp **msp_p, | 678 | struct ux500_msp **msp_p, |
651 | struct msp_i2s_platform_data *platform_data) | 679 | struct msp_i2s_platform_data *platform_data) |
@@ -653,30 +681,28 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
653 | struct resource *res = NULL; | 681 | struct resource *res = NULL; |
654 | struct device_node *np = pdev->dev.of_node; | 682 | struct device_node *np = pdev->dev.of_node; |
655 | struct ux500_msp *msp; | 683 | struct ux500_msp *msp; |
684 | int ret; | ||
656 | 685 | ||
657 | *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); | 686 | *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); |
658 | msp = *msp_p; | 687 | msp = *msp_p; |
659 | if (!msp) | 688 | if (!msp) |
660 | return -ENOMEM; | 689 | return -ENOMEM; |
661 | 690 | ||
662 | if (np) { | 691 | if (!platform_data) { |
663 | if (!platform_data) { | 692 | if (np) { |
664 | platform_data = devm_kzalloc(&pdev->dev, | 693 | ret = ux500_msp_i2s_of_init_msp(pdev, msp, |
665 | sizeof(struct msp_i2s_platform_data), GFP_KERNEL); | 694 | &platform_data); |
666 | if (!platform_data) | 695 | if (ret) |
667 | return -ENOMEM; | 696 | return ret; |
668 | } | 697 | } else |
669 | } else | ||
670 | if (!platform_data) | ||
671 | return -EINVAL; | 698 | return -EINVAL; |
699 | } else { | ||
700 | msp->playback_dma_data.dma_cfg = platform_data->msp_i2s_dma_tx; | ||
701 | msp->capture_dma_data.dma_cfg = platform_data->msp_i2s_dma_rx; | ||
702 | msp->id = platform_data->id; | ||
703 | } | ||
672 | 704 | ||
673 | dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__, | ||
674 | pdev->name, platform_data->id); | ||
675 | |||
676 | msp->id = platform_data->id; | ||
677 | msp->dev = &pdev->dev; | 705 | msp->dev = &pdev->dev; |
678 | msp->playback_dma_data.dma_cfg = platform_data->msp_i2s_dma_tx; | ||
679 | msp->capture_dma_data.dma_cfg = platform_data->msp_i2s_dma_rx; | ||
680 | 706 | ||
681 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 707 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
682 | if (res == NULL) { | 708 | if (res == NULL) { |
diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h index 258d0bcee0bd..875de0f68b85 100644 --- a/sound/soc/ux500/ux500_msp_i2s.h +++ b/sound/soc/ux500/ux500_msp_i2s.h | |||
@@ -475,7 +475,7 @@ struct ux500_msp_dma_params { | |||
475 | }; | 475 | }; |
476 | 476 | ||
477 | struct ux500_msp { | 477 | struct ux500_msp { |
478 | enum msp_i2s_id id; | 478 | int id; |
479 | void __iomem *registers; | 479 | void __iomem *registers; |
480 | struct device *dev; | 480 | struct device *dev; |
481 | struct ux500_msp_dma_params playback_dma_data; | 481 | struct ux500_msp_dma_params playback_dma_data; |
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index ce554de5d9dc..51a66a87305a 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c | |||
@@ -28,12 +28,6 @@ | |||
28 | #include "ux500_msp_i2s.h" | 28 | #include "ux500_msp_i2s.h" |
29 | #include "ux500_pcm.h" | 29 | #include "ux500_pcm.h" |
30 | 30 | ||
31 | #define UX500_PLATFORM_MIN_RATE 8000 | ||
32 | #define UX500_PLATFORM_MAX_RATE 48000 | ||
33 | |||
34 | #define UX500_PLATFORM_MIN_CHANNELS 1 | ||
35 | #define UX500_PLATFORM_MAX_CHANNELS 8 | ||
36 | |||
37 | #define UX500_PLATFORM_PERIODS_BYTES_MIN 128 | 31 | #define UX500_PLATFORM_PERIODS_BYTES_MIN 128 |
38 | #define UX500_PLATFORM_PERIODS_BYTES_MAX (64 * PAGE_SIZE) | 32 | #define UX500_PLATFORM_PERIODS_BYTES_MAX (64 * PAGE_SIZE) |
39 | #define UX500_PLATFORM_PERIODS_MIN 2 | 33 | #define UX500_PLATFORM_PERIODS_MIN 2 |
@@ -45,15 +39,6 @@ static const struct snd_pcm_hardware ux500_pcm_hw = { | |||
45 | SNDRV_PCM_INFO_MMAP | | 39 | SNDRV_PCM_INFO_MMAP | |
46 | SNDRV_PCM_INFO_RESUME | | 40 | SNDRV_PCM_INFO_RESUME | |
47 | SNDRV_PCM_INFO_PAUSE, | 41 | SNDRV_PCM_INFO_PAUSE, |
48 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | ||
49 | SNDRV_PCM_FMTBIT_U16_LE | | ||
50 | SNDRV_PCM_FMTBIT_S16_BE | | ||
51 | SNDRV_PCM_FMTBIT_U16_BE, | ||
52 | .rates = SNDRV_PCM_RATE_KNOT, | ||
53 | .rate_min = UX500_PLATFORM_MIN_RATE, | ||
54 | .rate_max = UX500_PLATFORM_MAX_RATE, | ||
55 | .channels_min = UX500_PLATFORM_MIN_CHANNELS, | ||
56 | .channels_max = UX500_PLATFORM_MAX_CHANNELS, | ||
57 | .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, | 42 | .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, |
58 | .period_bytes_min = UX500_PLATFORM_PERIODS_BYTES_MIN, | 43 | .period_bytes_min = UX500_PLATFORM_PERIODS_BYTES_MIN, |
59 | .period_bytes_max = UX500_PLATFORM_PERIODS_BYTES_MAX, | 44 | .period_bytes_max = UX500_PLATFORM_PERIODS_BYTES_MAX, |
@@ -65,14 +50,10 @@ static struct dma_chan *ux500_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, | |||
65 | struct snd_pcm_substream *substream) | 50 | struct snd_pcm_substream *substream) |
66 | { | 51 | { |
67 | struct snd_soc_dai *dai = rtd->cpu_dai; | 52 | struct snd_soc_dai *dai = rtd->cpu_dai; |
68 | struct device *dev = dai->dev; | ||
69 | u16 per_data_width, mem_data_width; | 53 | u16 per_data_width, mem_data_width; |
70 | struct stedma40_chan_cfg *dma_cfg; | 54 | struct stedma40_chan_cfg *dma_cfg; |
71 | struct ux500_msp_dma_params *dma_params; | 55 | struct ux500_msp_dma_params *dma_params; |
72 | 56 | ||
73 | dev_dbg(dev, "%s: MSP %d (%s): Enter.\n", __func__, dai->id, | ||
74 | snd_pcm_stream_str(substream)); | ||
75 | |||
76 | dma_params = snd_soc_dai_get_dma_data(dai, substream); | 57 | dma_params = snd_soc_dai_get_dma_data(dai, substream); |
77 | dma_cfg = dma_params->dma_cfg; | 58 | dma_cfg = dma_params->dma_cfg; |
78 | 59 | ||
@@ -108,26 +89,36 @@ static int ux500_pcm_prepare_slave_config(struct snd_pcm_substream *substream, | |||
108 | struct dma_slave_config *slave_config) | 89 | struct dma_slave_config *slave_config) |
109 | { | 90 | { |
110 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 91 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
111 | struct ux500_msp_dma_params *dma_params; | 92 | struct msp_i2s_platform_data *pdata = rtd->cpu_dai->dev->platform_data; |
112 | struct stedma40_chan_cfg *dma_cfg; | 93 | struct snd_dmaengine_dai_dma_data *snd_dma_params; |
94 | struct ux500_msp_dma_params *ste_dma_params; | ||
95 | dma_addr_t dma_addr; | ||
113 | int ret; | 96 | int ret; |
114 | 97 | ||
115 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 98 | if (pdata) { |
116 | dma_cfg = dma_params->dma_cfg; | 99 | ste_dma_params = |
100 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
101 | dma_addr = ste_dma_params->tx_rx_addr; | ||
102 | } else { | ||
103 | snd_dma_params = | ||
104 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
105 | dma_addr = snd_dma_params->addr; | ||
106 | } | ||
117 | 107 | ||
118 | ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); | 108 | ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); |
119 | if (ret) | 109 | if (ret) |
120 | return ret; | 110 | return ret; |
121 | 111 | ||
122 | slave_config->dst_maxburst = 4; | 112 | slave_config->dst_maxburst = 4; |
123 | slave_config->dst_addr_width = dma_cfg->dst_info.data_width; | ||
124 | slave_config->src_maxburst = 4; | 113 | slave_config->src_maxburst = 4; |
125 | slave_config->src_addr_width = dma_cfg->src_info.data_width; | 114 | |
115 | slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | ||
116 | slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | ||
126 | 117 | ||
127 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 118 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
128 | slave_config->dst_addr = dma_params->tx_rx_addr; | 119 | slave_config->dst_addr = dma_addr; |
129 | else | 120 | else |
130 | slave_config->src_addr = dma_params->tx_rx_addr; | 121 | slave_config->src_addr = dma_addr; |
131 | 122 | ||
132 | return 0; | 123 | return 0; |
133 | } | 124 | } |
@@ -139,15 +130,25 @@ static const struct snd_dmaengine_pcm_config ux500_dmaengine_pcm_config = { | |||
139 | .prepare_slave_config = ux500_pcm_prepare_slave_config, | 130 | .prepare_slave_config = ux500_pcm_prepare_slave_config, |
140 | }; | 131 | }; |
141 | 132 | ||
133 | static const struct snd_dmaengine_pcm_config ux500_dmaengine_of_pcm_config = { | ||
134 | .compat_request_channel = ux500_pcm_request_chan, | ||
135 | .prepare_slave_config = ux500_pcm_prepare_slave_config, | ||
136 | }; | ||
137 | |||
142 | int ux500_pcm_register_platform(struct platform_device *pdev) | 138 | int ux500_pcm_register_platform(struct platform_device *pdev) |
143 | { | 139 | { |
140 | const struct snd_dmaengine_pcm_config *pcm_config; | ||
141 | struct device_node *np = pdev->dev.of_node; | ||
144 | int ret; | 142 | int ret; |
145 | 143 | ||
146 | ret = snd_dmaengine_pcm_register(&pdev->dev, | 144 | if (np) |
147 | &ux500_dmaengine_pcm_config, | 145 | pcm_config = &ux500_dmaengine_of_pcm_config; |
148 | SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | | 146 | else |
149 | SND_DMAENGINE_PCM_FLAG_COMPAT | | 147 | pcm_config = &ux500_dmaengine_pcm_config; |
150 | SND_DMAENGINE_PCM_FLAG_NO_DT); | 148 | |
149 | ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, | ||
150 | SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | | ||
151 | SND_DMAENGINE_PCM_FLAG_COMPAT); | ||
151 | if (ret < 0) { | 152 | if (ret < 0) { |
152 | dev_err(&pdev->dev, | 153 | dev_err(&pdev->dev, |
153 | "%s: ERROR: Failed to register platform '%s' (%d)!\n", | 154 | "%s: ERROR: Failed to register platform '%s' (%d)!\n", |