[alsa-devel] [PATCH v2 0/8] ASoC: Intel: rework the mfld platform driver
This patch series reworks and reformats the existing platform driver we use. This is stepping support for seconds series of patches which will support Merrifield platform with DPCM based implementation
Not much logical changes in code except adding drain support for compressed audio. Most is mere modularization of the existing code
Fixes in v2: - add two more patches - fix makefile addition is 4th patch - dropped name change in platform ops patch
Vinod Koul (8): ASoC: Intel: remove FSF snail mail address ASoc: Intel: rename sst-mfld-platform.c ASoC: Intel: mark sst_set_stream_status as non static ASoC: Intel: split the pcm and compress to different files ASoC: Intel: remove unused sst-mfld platform dais ASoC: Intel: add drain_notify support ASoC: Intel: remove codec memeber from codec structs ASoC: Intel: move component registration blob
sound/soc/intel/Makefile | 14 +- sound/soc/intel/sst-mfld-dsp.h | 8 - sound/soc/intel/sst-mfld-platform-compress.c | 237 +++++++++++++++++++ ...sst-mfld-platform.c => sst-mfld-platform-pcm.c} | 250 +------------------- sound/soc/intel/sst-mfld-platform.h | 11 +- 5 files changed, 263 insertions(+), 257 deletions(-) create mode 100644 sound/soc/intel/sst-mfld-platform-compress.c rename sound/soc/intel/{sst-mfld-platform.c => sst-mfld-platform-pcm.c} (67%)
As this address can move
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/sst-mfld-dsp.h | 4 ---- sound/soc/intel/sst-mfld-platform.c | 6 ------ sound/soc/intel/sst-mfld-platform.h | 6 ------ 3 files changed, 0 insertions(+), 16 deletions(-)
diff --git a/sound/soc/intel/sst-mfld-dsp.h b/sound/soc/intel/sst-mfld-dsp.h index 3b63edc..a74477a 100644 --- a/sound/soc/intel/sst-mfld-dsp.h +++ b/sound/soc/intel/sst-mfld-dsp.h @@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
diff --git a/sound/soc/intel/sst-mfld-platform.c b/sound/soc/intel/sst-mfld-platform.c index 840306c..ec499ae 100644 --- a/sound/soc/intel/sst-mfld-platform.c +++ b/sound/soc/intel/sst-mfld-platform.c @@ -15,13 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/sound/soc/intel/sst-mfld-platform.h b/sound/soc/intel/sst-mfld-platform.h index 0c4e2dd..5bf8f9d 100644 --- a/sound/soc/intel/sst-mfld-platform.h +++ b/sound/soc/intel/sst-mfld-platform.h @@ -15,13 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * */
#ifndef __SST_PLATFORMDRV_H__
to sst-mfld-platform-pcm.c so that we can split pcm and compress to different files for upcoming changes to support more platforms
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/Makefile | 2 +- ...sst-mfld-platform.c => sst-mfld-platform-pcm.c} | 0 2 files changed, 1 insertions(+), 1 deletions(-) rename sound/soc/intel/{sst-mfld-platform.c => sst-mfld-platform-pcm.c} (100%)
diff --git a/sound/soc/intel/Makefile b/sound/soc/intel/Makefile index edeb79a..5d3fb6f 100644 --- a/sound/soc/intel/Makefile +++ b/sound/soc/intel/Makefile @@ -2,7 +2,7 @@ snd-soc-sst-dsp-objs := sst-dsp.o sst-firmware.o snd-soc-sst-acpi-objs := sst-acpi.o
-snd-soc-sst-mfld-platform-objs := sst-mfld-platform.o +snd-soc-sst-mfld-platform-objs := sst-mfld-platform-pcm.o snd-soc-mfld-machine-objs := mfld_machine.o
obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += snd-soc-sst-mfld-platform.o diff --git a/sound/soc/intel/sst-mfld-platform.c b/sound/soc/intel/sst-mfld-platform-pcm.c similarity index 100% rename from sound/soc/intel/sst-mfld-platform.c rename to sound/soc/intel/sst-mfld-platform-pcm.c
as this will be used in compressed split file in subsequent patch
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/sst-mfld-platform-pcm.c | 2 +- sound/soc/intel/sst-mfld-platform.h | 1 + 2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index ec499ae..3600003 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c @@ -156,7 +156,7 @@ static const struct snd_soc_component_driver sst_component = { };
/* helper functions */ -static inline void sst_set_stream_status(struct sst_runtime_stream *stream, +void sst_set_stream_status(struct sst_runtime_stream *stream, int state) { unsigned long flags; diff --git a/sound/soc/intel/sst-mfld-platform.h b/sound/soc/intel/sst-mfld-platform.h index 5bf8f9d..1005f55 100644 --- a/sound/soc/intel/sst-mfld-platform.h +++ b/sound/soc/intel/sst-mfld-platform.h @@ -142,6 +142,7 @@ struct sst_device { struct compress_sst_ops *compr_ops; };
+void sst_set_stream_status(struct sst_runtime_stream *stream, int state); int sst_register_dsp(struct sst_device *sst); int sst_unregister_dsp(struct sst_device *sst); #endif
For managing them and adding support for more platforms
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/Makefile | 14 ++- sound/soc/intel/sst-mfld-platform-compress.c | 228 ++++++++++++++++++++++++++ sound/soc/intel/sst-mfld-platform-pcm.c | 202 +---------------------- sound/soc/intel/sst-mfld-platform.h | 2 + 4 files changed, 245 insertions(+), 201 deletions(-) create mode 100644 sound/soc/intel/sst-mfld-platform-compress.c
diff --git a/sound/soc/intel/Makefile b/sound/soc/intel/Makefile index 5d3fb6f..57242c4 100644 --- a/sound/soc/intel/Makefile +++ b/sound/soc/intel/Makefile @@ -2,7 +2,7 @@ snd-soc-sst-dsp-objs := sst-dsp.o sst-firmware.o snd-soc-sst-acpi-objs := sst-acpi.o
-snd-soc-sst-mfld-platform-objs := sst-mfld-platform-pcm.o +snd-soc-sst-mfld-platform-objs := sst-mfld-platform-pcm.o sst-mfld-platform-compress.o snd-soc-mfld-machine-objs := mfld_machine.o
obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += snd-soc-sst-mfld-platform.o @@ -26,3 +26,15 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o + +# SST Platform Driver +PLATFORM_LIBS = platform-libs/controls_v2_dpcm.o + +snd-soc-sst-platform-objs := pcm.o compress.o $(PLATFORM_LIBS) +obj-$(CONFIG_SND_SST_PLATFORM) += snd-soc-sst-platform.o + +# Relevant Machine driver +obj-$(CONFIG_SND_SST_MACHINE) += board/ + +# IPC driver +obj-$(CONFIG_SND_INTEL_SST) += sst/ diff --git a/sound/soc/intel/sst-mfld-platform-compress.c b/sound/soc/intel/sst-mfld-platform-compress.c new file mode 100644 index 0000000..16d79fb --- /dev/null +++ b/sound/soc/intel/sst-mfld-platform-compress.c @@ -0,0 +1,228 @@ +/* + * sst_mfld_platform.c - Intel MID Platform driver + * + * Copyright (C) 2010-2014 Intel Corp + * Author: 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include <linux/slab.h> +#include <linux/io.h> +#include <linux/module.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h> +#include <sound/compress_driver.h> +#include "sst-mfld-platform.h" + +/* compress stream operations */ +static void sst_compr_fragment_elapsed(void *arg) +{ + struct snd_compr_stream *cstream = (struct snd_compr_stream *)arg; + + pr_debug("fragment elapsed by driver\n"); + if (cstream) + snd_compr_fragment_elapsed(cstream); +} + +static int sst_platform_compr_open(struct snd_compr_stream *cstream) +{ + + int ret_val = 0; + struct snd_compr_runtime *runtime = cstream->runtime; + struct sst_runtime_stream *stream; + + stream = kzalloc(sizeof(*stream), GFP_KERNEL); + if (!stream) + return -ENOMEM; + + spin_lock_init(&stream->status_lock); + + /* get the sst ops */ + if (!sst || !try_module_get(sst->dev->driver->owner)) { + pr_err("no device available to run\n"); + ret_val = -ENODEV; + goto out_ops; + } + stream->compr_ops = sst->compr_ops; + + stream->id = 0; + sst_set_stream_status(stream, SST_PLATFORM_INIT); + runtime->private_data = stream; + return 0; +out_ops: + kfree(stream); + return ret_val; +} + +static int sst_platform_compr_free(struct snd_compr_stream *cstream) +{ + struct sst_runtime_stream *stream; + int ret_val = 0, str_id; + + stream = cstream->runtime->private_data; + /*need to check*/ + str_id = stream->id; + if (str_id) + ret_val = stream->compr_ops->close(str_id); + module_put(sst->dev->driver->owner); + kfree(stream); + pr_debug("%s: %d\n", __func__, ret_val); + return 0; +} + +static int sst_platform_compr_set_params(struct snd_compr_stream *cstream, + struct snd_compr_params *params) +{ + struct sst_runtime_stream *stream; + int retval; + struct snd_sst_params str_params; + struct sst_compress_cb cb; + + stream = cstream->runtime->private_data; + /* construct fw structure for this*/ + memset(&str_params, 0, sizeof(str_params)); + + str_params.ops = STREAM_OPS_PLAYBACK; + str_params.stream_type = SST_STREAM_TYPE_MUSIC; + str_params.device_type = SND_SST_DEVICE_COMPRESS; + + switch (params->codec.id) { + case SND_AUDIOCODEC_MP3: { + str_params.codec = SST_CODEC_TYPE_MP3; + str_params.sparams.uc.mp3_params.codec = SST_CODEC_TYPE_MP3; + str_params.sparams.uc.mp3_params.num_chan = params->codec.ch_in; + str_params.sparams.uc.mp3_params.pcm_wd_sz = 16; + break; + } + + case SND_AUDIOCODEC_AAC: { + str_params.codec = SST_CODEC_TYPE_AAC; + str_params.sparams.uc.aac_params.codec = SST_CODEC_TYPE_AAC; + str_params.sparams.uc.aac_params.num_chan = params->codec.ch_in; + str_params.sparams.uc.aac_params.pcm_wd_sz = 16; + if (params->codec.format == SND_AUDIOSTREAMFORMAT_MP4ADTS) + str_params.sparams.uc.aac_params.bs_format = + AAC_BIT_STREAM_ADTS; + else if (params->codec.format == SND_AUDIOSTREAMFORMAT_RAW) + str_params.sparams.uc.aac_params.bs_format = + AAC_BIT_STREAM_RAW; + else { + pr_err("Undefined format%d\n", params->codec.format); + return -EINVAL; + } + str_params.sparams.uc.aac_params.externalsr = + params->codec.sample_rate; + break; + } + + default: + pr_err("codec not supported, id =%d\n", params->codec.id); + return -EINVAL; + } + + str_params.aparams.ring_buf_info[0].addr = + virt_to_phys(cstream->runtime->buffer); + str_params.aparams.ring_buf_info[0].size = + cstream->runtime->buffer_size; + str_params.aparams.sg_count = 1; + str_params.aparams.frag_size = cstream->runtime->fragment_size; + + cb.param = cstream; + cb.compr_cb = sst_compr_fragment_elapsed; + + retval = stream->compr_ops->open(&str_params, &cb); + if (retval < 0) { + pr_err("stream allocation failed %d\n", retval); + return retval; + } + + stream->id = retval; + return 0; +} + +static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd) +{ + struct sst_runtime_stream *stream = + cstream->runtime->private_data; + + return stream->compr_ops->control(cmd, stream->id); +} + +static int sst_platform_compr_pointer(struct snd_compr_stream *cstream, + struct snd_compr_tstamp *tstamp) +{ + struct sst_runtime_stream *stream; + + stream = cstream->runtime->private_data; + stream->compr_ops->tstamp(stream->id, tstamp); + tstamp->byte_offset = tstamp->copied_total % + (u32)cstream->runtime->buffer_size; + pr_debug("calc bytes offset/copied bytes as %d\n", tstamp->byte_offset); + return 0; +} + +static int sst_platform_compr_ack(struct snd_compr_stream *cstream, + size_t bytes) +{ + struct sst_runtime_stream *stream; + + stream = cstream->runtime->private_data; + stream->compr_ops->ack(stream->id, (unsigned long)bytes); + stream->bytes_written += bytes; + + return 0; +} + +static int sst_platform_compr_get_caps(struct snd_compr_stream *cstream, + struct snd_compr_caps *caps) +{ + struct sst_runtime_stream *stream = + cstream->runtime->private_data; + + return stream->compr_ops->get_caps(caps); +} + +static int sst_platform_compr_get_codec_caps(struct snd_compr_stream *cstream, + struct snd_compr_codec_caps *codec) +{ + struct sst_runtime_stream *stream = + cstream->runtime->private_data; + + return stream->compr_ops->get_codec_caps(codec); +} + +static int sst_platform_compr_set_metadata(struct snd_compr_stream *cstream, + struct snd_compr_metadata *metadata) +{ + struct sst_runtime_stream *stream = + cstream->runtime->private_data; + + return stream->compr_ops->set_metadata(stream->id, metadata); +} + +struct snd_compr_ops sst_platform_compr_ops = { + + .open = sst_platform_compr_open, + .free = sst_platform_compr_free, + .set_params = sst_platform_compr_set_params, + .set_metadata = sst_platform_compr_set_metadata, + .trigger = sst_platform_compr_trigger, + .pointer = sst_platform_compr_pointer, + .ack = sst_platform_compr_ack, + .get_caps = sst_platform_compr_get_caps, + .get_codec_caps = sst_platform_compr_get_codec_caps, +}; diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index 3600003..2beb959 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c @@ -29,8 +29,9 @@ #include <sound/compress_driver.h> #include "sst-mfld-platform.h"
-static struct sst_device *sst; +struct sst_device *sst; static DEFINE_MUTEX(sst_lock); +extern struct snd_compr_ops sst_platform_compr_ops;
int sst_register_dsp(struct sst_device *dev) { @@ -465,205 +466,6 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) return retval; }
-/* compress stream operations */ -static void sst_compr_fragment_elapsed(void *arg) -{ - struct snd_compr_stream *cstream = (struct snd_compr_stream *)arg; - - pr_debug("fragment elapsed by driver\n"); - if (cstream) - snd_compr_fragment_elapsed(cstream); -} - -static int sst_platform_compr_open(struct snd_compr_stream *cstream) -{ - - int ret_val = 0; - struct snd_compr_runtime *runtime = cstream->runtime; - struct sst_runtime_stream *stream; - - stream = kzalloc(sizeof(*stream), GFP_KERNEL); - if (!stream) - return -ENOMEM; - - spin_lock_init(&stream->status_lock); - - /* get the sst ops */ - if (!sst || !try_module_get(sst->dev->driver->owner)) { - pr_err("no device available to run\n"); - ret_val = -ENODEV; - goto out_ops; - } - stream->compr_ops = sst->compr_ops; - - stream->id = 0; - sst_set_stream_status(stream, SST_PLATFORM_INIT); - runtime->private_data = stream; - return 0; -out_ops: - kfree(stream); - return ret_val; -} - -static int sst_platform_compr_free(struct snd_compr_stream *cstream) -{ - struct sst_runtime_stream *stream; - int ret_val = 0, str_id; - - stream = cstream->runtime->private_data; - /*need to check*/ - str_id = stream->id; - if (str_id) - ret_val = stream->compr_ops->close(str_id); - module_put(sst->dev->driver->owner); - kfree(stream); - pr_debug("%s: %d\n", __func__, ret_val); - return 0; -} - -static int sst_platform_compr_set_params(struct snd_compr_stream *cstream, - struct snd_compr_params *params) -{ - struct sst_runtime_stream *stream; - int retval; - struct snd_sst_params str_params; - struct sst_compress_cb cb; - - stream = cstream->runtime->private_data; - /* construct fw structure for this*/ - memset(&str_params, 0, sizeof(str_params)); - - str_params.ops = STREAM_OPS_PLAYBACK; - str_params.stream_type = SST_STREAM_TYPE_MUSIC; - str_params.device_type = SND_SST_DEVICE_COMPRESS; - - switch (params->codec.id) { - case SND_AUDIOCODEC_MP3: { - str_params.codec = SST_CODEC_TYPE_MP3; - str_params.sparams.uc.mp3_params.codec = SST_CODEC_TYPE_MP3; - str_params.sparams.uc.mp3_params.num_chan = params->codec.ch_in; - str_params.sparams.uc.mp3_params.pcm_wd_sz = 16; - break; - } - - case SND_AUDIOCODEC_AAC: { - str_params.codec = SST_CODEC_TYPE_AAC; - str_params.sparams.uc.aac_params.codec = SST_CODEC_TYPE_AAC; - str_params.sparams.uc.aac_params.num_chan = params->codec.ch_in; - str_params.sparams.uc.aac_params.pcm_wd_sz = 16; - if (params->codec.format == SND_AUDIOSTREAMFORMAT_MP4ADTS) - str_params.sparams.uc.aac_params.bs_format = - AAC_BIT_STREAM_ADTS; - else if (params->codec.format == SND_AUDIOSTREAMFORMAT_RAW) - str_params.sparams.uc.aac_params.bs_format = - AAC_BIT_STREAM_RAW; - else { - pr_err("Undefined format%d\n", params->codec.format); - return -EINVAL; - } - str_params.sparams.uc.aac_params.externalsr = - params->codec.sample_rate; - break; - } - - default: - pr_err("codec not supported, id =%d\n", params->codec.id); - return -EINVAL; - } - - str_params.aparams.ring_buf_info[0].addr = - virt_to_phys(cstream->runtime->buffer); - str_params.aparams.ring_buf_info[0].size = - cstream->runtime->buffer_size; - str_params.aparams.sg_count = 1; - str_params.aparams.frag_size = cstream->runtime->fragment_size; - - cb.param = cstream; - cb.compr_cb = sst_compr_fragment_elapsed; - - retval = stream->compr_ops->open(&str_params, &cb); - if (retval < 0) { - pr_err("stream allocation failed %d\n", retval); - return retval; - } - - stream->id = retval; - return 0; -} - -static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd) -{ - struct sst_runtime_stream *stream = - cstream->runtime->private_data; - - return stream->compr_ops->control(cmd, stream->id); -} - -static int sst_platform_compr_pointer(struct snd_compr_stream *cstream, - struct snd_compr_tstamp *tstamp) -{ - struct sst_runtime_stream *stream; - - stream = cstream->runtime->private_data; - stream->compr_ops->tstamp(stream->id, tstamp); - tstamp->byte_offset = tstamp->copied_total % - (u32)cstream->runtime->buffer_size; - pr_debug("calc bytes offset/copied bytes as %d\n", tstamp->byte_offset); - return 0; -} - -static int sst_platform_compr_ack(struct snd_compr_stream *cstream, - size_t bytes) -{ - struct sst_runtime_stream *stream; - - stream = cstream->runtime->private_data; - stream->compr_ops->ack(stream->id, (unsigned long)bytes); - stream->bytes_written += bytes; - - return 0; -} - -static int sst_platform_compr_get_caps(struct snd_compr_stream *cstream, - struct snd_compr_caps *caps) -{ - struct sst_runtime_stream *stream = - cstream->runtime->private_data; - - return stream->compr_ops->get_caps(caps); -} - -static int sst_platform_compr_get_codec_caps(struct snd_compr_stream *cstream, - struct snd_compr_codec_caps *codec) -{ - struct sst_runtime_stream *stream = - cstream->runtime->private_data; - - return stream->compr_ops->get_codec_caps(codec); -} - -static int sst_platform_compr_set_metadata(struct snd_compr_stream *cstream, - struct snd_compr_metadata *metadata) -{ - struct sst_runtime_stream *stream = - cstream->runtime->private_data; - - return stream->compr_ops->set_metadata(stream->id, metadata); -} - -static struct snd_compr_ops sst_platform_compr_ops = { - - .open = sst_platform_compr_open, - .free = sst_platform_compr_free, - .set_params = sst_platform_compr_set_params, - .set_metadata = sst_platform_compr_set_metadata, - .trigger = sst_platform_compr_trigger, - .pointer = sst_platform_compr_pointer, - .ack = sst_platform_compr_ack, - .get_caps = sst_platform_compr_get_caps, - .get_codec_caps = sst_platform_compr_get_codec_caps, -}; - static struct snd_soc_platform_driver sst_soc_platform_drv = { .ops = &sst_platform_ops, .compr_ops = &sst_platform_compr_ops, diff --git a/sound/soc/intel/sst-mfld-platform.h b/sound/soc/intel/sst-mfld-platform.h index 1005f55..3ea4fee 100644 --- a/sound/soc/intel/sst-mfld-platform.h +++ b/sound/soc/intel/sst-mfld-platform.h @@ -23,6 +23,8 @@
#include "sst-mfld-dsp.h"
+extern struct sst_device *sst; + #define SST_MONO 1 #define SST_STEREO 2 #define SST_MAX_CAP 5
With DPCM we have media dai used and no sperate headset and speaker dai so remove the speaker dai The vibra is no longer supported thru audio, so remove
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/sst-mfld-platform-pcm.c | 30 ------------------------------ 1 files changed, 0 insertions(+), 30 deletions(-)
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index 2beb959..3f9cd77 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c @@ -111,36 +111,6 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { }, }, { - .name = "Speaker-cpu-dai", - .id = 1, - .playback = { - .channels_min = SST_MONO, - .channels_max = SST_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S24_LE, - }, -}, -{ - .name = "Vibra1-cpu-dai", - .id = 2, - .playback = { - .channels_min = SST_MONO, - .channels_max = SST_MONO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S24_LE, - }, -}, -{ - .name = "Vibra2-cpu-dai", - .id = 3, - .playback = { - .channels_min = SST_MONO, - .channels_max = SST_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S24_LE, - }, -}, -{ .name = "Compress-cpu-dai", .compress_dai = 1, .playback = {
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/sst-mfld-platform-compress.c | 11 +++++++++++ sound/soc/intel/sst-mfld-platform.h | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/sound/soc/intel/sst-mfld-platform-compress.c b/sound/soc/intel/sst-mfld-platform-compress.c index 16d79fb..5c3e234 100644 --- a/sound/soc/intel/sst-mfld-platform-compress.c +++ b/sound/soc/intel/sst-mfld-platform-compress.c @@ -38,6 +38,15 @@ static void sst_compr_fragment_elapsed(void *arg) snd_compr_fragment_elapsed(cstream); }
+static void sst_drain_notify(void *arg) +{ + struct snd_compr_stream *cstream = (struct snd_compr_stream *)arg; + + pr_debug("drain notify by driver\n"); + if (cstream) + snd_compr_drain_notify(cstream); +} + static int sst_platform_compr_open(struct snd_compr_stream *cstream) {
@@ -143,6 +152,8 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream,
cb.param = cstream; cb.compr_cb = sst_compr_fragment_elapsed; + cb.drain_cb_param = cstream; + cb.drain_notify = sst_drain_notify;
retval = stream->compr_ops->open(&str_params, &cb); if (retval < 0) { diff --git a/sound/soc/intel/sst-mfld-platform.h b/sound/soc/intel/sst-mfld-platform.h index 3ea4fee..6c5e7dc 100644 --- a/sound/soc/intel/sst-mfld-platform.h +++ b/sound/soc/intel/sst-mfld-platform.h @@ -104,6 +104,8 @@ struct sst_stream_params { struct sst_compress_cb { void *param; void (*compr_cb)(void *param); + void *drain_cb_param; + void (*drain_notify)(void *param); };
struct compress_sst_ops {
as we already have a memeber struct snd_sst_params.codec to fill this. so removing duplicate instance
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/sst-mfld-dsp.h | 4 ---- sound/soc/intel/sst-mfld-platform-compress.c | 2 -- sound/soc/intel/sst-mfld-platform-pcm.c | 1 - 3 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/sound/soc/intel/sst-mfld-dsp.h b/sound/soc/intel/sst-mfld-dsp.h index a74477a..8d482d7 100644 --- a/sound/soc/intel/sst-mfld-dsp.h +++ b/sound/soc/intel/sst-mfld-dsp.h @@ -36,7 +36,6 @@ enum stream_type { };
struct snd_pcm_params { - u16 codec; /* codec type */ u8 num_chan; /* 1=Mono, 2=Stereo */ u8 pcm_wd_sz; /* 16/24 - bit*/ u32 reserved; /* Bitrate in bits per second */ @@ -49,7 +48,6 @@ struct snd_pcm_params {
/* MP3 Music Parameters Message */ struct snd_mp3_params { - u16 codec; u8 num_chan; /* 1=Mono, 2=Stereo */ u8 pcm_wd_sz; /* 16/24 - bit*/ u8 crc_check; /* crc_check - disable (0) or enable (1) */ @@ -63,7 +61,6 @@ struct snd_mp3_params {
/* AAC Music Parameters Message */ struct snd_aac_params { - u16 codec; u8 num_chan; /* 1=Mono, 2=Stereo*/ u8 pcm_wd_sz; /* 16/24 - bit*/ u8 bdownsample; /*SBR downsampling 0 - disable 1 -enabled AAC+ only */ @@ -77,7 +74,6 @@ struct snd_aac_params {
/* WMA Music Parameters Message */ struct snd_wma_params { - u16 codec; u8 num_chan; /* 1=Mono, 2=Stereo */ u8 pcm_wd_sz; /* 16/24 - bit*/ u32 brate; /* Use the hard coded value. */ diff --git a/sound/soc/intel/sst-mfld-platform-compress.c b/sound/soc/intel/sst-mfld-platform-compress.c index 5c3e234..02abd19 100644 --- a/sound/soc/intel/sst-mfld-platform-compress.c +++ b/sound/soc/intel/sst-mfld-platform-compress.c @@ -112,7 +112,6 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream, switch (params->codec.id) { case SND_AUDIOCODEC_MP3: { str_params.codec = SST_CODEC_TYPE_MP3; - str_params.sparams.uc.mp3_params.codec = SST_CODEC_TYPE_MP3; str_params.sparams.uc.mp3_params.num_chan = params->codec.ch_in; str_params.sparams.uc.mp3_params.pcm_wd_sz = 16; break; @@ -120,7 +119,6 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream,
case SND_AUDIOCODEC_AAC: { str_params.codec = SST_CODEC_TYPE_AAC; - str_params.sparams.uc.aac_params.codec = SST_CODEC_TYPE_AAC; str_params.sparams.uc.aac_params.num_chan = params->codec.ch_in; str_params.sparams.uc.aac_params.pcm_wd_sz = 16; if (params->codec.format == SND_AUDIOSTREAMFORMAT_MP4ADTS) diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index 3f9cd77..380802a 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c @@ -151,7 +151,6 @@ static void sst_fill_pcm_params(struct snd_pcm_substream *substream, struct sst_pcm_params *param) {
- param->codec = SST_CODEC_TYPE_PCM; param->num_chan = (u8) substream->runtime->channels; param->pcm_wd_sz = substream->runtime->sample_bits; param->reserved = 0;
to the place near it is used
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/sst-mfld-platform-pcm.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/soc/intel/sst-mfld-platform-pcm.c b/sound/soc/intel/sst-mfld-platform-pcm.c index 380802a..7c790f5 100644 --- a/sound/soc/intel/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/sst-mfld-platform-pcm.c @@ -122,10 +122,6 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { }, };
-static const struct snd_soc_component_driver sst_component = { - .name = "sst", -}; - /* helper functions */ void sst_set_stream_status(struct sst_runtime_stream *stream, int state) @@ -442,6 +438,11 @@ static struct snd_soc_platform_driver sst_soc_platform_drv = { .pcm_free = sst_pcm_free, };
+static const struct snd_soc_component_driver sst_component = { + .name = "sst", +}; + + static int sst_platform_probe(struct platform_device *pdev) { int ret;
On Mon, May 05, 2014 at 10:19:17PM +0530, Vinod Koul wrote:
This patch series reworks and reformats the existing platform driver we use. This is stepping support for seconds series of patches which will support Merrifield platform with DPCM based implementation
Applied all, thanks. Please make the body of your commit message standalone, don't continue a sentance from the subject line - it makes it look like something got corrupted.
On Mon, 2014-05-05 at 22:19 +0530, Vinod Koul wrote:
This patch series reworks and reformats the existing platform driver we use. This is stepping support for seconds series of patches which will support Merrifield platform with DPCM based implementation
Not much logical changes in code except adding drain support for compressed audio. Most is mere modularization of the existing code
Fixes in v2:
- add two more patches
- fix makefile addition is 4th patch
- dropped name change in platform ops patch
All
Acked-by: Liam Girdwood liam.r.girdwood@linux.intel.com
--------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
On Mon, May 05, 2014 at 10:19:17PM +0530, Vinod Koul wrote:
This patch series reworks and reformats the existing platform driver we use. This is stepping support for seconds series of patches which will support Merrifield platform with DPCM based implementation
I've dropped this series since it broke the build in -next by adding recursion into a board subdirectory and there wasn't a response - please fix and resend.
participants (3)
-
Liam Girdwood
-
Mark Brown
-
Vinod Koul