forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/atmel/atmel-pcm-dma.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * atmel-pcm-dma.c -- ALSA PCM DMA support for the Atmel SoC.
34 *
....@@ -8,20 +9,6 @@
89 * Based on atmel-pcm by:
910 * Sedji Gaouaou <sedji.gaouaou@atmel.com>
1011 * Copyright 2008 Atmel
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2 of the License, or
15
- * (at your option) any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU General Public License
23
- * along with this program; if not, write to the Free Software
24
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2512 */
2613
2714 #include <linux/module.h>
....@@ -31,7 +18,6 @@
3118 #include <linux/dma-mapping.h>
3219 #include <linux/dmaengine.h>
3320 #include <linux/atmel-ssc.h>
34
-#include <linux/platform_data/dma-atmel.h>
3521
3622 #include <sound/core.h>
3723 #include <sound/pcm.h>
....@@ -57,7 +43,7 @@
5743 .buffer_bytes_max = 512 * 1024,
5844 };
5945
60
-/**
46
+/*
6147 * atmel_pcm_dma_irq: SSC interrupt handler for DMAENGINE enabled SSC
6248 *
6349 * We use DMAENGINE to send/receive data to/from SSC so this ISR is only to
....@@ -66,10 +52,10 @@
6652 static void atmel_pcm_dma_irq(u32 ssc_sr,
6753 struct snd_pcm_substream *substream)
6854 {
69
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
55
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
7056 struct atmel_pcm_dma_params *prtd;
7157
72
- prtd = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
58
+ prtd = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
7359
7460 if (ssc_sr & prtd->mask->ssc_error) {
7561 if (snd_pcm_running(substream))
....@@ -91,12 +77,12 @@
9177 static int atmel_pcm_configure_dma(struct snd_pcm_substream *substream,
9278 struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config)
9379 {
94
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
80
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
9581 struct atmel_pcm_dma_params *prtd;
9682 struct ssc_device *ssc;
9783 int ret;
9884
99
- prtd = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
85
+ prtd = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
10086 ssc = prtd->ssc;
10187
10288 ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config);
....@@ -124,15 +110,10 @@
124110
125111 int atmel_pcm_dma_platform_register(struct device *dev)
126112 {
127
- return snd_dmaengine_pcm_register(dev, &atmel_dmaengine_pcm_config, 0);
113
+ return devm_snd_dmaengine_pcm_register(dev,
114
+ &atmel_dmaengine_pcm_config, 0);
128115 }
129116 EXPORT_SYMBOL(atmel_pcm_dma_platform_register);
130
-
131
-void atmel_pcm_dma_platform_unregister(struct device *dev)
132
-{
133
- snd_dmaengine_pcm_unregister(dev);
134
-}
135
-EXPORT_SYMBOL(atmel_pcm_dma_platform_unregister);
136117
137118 MODULE_AUTHOR("Bo Shen <voice.shen@atmel.com>");
138119 MODULE_DESCRIPTION("Atmel DMA based PCM module");