Commit Graph

267 Commits

Author SHA1 Message Date
Liam Girdwood a26c4cca98 ipc: byt: use SOF_IPC_FW_READY for boot notification
Use global SOF_IPC_FW_READY to notify FW boot,

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-26 16:07:06 +01:00
Liam Girdwood 8337b77972 ipc: make sure all IPC return error values are processed correctly
Return int instead of uint32_t for errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-15 13:42:01 +01:00
Liam Girdwood 82be00f200 comp: dai: remove extra memcpy()
No need to copy data twice during DAI init.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-15 13:41:52 +01:00
Seppo Ingalsuo 56856e6a38 tone: The endpoint needs to be set
The signal generator is an endpoint component so this needs to be set for
the pipeline to function.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-06-14 11:16:24 +01:00
Liam Girdwood 29f3cc815d pipeline: set component pipeline ID when connecting components.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-13 15:43:54 +01:00
Liam Girdwood 3032fc4667 ipc: fix IIR and FIR build since they use IPC comp that embeds hdr
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-12 13:46:17 +01:00
Liam Girdwood 09988f00da ipc: all platform to specify the size of host page table data
This can save almost 4k of memory by allowing some tuning of the
compressed page table that is sent by the host.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-12 13:45:01 +01:00
Liam Girdwood 13ea3bcbe6 ipc: move iir, fir and src IPC data next to the other components.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-12 13:38:47 +01:00
Liam Girdwood be8c46b2e3 ipc: ext data: dont use zero size arrays and specify max elems
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-12 13:37:37 +01:00
Liam Girdwood 0a0944ce69 ipc:: dont use 0 as IPC code, start at 1
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-12 13:36:41 +01:00
Liam Girdwood 960cf8ecb8 comp: make the ipc component data memcpy explicit.
Lets not fool any code scanning tools.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-12 11:38:07 +01:00
Liam Girdwood 64609174a5 Merge remote-tracking branch 'sof/1.0-dev' into pre-1.0 2017-06-12 10:37:46 +01:00
Seppo Ingalsuo 6f27ab602d SRC: Fix possible use of uninitialized plus code cleanup
The s1.x_rptr, s1.y_wptr, and s2.y_wptr might be used as uninitialized.
Also remove some obsolete code lines.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-06-12 10:36:13 +01:00
Seppo Ingalsuo f132824ff8 IIR equalizer: Fix a null pointer issue
The cd->config could be passed as null pointer to eq_iir_setup() if the
previous malloc() would fail.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-06-12 10:36:13 +01:00
Seppo Ingalsuo 139df3efe3 FIR equalizer: Fix a null pointer issue
The cd->config could be passed as null pointer to eq_fir_setup() if the
previous malloc() would fail.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2017-06-12 10:36:13 +01:00
Liam Girdwood 3234a3dc4a cache: remove writeback for ICACHE
Not used so remove.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 22:26:17 +01:00
Liam Girdwood 29bc19f042 cache: fix build error when cache ops are builtin
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 21:39:34 +01:00
Liam Girdwood 06bb8e3dd3 ipc: values: read value ID and context from component data before use.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 17:59:55 +01:00
Liam Girdwood c3153812b9 scheduler: allocate scheduler context in system heap.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 17:58:49 +01:00
Liam Girdwood 9e8b23d548 ipc: check pipeline source is non NULL before using it
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 17:57:19 +01:00
Liam Girdwood af9e00e030 pipeline: err might be used uninitialized in component_op_upstream()
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 17:56:44 +01:00
Liam Girdwood 1764152119 audio: components: Allocate correct device size
The devices sizes can be variable depending on any IPC init data that is
stored. Make sure we allocate the correct size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-09 17:27:02 +01:00
Seppo Ingalsuo 6a24a293c6 Add IIR Equalizer component
This change provides an IIR equalizer component. The
 IIR equalizer can be used for any transducer or effects equalizer needs but
 it is especially recommended for speaker response equalization and other
 applications without dependence to matched phase response or best possible
 THD+N performance where FIR may be a better choise. IIR equalization is
 capable to strong response enhancement without need for large DSP resources
 consumption. The tool to create the EQ setup blobs is included in the
 rimage tools.
2017-06-07 15:23:58 +01:00
Seppo Ingalsuo 6f03aa5a5b Add FIR Equalizer component
This change provides a finite impulse response (FIR)
 equalizer component. The FIR equalizer can be used for any transducer or
 effects equalizer needs but it is especially recommended for microphone
 arrays equalization. The tool to create EQ setup blobs is included in the
 rimage tools.
2017-06-07 15:23:57 +01:00
Seppo Ingalsuo 29566ee3e4 Add tone generator component
This change provides a tone generator component. The
 purpose is to provide a high quality FW internal test signal generator for
 objective audio quality measurements for component or system tests. It can
 also be used as simple beep indication tones generator for users.
2017-06-07 15:09:57 +01:00
Seppo Ingalsuo 6a274839ee Add SRC component
This change provides a sample rate converter (SRC).
 The SRC is polyphase FIR type. All the conversions coefficients tables are
 automatically generated by a separate Octave scripts set in the rimage
 tools set. The supported in/out rates and the performance can be customized
 for a different quality/resources trade-off.
2017-06-07 15:09:31 +01:00
Liam Girdwood 84e46b0b2a cache: xtensa: Add cache region implementation for xtensa
Add cache ops for the xtensa architecture.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-07 12:41:29 +01:00
Liam Girdwood 3c5d9a3b63 cache: Add cache management API to writeback/invalidate regions
Add an API to allow drivers to writeback or invalidate cache contents.
This is useful where the DSP firmware runs from cache and needs to
writeback/buffer prior to DMA or other peripheral usage.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-07 10:13:57 +01:00
Liam Girdwood 425aa5e917 ipc: Add support for creating pipelines dynamically. Part 1
Currently pipelines have to be statically defined in the firmware source
code. This patch provides a mechanism whereby they can be created and
destroyed via IPC messages from the host.

Part 2 to follow.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 20:35:05 +01:00
Liam Girdwood f4fc2328bf scheduler: Add initial EDF scheduler.
Add an Earliest Deadline First scheduler to perform scheduling of audio
pipeline tasks based on task deadlines. i.e. the task with the earliest
deadline will be scheduled so that it will complete and preempt other
lower priority tasks before the deadline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 20:35:05 +01:00
Liam Girdwood 2d2cd78be1 task: add priority driven task management
Provide a method for tasks to be performed on a priority basis using the
interrupts levels to preempt lower priority tasks.

The scheduler will use the to schedule work at different priorities.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 20:35:05 +01:00
Liam Girdwood 535201458f arch: xtensa: display memory dump in the map file and add prefix
Also make sure the binaries have platform prefix.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 20:14:56 +01:00
Liam Girdwood 2743d0eeda drivers: ssp: move regsier macros into seperate header
Move the register macros into separate header.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 19:39:13 +01:00
Liam Girdwood a2d5fe5d58 drivers: dw-dma: move register macros into platform specific header.
Clean up the DW-DMA rsgisters so that it can be more easily integrated
into other platforms.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 19:36:27 +01:00
Liam Girdwood 405b1f34f2 list: add list previous iterator
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 16:41:35 +01:00
Liam Girdwood 69222cf7d7 core: create a context and pass it to each subsystem at init
Create a global firmware context structure and pass this to each subsystem
on initialisation. This allows components to share access to global DSP
context.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 16:41:07 +01:00
Liam Girdwood d65a18a98b trace: add more detailed trace vales for init
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 16:37:05 +01:00
Liam Girdwood b0401e9dc9 build: add rule to clean local files
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 13:17:22 +01:00
Liam Girdwood 68abb98990 dma: Add cherrytrail SSP IRQs and DMAC IDs
Add Cherrytrail SSP handshake IDs and extra DMAC

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 13:17:22 +01:00
Liam Girdwood 50f7b0e906 allocator: simplify heap modification and allocation part 1
The allocator currently has different methods to allocate heap memory
depending on memory size requested. The heap also has to be defined
in two places atm i.e in memory.h and baytrail.x

This patch aligns the heap macros with the linker script and introduces
new flags to specify the allocation type.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 13:17:22 +01:00
Liam Girdwood 658159e7c5 build: fix generation of commit ID and build number
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-06-06 13:17:22 +01:00
Keyon Jie 2e7a2af3b9 work: enable/disable workq timer following each timer_set/clear()
We need enable/disable workq timer also after each calling to
set/clear timer, but not only CPU frequency change, so merge
them into work_set/clear_timer().

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-03-16 19:55:15 +00:00
Keyon Jie 29973dfa78 ssp: add handle for default clk type
Add default clk type SSP_CLK_DEFAULT and the handle for it

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-03-16 19:52:53 +00:00
Keyon Jie d8dd7576b2 work: fix typos for comment message
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-03-16 19:51:52 +00:00
Liam Girdwood 2a0f0ea62b host: Add more comments to host callback
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2017-03-02 12:00:29 +00:00
Keyon Jie bfcf15ef41 host: remove host side buffer check and fix for capture
We assume that there are always datas/spaces for playback/capture,
and then don't need to check the host side buffer pointers, here
remove these buffer check related code to save about 0.6KB to the
firmware binary size.

We also do code cleanup for host in this patch: remove superfluous
prefix 'host_' for host_data members, merge host_dma_cb_playback()
and host_dma_cb_capture() as they have most common code, and the
latter change can save about 0.25KB to firmware binary size.

Furthermore, we also fix the capture doesn't work issue at the
same time.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-03-02 11:42:30 +00:00
Keyon Jie 28b48f83b0 component: set source buffer params for capture component .params()
Considering of capture pipeline, when doing .params(), we need
set params to each component's source buffer.

This patch implement that for host/volume component, as mixer is
only for playback ATM, and dai don't have source buffer for capture,
we don't need change them ATM.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-03-01 11:01:51 +00:00
Keyon Jie 1cdbc3e426 host: fix an uninitialized warning issue
We met a variable uninitialized issue:
'ret' might be used uninitialized in this function.
host.c:606 | host_preload()

Here adding the initialized assignment to fix this issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-14 09:45:34 +00:00
Liam Girdwood 12d789ad5b pipeline: Add support for full pipeline pre-loading.
Preload entire pipeline and all components by walking the pipeline graph.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Modified-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie cd77fb05a7 host: create host_elements_reset() and host_pointer_reset() for common use
The elements reset code may be shared by params() and stop(),
and the host side pointer resetting code may be used by both
reset() and stop().

Here create separate functions for those common codes, to make
code more clean.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 2b72ea7b0e component: host/volume/mixer: reset buffers for stop cmd
For command stop, excepting reset components, we may need reset
the buffer next to the component, otherwise, if the next start
command comes(without reset before it), the buffer pointers may
be disordered.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 55abae7eeb dw-dma: handle different cases in irq handler
After finished a transfer copy, check for reload channel:
1. if next.size is DMA_RELOAD_END, stop this dma copy;
2. if next.size > 0 but not DMA_RELOAD_LLI, use next
element for next copy;
3. if we are waiting for pause, pause it;
4. otherwise, reload lli.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 4c1937e50c dai: add R/W pointer check for dai copy
We should only copy when there is data, after copied the last bytes
or period, we will stop the dai and ssp, and trigger the pipeline
finish, which will notify host side the last read pointer and let
host side send trigger stop ipc.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 33d624956a mixer: add dd->last_bytes for the last bytes(< period) caculation
For the last bytes (< 1 period) copy, we need to remember this
for the size caculation at finished, here add dd->last_bytes for
this purpos.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 7a834bb2e2 mixer: add R/W pointer check for mixer_copy()
We should only copy when there is data, as we are using pulling
mode, should sink side should have free space always, we check
each source->avail and copy only some bytes when avail < period
size.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 4cbe38a52d mixer: mixer_params(): set the sink buffer params to STREAM_FORMAT_S32_LE.
As its sink won't be host/dai, it is alwasys internal component,
let's hard code it to STREAM_FORMAT_S32_LE ATM.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 240f90c54d volume: add R/W pointer check for volume_copy()
We should only copy when there is data, as we are using pulling
mode, should sink side should have free space always, we check
source->avail only and copy only some bytes when avail < period
size.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 7d0c7b6c1d volume: volume_cmd(): only stop/pause at running
We should only stop/pause it when the volume component is in
running status.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie f3aec1d744 component: status: rename COMP_STATE_STOPPED to COMP_STATE_SETUP
For component 'inactive, but ready' status, naming 'SETUP' may
be more understandable than 'STOPPED', and 'SETUP' is consistent
with ALSA.

     new()        params()       start()
none ======> init =======> setup ======> running
     <======      <=======       <======
     free()       reset()         stop()
2017-02-13 14:54:31 +00:00
Keyon Jie 002daab594 volume: volume_params(): set the sink buffer params depending on its sink
If its sink is host, we need set it to 16bit(hard coded ATM);
if its sink is dai, we need set it to 32bit SSP format;
otherwise, for internal component, we uses STREAM_FORMAT_S32_LE.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 1ff623bdf5 host: host_copy: only copy when there is data and wait until finish
We don't copy when host_avail is 0(usually stream finished), at the
same time, we need wait until the dma copy is finished before we
can start next pulling copy.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 8cbf06c96b host: cleanup host_cmd() cases
1. only pause at running stage;
2. resetting buffer pointers and local_elem for stopping, to let next
starting begin from original position;
3. adding processes for COMP_CMD_AVAIL_UPDATE.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie f0d4d7a14c host: reset pointers at new() and reset()
We need to clear those pointers at new(), and undo at reset()
those initialization what we did in set_params().

For new(), rzalloc() will help set host_data members to 0s and
NULLs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 9e58cf39a5 host: add a completion work to notify host side
We need to wait until the last bytes/period is finished in dai,
before we can notify host side about that, otherwise, host side
will trigger stop too early, and we will miss rendering them.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 1e524a17f0 host: add R/W pointers check for playback
Here add R/W pointers check for playback, make sure the next
copy size is not bigger than the host avail bytes.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 0eeb6ca7d2 host: for the last bytes/period, send read notification later
This read pointer indicate how much we have read, we can use it
to inform host side to refill the free periods.

But as it doesn't really mean that we have rendered all of them
(there may be several periods in the pipeline buffer), and for
the last bytes/period, host side will trigger stop immediately
once it got this notification.

To avoid lost for last several periods issue, we postpone this
notification to the finish of last bytes/period copy in dai,
which will be add in the following patches.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 33fccb139d host: rename host_pos_blks to host_pos_read
We use host_pos_blks to store the latest read pointer, and
report *host_pos to host side, here rename host_pos_blks to
host_pos_read to make it understandable.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie d9d1bc98f1 host: add host_update_buffer for produce and consume
To implement host side buffer R/W pointer check, we need add
buffer update procedures at first, here we introduce host_avail
and host_free to indicate the buffer usuage status.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie db2a9154da intel-ipc: add stream operation IPC_INTEL_STR_STOP
It used IPC_INTEL_STR_PAUSE plus IPC_INTEL_STR_RESET to stop a
stream, but sometimes we application only intend to stop the
stream(e.g. speaker-test with large buffer size( > .wav file
size)), which means we only reset the buffer pointers but don't
need set params again(for reset, we need set params again).

Here add this stream operation IPC_INTEL_STR_STOP to handle
this case.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie ce36bdc47a intel-ipc: add application buffer pointer update from host side
We need the application buffer pointer(write pointer for playback)
update from the host side, to make the ALSA pcm buffer pointer
checking possible.

Here we introduce component command COMP_CMD_AVAIL_UPDATE for the
update event notification.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie b3909d4601 ipc: presentation_posn should be uint64_t type
The presentation_posn used for dai rendered bytes readback to
host side should be uint64_t type, according to the driver side
definition.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 105a6c297f host: start: don't real start for start command
We uses pull mode for running pipeline, that means, we
start each copy in pipeline_schedule_copy().

So here remove this superfluous one period copy.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 7a1d88fdef pipleline: op_sink: don't need clear the buffer for each prepare
We clear the buffer in pipeline/buffer creating stage, here we
don't clear them for each preparing.
2017-02-13 14:54:31 +00:00
Keyon Jie f2f0cc3beb dai: reset dai_pos at MMAP_PPOS command
It reset dai_pos at prepare stage before, which will
make it wrong when the prepare is called more than
one time.

Here move the reset to MMAP_POS command handling,
which should happen at stream allocating stage only.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 423e8c910e host: handle more possibility for playback spitting
We may meet src buffer bound, sink buffer bound, and
splitting may not finish at one time DMA copy, that
is, next_size < split_remaining, ...

This patch added to handle all of those cases, and
prepare for the buffer read/write pointer checking
in future.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-02-13 14:54:31 +00:00
Keyon Jie 1659269bfa volume: fix the L/R channel mixed issue
The Right channel was assigned with Left channel by mistake
in vol_s16_to_s32 and vol_s32_to_s32, here correct it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-11 08:18:25 +00:00
Keyon Jie 87bb87af53 component: fix comp_update_buffer() when buffer full
It will treat full buffer as empty one at current
comp_update_buffer(), as w_ptr is equal to r_ptr,
this will make us missing those datas or at least
the buffer->avail/free are not correct.

Here spit comp_update_buffer() into consuming one
and producing one, for consuming, 'r_ptr == w_ptr'
update means buffer is becoming empty, and for
producing, 'w_ptr == r_ptr' means buffer is becoming
full.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-10 09:34:41 +00:00
Keyon Jie b9bd368186 volume: use rzalloc for component new
Replace rmalloc() with rzalloc() to make sure the new
allocated structs are clear to all 0s.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-10 09:34:34 +00:00
Keyon Jie 75eee17e0c dai: rename frame_size in dai_config to sample_size
The element frame_size in dai_config struct is actually
sample size for each channel, e.g. 24 for S24_4LE, so
rename it to sample_size to avoid confusion.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-03 11:37:32 +00:00
Keyon Jie 41305b3605 pipeline: change back to use normal static pipeline by default
As the normal static pipeline can work fine after the 1.33->1ms
buffer and 16->32 bits internal buffer transforming finished,
let's change back to use normal static pipeline by default.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-03 11:37:27 +00:00
Keyon Jie 6e01ff627e mixer: use int64_t intermediate variable to avoid clamping
As we have changed internal buffer to 32 bits, to
avoid clamping, we need to change accumulator to
64 bits.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-03 11:37:27 +00:00
Keyon Jie 6cc211498e volume: add 24bit<==>32bit scaler and mapping
As we are using 32 bits data in internal buffer, we need
24bit<==>32bit volume scaler for host<==>processing<==>dai
converting.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2017-01-03 11:37:27 +00:00
Keyon Jie f24dd313ea host: fix the increment offset in the callback
When the host buffer is not 1ms aligned and splitting happens,
the increment is not period size, this wrong pointer will make
pcm data missed/clipped and sound noisy.

Changing to use the actual size last dma copy consumed,
local_elem->size, to fix the issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-29 10:41:42 +00:00
Keyon Jie 6d608f76f5 dai: add stream_format to dai_data for codec stream
Adding stream_format to indicate the stream format that the
dai buffer is using, which will be used for volume copy
functions mapping.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-29 10:41:42 +00:00
Liam Girdwood c87617fe7c ssp: use BCLK and MCLK directly for DAI clocking
It's better to express MCLK and BCLK as freqencies rather than as ratios.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-29 10:41:31 +00:00
Liam Girdwood 8eb6743a45 mixer: make mixer more optimal and easier to vectorise
Make the mixer compute two channels per loop iteration. This allows for
easier vectorisation. The loop is also more efficient if we update or
source/sink pointers after mixing has completed.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-29 10:41:31 +00:00
Liam Girdwood dcbff09253 volume: Fix R channel and select correct conversion.
The conversion should up/down convert only if source/sink is host or dai.
Volume should be 32 bit at all other times

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-29 10:41:31 +00:00
Liam Girdwood b246c42d07 pipeline: set up static buffers using platform macros.
Use period frames instead of period size in bytes. This makes the pipeline
configuration less ambiguous and also allows for host, dai and internal frame
sizes to be defined.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-29 10:41:31 +00:00
Liam Girdwood 77bc065d6c version: improve git version for build and IPC
Improve the git version and include last commit for IPC version message.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:20:10 +00:00
Liam Girdwood cc9b2ffa21 pipeline: Add simple debug pipeline.
Add a simple static pipeline that can be used for debug

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:20:02 +00:00
Liam Girdwood 8b7e372eb3 pipeline: use 1ms tick for low latency pipeline.
Change tick from 1.3ms to 1ms to improve latency.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:56 +00:00
Liam Girdwood ae0a203d31 dw-dma: Add parenthesis around if statement logic
Make it less ambiguous.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:49 +00:00
Liam Girdwood 53a996454e panic: disable all interrupts when we panic.
Make sure any interrupt handler can run after a panic.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:43 +00:00
Liam Girdwood e413380d43 host: Add support for non continuous host buffers
Host buffers are not guaranteed to be continuous physical pages or a factor
of the DSP period size. Add support for non continuous host buffers of any
size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:38 +00:00
Liam Girdwood 0fb95a8ed3 host: use platform DMA timeout for host DMA timeout.
This will be different for each platform so use the platform tiemout.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:34 +00:00
Liam Girdwood bf407d2a7e component: host: Add support for passing host buffer size as param
The host buffer may not be a multiple of host PHY page size, so provide
so pass this value as part of our host buffer init.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:28 +00:00
Liam Girdwood 6d21349094 dma: Add support for callback DMA reload.
Add support to immediately reload the DMA during a DMA transfer completion
callback. This allows components to respond quickly to any physical
DMA copy updates i.e. period split over two non continuous physical host
pages.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-12-22 20:19:22 +00:00
Keyon Jie cff154ca87 ssp: switch dai format form PCM B mode to normal I2S mode
it is configured from host/codec side that using I2S mode, so
switch it.
2016-12-22 16:30:26 +00:00
Keyon Jie 71a85c764d volume: add 16bit<==>24bit volume copy function and mapping
add 16bit<==>24bit volume copy function and mapping, for
24 bits ssp output/input.

here also optimize all other volume copy functions.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-22 16:18:47 +00:00
Keyon Jie 6ac88d96a4 platform: switch default ssp clock to 19.2M
switch default ssp clock from 25M to 19.2M, which may help
for 24 bit format.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-22 16:18:42 +00:00
Keyon Jie d58b35c4e7 ssp: switch to use SCR for BCLK generation.
switch the BCLK generation from shim ssp clock divider to
using SSCR0.SCR, as the divider may lead to jitter.

clear and remove M/N divider part code.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-22 16:18:36 +00:00
Keyon Jie 05af7a8a8a dw-dma: fix dsp local memory mapping issue
for DMA controller, we need mask dsp local memory before
setting it to DMAC registers, otherwise, DMAC will locate
to wrong memory address.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-09 14:15:25 +00:00
Keyon Jie 5ffc92087a pipeline: clear buffer content to 0s on new
We need clear/reset buffer content to 0s each time
creating a pipeline buffer, to avoid random noise
when using it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-12-09 13:57:19 +00:00
Keyon Jie 353b0d34ff platform: baytrail: use package string as the fw version
On the linux driver side, it need get version infomation
from fw, including:

type -- Reef
version -- major.minor
build number
last commit id -- gID

So here we use the package string, which come from git
version, which can provide all those fw version infos.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-10-27 10:11:08 +01:00
Keyon Jie 997e14b7b0 ssp: return after draining finished
To prevent the consequent command arrive when we are
at substates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-10-24 10:53:22 +01:00
Keyon Jie 677fc76612 ssp: cleanup ssp status
We are using 6 states, 2 of them are substates:
init, idle, running, paused,
draining(sub state when transferring from running to idle)
pausing(substate when transferring from running to paused).

Don't response new command when in substates, only stay in
substates for limited timeout. e.g. 2ms for draing and 1ms
for pausing.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-10-24 10:53:15 +01:00
Keyon Jie 991ea7b034 dai: cleanup dai component status
Only use 4 states for dai component:
init, prepare, runing, paused.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-10-24 10:53:05 +01:00
Keyon Jie fec488d446 dai: add macros for dai tracing
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2016-10-24 10:52:51 +01:00
Liam Girdwood 446fe1af42 ipc: dma: Correct typo for DMA timeout time and units.
100 usecs not 1 msec

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-20 16:05:12 +01:00
Liam Girdwood 5b33175b11 platform: cht: Add support for CHT DMACs and SSP ports
Make sure we initialise the extra SSPs and DMACs for CHT.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-20 15:51:22 +01:00
Liam Girdwood e00e51697a cht: Add M/N dividers for 19.2MHz
Add some M/N divider entries for 19.2M source clock.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-20 15:51:22 +01:00
Liam Girdwood eb042a4241 dma: Add DMAC2 for CHT
CHT has 3 DMACs compared to the 2 DMACs on BYT

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-20 15:51:22 +01:00
Liam Girdwood 32ebf0f866 dai: add support for CHT SSP ports
CHT has 6 SSP ports compared to 3 on BYT

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-20 15:10:12 +01:00
Liam Girdwood c55a11cdd6 clk: base frequencies for BYT and CHT are different.
Create a table for each platform with the correct frequencies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-19 15:31:41 +01:00
Liam Girdwood b45d98cee1 dma: set mask on local DSP memory regions.
The DMA controller needs to differentiate between host and DSP memory
regions. This can be done with a mask that is ORed with local DSP memory
locations.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-17 16:10:31 +01:00
Liam Girdwood 0fe9e33143 host: cleanup formatting.
Some lines > 80 chars.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-10-17 16:10:20 +01:00
Liam Girdwood c0dfb4e62a core: initial import of open source DSP firmware
This project provides an open source audio firmware infrastructure for audio
DSPs found on many modern devices. The intention is to allow developers to
create their own codecs, audio processing algorithms and pipelines using
the infrastructure and audio components provided by this project.

The project currently supports the Intel Baytrail and Cherrytrail audio DSP
platforms which use the Xtensa architecture.

The firmware source code is released under the BSD 3 clause licence.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2016-09-22 16:02:43 +01:00