Commit Graph

56 Commits

Author SHA1 Message Date
Ralf Herz
e0b9234773 dsp: Fix open params for read_compr in IEC61937 mode
The read compressed in IEC61937 mode doesn't unpack data to frames, but
data flow still requires frames_per_buf to be set to nonzero value.

Change-Id: Idb09219c57d7790cb90df62c97baf3ef0e9d8a2f
Signed-off-by: Ralf Herz <rherz@codeaurora.org>
2019-07-02 00:37:18 -07:00
qctecmdr
9ad54a5373 Merge "dsp: Define channel map for 14channels" 2019-06-17 21:01:33 -07:00
qctecmdr
bb8a875619 Merge "dsp: Add asm channel map support for 10channels" 2019-06-17 20:39:57 -07:00
Chaithanya Krishna Bacharaju
3dd8fdf8a5 dsp: Define channel map for 14channels
Define channel map for channel count 14 for adm and asm to
support capture usecases for this configuration.

Change-Id: Ieb43dafd05f88bf34fa512fd7268258163e9ac92
Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>
2019-06-16 17:30:32 -07:00
Weiyin Jiang
fcf3cc05fb dsp: rtac: use accurate stream id during rtac asm apr call
Hard coded stream id fails rtac call for subsequential gapless stream
which uses stream id other than default value. To get/set rtac for
gapless session successfully, we need to update the stream_id as a part
of asm apr header with correct value populated from asm session table.

Change-Id: If4afd73b4cf11bf91730a58ae6dff03efb04519d
Signed-off-by: Weiyin Jiang <wjiang@codeaurora.org>
2019-06-03 16:11:54 -07:00
Chaithanya Krishna Bacharaju
e2c1904988 dsp: Add asm channel map support for 10channels
Add asm channel map support for 10channels to support
10channel recording usecase.

Change-Id: Ic939eabed893e9e56b17e62bc5100f2d6d51732f
Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>
2019-05-06 23:09:51 -07:00
qctecmdr
792edd228f Merge "dsp: codecs: Remove error logging during ssr" 2019-04-23 20:42:20 -07:00
Md Mansoor Ahmed
be50237438 dsp: Replace wall clock for KPI calculations
Replace clock reference from wall clock to MONOTONIC.
This is to avoid getting impacted when system time is
set backwards or forwards (either through network or manually).

Change-Id: I98625b033f689002c9334633cf3944608d5a77d3
Signed-off-by: Md Mansoor Ahmed <mansoor@codeaurora.org>
2019-04-15 02:32:04 -07:00
Ramprasad Katkam
7311253f6f dsp: codecs: Remove error logging during ssr
During SSR avoid printing some errors which could lead
to excessive logging.

Change-Id: I5f9e7e5f32bc3de87996838048514e16d59c97a6
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2019-04-15 02:21:15 -07:00
Vignesh Kulothungan
d5f41ba7f4 dsp: Remove redundant payload size check
Due to redundant payload checks, ASM
get param requests in RTAC mode fail with timeout
errors. Fix this by removing the redundant
payload checks.

CRs-Fixed: 2372302
Change-Id: If08ec942f3530e132b5980da579ea1766d21c52b
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-04-05 08:09:25 -07:00
Linux Build Service Account
66547d7c3f Merge "dsp: asm: Add check for num_channels before calling q6asm_map_channels" 2019-03-14 15:24:19 -07:00
Linux Build Service Account
e848e37cb2 Merge "dsp: asm: validate ADSP data size before access" 2019-03-14 06:55:35 -07:00
Xiaoyu Ye
f74e89bd89 asoc: avoid excessive logging
Excessive logging by pr_err() could cause audio thread to stuck
in the printing session which results PD down notification timeout.
This eventually can cause ADSP PDR failure. Fix this issue by using
pr_err_ratelimited and dev_err_ratelimited to limit the number of
error messages during the ADSP PDR.

Change-Id: I68b617fef53ebd03ba79fd919bffd8c35e6eb048
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
2019-03-12 22:28:30 -07:00
Vignesh Kulothungan
52b8722a94 dsp: asm: validate ADSP data size before access
Check the size of ADSP payload before accessing it.
Validate buffer index obtained from ADSP token before using it.

CRs-Fixed: 2372302
Change-Id: I3f5e1b6f515935a10a8c59c324452be0a71f9473
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-03-12 11:42:59 -07:00
Rohit kumar
2a64e52662 dsp: asm: Add check for num_channels before calling q6asm_map_channels
Channel_mapping array size varies for different commands.
Add check for num_channels before calling q6asm_map_channels.

Change-Id: Iccbcfe82f716fc0ffe0a26b1779dcaa1c3cb805b
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
2019-03-11 05:39:41 -07:00
Ralf Herz
fba2a8270a dsp: Handle media fmt update events
Handle media format update events from ADSP in case of DSP loopback.

Change-Id: I4004759cc77a05f46106d359417f97f0326af19d
Signed-off-by: Ralf Herz <rherz@codeaurora.org>
2019-03-04 21:22:03 -08:00
Xiaojun Sang
a34ba3f372 dsp: asm: validate payload size before access
Payload size is not checked before payload access. Check size
to avoid out-of-boundary memory access.

Change-Id: Iaa39ee4ea5489bb5579e7b7d5dfada12d88c5809
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-02-26 19:12:56 -08:00
Meng Wang
c2acbee602 dsp: update copyright marking for q6afecal-hwdep and q6asm
Copyright year 2018 for q6afecal-hwdep and third party copyright
marking for q6asm are removed during updating file headers.
Add them back.

Change-Id: I0341116ca0cf82be8c3876534b98ad2c376b3531
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2019-02-12 08:32:44 +08:00
Meng Wang
688a867091 asoc: Update file header to GPL-2.0-only
Update file header to GPL-2.0-only.

Change-Id: If16bf92f951c6d7521f56a3e9b91da2ca2ccf6f8
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2019-01-29 13:43:33 +08:00
Dhananjay Kumar
defd81b1a5 dsp: add support to set custom channel mixer coefficients
Enhance Channel Mixer control for MultiMedia Frontends to
get custom channel mixer coefficients from userspace and
use it during device routings to control stream to device
channel mappings.

Change-Id: Ifedac25de5ae6bad1092b66ec405bba66a80f608
Signed-off-by: Cong Tang <congt@codeaurora.org>
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
2019-01-21 20:58:22 -08:00
Vignesh Kulothungan
0fcf2af3df asoc: dsp: ipc: Reduce wait timeout to 1 second
Reduce the amount of time driver waits to get a response from ADSP.
Current wait time in some cases is 5 secconds, which might cause
user space crashes in Android P. So reducing the timeout to
1 second.

CRs-Fixed: 2318751
Change-Id: I6b6789aa5b408659dd57f8f6b017df52d14b28aa
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-01-02 16:04:27 +08:00
Meng Wang
61af6849e9 ASoC: switch audio drivers to SPDX identifier
Switch audio drivers to SPDX identifier on msm-4.19.

Change-Id: Ic3f0230a516db251b8d81e8a7e73dbc04d66fe1b
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2018-12-07 15:47:32 +08:00
Dieter Luecking
39b3e3cc9e dsp: Update ASM driver to support 32 ch
ASM supports now up to 32 channels. Extend
the ASM Channel map structures from 8 to 32
channels.

Change-Id: I958d15910785cf0c5707dec432b4dd3e272c3dc1
Signed-off-by: Dieter Luecking <dieterl@codeaurora.org>
Signed-off-by: Mangesh Kunchamwar <mangeshk@codeaurora.org>
2018-10-04 07:13:39 -07:00
Linux Build Service Account
8903e56097 Merge "ASoC: rate limit for error log" 2018-09-20 11:43:44 -07:00
Xiaojun Sang
c226e86c15 ASoC: rate limit for error log
Use rate limit to reduce redundant log.

Change-Id: I7cd7403c42ddce7915c5ecb82504e6c38bcf0572
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2018-09-19 08:53:45 +08:00
Vignesh Kulothungan
e5159cdc90 dsp: asm: split check condition for NULL and stale
Split the muli-check condition into two separate check conditions.
Suppress the logs for stale condition to debug.

CRs-Fixed: 2307741
Change-Id: I984a2ea7928de052e993e77db807df83109ab423
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2018-09-12 11:23:34 -07:00
Karthikeyan Mani
0c1f938992 dsp: rate limit read/write error logs
Rate limit dsp read/write error logs to reduce log
prints during SSR scenario for read/write failures.

Change-Id: I031be5ebd39bdd11dc8e1eb92c77ed782f1dc149
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2018-08-28 14:32:37 -07:00
Vignesh Kulothungan
61e56a95a3 dsp: asm: initialize variables before use
Initialize flag variables before use in spinlocks.

CRs-Fixed: 2257317
Change-Id: I8b5973c1dfe3c7266a71d4e8ef4d5884b685ae5d
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2018-08-23 09:52:35 -07:00
Linux Build Service Account
6f046cdf21 Merge "ASoC: q6asm: use session lock to avoid use-after-free" 2018-08-08 23:32:14 -07:00
Linux Build Service Account
ed06521452 Merge "asoc: msm: update asm channel map for push pull mode" 2018-08-07 06:18:42 -07:00
Xiaojun Sang
fe99d5b2d1 ASoC: q6asm: use session lock to avoid use-after-free
It is possible that audio session free and param set happens
simultaneously. Audio client might be freed while param set
is doing wait_event_timeout.
Use session lock to make sure client_free happens after param set.

Change-Id: I0947c309c8e445fa2e220680e329d88bd5fe2418
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2018-08-02 17:38:17 +08:00
Surendar Karka
5628e8bc98 asoc: msm: update asm channel map for push pull mode
In noirq push pull mode channel map needs to be set during
ASM open shared io stream. Add support for no irq driver to
set channel map during ASM shared io stream open.

CRs-Fixed: 2267809
Change-Id: Ic1abfe60bb54b6529fbb4cf999e50196befaba46
Signed-off-by: Surendar Karka <skarka@codeaurora.org>
2018-08-02 13:05:05 +05:30
Linux Build Service Account
2cb347bab2 Merge "asoc: qcs405: Add support for AFE SPDIF interfaces" 2018-07-31 09:34:20 -07:00
Mangesh Kunchamwar
2eabdc7309 asoc: dsp: add check for integer overflow
Add check for integer overflow of user
supplied data for ADSP stream command.

CRs-Fixed: 2173850
Change-Id: Idde5665c770398629b1b0cfa2c18d3c023b0f9a2
Signed-off-by: Mangesh Kunchamwar <mangeshk@codeaurora.org>
2018-07-27 21:32:46 +05:30
Ralf Herz
cc29b9e839 dsp: support for AFE SPDIF input interface
Support two SPDIF input and two SPDIF output interfaces in AFE.
Support 61937 compressed capture.

Change-Id: Ie71434eb53be798567a6240e0f4bf171aee305b8
Signed-off-by: Ralf Herz <rherz@codeaurora.org>
2018-07-25 21:35:33 +05:30
Linux Build Service Account
d36e5ef530 Merge "dsp: Avoid excessive list iterations" 2018-07-09 11:56:34 -07:00
Linux Build Service Account
f247ce1f32 Merge "ASOC: dsp: add spin_lock for q6asm_add_hdr" 2018-07-06 14:46:26 -07:00
Vignesh Kulothungan
96ba1625dc dsp: Avoid excessive list iterations
Exit list iteration after the required conditions
for the loop has been satisfied to avoid additional
list iteration.

Change-Id: I96872d3be469420e613ec0244588a0a8ecb50e58
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2018-07-05 11:40:48 -07:00
Meng Wang
d1942a26d8 dsp: add null check for temp handle
Variable mem_state in audio client(ac) is set to zero
when there is a successful memory mapping. However the
same variable is updated for various mapping commands.
Ensure to check for both memstate and specific mem_handle
to be updated in the wait condition to wake up the right
waiting command.

Change-Id: Iabba61cef0a90f636de50e9d27eecf886dc59a27
Signed-off-by: Meng Wang <mwang@codeaurora.org>
2018-07-03 17:48:02 -07:00
Meng Wang
d5d1092c0c ASOC: dsp: add spin_lock for q6asm_add_hdr
During SSR, ac could get freed after unlock the session lock
during the execution of q6asm_callback. If we try to get the
ac->cmd_lock after ac freed, kernel panic happens.
Remove mutex_lock in reset_event to avoid kernel panic.
Add spin_lock_irqsave in q6asm_add_hdr and change spin_lock to
spin_lock_irqsave in q6asm_callback to add synchronize between
q6asm_add_hdr and q6asm_callback to avoid kernel panic.

Change-Id: I72cf959fe6a764920a13d565c72243a80ac4f236
Signed-off-by: Meng Wang <mengw@codeaurora.org>
2018-07-03 08:34:46 +08:00
Aditya Bavanari
d66cc71409 dsp: Fix rtac memory unmap issue in ASM driver
During unmap of rtac block in ASM, mem_map_handle
address is set to zero instead of the value. Set the
map handle value to zero to avoid issue in freeing the
ion memory.

CRs-Fixed: 2254339
Change-Id: I6584be029d4c8dde235e722149c758df0db9916e
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2018-06-18 12:57:32 +05:30
Vikram Panduranga
c712c17ab0 dsp: Add support for custom encoder
Add support to set custom encoder in ASM which
can be enabled through compress capture path.

Change-Id: I563c59eb3a0213c26ce69d3c2f8d650cf3c7d32d
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
2018-06-05 12:57:23 -07:00
Karthikeyan Mani
145e63390c dsp: q6asm: check for buffer size before read
Check for debugfs ops buf size passed before reading
to avoid reading out of bounds.

Change-Id: Idd5e755ac16448af5751e2f3381097f234e74a74
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2018-04-09 10:37:38 -07:00
Xiaojun Sang
75642c362c ASoC: msm: check payload size before memory allocation
Buffer from mixer ctl or ADSP is composed of payload size and
actual payload. On a 32 bit platform, we could have an overflow
if payload size is below UINT_MAX while payload size + sizeof(struct)
is over UINT_MAX. Allocated memory size would be less than expected.
Check payload size against limit before memory allocation.

Change-Id: I0bf19ca7b8c93083177a21ad726122dc20f45551
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2018-04-02 22:00:23 +08:00
Vikram Panduranga
770b8383d2 dsp: Mark cal block after use
After applying calibration on DSP, cal block
is marked stale to ensure same calibration is not
reused for future usecase.

Change-Id: I9f446c0602f4ab34ca71b9d2611319624fb19cd2
Signed-off-by: Vikram Panduranga <vpandura@codeaurora.org>
2018-03-16 17:54:53 -07:00
Vignesh Kulothungan
fa497d2051 ASoC: dsp: Update audio effects driver to support Instance ID
Add support to set and get audio effects module params with
Instance ID support. Maintain support for non
Instance ID set and get param structures as well.
Use common pack and set param functions to set and
get parameters to DSP instead of handling them at an
individual module level.

CRs-Fixed: 2151551
Change-Id: I0fdba2560950c931a2ec6f152499fd4bb9f59086
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2018-03-04 23:22:34 -08:00
Vignesh Kulothungan
f20d5b7ea5 ASoC: dsp: Update ASM driver to support Instance ID
Add support to set and get ASM module params with
Instance ID support. Maintain support for non
Instance ID set and get param structures as well.
Use common pack and set param functions to set and
get parameters to DSP instead of handling them at an
individual module level.

CRs-Fixed: 2151551
Change-Id: I633ce10a83d9033d42fadb7bad0b26842459df84
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2018-03-04 23:22:19 -08:00
Vignesh Kulothungan
1ccc875287 ASoC: dsp: Update rtac driver to support Instance ID
Add support to set and get rtac params with
Instance ID support. Maintain support for non
Instance ID set and get param structures as well.
Use common pack and set param functions to set and
get parameters to DSP instead of handling them at an
individual module level.

CRs-Fixed: 2151551
Change-Id: Ic96e83477e72dc5ffa4d87a1e98c34814bbd0b8d
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2018-03-04 23:07:03 -08:00
Banajit Goswami
08bb73698a dsp: update MSM Audio ION wrappers to align with upstream
Between Linux-4.9 and Linux-4.14, upstream has updated the
ION APIs significantly to make ION ready to bring out of
staging folder. This has changed the way ION and dma_buf
APIs used to work together for allocating, mapping and
deallocating ION buffers.
Update MSM Audio ION wrapper functions used by audio drivers
to reflect these ION API changes as per upstream ION.

Change-Id: I63097e147a397aa3a538f69ac88b6fb10871c3dc
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
2018-02-04 03:41:06 -08:00
Meng Wang
9730cdd47e ASoC: dsp: add spin lock to protect ac
There is a possible use after free for the ac variable
that causes kernel panic. Add spinlock to fix race
condition to avoid this issue.

Change-Id: I71638c269f572ff1eaad87682fa000cd1dad407d
Signed-off-by: Meng Wang <mwang@codeaurora.org>
2017-12-12 23:44:08 -08:00