|
@@ -32,7 +32,7 @@
|
|
|
|
|
|
#include "s3c24xx-pcm.h"
|
|
|
|
|
|
-static const struct snd_pcm_hardware s3c24xx_pcm_hardware = {
|
|
|
+static const struct snd_pcm_hardware s3c_dma_hardware = {
|
|
|
.info = SNDRV_PCM_INFO_INTERLEAVED |
|
|
|
SNDRV_PCM_INFO_BLOCK_TRANSFER |
|
|
|
SNDRV_PCM_INFO_MMAP |
|
|
@@ -62,15 +62,15 @@ struct s3c24xx_runtime_data {
|
|
|
dma_addr_t dma_start;
|
|
|
dma_addr_t dma_pos;
|
|
|
dma_addr_t dma_end;
|
|
|
- struct s3c24xx_pcm_dma_params *params;
|
|
|
+ struct s3c_dma_params *params;
|
|
|
};
|
|
|
|
|
|
-/* s3c24xx_pcm_enqueue
|
|
|
+/* s3c_dma_enqueue
|
|
|
*
|
|
|
* place a dma buffer onto the queue for the dma system
|
|
|
* to handle.
|
|
|
*/
|
|
|
-static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream)
|
|
|
+static void s3c_dma_enqueue(struct snd_pcm_substream *substream)
|
|
|
{
|
|
|
struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
|
|
|
dma_addr_t pos = prtd->dma_pos;
|
|
@@ -132,19 +132,19 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel,
|
|
|
spin_lock(&prtd->lock);
|
|
|
if (prtd->state & ST_RUNNING && !s3c_dma_has_circular()) {
|
|
|
prtd->dma_loaded--;
|
|
|
- s3c24xx_pcm_enqueue(substream);
|
|
|
+ s3c_dma_enqueue(substream);
|
|
|
}
|
|
|
|
|
|
spin_unlock(&prtd->lock);
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
|
|
|
+static int s3c_dma_hw_params(struct snd_pcm_substream *substream,
|
|
|
struct snd_pcm_hw_params *params)
|
|
|
{
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
struct s3c24xx_runtime_data *prtd = runtime->private_data;
|
|
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
|
|
- struct s3c24xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data;
|
|
|
+ struct s3c_dma_params *dma = rtd->dai->cpu_dai->dma_data;
|
|
|
unsigned long totbytes = params_buffer_bytes(params);
|
|
|
int ret = 0;
|
|
|
|
|
@@ -197,7 +197,7 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream)
|
|
|
+static int s3c_dma_hw_free(struct snd_pcm_substream *substream)
|
|
|
{
|
|
|
struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
|
|
|
|
|
@@ -214,7 +214,7 @@ static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream)
|
|
|
+static int s3c_dma_prepare(struct snd_pcm_substream *substream)
|
|
|
{
|
|
|
struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
|
|
|
int ret = 0;
|
|
@@ -247,12 +247,12 @@ static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream)
|
|
|
prtd->dma_pos = prtd->dma_start;
|
|
|
|
|
|
/* enqueue dma buffers */
|
|
|
- s3c24xx_pcm_enqueue(substream);
|
|
|
+ s3c_dma_enqueue(substream);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
|
|
+static int s3c_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
|
|
{
|
|
|
struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
|
|
|
int ret = 0;
|
|
@@ -287,7 +287,7 @@ static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
|
|
}
|
|
|
|
|
|
static snd_pcm_uframes_t
|
|
|
-s3c24xx_pcm_pointer(struct snd_pcm_substream *substream)
|
|
|
+s3c_dma_pointer(struct snd_pcm_substream *substream)
|
|
|
{
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
struct s3c24xx_runtime_data *prtd = runtime->private_data;
|
|
@@ -322,7 +322,7 @@ s3c24xx_pcm_pointer(struct snd_pcm_substream *substream)
|
|
|
return bytes_to_frames(substream->runtime, res);
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_open(struct snd_pcm_substream *substream)
|
|
|
+static int s3c_dma_open(struct snd_pcm_substream *substream)
|
|
|
{
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
struct s3c24xx_runtime_data *prtd;
|
|
@@ -330,7 +330,7 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream)
|
|
|
pr_debug("Entered %s\n", __func__);
|
|
|
|
|
|
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
|
|
|
- snd_soc_set_runtime_hwparams(substream, &s3c24xx_pcm_hardware);
|
|
|
+ snd_soc_set_runtime_hwparams(substream, &s3c_dma_hardware);
|
|
|
|
|
|
prtd = kzalloc(sizeof(struct s3c24xx_runtime_data), GFP_KERNEL);
|
|
|
if (prtd == NULL)
|
|
@@ -342,7 +342,7 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_close(struct snd_pcm_substream *substream)
|
|
|
+static int s3c_dma_close(struct snd_pcm_substream *substream)
|
|
|
{
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
struct s3c24xx_runtime_data *prtd = runtime->private_data;
|
|
@@ -350,14 +350,14 @@ static int s3c24xx_pcm_close(struct snd_pcm_substream *substream)
|
|
|
pr_debug("Entered %s\n", __func__);
|
|
|
|
|
|
if (!prtd)
|
|
|
- pr_debug("s3c24xx_pcm_close called with prtd == NULL\n");
|
|
|
+ pr_debug("s3c_dma_close called with prtd == NULL\n");
|
|
|
|
|
|
kfree(prtd);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int s3c24xx_pcm_mmap(struct snd_pcm_substream *substream,
|
|
|
+static int s3c_dma_mmap(struct snd_pcm_substream *substream,
|
|
|
struct vm_area_struct *vma)
|
|
|
{
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
@@ -370,23 +370,23 @@ static int s3c24xx_pcm_mmap(struct snd_pcm_substream *substream,
|
|
|
runtime->dma_bytes);
|
|
|
}
|
|
|
|
|
|
-static struct snd_pcm_ops s3c24xx_pcm_ops = {
|
|
|
- .open = s3c24xx_pcm_open,
|
|
|
- .close = s3c24xx_pcm_close,
|
|
|
+static struct snd_pcm_ops s3c_dma_ops = {
|
|
|
+ .open = s3c_dma_open,
|
|
|
+ .close = s3c_dma_close,
|
|
|
.ioctl = snd_pcm_lib_ioctl,
|
|
|
- .hw_params = s3c24xx_pcm_hw_params,
|
|
|
- .hw_free = s3c24xx_pcm_hw_free,
|
|
|
- .prepare = s3c24xx_pcm_prepare,
|
|
|
- .trigger = s3c24xx_pcm_trigger,
|
|
|
- .pointer = s3c24xx_pcm_pointer,
|
|
|
- .mmap = s3c24xx_pcm_mmap,
|
|
|
+ .hw_params = s3c_dma_hw_params,
|
|
|
+ .hw_free = s3c_dma_hw_free,
|
|
|
+ .prepare = s3c_dma_prepare,
|
|
|
+ .trigger = s3c_dma_trigger,
|
|
|
+ .pointer = s3c_dma_pointer,
|
|
|
+ .mmap = s3c_dma_mmap,
|
|
|
};
|
|
|
|
|
|
-static int s3c24xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
|
|
|
+static int s3c_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
|
|
|
{
|
|
|
struct snd_pcm_substream *substream = pcm->streams[stream].substream;
|
|
|
struct snd_dma_buffer *buf = &substream->dma_buffer;
|
|
|
- size_t size = s3c24xx_pcm_hardware.buffer_bytes_max;
|
|
|
+ size_t size = s3c_dma_hardware.buffer_bytes_max;
|
|
|
|
|
|
pr_debug("Entered %s\n", __func__);
|
|
|
|
|
@@ -401,7 +401,7 @@ static int s3c24xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
|
|
|
+static void s3c_dma_free_dma_buffers(struct snd_pcm *pcm)
|
|
|
{
|
|
|
struct snd_pcm_substream *substream;
|
|
|
struct snd_dma_buffer *buf;
|
|
@@ -424,9 +424,9 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static u64 s3c24xx_pcm_dmamask = DMA_BIT_MASK(32);
|
|
|
+static u64 s3c_dma_mask = DMA_BIT_MASK(32);
|
|
|
|
|
|
-static int s3c24xx_pcm_new(struct snd_card *card,
|
|
|
+static int s3c_dma_new(struct snd_card *card,
|
|
|
struct snd_soc_dai *dai, struct snd_pcm *pcm)
|
|
|
{
|
|
|
int ret = 0;
|
|
@@ -434,19 +434,19 @@ static int s3c24xx_pcm_new(struct snd_card *card,
|
|
|
pr_debug("Entered %s\n", __func__);
|
|
|
|
|
|
if (!card->dev->dma_mask)
|
|
|
- card->dev->dma_mask = &s3c24xx_pcm_dmamask;
|
|
|
+ card->dev->dma_mask = &s3c_dma_mask;
|
|
|
if (!card->dev->coherent_dma_mask)
|
|
|
card->dev->coherent_dma_mask = 0xffffffff;
|
|
|
|
|
|
if (dai->playback.channels_min) {
|
|
|
- ret = s3c24xx_pcm_preallocate_dma_buffer(pcm,
|
|
|
+ ret = s3c_preallocate_dma_buffer(pcm,
|
|
|
SNDRV_PCM_STREAM_PLAYBACK);
|
|
|
if (ret)
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
if (dai->capture.channels_min) {
|
|
|
- ret = s3c24xx_pcm_preallocate_dma_buffer(pcm,
|
|
|
+ ret = s3c_preallocate_dma_buffer(pcm,
|
|
|
SNDRV_PCM_STREAM_CAPTURE);
|
|
|
if (ret)
|
|
|
goto out;
|
|
@@ -457,9 +457,9 @@ static int s3c24xx_pcm_new(struct snd_card *card,
|
|
|
|
|
|
struct snd_soc_platform s3c24xx_soc_platform = {
|
|
|
.name = "s3c24xx-audio",
|
|
|
- .pcm_ops = &s3c24xx_pcm_ops,
|
|
|
- .pcm_new = s3c24xx_pcm_new,
|
|
|
- .pcm_free = s3c24xx_pcm_free_dma_buffers,
|
|
|
+ .pcm_ops = &s3c_dma_ops,
|
|
|
+ .pcm_new = s3c_dma_new,
|
|
|
+ .pcm_free = s3c_dma_free_dma_buffers,
|
|
|
};
|
|
|
EXPORT_SYMBOL_GPL(s3c24xx_soc_platform);
|
|
|
|
|
@@ -476,5 +476,5 @@ static void __exit s3c24xx_soc_platform_exit(void)
|
|
|
module_exit(s3c24xx_soc_platform_exit);
|
|
|
|
|
|
MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
|
|
|
-MODULE_DESCRIPTION("Samsung S3C24XX PCM DMA module");
|
|
|
+MODULE_DESCRIPTION("Samsung S3C Audio DMA module");
|
|
|
MODULE_LICENSE("GPL");
|