mailman.alsa-project.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Sound-open-firmware

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
sound-open-firmware@alsa-project.org

  • 4 participants
  • 1576 discussions
[Sound-open-firmware] [PATCH] EQ IIR: Get filter config and response switch via ABI
by Seppo Ingalsuo 25 Sep '17

25 Sep '17
The IIR equalizer configure and control is updated to use the new component ABI. In addition there are checks added to protect IIR equalizer from invalid setup. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> --- src/audio/eq_iir.c | 76 +++++++++++++++++--------------- src/audio/eq_iir.h | 47 -------------------- src/include/uapi/eq.h | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+), 83 deletions(-) create mode 100644 src/include/uapi/eq.h diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c index 58a06a3..86f879a 100644 --- a/src/audio/eq_iir.c +++ b/src/audio/eq_iir.c @@ -44,6 +44,7 @@ #include <reef/audio/pipeline.h> #include <reef/audio/format.h> #include <uapi/ipc.h> +#include <uapi/eq.h> #include "eq_iir.h" #include "iir.h" @@ -57,7 +58,7 @@ /* src component private data */ struct comp_data { - struct eq_iir_configuration *config; + struct sof_eq_iir_config *config; uint32_t period_bytes; struct iir_state_df2t iir[PLATFORM_MAX_CHANNELS]; void (*eq_iir_func)(struct comp_dev *dev, @@ -120,7 +121,7 @@ static void eq_iir_s32_default(struct comp_dev *dev, } } -static void eq_iir_free_parameters(struct eq_iir_configuration **config) +static void eq_iir_free_parameters(struct sof_eq_iir_config **config) { if (*config != NULL) rfree(*config); @@ -150,27 +151,31 @@ static void eq_iir_free_delaylines(struct iir_state_df2t *iir) } static int eq_iir_setup(struct iir_state_df2t iir[], - struct eq_iir_configuration *config, int nch) + struct sof_eq_iir_config *config, int nch) { int i, j, idx, resp; size_t s; size_t size_sum = 0; int64_t *iir_delay; /* TODO should not need to know the type */ + int32_t *coef_data, *assign_response; int response_index[PLATFORM_MAX_CHANNELS]; - if (nch > PLATFORM_MAX_CHANNELS) - return -EINVAL; - /* Free existing IIR channels data if it was allocated */ eq_iir_free_delaylines(iir); + if ((nch > PLATFORM_MAX_CHANNELS) + || (config->channels_in_config > PLATFORM_MAX_CHANNELS)) + return -EINVAL; + /* Collect index of respose start positions in all_coefficients[] */ j = 0; + assign_response = &config->data[0]; + coef_data = &config->data[config->channels_in_config]; for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) { - if (i < config->number_of_responses_defined) { + if (i < config->number_of_responses) { response_index[i] = j; j += NHEADER_DF2T - + NBIQUAD_DF2T * config->all_coefficients[j]; + + NBIQUAD_DF2T * coef_data[j]; } else { response_index[i] = 0; } @@ -178,15 +183,17 @@ static int eq_iir_setup(struct iir_state_df2t iir[], /* Initialize 1st phase */ for (i = 0; i < nch; i++) { - resp = config->assign_response[i]; + resp = assign_response[i]; + if (resp > config->number_of_responses - 1) + return -EINVAL; + if (resp < 0) { /* Initialize EQ channel to bypass */ iir_reset_df2t(&iir[i]); } else { /* Initialize EQ coefficients */ idx = response_index[resp]; - s = iir_init_coef_df2t(&iir[i], - &config->all_coefficients[idx]); + s = iir_init_coef_df2t(&iir[i], &coef_data[idx]); if (s > 0) size_sum += s; else @@ -204,9 +211,8 @@ static int eq_iir_setup(struct iir_state_df2t iir[], /* Initialize 2nd phase to set EQ delay lines pointers */ for (i = 0; i < nch; i++) { - resp = config->assign_response[i]; + resp = assign_response[i]; if (resp >= 0) { - idx = response_index[resp]; iir_init_delay_df2t(&iir[i], &iir_delay); } @@ -216,18 +222,19 @@ static int eq_iir_setup(struct iir_state_df2t iir[], } static int eq_iir_switch_response(struct iir_state_df2t iir[], - struct eq_iir_configuration *config, struct eq_iir_update *update, - int nch) + struct sof_eq_iir_config *config, + struct sof_ipc_ctrl_value_comp compv[], uint32_t num_elemens, int nch) { - int i, ret; + int i, j, ret; /* Copy assign response from update and re-initilize EQ */ if (config == NULL) return -EINVAL; - for (i = 0; i < config->stream_max_channels; i++) { - if (i < update->stream_max_channels) - config->assign_response[i] = update->assign_response[i]; + for (i = 0; i < num_elemens; i++) { + j = compv[i].index; + if (j < config->channels_in_config) + config->data[i] = compv[i].svalue; } ret = eq_iir_setup(iir, config, nch); @@ -293,7 +300,11 @@ static int eq_iir_params(struct comp_dev *dev) trace_eq_iir("par"); - /* calculate period size based on config */ + /* Calculate period size based on config. First make sure that + * frame_bytes is set. + */ + dev->frame_bytes = + dev->params.sample_container_bytes * dev->params.channels; cd->period_bytes = dev->frames * dev->frame_bytes; /* configure downstream buffer */ @@ -316,21 +327,21 @@ static int eq_iir_params(struct comp_dev *dev) static int iir_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - struct eq_iir_update *iir_update; /* TODO: move to IPC header as part of ABI */ + struct sof_ipc_ctrl_value_comp *compv; int i, ret = 0; size_t bs; switch (cdata->cmd) { case SOF_CTRL_CMD_EQ_SWITCH: trace_eq_iir("EFx"); - iir_update = (struct eq_iir_update *) cdata->data; + compv = (struct sof_ipc_ctrl_value_comp *) cdata->data->data; ret = eq_iir_switch_response(cd->iir, cd->config, - iir_update, PLATFORM_MAX_CHANNELS); + compv, cdata->num_elems, PLATFORM_MAX_CHANNELS); /* Print trace information */ - tracev_value(iir_update->stream_max_channels); - for (i = 0; i < iir_update->stream_max_channels; i++) - tracev_value(iir_update->assign_response[i]); + tracev_value(cd->config->channels_in_config); + for (i = 0; i < cd->config->channels_in_config; i++) + tracev_value(cd->config->data[i]); break; case SOF_CTRL_CMD_EQ_CONFIG: @@ -339,8 +350,8 @@ static int iir_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) eq_iir_free_parameters(&cd->config); /* Copy new config, need to decode data to know the size */ - bs = cdata->num_elems; - if (bs > EQ_IIR_MAX_BLOB_SIZE) + bs = cdata->data->size; + if ((bs > SOF_EQ_IIR_MAX_SIZE) || (bs < 1)) return -EINVAL; /* Allocate and make a copy of the blob and setup IIR */ @@ -348,18 +359,11 @@ static int iir_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) if (cd->config == NULL) return -EINVAL; - memcpy(cd->config, cdata->data, bs); + memcpy(cd->config, cdata->data->data, bs); /* Initialize all channels, the actual number of channels may * not be set yet. */ ret = eq_iir_setup(cd->iir, cd->config, PLATFORM_MAX_CHANNELS); - - /* Print trace information */ - tracev_value(cd->config->stream_max_channels); - tracev_value(cd->config->number_of_responses_defined); - for (i = 0; i < cd->config->stream_max_channels; i++) - tracev_value(cd->config->assign_response[i]); - break; case SOF_CTRL_CMD_MUTE: trace_eq_iir("EFm"); diff --git a/src/audio/eq_iir.h b/src/audio/eq_iir.h index 42d95c1..e28a1a3 100644 --- a/src/audio/eq_iir.h +++ b/src/audio/eq_iir.h @@ -33,51 +33,4 @@ #ifndef EQ_IIR_H #define EQ_IIR_H - - -/* eq_iir_configuration - * uint32_t platform max channels - * uint32_t number_of_responses_defined - * 0=no responses, 1=one response defined, 2=two responses defined, etc. - * uint32_t assign_response[PLATFORM_MAX_CHANNELS] - * -1 = not defined, 0 = use first response, 1 = use 2nd response, etc. - * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the - * same first defined response and leave channels 4-7 unequalized. - * all_coefficients[] - * <1st EQ> - * uint32_t num_biquads - * uint32_t num_biquads_in_series - * <1st biquad> - * int32_t coef_a2 Q2.30 format - * int32_t coef_a1 Q2.30 format - * int32_t coef_b2 Q2.30 format - * int32_t coef_b1 Q2.30 format - * int32_t coef_b0 Q2.30 format - * int32_t output_shift number of shifts right, shift left is negative - * int32_t output_gain Q2.14 format - * <2nd biquad> - * ... - * <2nd EQ> - * - * Note: A flat response biquad can be made with a section set to - * b0 = 1.0, gain = 1.0, and other parameters set to 0 - * {0, 0, 0, 0, 1073741824, 0, 16484} - */ - -#define EQ_IIR_MAX_BLOB_SIZE 1024 /* In bytes or size_t */ - -#define NHEADER_EQ_IIR_BLOB 2 /* Blob is two words plus asssigns plus coef */ - -struct eq_iir_configuration { - int32_t stream_max_channels; - int32_t number_of_responses_defined; - int32_t assign_response[PLATFORM_MAX_CHANNELS]; - int32_t all_coefficients[]; -}; - -struct eq_iir_update { - int32_t stream_max_channels; - int32_t assign_response[PLATFORM_MAX_CHANNELS]; -}; - #endif diff --git a/src/include/uapi/eq.h b/src/include/uapi/eq.h new file mode 100644 index 0000000..9c42a51 --- /dev/null +++ b/src/include/uapi/eq.h @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2017, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> + */ + +#ifndef EQ_H +#define EQ_H + +/* FIR EQ type */ + +/* Component will reject non-matching configuration. The version number need + * to be incremented with any ABI changes in function fir_cmd(). + */ +#define SOF_EQ_FIR_ABI_VERSION 1 + +#define SOF_EQ_FIR_MAX_SIZE 4096 /* Max size allowed for coef data in bytes */ + +/* + * eq_fir_configuration data structure contains this information + * uint16_t channels_in_config + * This describes the number of channels in this EQ config data. It + * can be different from PLATFORM_MAX_CHANNELS. + * uint16_t number_of_responses + * 0=no responses, 1=one response defined, 2=two responses defined, etc. + * int16_t data[] + * assign_response[STREAM_MAX_CHANNELS] + * -1 = not defined, 0 = use first response, 1 = use 2nd response, etc. + * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the + * same first defined response and leave channels 4-7 unequalized. + * coef_data[] + * Repeated data { filter_length, input_shift, output_shift, h[] } + * for every EQ response defined where vector h has filter_length + * number of coefficients. Coefficients in h[] are in Q1.15 format. + * E.g. 16384 (Q1.15) = 0.5. The shifts are number of right shifts. + */ + +struct sof_eq_fir_config { + uint16_t channels_in_config; + uint16_t number_of_responses; + int16_t data[]; +}; + +/* IIR EQ type */ + +/* Component will reject non-matching configuration. The version number need + * to be incremented with any ABI changes in function fir_cmd(). + */ +#define SOF_EQ_FIR_ABI_VERSION 1 + +#define SOF_EQ_IIR_MAX_SIZE 1024 /* Max size allowed for coef data in bytes */ + +/* eq_iir_configuration + * uint32_t channels_in_config + * This describes the number of channels in this EQ config data. It + * can be different from PLATFORM_MAX_CHANNELS. + * uint32_t number_of_responses_defined + * 0=no responses, 1=one response defined, 2=two responses defined, etc. + * int32_t data[] + * Data consist of two parts. First is the response assign vector that + * has length of channels_in_config. The latter part is coefficient + * data. + * uint32_t assign_response[channels_in_config] + * -1 = not defined, 0 = use first response, 1 = use 2nd, etc. + * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the + * same first defined response and leave channels 4-7 unequalized. + * coefficient_data[] + * <1st EQ> + * uint32_t num_biquads + * uint32_t num_biquads_in_series + * <1st biquad> + * int32_t coef_a2 Q2.30 format + * int32_t coef_a1 Q2.30 format + * int32_t coef_b2 Q2.30 format + * int32_t coef_b1 Q2.30 format + * int32_t coef_b0 Q2.30 format + * int32_t output_shift number of shifts right, shift left is negative + * int32_t output_gain Q2.14 format + * <2nd biquad> + * ... + * <2nd EQ> + * + * Note: A flat response biquad can be made with a section set to + * b0 = 1.0, gain = 1.0, and other parameters set to 0 + * {0, 0, 0, 0, 1073741824, 0, 16484} + */ + +struct sof_eq_iir_config { + uint32_t channels_in_config; + uint32_t number_of_responses; + int32_t data[]; +}; + +#endif /* EQ_H */ + -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH] Component ABI: Check for valid ABI header for COMP_CMD_SET_DATA command
by Seppo Ingalsuo 25 Sep '17

25 Sep '17
This patch adds the code to check the generic ABI header fields and reject data with invalid header. The individual components those use ABI need to check the component specific fields in addition. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> --- src/include/reef/audio/component.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index 5ae8084..436a758 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -245,6 +245,17 @@ static inline int comp_host_buffer(struct comp_dev *dev, /* send component command - mandatory */ static inline int comp_cmd(struct comp_dev *dev, int cmd, void *data) { + struct sof_ipc_ctrl_data *cdata = data; + + if ((cmd == COMP_CMD_SET_DATA) + && ((cdata->data->magic != SOF_ABI_MAGIC) + || (cdata->data->abi != SOF_ABI_VERSION))) { + trace_comp_error("abi"); + trace_value(cdata->data->magic); + trace_value(cdata->data->abi); + return -EINVAL; + } + return dev->drv->ops.cmd(dev, cmd, data); } -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH] Volume: Add 24 to 24 bit samples volume processing
by Seppo Ingalsuo 25 Sep '17

25 Sep '17
This patch adds to component volume S24_4LE to S24_4LE processing. The macro from audio/format.h is used to compute shifts needed for product. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> --- src/audio/volume.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/audio/volume.c b/src/audio/volume.c index be6197e..b7e8e39 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -41,6 +41,7 @@ #include <reef/clock.h> #include <reef/audio/component.h> #include <reef/audio/pipeline.h> +#include <reef/audio/format.h> #define trace_volume(__e) trace_event(TRACE_CLASS_VOLUME, __e) #define tracev_volume(__e) tracev_event(TRACE_CLASS_VOLUME, __e) @@ -214,6 +215,26 @@ static void vol_s24_to_s32(struct comp_dev *dev, struct comp_buffer *sink, } } +/* Copy and scale volume from 24 bit source buffer to 24 bit on 32 bit boundary + * dest buffer. + */ +static void vol_s24_to_s24(struct comp_dev *dev, struct comp_buffer *sink, + struct comp_buffer *source, uint32_t frames) +{ + struct comp_data *cd = comp_get_drvdata(dev); + int32_t i, *src = (int32_t*) source->r_ptr; + int32_t *dest = (int32_t*) sink->w_ptr; + + /* buffer sizes are always divisible by period frames */ + /* Samples are Q1.23 and volume is Q1.16 */ + for (i = 0; i < frames * 2; i += 2) { + dest[i] = (int32_t)(Q_MULTS_32X32( + (int64_t)src[i], cd->volume[0], 23, 16, 23)); + dest[i + 1] = (int32_t)(Q_MULTS_32X32( + (int64_t)src[i+1], cd->volume[1], 23, 16, 23)); + } +} + /* map of source and sink buffer formats to volume function */ static const struct comp_func_map func_map[] = { {SOF_IPC_FRAME_S16_LE, SOF_IPC_FRAME_S16_LE, 2, vol_s16_to_s16}, @@ -224,6 +245,7 @@ static const struct comp_func_map func_map[] = { {SOF_IPC_FRAME_S24_4LE, SOF_IPC_FRAME_S16_LE, 2, vol_s24_to_s16}, {SOF_IPC_FRAME_S32_LE, SOF_IPC_FRAME_S24_4LE, 2, vol_s32_to_s24}, {SOF_IPC_FRAME_S24_4LE, SOF_IPC_FRAME_S32_LE, 2, vol_s24_to_s32}, + {SOF_IPC_FRAME_S24_4LE, SOF_IPC_FRAME_S24_4LE, 2, vol_s24_to_s24}, }; /* synchronise host mmap() volume with real value */ -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH] comp: host: Add trace output for buffer size errors
by Liam Girdwood 25 Sep '17

25 Sep '17
Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/audio/host.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/audio/host.c b/src/audio/host.c index a1d312a..76124fc 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -415,6 +415,7 @@ static int host_params(struct comp_dev *dev) err = buffer_set_size(hd->dma_buffer, buffer_size); if (err < 0) { trace_host_error("eSz"); + trace_value(buffer_size); return err; } -- 2.11.0
1 1
0 0
[Sound-open-firmware] [PATCH] topology: fix capture pipeline ID for SSP DAI
by Liam Girdwood 24 Sep '17

24 Sep '17
Capture pipeline for SSP DAI should be 2. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- topology/reef-apl-nocodec.m4 | 2 +- topology/reef-bdw-rt286.m4 | 2 +- topology/reef-bdw-rt5640.m4 | 2 +- topology/reef-bxt-nocodec.m4 | 2 +- topology/reef-byt-nocodec.m4 | 2 +- topology/reef-byt-rt5640.m4 | 2 +- topology/reef-byt-rt5651.m4 | 2 +- topology/reef-cht-nocodec.m4 | 2 +- topology/reef-hsw-rt5640.m4 | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/topology/reef-apl-nocodec.m4 b/topology/reef-apl-nocodec.m4 index f87a4e9..5e497f6 100644 --- a/topology/reef-apl-nocodec.m4 +++ b/topology/reef-apl-nocodec.m4 @@ -93,7 +93,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 2, I2S, + 2, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-bdw-rt286.m4 b/topology/reef-bdw-rt286.m4 index eae2065..cb11ad6 100644 --- a/topology/reef-bdw-rt286.m4 +++ b/topology/reef-bdw-rt286.m4 @@ -93,7 +93,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP0 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 0, I2S, + 2, SSP, 0, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-bdw-rt5640.m4 b/topology/reef-bdw-rt5640.m4 index 60feb82..b3c19c2 100644 --- a/topology/reef-bdw-rt5640.m4 +++ b/topology/reef-bdw-rt5640.m4 @@ -93,7 +93,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP0 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 0, I2S, + 2, SSP, 0, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-bxt-nocodec.m4 b/topology/reef-bxt-nocodec.m4 index 744e9b1..58bc6f6 100644 --- a/topology/reef-bxt-nocodec.m4 +++ b/topology/reef-bxt-nocodec.m4 @@ -93,7 +93,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 2, I2S, + 2, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-byt-nocodec.m4 b/topology/reef-byt-nocodec.m4 index 05373f9..5f6cd1d 100644 --- a/topology/reef-byt-nocodec.m4 +++ b/topology/reef-byt-nocodec.m4 @@ -82,7 +82,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 2, I2S, + 2, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-byt-rt5640.m4 b/topology/reef-byt-rt5640.m4 index 911b4d1..c5e8b52 100644 --- a/topology/reef-byt-rt5640.m4 +++ b/topology/reef-byt-rt5640.m4 @@ -82,7 +82,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 2, Audio, + 2, SSP, 2, Audio, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-byt-rt5651.m4 b/topology/reef-byt-rt5651.m4 index c6f20a4..e335d66 100644 --- a/topology/reef-byt-rt5651.m4 +++ b/topology/reef-byt-rt5651.m4 @@ -82,7 +82,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP2 using "Audio" DAPM stream name and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 2, Audio, + 2, SSP, 2, Audio, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-cht-nocodec.m4 b/topology/reef-cht-nocodec.m4 index 43e0e6e..ddeb71e 100644 --- a/topology/reef-cht-nocodec.m4 +++ b/topology/reef-cht-nocodec.m4 @@ -82,7 +82,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 2, I2S, + 2, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) diff --git a/topology/reef-hsw-rt5640.m4 b/topology/reef-hsw-rt5640.m4 index 3d26149..efd815b 100644 --- a/topology/reef-hsw-rt5640.m4 +++ b/topology/reef-hsw-rt5640.m4 @@ -93,7 +93,7 @@ DAI_ADD(sof/pipe-dai-playback.m4, # capture DAI is SSP0 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 1, SSP, 0, I2S, + 2, SSP, 0, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH] pipeline: fix timestamp for capture streams.
by Liam Girdwood 24 Sep '17

24 Sep '17
Make sure we timestamp upstream in capture streams Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/audio/pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 62c21b7..4e830c6 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -851,7 +851,7 @@ upstream: continue; /* continue downstream */ - res = timestamp_upstream(start, buffer->sink, posn); + res = timestamp_upstream(start, buffer->source, posn); if (res == 1) break; } -- 2.11.0
1 3
0 0
[Sound-open-firmware] [PATCH] ssp: add missing break in dai format switch
by Pierre-Louis Bossart 23 Sep '17

23 Sep '17
Support for DSP_A is obviously broken. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com> --- src/drivers/ssp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/drivers/ssp.c b/src/drivers/ssp.c index c97b60e..a472974 100644 --- a/src/drivers/ssp.c +++ b/src/drivers/ssp.c @@ -224,6 +224,7 @@ static inline int ssp_set_config(struct dai *dai, sscr0 |= SSCR0_PSP | SSCR0_MOD | SSCR0_FRDC(config->num_slots); sscr1 |= SSCR1_TRAIL; sspsp |= SSPSP_SFRMWDTH(1) | SSPSP_SFRMDLY(2); + break; case SOF_DAI_FMT_DSP_B: sscr0 |= SSCR0_PSP | SSCR0_MOD | SSCR0_FRDC(config->num_slots); sscr1 |= SSCR1_TRAIL; -- 2.11.0
2 1
0 0
[Sound-open-firmware] [PATCH 1/4] SRC: Add checks for number of channels when initializing from params
by Seppo Ingalsuo 22 Sep '17

22 Sep '17
This patch prevents SRCs init to loop past PLATFORM_MAX_CHANNELS. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> --- src/audio/src.c | 5 +++-- src/audio/src_core.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/audio/src.c b/src/audio/src.c index 1f84a5a..203e802 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -322,7 +322,7 @@ static int src_params(struct comp_dev *dev) size_t delay_lines_size; uint32_t source_rate, sink_rate; int32_t *buffer_start; - int n = 0, i, err, frames_is_for_source, q; + int n = 0, i, err, frames_is_for_source, nch, q; trace_src("par"); @@ -392,7 +392,8 @@ static int src_params(struct comp_dev *dev) buffer_start = cd->delay_lines + need.scratch; /* Initize SRC for actual sample rate */ - for (i = 0; i < params->channels; i++) { + nch = MIN(params->channels, PLATFORM_MAX_CHANNELS); + for (i = 0; i < nch; i++) { n = src_polyphase_init(&cd->src[i], source_rate, sink_rate, &need, buffer_start); buffer_start += need.single_src; diff --git a/src/audio/src_core.h b/src/audio/src_core.h index 5977421..886cc23 100644 --- a/src/audio/src_core.h +++ b/src/audio/src_core.h @@ -33,6 +33,7 @@ #define SRC_CORE_H #define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) struct src_alloc { int fir_s1; -- 2.11.0
2 4
0 0
[Sound-open-firmware] [PATCH 1/3] ipc: add support for timer topology scheduling source.
by Liam Girdwood 22 Sep '17

22 Sep '17
Add an option to schedule based on timer or on DAI/DMA IRQ Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/include/uapi/ipc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index acfa05e..472fb41 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -678,6 +678,7 @@ struct sof_ipc_pipe_new { uint32_t mips; /* worst case instruction count per period */ uint32_t frames_per_sched; /* output frames of pipeline, 0 is variable */ uint32_t xrun_limit_usecs; /* report xruns greater than limit */ + uint32_t timer; /* non zero if timer scheduled otherwise DAI scheduled */ } __attribute__((packed)); /* pipeline construction complete - SOF_IPC_TPLG_PIPE_COMPLETE */ -- 2.11.0
1 2
0 0
[Sound-open-firmware] [PATCH] comp: enforce state transition checking for each component.
by Liam Girdwood 21 Sep '17

21 Sep '17
Make sure each component checks the state transition prior to performing any action for the new state. This ensure that only supported transitions are used and any non supported transition is flagged as an error. This also removes DRAIN state and performs some cleanup on mixer state handling. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/audio/component.c | 7 +++--- src/audio/dai.c | 16 ++++-------- src/audio/eq_fir.c | 10 +++++--- src/audio/eq_iir.c | 28 ++++----------------- src/audio/host.c | 15 +++++------ src/audio/mixer.c | 51 +++++++++++++++++++++----------------- src/audio/src.c | 14 +++++------ src/audio/tone.c | 14 +++++------ src/audio/volume.c | 15 +++++------ src/include/reef/audio/component.h | 1 - src/ipc/intel-ipc.c | 3 --- 11 files changed, 74 insertions(+), 100 deletions(-) diff --git a/src/audio/component.c b/src/audio/component.c index 1cf4799..ec170c6 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -126,6 +126,7 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state = COMP_STATE_ACTIVE; } else { trace_comp_error("CES"); + trace_value(dev->state); ret = -EINVAL; } break; @@ -134,6 +135,7 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state = COMP_STATE_ACTIVE; } else { trace_comp_error("CEr"); + trace_value(dev->state); ret = -EINVAL; } break; @@ -142,6 +144,7 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state = COMP_STATE_READY; } else { trace_comp_error("CEs"); + trace_value(dev->state); ret = -EINVAL; } break; @@ -151,13 +154,11 @@ int comp_set_state(struct comp_dev *dev, int cmd) dev->state = COMP_STATE_PAUSED; else { trace_comp_error("CEp"); + trace_value(dev->state); ret = -EINVAL; } break; default: - trace_comp_error("CEd"); - trace_value(cmd); - ret = -EINVAL; break; } diff --git a/src/audio/dai.c b/src/audio/dai.c index cf8de72..e22d21d 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -444,20 +444,18 @@ static int dai_reset(struct comp_dev *dev) static int dai_cmd(struct comp_dev *dev, int cmd, void *data) { struct dai_data *dd = comp_get_drvdata(dev); -// struct sof_ipc_ctrl_values *ctrl = data; int ret; trace_dai("cmd"); tracev_value(cmd); + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; + switch (cmd) { - case COMP_CMD_PAUSE: - case COMP_CMD_STOP: - dev->state = COMP_STATE_PAUSED; - break; case COMP_CMD_RELEASE: case COMP_CMD_START: - ret = dma_start(dd->dma, dd->chan); if (ret < 0) return ret; @@ -465,16 +463,12 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data) /* update starting wallclock */ platform_dai_wallclock(dev, &dd->wallclock); - dev->state = COMP_STATE_ACTIVE; - break; - case COMP_CMD_SUSPEND: - case COMP_CMD_RESUME: break; default: break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index ef3b7d2..ba42643 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -389,16 +389,18 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) trace_src("cmd"); + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; + switch (cmd) { case COMP_CMD_SET_DATA: ret = fir_cmd(dev, cdata); break; - case COMP_CMD_START: case COMP_CMD_STOP: - case COMP_CMD_PAUSE: - case COMP_CMD_RELEASE: + comp_buffer_reset(dev); + break; default: - ret = comp_set_state(dev, cmd); break; } diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c index 4a4cff1..995721b 100644 --- a/src/audio/eq_iir.c +++ b/src/audio/eq_iir.c @@ -392,36 +392,18 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) trace_eq_iir("cmd"); + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; + switch (cmd) { case COMP_CMD_SET_DATA: ret = iir_cmd(dev, cdata); break; - case COMP_CMD_START: - trace_eq_iir("EFs"); - dev->state = COMP_STATE_ACTIVE; - break; case COMP_CMD_STOP: - trace_eq_iir("ESp"); - if (dev->state == COMP_STATE_ACTIVE || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_READY; - } - break; - case COMP_CMD_PAUSE: - trace_eq_iir("EPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_ACTIVE) - dev->state = COMP_STATE_PAUSED; - - break; - case COMP_CMD_RELEASE: - trace_eq_iir("ERl"); - dev->state = COMP_STATE_ACTIVE; + comp_buffer_reset(dev); break; default: - trace_eq_iir("EDf"); - ret = -EINVAL; break; } diff --git a/src/audio/host.c b/src/audio/host.c index 8aa29ad..a1d312a 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -278,7 +278,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) /* init posn data. TODO: other fields */ hd->posn.comp_id = comp->id; - + dev->state = COMP_STATE_READY; return dev; error: @@ -549,19 +549,16 @@ static int host_cmd(struct comp_dev *dev, int cmd, void *data) trace_host("cmd"); + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; + switch (cmd) { case COMP_CMD_PAUSE: case COMP_CMD_STOP: - if (dev->state == COMP_STATE_ACTIVE) - ret = host_stop(dev); - break; - case COMP_CMD_SUSPEND: - case COMP_CMD_RESUME: + ret = host_stop(dev); break; - case COMP_CMD_START: - case COMP_CMD_RELEASE: default: - ret = comp_set_state(dev, cmd); break; } diff --git a/src/audio/mixer.c b/src/audio/mixer.c index 85aa601..3861b7c 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -151,55 +151,60 @@ static int mixer_params(struct comp_dev *dev) return 0; } -static int mixer_status_change(struct comp_dev *dev/* , uint32_t target_state */) +static int mixer_source_status_count(struct comp_dev *mixer, uint32_t status) { - int finish = 0; struct comp_buffer *source; struct list_item * blist; - uint32_t stream_target = COMP_STATE_INIT; + int count = 0; - /* calculate the highest status between input streams */ - list_for_item(blist, &dev->bsource_list) { + /* count source with state == status */ + list_for_item(blist, &mixer->bsource_list) { source = container_of(blist, struct comp_buffer, sink_list); - if (source->source->state > stream_target) - stream_target = source->source->state; + if (source->source->state == status) + count++; } - if (dev->state == stream_target) - finish = 1; - else - dev->state = stream_target; + return count; +} + +static inline int mixer_sink_status(struct comp_dev *mixer) +{ + struct comp_buffer *sink; - return finish; + sink = list_first_item(&mixer->bsink_list, struct comp_buffer, + source_list); + return sink->sink->state; } /* used to pass standard and bespoke commands (with data) to component */ static int mixer_cmd(struct comp_dev *dev, int cmd, void *data) { - int finish = 0; + int ret; trace_mixer("cmd"); + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; + switch(cmd) { case COMP_CMD_START: - trace_mixer("MSa"); - case COMP_CMD_PAUSE: case COMP_CMD_RELEASE: - case COMP_CMD_DRAIN: - case COMP_CMD_SUSPEND: - case COMP_CMD_RESUME: - finish = mixer_status_change(dev); + if (mixer_sink_status(dev) == COMP_STATE_ACTIVE) + return 1; /* no need to go downstream */ break; + case COMP_CMD_PAUSE: case COMP_CMD_STOP: - finish = mixer_status_change(dev); - if (finish == 0) - comp_buffer_reset(dev); + if (mixer_source_status_count(dev, COMP_STATE_ACTIVE) > 0) { + dev->state = COMP_STATE_ACTIVE; + return 1; /* no need to go downstream */ + } break; default: break; } - return finish; + return 0; /* send cmd downstream */ } /* diff --git a/src/audio/src.c b/src/audio/src.c index bc32f95..1f84a5a 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -292,6 +292,7 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp) for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) src_polyphase_reset(&cd->src[i]); + dev->state = COMP_STATE_READY; return dev; } @@ -489,17 +490,16 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) struct sof_ipc_ctrl_data *cdata = data; int ret = 0; - trace_src("SCm"); + trace_src("cmd"); + + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; switch (cmd) { case COMP_CMD_SET_VALUE: return src_ctrl_cmd(dev, cdata); - case COMP_CMD_START: - case COMP_CMD_STOP: - case COMP_CMD_PAUSE: - case COMP_CMD_RELEASE: default: - ret = comp_set_state(dev, cmd); break; } @@ -564,7 +564,7 @@ static int src_reset(struct comp_dev *dev) for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) src_polyphase_reset(&cd->src[i]); - dev->state = COMP_STATE_INIT; + dev->state = COMP_STATE_READY; return 0; } diff --git a/src/audio/tone.c b/src/audio/tone.c index aec8a72..94d9aa7 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -395,6 +395,7 @@ static struct comp_dev *tone_new(struct sof_ipc_comp *comp) /* Reset tone generator and set channels volumes to default */ tonegen_reset(&cd->sg); + dev->state = COMP_STATE_READY; return dev; } @@ -472,17 +473,16 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data) struct sof_ipc_ctrl_data *cdata = data; int ret = 0; - trace_tone("tri"); + trace_tone("cmd"); + + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; switch (cmd) { case COMP_CMD_SET_VALUE: return tone_ctrl_cmd(dev, cdata); - case COMP_CMD_START: - case COMP_CMD_STOP: - case COMP_CMD_PAUSE: - case COMP_CMD_RELEASE: default: - ret = comp_set_state(dev, cmd); break; } @@ -550,7 +550,7 @@ static int tone_reset(struct comp_dev *dev) /* Initialize with the defaults */ tonegen_reset(&cd->sg); - dev->state = COMP_STATE_INIT; + dev->state = COMP_STATE_READY; return 0; } diff --git a/src/audio/volume.c b/src/audio/volume.c index 45bbe27..960a144 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -466,25 +466,22 @@ static int volume_ctrl_get_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *c static int volume_cmd(struct comp_dev *dev, int cmd, void *data) { struct sof_ipc_ctrl_data *cdata = data; - int ret = 0; + int ret; trace_volume("cmd"); + ret = comp_set_state(dev, cmd); + if (ret < 0) + return ret; + switch (cmd) { case COMP_CMD_SET_VALUE: return volume_ctrl_set_cmd(dev, cdata); case COMP_CMD_GET_VALUE: return volume_ctrl_get_cmd(dev, cdata); - case COMP_CMD_START: - case COMP_CMD_STOP: - case COMP_CMD_PAUSE: - case COMP_CMD_RELEASE: default: - ret = comp_set_state(dev, cmd); - break; + return ret; } - - return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index d092210..5ae8084 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -76,7 +76,6 @@ #define COMP_CMD_START 1 /* start component stream */ #define COMP_CMD_PAUSE 2 /* immediately pause the component stream */ #define COMP_CMD_RELEASE 3 /* release paused component stream */ -#define COMP_CMD_DRAIN 4 /* drain component buffers */ #define COMP_CMD_SUSPEND 5 /* suspend component */ #define COMP_CMD_RESUME 6 /* resume component */ diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 752ea0c..92dfd73 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -394,9 +394,6 @@ static int ipc_stream_trigger(uint32_t header) case iCS(SOF_IPC_STREAM_TRIG_RELEASE): cmd = COMP_CMD_RELEASE; break; - case iCS(SOF_IPC_STREAM_TRIG_DRAIN): - cmd = COMP_CMD_DRAIN; - break; /* XRUN is special case- TODO */ case iCS(SOF_IPC_STREAM_TRIG_XRUN): return 0; -- 2.11.0
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • ...
  • 158
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.