CRAS: dsp - Lower print for no enabled dsp.

This is very common, as only built in devices will have a dsp
configured.  Lower the priority to info so it doesn't appear in all
the logs.

Change-Id: I69c60e62737282bb7ff2d6630b124a1dd84903aa
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231568
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
CRAS: iodev - add buffer pointer to put buffer

Passing the buffer pointer back to iodev will allow the DSP
application to be moved here.

BUG=none
TEST=play/record audio on Panther and Samus

Change-Id: I69f5b6894e364bc89e06444e79bc016f0b722e2d
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231569
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: move dsp application to cras_iodev.c

Applying the DSP from iodev will later allow for audio thread to not
worry if the audio format is changed during processing.

BUG=none
TEST=pla/record audio on Big and Samus.

Change-Id: I5eeafb9120757aec4595635d8b7a16183b7a8df1
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231570
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: Move get_dsp_delay to cras_iodev.c

This will allow the audio_thread to be free of direct dsp access.

BUG=none
TEST=play audio on panther and samus

Change-Id: I47cd7ff5cff9038e570d9906c23ae363a6689212
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231571
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: Allow DSP pipeline to change number of channels.

Some new input processing, such as beamforming will reduce the number
of input channels.  Change the DSP pipeline to support this.

BUG=none
TEST=play/record audio on Panther.

Change-Id: I22b7f76aeb29ee314a2ca988336170434ef52ae1
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231572
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: remove DSP stubs from audio_thread UT

The DSP code has been moved to iodev, not needed in the audio thread
unit test.

BUG=none
TEST=none

Change-Id: I9757371cdad50d279d3cc02d0c05ffcee8a1a1f2
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231573
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: Add external format to iodev.

This changes iodev to track the format visible to the audio thread
separately from the format the hardware is actually configured to.
This will allow for a DSP module top change the format for use cases
such as beam forming.

BUG=none
TEST=none

Change-Id: Iee1652976c695ecd06030df013a8723ac74f8e77
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231574
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: iodev - Allow DSP to modify number of channels.

When setting up the iodev format, if there is a DSP applied, check if
it wants to modify the number of channels when processing.  This
allows for use cases such as a beam former that takes in 2 or more
channels and produces mono output.

BUG=none
TEST=none

Change-Id: I3ea51a13c5bc63faecc0093dba09cc08d022fa89
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231575
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: iodev UT - add put_buffer tests

Change-Id: If2ec60419a8ae4a83266ec1f781967ff5af613d0
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231683
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: audio_thread UT - Remove more unused functions.

These has been moved to iodev.

BUG=none
TEST=this is a test.

Change-Id: I3b463ffe413b664a152b6fd3a845cbe4812a740d
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231713
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
CRAS: Be more precise with frames_to_time.

This adds a variant of frames_to_time that accepts a double for the
sample rate.  doing this will provide more accurate times for each
sleep interval.

BUG=chromium:436251
TEST=capture with show_latency for a really long time.

Change-Id: I77f9b411f2e4401a27e44d0c7fb0463078e96b97
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231712
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Samus: disable the left speaker.

Since the left speaker will occasionally hiss, route both channels to
the right speaker.  This can be reverted once the left speaker hiss
issue is fixed.

BUG=none
TEST=play 5.1 channel audio, check only right speaker works, and that
headphones are unaffected.

Change-Id: I0c9f2d6f517f933edef52df2e78fcd5af0a4a2e1
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231715
Reviewed-by: Ben Zhang <benzh@chromium.org>
CRAS: fmt_conv - don't restrict in and out to s16le

Allow both the input and output to be non-s16le.  This will be useful
when playing to hardware that only support 24 or 32 bit samples such
as many USB DACS.

BUG=none
TEST=added unit test

Change-Id: Ia6858345958ec2febc716beea56b47868b5706e3
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: Allow 24 and 32 bit samples to alsa devices

Some USB DACs only support 24 or 32 bit samples.  Start to support
this by adding checks for S24_LE and S32_LE formats.

BUG=chromium:219948
TEST=updated unittests

Change-Id: Ibedd27182471947741e6f62007574fb49b455e56
CRAS: mix - Short circuit some scaling.

Add checks if it is worth scaling before doing the scaling.
Re-order cras_mix add to be more readable and take advantage of the
new check in scale_add_clip.

Change-Id: I4a4f340e13f4167e57ff83429b2eea33519751aa
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: mix - reorder exported functions

This will make it clearer when the scale and mix_add functions expand
to support formats other than s16le.

Change-Id: I28c6403e2c35d93164b8c6ea6dc758994bac1e81
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: mix - Add 32 and 24 bit mixing

This will be used for devices that support S32_LE  and S24_LE formats.

BUG=chromium:219948
TEST=added unittests

Change-Id: I41f0f49ca8cc81e5321d3eed1767ded541355aea
Signed-off-by: Dylan Reid <dgreid@chromium.org>
CRAS: dev_stream - Mix proper format.

Mix the format that matches the device.  This adds a format parameter
to dev_stream_mix so the correct format can be used when mixing.

BUG=chromium:219948
TEST=play through USB DAC that supports 32 bit samples only.

Signed-off-by: Dylan Reid <dgreid@chromium.org>