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

  • 1572 discussions
[Sound-open-firmware] [PATCH] topology: apl-tdf8532: add support for SSP2-Codec
by Keyon Jie 28 Mar '18

28 Mar '18
Signed-off-by: Keyon Jie <yang.jie(a)linux.intel.com> --- topology/reef-apl-tdf8532.m4 | 48 ++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/topology/reef-apl-tdf8532.m4 b/topology/reef-apl-tdf8532.m4 index eaddac9..50023f0 100644 --- a/topology/reef-apl-tdf8532.m4 +++ b/topology/reef-apl-tdf8532.m4 @@ -20,8 +20,8 @@ include(`dsps/bxt.m4') # Define the pipelines # # PCM0 ----> volume -----> SSP4 -# -# PCM1 <---- Volume <----- SSP4 +# PCM1 ----> volume -----> SSP2 +# PCM2 <---- Volume <----- SSP2 # # Low Latency playback pipeline 1 on PCM 0 using max 4 channels of s32le. @@ -31,18 +31,22 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-volume-playback.m4, 1, 0, 4, s32le, 48, 1000, 0, 0, 0, 1, SSP, 4, s32le, 2) -# Low Latency capture pipeline 2 on PCM 0 using max 4 channels of s32le. +# Low Latency playback pipeline 3 on PCM 1 using max 4 channels of s32le. # Schedule 48 frames per 1000us deadline on core 0 with priority 0 -# Use DMAC 0 channel 2 for PCM audio capture data -PIPELINE_PCM_DAI_ADD(sof/pipe-volume-capture.m4, - 2, 0, 4, s32le, - 48, 1000, 0, 0, 0, 1, SSP, 4, s32le, 2) +# Use DMAC 0 channel 1 for PCM audio playback data +PIPELINE_PCM_DAI_ADD(sof/pipe-volume-playback.m4, + 2, 1, 2, s16le, + 48, 1000, 0, 0, 0, 1, SSP, 2, s16le, 2) +# Low Latency playback pipeline 1 on PCM 0 using max 4 channels of s32le. +# Schedule 48 frames per 1000us deadline on core 0 with priority 0 +# Use DMAC 0 channel 1 for PCM audio playback data +PIPELINE_PCM_DAI_ADD(sof/pipe-volume-capture.m4, + 3, 1, 2, s16le, + 48, 1000, 0, 0, 0, 1, SSP, 2, s16le, 2) # # DAI configuration # -# SSP port 4 is our only pipeline DAI -# # playback DAI is SSP4 using 2 periods # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 @@ -51,15 +55,23 @@ DAI_ADD(sof/pipe-dai-playback.m4, PIPELINE_SOURCE_1, 2, s32le, 48, 1000, 0, 0) -# capture DAI is SSP4 using 2 periods -# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 +# playback DAI is SSP2 using 2 periods +# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 +DAI_ADD(sof/pipe-dai-playback.m4, + 2, SSP, 2, SSP2-Codec, + PIPELINE_SOURCE_2, 2, s16le, + 48, 1000, 0, 0) + +# capture DAI is SSP2 using 2 periods +# Buffers use s16le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, - 2, SSP, 4, SSP4-Codec, - PIPELINE_SINK_2, 2, s32le, + 3, SSP, 2, SSP2-Codec, + PIPELINE_SINK_3, 2, s16le, 48, 1000, 0, 0) -# PCM Low Latency -PCM_DUPLEX_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2) +# PCM Low Latency, id 0 +PCM_PLAYBACK_ADD(Port4, 1, 0, 0, PIPELINE_PCM_1) +PCM_DUPLEX_ADD(Port2, 4, 1, 1, PIPELINE_PCM_2, PIPELINE_PCM_3) # # BE configurations - overrides config in ACPI if present @@ -69,3 +81,9 @@ DAI_CONFIG(SSP, 4, SSP4-Codec, DSP_B, 32, DAI_CLOCK(bclk, 12288000, slave), DAI_CLOCK(fsync, 48000, slave), DAI_TDM(8, 32, 15, 15)) + +DAI_CONFIG(SSP, 2, SSP2-Codec, I2S, 16, + DAI_CLOCK(mclk, 24576000, slave), + DAI_CLOCK(bclk, 1536000, slave), + DAI_CLOCK(fsync, 48000, slave), + DAI_TDM(2, 16, 3, 3)) -- 2.14.1
2 1
0 0
[Sound-open-firmware] [PATCH 1/3] topology: append pipeline id to PGA and control mixer
by Keyon Jie 28 Mar '18

28 Mar '18
Signed-off-by: Keyon Jie <yang.jie(a)linux.intel.com> --- topology/m4/mixercontrol.m4 | 2 +- topology/sof/pipe-low-latency-capture.m4 | 2 +- topology/sof/pipe-low-latency-playback.m4 | 4 ++-- topology/sof/pipe-pcm-media.m4 | 2 +- topology/sof/pipe-tone.m4 | 4 ++-- topology/sof/pipe-volume-capture.m4 | 2 +- topology/sof/pipe-volume-playback.m4 | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/topology/m4/mixercontrol.m4 b/topology/m4/mixercontrol.m4 index 77a3784..a3423c3 100644 --- a/topology/m4/mixercontrol.m4 +++ b/topology/m4/mixercontrol.m4 @@ -30,7 +30,7 @@ define(`CONTROLMIXER_OPS', dnl C_CONTROLMIXER(name, index, ops, max, invert, tlv, KCONTROL_CHANNELS) define(`C_CONTROLMIXER', -`SectionControlMixer.STR($1) {' +`SectionControlMixer."$1 PIPELINE_ID" {' `' ` # control belongs to this index group' ` index STR($2)' diff --git a/topology/sof/pipe-low-latency-capture.m4 b/topology/sof/pipe-low-latency-capture.m4 index 96fa3cc..39be2bc 100644 --- a/topology/sof/pipe-low-latency-capture.m4 +++ b/topology/sof/pipe-low-latency-capture.m4 @@ -32,7 +32,7 @@ C_CONTROLMIXER(PCM PCM_ID Capture Volume, PIPELINE_ID, W_PCM_CAPTURE(PCM_ID, Low Latency Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 0) # "Capture Volume" has 2 sink and source periods for host and DAI ping-pong -W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, LIST(` ', "PCM PCM_ID Capture Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, 0, LIST(` ', "PCM PCM_ID Capture Volume PIPELINE_ID")) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, diff --git a/topology/sof/pipe-low-latency-playback.m4 b/topology/sof/pipe-low-latency-playback.m4 index b7f2d11..b40b793 100644 --- a/topology/sof/pipe-low-latency-playback.m4 +++ b/topology/sof/pipe-low-latency-playback.m4 @@ -57,10 +57,10 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, W_PCM_PLAYBACK(PCM_ID, Low Latency Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2) # "Playback Volume" has 1 sink period and 2 source periods for host ping-pong -W_PGA(0, PIPELINE_FORMAT, 1, 2, 1, LIST(` ', "PCM PCM_ID Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 1, 2, 1, LIST(` ', "PCM PCM_ID Playback Volume PIPELINE_ID")) # "Master Playback Volume" has 1 source and 2 sink periods for DAI ping-pong -W_PGA(1, PIPELINE_FORMAT, 2, 1, 1, LIST(` ', "Master Playback Volume")) +W_PGA(1, PIPELINE_FORMAT, 2, 1, 1, LIST(` ', "Master Playback Volume PIPELINE_ID")) # Mixer 0 has 1 sink and source periods. W_MIXER(0, PIPELINE_FORMAT, 1, 1, 1) diff --git a/topology/sof/pipe-pcm-media.m4 b/topology/sof/pipe-pcm-media.m4 index 9eaa187..7f68977 100644 --- a/topology/sof/pipe-pcm-media.m4 +++ b/topology/sof/pipe-pcm-media.m4 @@ -45,7 +45,7 @@ W_DATA(media_src_conf, media_src_tokens) W_PCM_PLAYBACK(PCM_ID, Media Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2) # "Playback Volume" has 2 sink period and 2 source periods for host ping-pong -W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "PCM PCM_ID Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "PCM PCM_ID Playback Volume PIPELINE_ID")) # "SRC 0" has 2 sink and source periods. W_SRC(0, PIPELINE_FORMAT, 2, 2, media_src_conf, 2) diff --git a/topology/sof/pipe-tone.m4 b/topology/sof/pipe-tone.m4 index 09ed32c..3cdd408 100644 --- a/topology/sof/pipe-tone.m4 +++ b/topology/sof/pipe-tone.m4 @@ -20,7 +20,7 @@ include(`pipeline.m4') # # Volume Mixer control with max value of 32 -C_CONTROLMIXER(Tone Volume PIPELINE_ID, PIPELINE_ID, +C_CONTROLMIXER(Tone Volume, PIPELINE_ID, CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256), CONTROLMIXER_MAX(, 32), false, @@ -29,7 +29,7 @@ C_CONTROLMIXER(Tone Volume PIPELINE_ID, PIPELINE_ID, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) # Switch type Mixer Control with max value of 1 -C_CONTROLMIXER(Tone Switch PIPELINE_ID, PIPELINE_ID, +C_CONTROLMIXER(Tone Switch, PIPELINE_ID, CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256), CONTROLMIXER_MAX(max 1 indicates switch type control, 1), false, diff --git a/topology/sof/pipe-volume-capture.m4 b/topology/sof/pipe-volume-capture.m4 index 5d1c24f..b3d3206 100644 --- a/topology/sof/pipe-volume-capture.m4 +++ b/topology/sof/pipe-volume-capture.m4 @@ -34,7 +34,7 @@ C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, W_PCM_CAPTURE(PCM_ID, Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 0, 2, 2) # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Capture Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Capture Volume PIPELINE_ID")) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, diff --git a/topology/sof/pipe-volume-playback.m4 b/topology/sof/pipe-volume-playback.m4 index 727490d..4b12d2a 100644 --- a/topology/sof/pipe-volume-playback.m4 +++ b/topology/sof/pipe-volume-playback.m4 @@ -34,7 +34,7 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 2, 0, 2) # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, 2, LIST(` ', "Master Playback Volume PIPELINE_ID")) # Playback Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, -- 2.14.1
2 3
0 0
[Sound-open-firmware] [PATCH v3 1/3] trace: core: add trace_flush()
by Ranjani Sridharan 28 Mar '18

28 Mar '18
This patch adds a new trace_flush() feature to flush the last remaining trace messages during panic. Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> Signed-off-by: Yan Wang <yan.wang(a)linux.intel.com> --- Tested with Minnowboard Turbot with RT5651 Kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 SOF: https://github.com/ranj063/sof.git branch: debug/trace_test SOFT: 1.1-stable --- --- src/include/reef/dma-trace.h | 1 + src/include/reef/panic.h | 8 ++++- src/include/reef/trace.h | 1 + src/lib/dma-trace.c | 35 ++++++++++++++++++++++ src/lib/trace.c | 11 +++++++ .../apollolake/include/platform/platform.h | 3 ++ src/platform/baytrail/include/platform/platform.h | 3 ++ .../cannonlake/include/platform/platform.h | 3 ++ src/platform/haswell/include/platform/platform.h | 3 ++ 9 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h index f17ffe5..bf6e3f3 100644 --- a/src/include/reef/dma-trace.h +++ b/src/include/reef/dma-trace.h @@ -72,6 +72,7 @@ int dma_trace_init_complete(struct dma_trace_data *d); int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size); int dma_trace_enable(struct dma_trace_data *d); +void dma_trace_flush(void *t); void dtrace_event(const char *e, uint32_t size); void dtrace_event_atomic(const char *e, uint32_t length); diff --git a/src/include/reef/panic.h b/src/include/reef/panic.h index e8b4ae2..71df1b8 100644 --- a/src/include/reef/panic.h +++ b/src/include/reef/panic.h @@ -34,6 +34,7 @@ #include <reef/reef.h> #include <reef/mailbox.h> #include <reef/interrupt.h> +#include <reef/trace.h> #include <platform/platform.h> #include <uapi/ipc.h> #include <stdint.h> @@ -59,8 +60,13 @@ static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames) /* TODO: send IPC oops message to host */ - /* panic and loop forever */ + /* panic */ platform_panic(p); + + /* flush last trace messages */ + trace_flush(); + + /* and loop forever */ while (1) {}; } diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 7afbd23..44824b9 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -106,6 +106,7 @@ void _trace_error(uint32_t event); void _trace_error_value(uint32_t event); void _trace_event_atomic(uint32_t event); void _trace_error_atomic(uint32_t event); +void trace_flush(void); void trace_off(void); void trace_init(struct reef * reef); diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 10e6102..5046a09 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -36,6 +36,7 @@ #include <arch/cache.h> #include <platform/timer.h> #include <platform/dma.h> +#include <platform/platform.h> #include <reef/lock.h> #include <stdint.h> @@ -285,6 +286,40 @@ int dma_trace_enable(struct dma_trace_data *d) return 0; } +void dma_trace_flush(void *t) +{ + struct dma_trace_buf *buffer = &trace_data->dmatb; + uint32_t avail = buffer->avail; + int32_t size; + int32_t wrap_count; + + /* number of bytes to flush */ + if (avail > DMA_FLUSH_TRACE_SIZE) { + size = DMA_FLUSH_TRACE_SIZE; + } else { + /* check for buffer wrap */ + if (buffer->w_ptr > buffer->r_ptr) + size = buffer->w_ptr - buffer->r_ptr; + else + size = buffer->end_addr - buffer->r_ptr + + buffer->w_ptr - buffer->addr; + } + + /* check for buffer wrap */ + if (buffer->w_ptr - size < buffer->addr) { + wrap_count = buffer->w_ptr - buffer->addr; + memcpy(t, buffer->end_addr - (size - wrap_count), + size - wrap_count); + memcpy(t + (size - wrap_count), buffer->addr, + wrap_count); + } else { + memcpy(t, buffer->w_ptr - size, size); + } + + /* writeback trace data */ + dcache_writeback_region(t, size); +} + static void dtrace_add_event(const char *e, uint32_t length) { struct dma_trace_buf *buffer = &trace_data->dmatb; diff --git a/src/lib/trace.c b/src/lib/trace.c index de99a4e..8d53b97 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -136,6 +136,17 @@ void _trace_event_atomic(uint32_t event) dtrace_event_atomic((const char*)dt, sizeof(uint64_t) * 2); } +void trace_flush(void) +{ + volatile uint64_t *t; + + /* get mailbox position */ + t = (volatile uint64_t *)(MAILBOX_TRACE_BASE + trace.pos); + + /* flush dma trace messages */ + dma_trace_flush((void *)t); +} + void trace_off(void) { trace.enable = 0; diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h index a1dfba2..86172bf 100644 --- a/src/platform/apollolake/include/platform/platform.h +++ b/src/platform/apollolake/include/platform/platform.h @@ -88,6 +88,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index 9a6967b..f3464f5 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -82,6 +82,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h index b007e8a..764ef76 100644 --- a/src/platform/cannonlake/include/platform/platform.h +++ b/src/platform/cannonlake/include/platform/platform.h @@ -92,6 +92,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index a9efe8a..9ffab90 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -81,6 +81,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 -- 2.14.1
2 3
0 0
[Sound-open-firmware] [PATCH V2] dma-trace: Fix reschedule bug to avoid dma buffer overflow
by Xiuli Pan 28 Mar '18

28 Mar '18
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> We have wrong logic in reschedule, we always reschedule the trace_work once the buffer is half full and new trace coming. We will delay the old schedule before the old scheduled trace_work is finally run. Thus the trace_work will like the carrot in front of the DSP as the donkey, the DSP will never run the trace_work that scheduled in the furture while we are in busy state and lots of trace are coming continuously. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> Reviewed-by: Zhigang Wu <zhigang.wu(a)linux.intel.com> Reviewed-by: Yan Wang <yan.wang(a)linux.intel.com> Tested-by: Zhigang Wu <zhigang.wu(a)linux.intel.com> --- V2: reuse copy in progress as Yan suggest. Test with: Mininow max rt5651 and GP-MRB nocodec and CNL nocodec SOF 1.1-stable: 210989dffeea811de2370fccb7cf5d53106b1e6e SOF-Tool 1.1-stable: 49c1b450e635ac0c893d67ff0ddfd34e03a85b46 https://github.com/plbossart/sound/tree/topic/sof-v4.14: 8d8c1bb32537800726b14d00d13f324b7f536386 --- src/lib/dma-trace.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 1ff2bd4..733435e 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -115,7 +115,7 @@ out: buffer->avail -= size; } - /* DMA trace copying is done */ + /* DMA trace copying is done, allow reschedule */ d->copy_in_progress = 0; spin_unlock_irq(&d->lock, flags); @@ -137,6 +137,7 @@ int dma_trace_init_early(struct reef *reef) struct dma_trace_buf *buffer; trace_data = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*trace_data)); + trace_data->rescheduled = 0; buffer = &trace_data->dmatb; /* allocate new buffer */ @@ -335,9 +336,15 @@ void dtrace_event(const char *e, uint32_t length) spin_unlock_irq(&trace_data->lock, flags); /* schedule copy now if buffer > 50% full */ - if (trace_data->enabled && buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) + if (trace_data->enabled && + buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) { work_reschedule_default(&trace_data->dmat_work, DMA_TRACE_RESCHEDULE_TIME); + /* reschedule should not be intrrupted */ + /* just like we are in copy progress */ + trace_data->copy_in_progress = 1; + } + } void dtrace_event_atomic(const char *e, uint32_t length) -- 2.7.4
3 3
0 0
[Sound-open-firmware] [PATCH] sof: Turn IRQs off globally when send command to pipeline component
by Wu Zhigang 28 Mar '18

28 Mar '18
When pipeline processing the command, we have to turn off the IRQs. If not, the DMA IRQ will interrupt the pipeline state set process, when pipeline is scheduled, the states inconsistence will cause xrun. Signed-off-by: Wu Zhigang <zhigang.wu(a)linux.intel.com> --- Tested with apl-gpmrb board kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 95d77adbaadc44b28c8975a3714f70824d1a8529 firmware: git://git.alsa-project.org/sound-open-firmware.git branch: 1.1-stable 210989dffeea811de2370fccb7cf5d53106b1e6e tools: branch: 1.1-stable cc91c73aa3e91eea35abdeb76d578b97f718feff --- src/audio/pipeline.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 1b7f248..23be503 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -627,6 +627,7 @@ int pipeline_cmd(struct pipeline *p, struct comp_dev *host, int cmd, { struct op_data op_data; int ret; + uint32_t flags; trace_pipe("cmd"); @@ -635,7 +636,7 @@ int pipeline_cmd(struct pipeline *p, struct comp_dev *host, int cmd, op_data.cmd = cmd; op_data.cmd_data = data; - spin_lock(&p->lock); + spin_lock_irq(&p->lock, flags); if (host->params.direction == SOF_IPC_STREAM_PLAYBACK) { /* send cmd downstream from host to DAI */ @@ -651,7 +652,7 @@ int pipeline_cmd(struct pipeline *p, struct comp_dev *host, int cmd, trace_error_value(cmd); } - spin_unlock(&p->lock); + spin_unlock_irq(&p->lock, flags); return ret; } -- 2.11.0
4 6
0 0
[Sound-open-firmware] [PATCH v2] trace: core: add trace_flush()
by Ranjani Sridharan 27 Mar '18

27 Mar '18
This patch adds a new trace_flush() feature to flush the last remaining trace messages during panic. Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> --- Tested with Minnowboard Turbot with RT5651 Kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 SOF: https://github.com/ranj063/sof.git branch: debug/trace_test SOFT: 1.1-stable --- --- src/include/reef/dma-trace.h | 1 + src/include/reef/panic.h | 8 +++++- src/include/reef/trace.h | 1 + src/lib/dma-trace.c | 29 ++++++++++++++++++++++ src/lib/trace.c | 11 ++++++++ .../apollolake/include/platform/platform.h | 3 +++ src/platform/baytrail/include/platform/platform.h | 3 +++ .../cannonlake/include/platform/platform.h | 3 +++ src/platform/haswell/include/platform/platform.h | 3 +++ 9 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h index f17ffe5..bf6e3f3 100644 --- a/src/include/reef/dma-trace.h +++ b/src/include/reef/dma-trace.h @@ -72,6 +72,7 @@ int dma_trace_init_complete(struct dma_trace_data *d); int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size); int dma_trace_enable(struct dma_trace_data *d); +void dma_trace_flush(void *t); void dtrace_event(const char *e, uint32_t size); void dtrace_event_atomic(const char *e, uint32_t length); diff --git a/src/include/reef/panic.h b/src/include/reef/panic.h index e8b4ae2..71df1b8 100644 --- a/src/include/reef/panic.h +++ b/src/include/reef/panic.h @@ -34,6 +34,7 @@ #include <reef/reef.h> #include <reef/mailbox.h> #include <reef/interrupt.h> +#include <reef/trace.h> #include <platform/platform.h> #include <uapi/ipc.h> #include <stdint.h> @@ -59,8 +60,13 @@ static inline void panic_rewind(uint32_t p, uint32_t stack_rewind_frames) /* TODO: send IPC oops message to host */ - /* panic and loop forever */ + /* panic */ platform_panic(p); + + /* flush last trace messages */ + trace_flush(); + + /* and loop forever */ while (1) {}; } diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 7afbd23..44824b9 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -106,6 +106,7 @@ void _trace_error(uint32_t event); void _trace_error_value(uint32_t event); void _trace_event_atomic(uint32_t event); void _trace_error_atomic(uint32_t event); +void trace_flush(void); void trace_off(void); void trace_init(struct reef * reef); diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 1ff2bd4..fb30989 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -36,6 +36,7 @@ #include <arch/cache.h> #include <platform/timer.h> #include <platform/dma.h> +#include <platform/platform.h> #include <reef/lock.h> #include <stdint.h> @@ -285,6 +286,34 @@ int dma_trace_enable(struct dma_trace_data *d) return 0; } +void dma_trace_flush(void *t) +{ + struct dma_trace_buf *buffer = &trace_data->dmatb; + uint32_t avail = buffer->avail; + int32_t size; + int32_t wrap_count; + + /* number of bytes to flush */ + if (avail > DMA_FLUSH_TRACE_SIZE) + size = DMA_FLUSH_TRACE_SIZE; + else + size = buffer->w_ptr - buffer->r_ptr; + + /* check for buffer wrap */ + if (buffer->w_ptr - size < buffer->addr) { + wrap_count = buffer->w_ptr - buffer->addr; + memcpy(t, buffer->end_addr - (size - wrap_count), + size - wrap_count); + memcpy(t + (size - wrap_count), buffer->addr, + wrap_count); + } else { + memcpy(t, buffer->w_ptr - size, size); + } + + /* writeback trace data */ + dcache_writeback_region(t, size); +} + static void dtrace_add_event(const char *e, uint32_t length) { struct dma_trace_buf *buffer = &trace_data->dmatb; diff --git a/src/lib/trace.c b/src/lib/trace.c index de99a4e..8d53b97 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -136,6 +136,17 @@ void _trace_event_atomic(uint32_t event) dtrace_event_atomic((const char*)dt, sizeof(uint64_t) * 2); } +void trace_flush(void) +{ + volatile uint64_t *t; + + /* get mailbox position */ + t = (volatile uint64_t *)(MAILBOX_TRACE_BASE + trace.pos); + + /* flush dma trace messages */ + dma_trace_flush((void *)t); +} + void trace_off(void) { trace.enable = 0; diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h index a1dfba2..86172bf 100644 --- a/src/platform/apollolake/include/platform/platform.h +++ b/src/platform/apollolake/include/platform/platform.h @@ -88,6 +88,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index 9a6967b..f3464f5 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -82,6 +82,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h index b007e8a..764ef76 100644 --- a/src/platform/cannonlake/include/platform/platform.h +++ b/src/platform/cannonlake/include/platform/platform.h @@ -92,6 +92,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index a9efe8a..9ffab90 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -81,6 +81,9 @@ struct reef; /* local buffer size of DMA tracing */ #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE +/* trace bytes flushed during panic */ +#define DMA_FLUSH_TRACE_SIZE (MAILBOX_TRACE_SIZE >> 2) + /* the interval of DMA trace copying */ #define DMA_TRACE_PERIOD 500000 -- 2.14.1
2 2
0 0
[Sound-open-firmware] [PATCH V3] dma-trace: Fix reschedule bug to avoid dma buffer overflow
by Xiuli Pan 27 Mar '18

27 Mar '18
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> We have wrong logic in reschedule, we always reschedule the trace_work once the buffer is half full and new trace coming. We will delay the old schedule before the old scheduled trace_work is finally run. Thus the trace_work will like the carrot in front of the DSP as the donkey, the DSP will never run the trace_work that scheduled in the furture while we are in busy state and lots of trace are coming continuously. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> Reviewed-by: Zhigang Wu <zhigang.wu(a)linux.intel.com> Reviewed-by: Yan Wang <yan.wang(a)linux.intel.com> Tested-by: Zhigang Wu <zhigang.wu(a)linux.intel.com> --- V2: reuse copy in progress as Yan suggest. V3: Fix a typo in refine Test with: Mininow max rt5651 and GP-MRB nocodec and CNL nocodec SOF 1.1-stable: 210989dffeea811de2370fccb7cf5d53106b1e6e SOF-Tool 1.1-stable: 49c1b450e635ac0c893d67ff0ddfd34e03a85b46 https://github.com/plbossart/sound/tree/topic/sof-v4.14: 8d8c1bb32537800726b14d00d13f324b7f536386 --- src/lib/dma-trace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 1ff2bd4..10e6102 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -115,7 +115,7 @@ out: buffer->avail -= size; } - /* DMA trace copying is done */ + /* DMA trace copying is done, allow reschedule */ d->copy_in_progress = 0; spin_unlock_irq(&d->lock, flags); @@ -335,9 +335,15 @@ void dtrace_event(const char *e, uint32_t length) spin_unlock_irq(&trace_data->lock, flags); /* schedule copy now if buffer > 50% full */ - if (trace_data->enabled && buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) + if (trace_data->enabled && + buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) { work_reschedule_default(&trace_data->dmat_work, DMA_TRACE_RESCHEDULE_TIME); + /* reschedule should not be intrrupted */ + /* just like we are in copy progress */ + trace_data->copy_in_progress = 1; + } + } void dtrace_event_atomic(const char *e, uint32_t length) -- 2.7.4
2 1
0 0
[Sound-open-firmware] [PATCH] dma-trace: Fix reschedule bug to avoid dma buffer overflow
by Xiuli Pan 27 Mar '18

27 Mar '18
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> We have wrong logic in reschedule, we always reschedule the trace_work once the buffer is half full and new trace coming. We will delay the old schedule before the old scheduled trace_work is finally run. Thus the trace_work will like the carrot in front of the DSP as the donkey, the DSP will never run the trace_work that scheduled in the furture while we are in busy state and lots of trace are coming continuously. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> Reviewed-by: Zhigang Wu <zhigang.wu(a)linux.intel.com> Tested-by: Zhigang Wu <zhigang.wu(a)linux.intel.com> --- Test with: Mininow max rt5651 and GP-MRB nocodec and CNL nocodec SOF 1.1-stable: 210989dffeea811de2370fccb7cf5d53106b1e6e SOF-Tool 1.1-stable: 49c1b450e635ac0c893d67ff0ddfd34e03a85b46 https://github.com/plbossart/sound/tree/topic/sof-v4.14: 8d8c1bb32537800726b14d00d13f324b7f536386 --- src/include/reef/dma-trace.h | 1 + src/lib/dma-trace.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h index f17ffe5..5ef5eb2 100644 --- a/src/include/reef/dma-trace.h +++ b/src/include/reef/dma-trace.h @@ -63,6 +63,7 @@ struct dma_trace_data { struct work dmat_work; uint32_t enabled; uint32_t copy_in_progress; + uint32_t rescheduled; uint32_t stream_tag; spinlock_t lock; }; diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 1ff2bd4..ef29026 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -128,6 +128,9 @@ out: ipc_dma_trace_send_position(); #endif + /* enable reschedule after one copy is done */ + if (d->rescheduled) + d->rescheduled = 0; /* reschedule the trace copying work */ return DMA_TRACE_PERIOD; } @@ -137,6 +140,7 @@ int dma_trace_init_early(struct reef *reef) struct dma_trace_buf *buffer; trace_data = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*trace_data)); + trace_data->rescheduled = 0; buffer = &trace_data->dmatb; /* allocate new buffer */ @@ -335,9 +339,12 @@ void dtrace_event(const char *e, uint32_t length) spin_unlock_irq(&trace_data->lock, flags); /* schedule copy now if buffer > 50% full */ - if (trace_data->enabled && buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) + if (trace_data->enabled && !trace_data->rescheduled && + buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) { work_reschedule_default(&trace_data->dmat_work, DMA_TRACE_RESCHEDULE_TIME); + trace_data->rescheduled = 1; + } } void dtrace_event_atomic(const char *e, uint32_t length) -- 2.7.4
3 2
0 0
[Sound-open-firmware] [PATCH] sof: Add volume component state check
by Wu Zhigang 27 Mar '18

27 Mar '18
Add the state check in volume_copy function, this can low down the xrun error possibility: For example: when firmware receive the PAUSE command, the HOST and VOLUME component are set to PAUSE state. at this time DMA IRQ happen, the pipeline is scheduled. host_copy() function will be called, but jump out immediately because of PAUSE state. but volume_copy() did not have this state check, the xrun will happen. Signed-off-by: Wu Zhigang <zhigang.wu(a)linux.intel.com> Reviewed-by: Keyon Jie <yang.jie(a)linux.intel.com> --- Tested with apl-gpmrb board kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 4881a4bd906f8b52bebd209b88ff920005550d53 firmware: git://git.alsa-project.org/sound-open-firmware.git branch: 1.1-stable 1f8c6c4d2018aac6994c75f60cee54765435d424 tools: branch: 1.1-stable cc91c73aa3e91eea35abdeb76d578b97f718feff --- src/audio/volume.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/audio/volume.c b/src/audio/volume.c index df926c5..2652765 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -836,6 +836,9 @@ static int volume_copy(struct comp_dev *dev) tracev_volume("cpy"); + if (dev->state != COMP_STATE_ACTIVE) + return 0; + /* volume components will only ever have 1 source and 1 sink buffer */ source = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); -- 2.11.0
5 7
0 0
[Sound-open-firmware] [PATCH] dai: use verbose trace call to prevent trace buffer overflow
by Ranjani Sridharan 27 Mar '18

27 Mar '18
This patch changes the trace message to use the verbose option to prevent trace buffer overflow. Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> --- Tested with Minnowboard Turbot with RT5651 Kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 SOF: 1.1-stable SOFT: 1.1-stable --- --- src/audio/dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/dai.c b/src/audio/dai.c index 53536ed..f1b4a8e 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -82,7 +82,7 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next) struct comp_buffer *dma_buffer; uint32_t copied_size; - trace_dai("irq"); + tracev_dai("irq"); /* is stream stopped or paused and we are not handling XRUN ? */ if (dev->state != COMP_STATE_ACTIVE && dd->xrun == 0) { -- 2.14.1
3 3
0 0
  • ← Newer
  • 1
  • ...
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • ...
  • 158
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.