From 61b165caa686b8334379293d0e241f740fac195a Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Fri, 13 Jun 2014 18:03:56 +0530 Subject: ASoC: Intel: add mrfld pipelines Merrifield DSP used various pipelines to identify the streams and processing modules. Add these defination in the pcm driver and also add a table for device entries to firmware pipeline id conversion Signed-off-by: Vinod Koul Signed-off-by: Mark Brown --- arch/x86/include/asm/platform_sst_audio.h | 78 +++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 arch/x86/include/asm/platform_sst_audio.h (limited to 'arch') diff --git a/arch/x86/include/asm/platform_sst_audio.h b/arch/x86/include/asm/platform_sst_audio.h new file mode 100644 index 000000000000..0a4e140315b6 --- /dev/null +++ b/arch/x86/include/asm/platform_sst_audio.h @@ -0,0 +1,78 @@ +/* + * platform_sst_audio.h: sst audio platform data header file + * + * Copyright (C) 2012-14 Intel Corporation + * Author: Jeeja KP + * Omair Mohammed Abdullah + * Vinod Koul ,vinod.koul@intel.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 + * of the License. + */ +#ifndef _PLATFORM_SST_AUDIO_H_ +#define _PLATFORM_SST_AUDIO_H_ + +#include + +enum sst_audio_task_id_mrfld { + SST_TASK_ID_NONE = 0, + SST_TASK_ID_SBA = 1, + SST_TASK_ID_MEDIA = 3, + SST_TASK_ID_MAX = SST_TASK_ID_MEDIA, +}; + +/* Device IDs for Merrifield are Pipe IDs, + * ref: DSP spec v0.75 */ +enum sst_audio_device_id_mrfld { + /* Output pipeline IDs */ + PIPE_ID_OUT_START = 0x0, + PIPE_CODEC_OUT0 = 0x2, + PIPE_CODEC_OUT1 = 0x3, + PIPE_SPROT_LOOP_OUT = 0x4, + PIPE_MEDIA_LOOP1_OUT = 0x5, + PIPE_MEDIA_LOOP2_OUT = 0x6, + PIPE_VOIP_OUT = 0xC, + PIPE_PCM0_OUT = 0xD, + PIPE_PCM1_OUT = 0xE, + PIPE_PCM2_OUT = 0xF, + PIPE_MEDIA0_OUT = 0x12, + PIPE_MEDIA1_OUT = 0x13, +/* Input Pipeline IDs */ + PIPE_ID_IN_START = 0x80, + PIPE_CODEC_IN0 = 0x82, + PIPE_CODEC_IN1 = 0x83, + PIPE_SPROT_LOOP_IN = 0x84, + PIPE_MEDIA_LOOP1_IN = 0x85, + PIPE_MEDIA_LOOP2_IN = 0x86, + PIPE_VOIP_IN = 0x8C, + PIPE_PCM0_IN = 0x8D, + PIPE_PCM1_IN = 0x8E, + PIPE_MEDIA0_IN = 0x8F, + PIPE_MEDIA1_IN = 0x90, + PIPE_MEDIA2_IN = 0x91, + PIPE_RSVD = 0xFF, +}; + +/* The stream map for each platform consists of an array of the below + * stream map structure. + */ +struct sst_dev_stream_map { + u8 dev_num; /* device id */ + u8 subdev_num; /* substream */ + u8 direction; + u8 device_id; /* fw id */ + u8 task_id; /* fw task */ + u8 status; +}; + +struct sst_platform_data { + /* Intel software platform id*/ + struct sst_dev_stream_map *pdev_strm_map; + unsigned int strm_map_size; +}; + +int add_sst_platform_device(void); +#endif + -- cgit v1.2.3 From ffb83e8cb14cace1b08ceb56695b580c808d8a41 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 22 Jun 2014 17:55:18 -0700 Subject: ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS for snd_pcm_lib_preallocate_pages_for_all(). But, it came from original dma-sh7760.c, and no longer needed. This patch exchange its parameter, and removed original dma mapping and un-needed dma_sync_single_xxx() from driver. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- arch/arm/mach-shmobile/board-armadillo800eva.c | 4 +++ arch/arm/mach-shmobile/board-kzm9g.c | 2 ++ arch/arm/mach-shmobile/board-mackerel.c | 4 +++ arch/sh/boards/mach-ecovec24/setup.c | 2 ++ sound/soc/sh/fsi.c | 42 +++----------------------- 5 files changed, 17 insertions(+), 37 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 30fcac73a540..689c121157ec 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -998,6 +998,8 @@ static struct platform_device fsi_wm8978_device = { .id = 0, .dev = { .platform_data = &fsi_wm8978_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask, }, }; @@ -1021,6 +1023,8 @@ static struct platform_device fsi_hdmi_device = { .id = 1, .dev = { .platform_data = &fsi2_hdmi_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask, }, }; diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index f94ec8ca42c1..01e0d1386db7 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c @@ -603,6 +603,8 @@ static struct platform_device fsi_ak4648_device = { .name = "asoc-simple-card", .dev = { .platform_data = &fsi2_ak4648_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask, }, }; diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 0ff4d8e45cf7..112553f0f9bf 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -523,6 +523,8 @@ static struct platform_device fsi_hdmi_device = { .id = 1, .dev = { .platform_data = &fsi2_hdmi_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask, }, }; @@ -919,6 +921,8 @@ static struct platform_device fsi_ak4643_device = { .name = "asoc-simple-card", .dev = { .platform_data = &fsi2_ak4643_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask, }, }; diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 85d5255d259f..0d3049244cd3 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = { .name = "asoc-simple-card", .dev = { .platform_data = &fsi_da7210_info, + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask, }, }; diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 710a079a7377..7a6b632c3db8 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -233,7 +233,6 @@ struct fsi_stream { */ struct dma_chan *chan; struct work_struct work; - dma_addr_t dma; int dma_id; int loop_cnt; int additional_pos; @@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data) */ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io) { - struct snd_pcm_runtime *runtime = io->substream->runtime; - struct snd_soc_dai *dai = fsi_get_dai(io->substream); - enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? - DMA_TO_DEVICE : DMA_FROM_DEVICE; - /* * 24bit data : 24bit bus / package in back * 16bit data : 16bit bus / stream mode @@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io) io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */ io->additional_pos = 0; - io->dma = dma_map_single(dai->dev, runtime->dma_area, - snd_pcm_lib_buffer_bytes(io->substream), dir); - return 0; -} - -static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io) -{ - struct snd_soc_dai *dai = fsi_get_dai(io->substream); - enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? - DMA_TO_DEVICE : DMA_FROM_DEVICE; - dma_unmap_single(dai->dev, io->dma, - snd_pcm_lib_buffer_bytes(io->substream), dir); return 0; } @@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional) if (period >= runtime->periods) period = 0; - return io->dma + samples_to_bytes(runtime, period * io->period_samples); + return runtime->dma_addr + + samples_to_bytes(runtime, period * io->period_samples); } static void fsi_dma_complete(void *data) @@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data) struct fsi_stream *io = (struct fsi_stream *)data; struct fsi_priv *fsi = fsi_stream_to_priv(io); struct snd_pcm_runtime *runtime = io->substream->runtime; - struct snd_soc_dai *dai = fsi_get_dai(io->substream); - enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? - DMA_TO_DEVICE : DMA_FROM_DEVICE; - - dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0), - samples_to_bytes(runtime, io->period_samples), dir); io->buff_sample_pos += io->period_samples; io->period_pos++; @@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work) for (i = 0; i < io->loop_cnt; i++) { buf = fsi_dma_get_area(io, io->additional_pos); - dma_sync_single_for_device(dai->dev, buf, len, dir); - desc = dmaengine_prep_slave_single(io->chan, buf, len, dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { @@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io) static struct fsi_stream_handler fsi_dma_push_handler = { .init = fsi_dma_init, - .quit = fsi_dma_quit, .probe = fsi_dma_probe, .transfer = fsi_dma_transfer, .remove = fsi_dma_remove, @@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm) static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd) { - struct snd_pcm *pcm = rtd->pcm; - - /* - * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel - * in MMAP mode (i.e. aplay -M) - */ return snd_pcm_lib_preallocate_pages_for_all( - pcm, - SNDRV_DMA_TYPE_CONTINUOUS, - snd_dma_continuous_data(GFP_KERNEL), + rtd->pcm, + SNDRV_DMA_TYPE_DEV, + rtd->card->snd_card->dev, PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); } -- cgit v1.2.3