diff options
| -rw-r--r-- | sound/soc/ux500/ux500_msp_dai.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index bc042cce115f..f4d607a72668 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 | ||
