diff options
| -rw-r--r-- | sound/soc/davinci/davinci-evm.c | 22 | ||||
| -rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 21 | ||||
| -rw-r--r-- | sound/soc/davinci/edma-pcm.c | 57 | ||||
| -rw-r--r-- | sound/soc/davinci/edma-pcm.h | 25 |
4 files changed, 106 insertions, 19 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 621e9a997d4c..cab98a580053 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
| @@ -123,35 +123,29 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
| 123 | /* Logic for a aic3x as connected on a davinci-evm */ | 123 | /* Logic for a aic3x as connected on a davinci-evm */ |
| 124 | static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) | 124 | static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) |
| 125 | { | 125 | { |
| 126 | struct snd_soc_card *card = rtd->card; | ||
| 126 | struct snd_soc_codec *codec = rtd->codec; | 127 | struct snd_soc_codec *codec = rtd->codec; |
| 127 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
| 128 | struct device_node *np = codec->card->dev->of_node; | 128 | struct device_node *np = codec->card->dev->of_node; |
| 129 | int ret; | 129 | int ret; |
| 130 | 130 | ||
| 131 | /* Add davinci-evm specific widgets */ | 131 | /* Add davinci-evm specific widgets */ |
| 132 | snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, | 132 | snd_soc_dapm_new_controls(&card->dapm, aic3x_dapm_widgets, |
| 133 | ARRAY_SIZE(aic3x_dapm_widgets)); | 133 | ARRAY_SIZE(aic3x_dapm_widgets)); |
| 134 | 134 | ||
| 135 | if (np) { | 135 | if (np) { |
| 136 | ret = snd_soc_of_parse_audio_routing(codec->card, | 136 | ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing"); |
| 137 | "ti,audio-routing"); | ||
| 138 | if (ret) | 137 | if (ret) |
| 139 | return ret; | 138 | return ret; |
| 140 | } else { | 139 | } else { |
| 141 | /* Set up davinci-evm specific audio path audio_map */ | 140 | /* Set up davinci-evm specific audio path audio_map */ |
| 142 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | 141 | snd_soc_dapm_add_routes(&card->dapm, audio_map, |
| 142 | ARRAY_SIZE(audio_map)); | ||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | /* not connected */ | 145 | /* not connected */ |
| 146 | snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); | 146 | snd_soc_dapm_nc_pin(&codec->dapm, "MONO_LOUT"); |
| 147 | snd_soc_dapm_disable_pin(dapm, "HPLCOM"); | 147 | snd_soc_dapm_nc_pin(&codec->dapm, "HPLCOM"); |
| 148 | snd_soc_dapm_disable_pin(dapm, "HPRCOM"); | 148 | snd_soc_dapm_nc_pin(&codec->dapm, "HPRCOM"); |
| 149 | |||
| 150 | /* always connected */ | ||
| 151 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); | ||
| 152 | snd_soc_dapm_enable_pin(dapm, "Line Out"); | ||
| 153 | snd_soc_dapm_enable_pin(dapm, "Mic Jack"); | ||
| 154 | snd_soc_dapm_enable_pin(dapm, "Line In"); | ||
| 155 | 149 | ||
| 156 | return 0; | 150 | return 0; |
| 157 | } | 151 | } |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b0ae0677f023..a01ae97c90aa 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
| @@ -1026,6 +1026,7 @@ nodata: | |||
| 1026 | static int davinci_mcasp_probe(struct platform_device *pdev) | 1026 | static int davinci_mcasp_probe(struct platform_device *pdev) |
| 1027 | { | 1027 | { |
| 1028 | struct davinci_pcm_dma_params *dma_params; | 1028 | struct davinci_pcm_dma_params *dma_params; |
| 1029 | struct snd_dmaengine_dai_dma_data *dma_data; | ||
| 1029 | struct resource *mem, *ioarea, *res, *dat; | 1030 | struct resource *mem, *ioarea, *res, *dat; |
| 1030 | struct davinci_mcasp_pdata *pdata; | 1031 | struct davinci_mcasp_pdata *pdata; |
| 1031 | struct davinci_mcasp *mcasp; | 1032 | struct davinci_mcasp *mcasp; |
| @@ -1095,6 +1096,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
| 1095 | mcasp->dat_port = true; | 1096 | mcasp->dat_port = true; |
| 1096 | 1097 | ||
| 1097 | dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; | 1098 | dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; |
| 1099 | dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK]; | ||
| 1098 | dma_params->asp_chan_q = pdata->asp_chan_q; | 1100 | dma_params->asp_chan_q = pdata->asp_chan_q; |
| 1099 | dma_params->ram_chan_q = pdata->ram_chan_q; | 1101 | dma_params->ram_chan_q = pdata->ram_chan_q; |
| 1100 | dma_params->sram_pool = pdata->sram_pool; | 1102 | dma_params->sram_pool = pdata->sram_pool; |
| @@ -1105,7 +1107,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
| 1105 | dma_params->dma_addr = mem->start + pdata->tx_dma_offset; | 1107 | dma_params->dma_addr = mem->start + pdata->tx_dma_offset; |
| 1106 | 1108 | ||
| 1107 | /* Unconditional dmaengine stuff */ | 1109 | /* Unconditional dmaengine stuff */ |
| 1108 | mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr = dma_params->dma_addr; | 1110 | dma_data->addr = dma_params->dma_addr; |
| 1109 | 1111 | ||
| 1110 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 1112 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
| 1111 | if (res) | 1113 | if (res) |
| @@ -1113,7 +1115,14 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
| 1113 | else | 1115 | else |
| 1114 | dma_params->channel = pdata->tx_dma_channel; | 1116 | dma_params->channel = pdata->tx_dma_channel; |
| 1115 | 1117 | ||
| 1118 | /* dmaengine filter data for DT and non-DT boot */ | ||
| 1119 | if (pdev->dev.of_node) | ||
| 1120 | dma_data->filter_data = "tx"; | ||
| 1121 | else | ||
| 1122 | dma_data->filter_data = &dma_params->channel; | ||
| 1123 | |||
| 1116 | dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE]; | 1124 | dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE]; |
| 1125 | dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE]; | ||
| 1117 | dma_params->asp_chan_q = pdata->asp_chan_q; | 1126 | dma_params->asp_chan_q = pdata->asp_chan_q; |
| 1118 | dma_params->ram_chan_q = pdata->ram_chan_q; | 1127 | dma_params->ram_chan_q = pdata->ram_chan_q; |
| 1119 | dma_params->sram_pool = pdata->sram_pool; | 1128 | dma_params->sram_pool = pdata->sram_pool; |
| @@ -1124,7 +1133,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
| 1124 | dma_params->dma_addr = mem->start + pdata->rx_dma_offset; | 1133 | dma_params->dma_addr = mem->start + pdata->rx_dma_offset; |
| 1125 | 1134 | ||
| 1126 | /* Unconditional dmaengine stuff */ | 1135 | /* Unconditional dmaengine stuff */ |
| 1127 | mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE].addr = dma_params->dma_addr; | 1136 | dma_data->addr = dma_params->dma_addr; |
| 1128 | 1137 | ||
| 1129 | if (mcasp->version < MCASP_VERSION_3) { | 1138 | if (mcasp->version < MCASP_VERSION_3) { |
| 1130 | mcasp->fifo_base = DAVINCI_MCASP_V2_AFIFO_BASE; | 1139 | mcasp->fifo_base = DAVINCI_MCASP_V2_AFIFO_BASE; |
| @@ -1140,9 +1149,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
| 1140 | else | 1149 | else |
| 1141 | dma_params->channel = pdata->rx_dma_channel; | 1150 | dma_params->channel = pdata->rx_dma_channel; |
| 1142 | 1151 | ||
| 1143 | /* Unconditional dmaengine stuff */ | 1152 | /* dmaengine filter data for DT and non-DT boot */ |
| 1144 | mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK].filter_data = "tx"; | 1153 | if (pdev->dev.of_node) |
| 1145 | mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE].filter_data = "rx"; | 1154 | dma_data->filter_data = "rx"; |
| 1155 | else | ||
| 1156 | dma_data->filter_data = &dma_params->channel; | ||
| 1146 | 1157 | ||
| 1147 | dev_set_drvdata(&pdev->dev, mcasp); | 1158 | dev_set_drvdata(&pdev->dev, mcasp); |
| 1148 | 1159 | ||
diff --git a/sound/soc/davinci/edma-pcm.c b/sound/soc/davinci/edma-pcm.c new file mode 100644 index 000000000000..d38afb1c61ae --- /dev/null +++ b/sound/soc/davinci/edma-pcm.c | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * edma-pcm.c - eDMA PCM driver using dmaengine for AM3xxx, AM4xxx | ||
| 3 | * | ||
| 4 | * Copyright (C) 2014 Texas Instruments, Inc. | ||
| 5 | * | ||
| 6 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
| 7 | * | ||
| 8 | * Based on: sound/soc/tegra/tegra_pcm.c | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU General Public License | ||
| 12 | * version 2 as published by the Free Software Foundation. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, but | ||
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 17 | * General Public License for more details. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/module.h> | ||
| 21 | #include <sound/core.h> | ||
| 22 | #include <sound/pcm.h> | ||
| 23 | #include <sound/pcm_params.h> | ||
| 24 | #include <sound/soc.h> | ||
| 25 | #include <sound/dmaengine_pcm.h> | ||
| 26 | #include <linux/edma.h> | ||
| 27 | |||
| 28 | static const struct snd_pcm_hardware edma_pcm_hardware = { | ||
| 29 | .info = SNDRV_PCM_INFO_MMAP | | ||
| 30 | SNDRV_PCM_INFO_MMAP_VALID | | ||
| 31 | SNDRV_PCM_INFO_BATCH | | ||
| 32 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME | | ||
| 33 | SNDRV_PCM_INFO_INTERLEAVED, | ||
| 34 | .buffer_bytes_max = 128 * 1024, | ||
| 35 | .period_bytes_min = 32, | ||
| 36 | .period_bytes_max = 64 * 1024, | ||
| 37 | .periods_min = 2, | ||
| 38 | .periods_max = 19, /* Limit by edma dmaengine driver */ | ||
| 39 | }; | ||
| 40 | |||
| 41 | static const struct snd_dmaengine_pcm_config edma_dmaengine_pcm_config = { | ||
| 42 | .pcm_hardware = &edma_pcm_hardware, | ||
| 43 | .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, | ||
| 44 | .compat_filter_fn = edma_filter_fn, | ||
| 45 | .prealloc_buffer_size = 128 * 1024, | ||
| 46 | }; | ||
| 47 | |||
| 48 | int edma_pcm_platform_register(struct device *dev) | ||
| 49 | { | ||
| 50 | return devm_snd_dmaengine_pcm_register(dev, &edma_dmaengine_pcm_config, | ||
| 51 | SND_DMAENGINE_PCM_FLAG_COMPAT); | ||
| 52 | } | ||
| 53 | EXPORT_SYMBOL_GPL(edma_pcm_platform_register); | ||
| 54 | |||
| 55 | MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>"); | ||
| 56 | MODULE_DESCRIPTION("eDMA PCM ASoC platform driver"); | ||
| 57 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/davinci/edma-pcm.h b/sound/soc/davinci/edma-pcm.h new file mode 100644 index 000000000000..894c378c0f74 --- /dev/null +++ b/sound/soc/davinci/edma-pcm.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | * edma-pcm.h - eDMA PCM driver using dmaengine for AM3xxx, AM4xxx | ||
| 3 | * | ||
| 4 | * Copyright (C) 2014 Texas Instruments, Inc. | ||
| 5 | * | ||
| 6 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
| 7 | * | ||
| 8 | * Based on: sound/soc/tegra/tegra_pcm.h | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU General Public License | ||
| 12 | * version 2 as published by the Free Software Foundation. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, but | ||
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 17 | * General Public License for more details. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __EDMA_PCM_H__ | ||
| 21 | #define __EDMA_PCM_H__ | ||
| 22 | |||
| 23 | int edma_pcm_platform_register(struct device *dev); | ||
| 24 | |||
| 25 | #endif /* __EDMA_PCM_H__ */ | ||
