Commit Graph

474 Commits

Author SHA1 Message Date
Yan Wang a9d5181621 Add header file for avoiding compiing warning.
If no this, "error: no previous prototype for XXX" will be reported.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-28 22:50:16 +01:00
Pierre-Louis Bossart d46dd3567d sof: check for missing prototypes
gcc -Wall is not enough, add -Wmissing-prototypes to align with
kernel warnings.

Add relevant includes and move functions without prototype as static

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:34 +01:00
Pierre-Louis Bossart 0ffc585dff ipc: remove unnecessary tests
Last test would always evaluate as true, refactor to fold equal and
less than case as one

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 090d4f4c8d wait: reduce number of nested breaks
MISRA-C:2012, 15.4 - There should be no more than one break or goto
statement used to terminate any iteration statement

reshuffle the code to use a single break

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 66bc346267 ssp: remove unnecessary direction parameter in ssp_stop
No longer needed since we do the same thing for playback and capture

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart e079f9eb96 ssp: replace switch by if for readability
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 8f03c9ba0a volume: replace switch by if for readability
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart c3253e1d8f tone: replace switch by if for readability
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart b513a45e10 SRC: replace switch by if for readability
MISRA C:2012, 16.5: Every switch statement shall have at least two
switch-clauses

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 0d9fd41b3b pipeline: simplify prepare loop
MISRA-C:2012, 15.4 - There should be no more than one break or goto
statement used to terminate any iteration statement

reshuffle the code to use a single break with no additional tests.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 5f6d6c8391 pipeline: add missing default case
Make static analysis warnings go away and comply with MISRA rules:
the final clause of a switch statement shall be the default case

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Pierre-Louis Bossart 4ccf81daff sof: define each identifier in a dedicated statement
MISRA C++:2008, 8.0.1 and CERT-DCL52-J require that one variable per
declaration.

Change tree-wide, keeping variables in the initial order (except
when it was obviously better to change).

No functional change. The Tensilica HAL remains as is as it should
be modified separately

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-27 10:54:23 +01:00
Liam Girdwood 34ab0309d8 gitigore: ignore disassembly and mapfiles
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-25 12:52:10 +01:00
Liam Girdwood 8af048f914 comp: host: Add trace output for buffer size errors
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-25 12:46:11 +01:00
Seppo Ingalsuo c46d66d7a1 EQ IIR: Get filter config and response switch via ABI
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@linux.intel.com>
2017-09-25 12:44:24 +01:00
Seppo Ingalsuo 34e4dac557 EQ FIR: Get coefficients and response switch via ABI
The FIR equalizer configure and control is updated to use the new
component ABI. Checks are added to protect equalizer from invalid
setup. Also an unused parameter is removed from fir_init_delay()
function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-25 12:44:24 +01:00
Seppo Ingalsuo 03e670b16a Component ABI: Check for valid ABI header for COMP_CMD_SET_DATA command
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@linux.intel.com>
2017-09-25 12:39:46 +01:00
Seppo Ingalsuo 66cf828eb7 Volume: Add 24 to 24 bit samples volume processing
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@linux.intel.com>
2017-09-25 11:33:42 +01:00
Liam Girdwood 2293403b56 comp: volume: dump trace output on format matching failure.
Emit trace data to show format matching failures for source and sink data
types.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Liam Girdwood 6506fd93d4 pipeline: pipeline_complete() now checks pipe status and return errors
pipeline completion should check for valid pipeline status and return
any errors for invalid status (like already completed pipelines).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Liam Girdwood 37cb3ebfc9 alloc: remove unecessary debug trace statement
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Liam Girdwood 52177cab21 pipeline: fix timestamp for capture streams.
Make sure we timestamp upstream in capture streams

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-23 23:06:14 +01:00
Pierre-Louis Bossart ea44940219 ssp: add missing break in dai format switch
Support for DSP_A is obviously broken.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo f9a671b8de Component ABI: Add SOF ABI header to struct sof_ipc_ctrl_data
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo e83a4808b7 Component ABI: Add data field to struct
This patch adds flexible field "data" to struct sof_abi_hdr to be used
to pass binary data via ABI.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 94cd49734c Component ABI: Magic id for uapi/abi.h
This patch adds a define of 32 bit integer that equals to ASCII
string "SOF\0" to be used in checking for correct magic number in
binary data. The char type for the magic is changed to uint32_t for
simpler comparison.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 8aa14a62cb EQ IIR: Fix duplicated buffers pointers advance
This patch removes pointers advance from filters function since it was
added to copy().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 1940496e25 EQ FIR: Fix duplicated buffers pointers advance
This patch removes pointers advance from filter function since it was
added to copy.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 8725de778a EQ FIR: Minor trace bug fix
This patch fixes the trace class and renames the macro to match module
name. Note that some trace patches are related to other changes data
and cannot be separated to this patch.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-23 23:06:14 +01:00
Seppo Ingalsuo 14d10a82b8 SRC: Comment edit
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-22 15:23:37 +01:00
Seppo Ingalsuo 9d9a400c5f SRC: Add tiny 16 bit coefficient set and set it as default for BYT
This patch adds a very small size and fast to compute SRC coefficients set
for converting between 8/16/24/32/44.1/48 kHz and 48 kHz. It is
set as default for BYT platform until a more optimized SRC core is
available. The quality of this set has been reduced to achieve the faster
computation.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-22 15:23:37 +01:00
Seppo Ingalsuo d7f1863f00 SRC: Bug fix for SRC_SHORT 16 bit coefficients usage
This patch fixes the circular dependency of defines that prevented the
16 bit coefficients to be applied correctly.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-22 15:23:37 +01:00
Seppo Ingalsuo 849a528506 SRC: Add checks for number of channels when initializing from params
This patch prevents SRCs init to loop past PLATFORM_MAX_CHANNELS.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-22 15:23:37 +01:00
Liam Girdwood efbb97bb05 dai: stop the DAI on any state other than active
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-22 00:31:51 +01:00
Liam Girdwood 2ea55f8ecd scheduler: Add support for 64bit timer driven scheduling.
Currently the scheduler will schedule task based on DAI DMA interrupts.
This patch also adds the option to also schedule based on a 64 bit timer.

The scheduler will now check the tasks in the queue and it will only
run the tasks in the current window otherwise it will set a timer to
call schedule() on the next task start time (in another window).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-22 00:31:51 +01:00
Liam Girdwood b1ea715aba ipc: add support for timer topology scheduling source.
Add an option to schedule based on timer or on DAI/DMA IRQ

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-22 00:31:51 +01:00
Liam Girdwood be41b682ca comp: enforce state transition checking for each component.
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@linux.intel.com>
2017-09-22 00:31:51 +01:00
Seppo Ingalsuo a77a38e019 SRC: Add standard int24 coefficient set
This patch adds a flexible conversions set in 8-192 kHz range.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-21 13:06:44 +01:00
Liam Girdwood e7b2192e9d comps: make sure correct state transitions are used and verified.
Use the correct component states and verify this at runtime.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:47 +01:00
Liam Girdwood 4d5924cfc9 timer: use 64 bit timestamps
Use 64bit timestamps now that 64 bit timers are implemented.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:47 +01:00
Liam Girdwood 90880bd287 ssp: irq: fix handler comment and remove FIFO empty loop
Comment is wrong and FIFO empty not needed in IRQ handler.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:34 +01:00
Liam Girdwood c00e48f22c dai: cache: Make sure we only writeback the amount copied
The DAI IRQ hanlder was always writing back full period size even when
less data was copied. Only writeback the amount of data copied.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-09-20 23:31:10 +01:00
Keyon Jie 7754fa10b9 interrupt-map: add cpu param for REEF_IRQ generation
This will be needed for multi-core, add it here.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-09-20 23:31:10 +01:00
Yan Wang fc6820eeea Add IPC processing code for DMA tracing.
1. Add processing case branch of SOF_IPC_GLB_TRACE_MSG.
2. Add processing functions for SOF_IPC_TRACE_DMA_INIT and
SOF_IPC_TRACE_DMA_PARAMS for initlizing DMA for Trace and reply host.
3. Modify page table parsing fucntion for using in both PCM streaming and
DMA tracing case.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Yan Wang 5aef53511f Add the implementation for DMA tracing.
1. Initialize the data structure.
    a) Create local DMA buffer for saving trace data.
    b) Initialize the tracing work handler for syatem work queue.
2. Implement local circle buffer.
    a) When the local buffer is full, empty it and reset reading/writing pointer.
3. Save the host buffer PHY addr which is parsed from IPC message. After this
config, start trace work in work queue.
4. Provide dtrace_event() for recroding trace string into local buffer.
5. Add rstrlen() utility function for getting the trace string length because
DSP side hasn't strlen().
6. Enbale trace DMA copying once every 500ms or some special cases.
    a) Schedule the tracing sending work once every 500ms.
    b) If the local buffer is half full, call trace sending immediately.
    c) When the wrting pointer will arrive iat the end of local buffer, call
    trace sending immediately.
7. Use dma_copy_to_host() function to do trace sending.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Yan Wang 44fc644876 Add IPC message definition for DMA tracing.
1. Add SOF_IPC_GLB_TRACE_MSG class of IPC communication.
2. Add two IPC commands for DMA tracing.
  a) SOF_IPC_TRACE_DMA_INIT is used to initilize local buffer on DSP side.
  b) SOF_IPC_TRACE_DMA_PARAMS is used to receive host DMA buffer PHY.
3. Define DMA for Trace params IPC info structure.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Yan Wang 05e2b6f1b9 Add DMA callback for dma_copy_to_host() and dma_copy_from_host().
It is necessary to add dma callback to set completion_t variable to notify
DMA copying is finished. Otherwise it will always enter into error handler.

Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
2017-09-20 15:23:19 +01:00
Seppo Ingalsuo 887628a498 SRC: Add S24_4LE format and platform specific coefficient set
This patch adds missing S24_4LE format. Input and output format need to
be still the same. The filter coefficient set is configured in
src_config.h per platform. BYT uses a small int24 set, other use
standard int24 set. SRC wasnot unmuted by pipeline so in this version
SRC initialized to unmuted state.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00
Seppo Ingalsuo e81699a1ac SRC: Increase default DSP clock speed in BYT platform
As temporary fix to allow SRC to run do not drop clock frequency to
minimum after BYT platform boot is completed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00
Seppo Ingalsuo 2c25480a17 SRC: Add small 24bit coefficient set
This coefficient is suitable for BYT platform RAM. It provides conversions
for 8/16/24/32/44.1/48 kHz to/from 48 kHz. Coefficients are 24 bit word
length.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-09-20 15:13:21 +01:00