Commit graph

102 commits

Author SHA1 Message Date
Xiaojun Sang
1b75396524 dsp: asm: validate payload size before access
Payload size is not checked before payload access. Check it
to avoid out-of-boundary memory access.

Change-Id: Iaa39ee4ea5489bb5579e7b7d5dfada12d88c5809
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-04-10 15:36:09 +08:00
Vignesh Kulothungan
ed93ca6232 msm: asm: validate ADSP data before access
Validate buffer index obtained from ADSP token before using it.

CRs-Fixed: 2372302
Change-Id: I5c3b1634bd08b516844638dd67f726a882edfc17
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-03-28 18:29:01 -07:00
Rohit kumar
8c12285cf3 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-01 03:42:08 -08:00
Soumya Managoli
5206b51937 asoc : msm: Fix zero size pointer issue
APPS crashes randomly due to invalid memory allocation
in q6asm_audio_client_buf_free_contiguous.
Added check to return error if memory allocation size is 0.

Change-Id: I40f49aa147d513b29b56224a5ee77ccbb2dcc110
CRs-Fixed: 2285272
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2018-09-04 04:53:26 -07:00
Erin Yan
2a7de56683 q6asm: retry asm_open_read and asm_open_loopback when session id conflict
The ADSP asm session ids are managed by the kernel driver. It's all right
for native use cases. But for virtualization use cases, there's no way to
synchronize the session ids' status among virtual machines.  Playing back
in one virtual machine is probably failed, because the session id may had
been occupied by a use case in another virtual machine.

The patch allowed audio capture stream and loopback stream to try all
available session ids in case of session id conflict error, to support
concurrent playback from multiple virtual machines.

Change-Id: I01b4da65f3e5716dd14c20c614b53f3c45dd9ea3
Signed-off-by: Erin Yan <xinyey@codeaurora.org>
2018-08-14 19:49:31 -07:00
Aditya Bavanari
04708e34ee ASoC: msm: qdsp6v2: 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-19 17:50:52 +05:30
Han Lu
53c8faf4dc q6asm: retry asm open in case of session id conflict
The ADSP asm session ids are managed by the kernel driver. It's all right
for native use cases. But for virtualization use cases, there's no way to
synchronize the session ids' status among virtual machines.  Playing back
in one virtual machine is probably failed, because the session id may had
been occupied by a use case in another virtual machine.

The patch allowed audio playback stream to try all available session ids
in case of session id conflict error, to support concurrent playback from
multiple virtual machines.

Change-Id: If98d05898cec3f05d80c750ec8a014add3b1f34c
Signed-off-by: Han Lu <hanlu@codeaurora.org>
2018-06-04 00:32:36 -07:00
Soumya Managoli
63f8971543 ASoC: msm: Modify buf size check to prevent OOB error
Expected buffer size to read is 2 bytes.
Corrected the size check to return error
when count is not 2.

Change-Id: I43b572d191f6f98a8a790b5ae77b43fabcd7329a
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2018-04-27 11:31:54 +05:30
Cong Tang
53a51106b5 ASoC: msm: Upgrade ASM Driver to support 32 Channels
HLOS update ASM driver to support 32 channels playback
and capture since ADSP firmware has already support on this.
With this each MultiMedia Frontend would be able to support
32 channels playback and capture.

Signed-off-by: Cong Tang <congt@codeaurora.org>
Change-Id: Ie2ada37e612d0096cb623777f43aa9c05989058d
2018-03-20 22:36:40 -07:00
Linux Build Service Account
bf641b6b92 Merge "ASoC: msm: qdsp6v2: check for buffer size before read" 2018-03-12 02:47:14 -07:00
Karthikeyan Mani
023bc4e0bf ASoC: msm: qdsp6v2: check for buffer size before read
Check for debugfs ops buf size passed before reading
to eliminate the possibility of reading out of bounds.

Change-Id: I28fd60ce93256b6b0bad62b449092a891cc15463
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2018-03-09 10:34:18 -08:00
Aditya Bavanari
893f3cf2fb asoc: msm: add check for integer overflow
Add check for integer overflow of user
supplied data for ADSP stream command.

CRs-Fixed: 2173850
Change-Id: Ic70093e890b7a6dd07529d77d10fff003282a8ea
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2018-03-06 12:52:27 +05:30
Linux Build Service Account
e64256fca0 Merge "ASoC: msm: qdsp6v2: add spin lock to protect ac" 2018-01-11 04:14:55 -08:00
Meng Wang
13661b77b8 ASoC: msm: qdsp6v2: add spin lock to protect ac
ac could get freed during the execution of q6asm_callback.
And kernel panic happens. Add spinlock to protect ac to avoid
kernel panic.

Change-Id: Ie49c8a3979231552ba7d5f207aab0d95ffdc2a72
Signed-off-by: Meng Wang <mwang@codeaurora.org>
2018-01-05 12:52:28 +08:00
Aditya Bavanari
7448b5c257 ASoC: msm: qdsp6v2: 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: I62342d434fc5bd58c06d22913683d7d0fd602da9
Signed-off-by: Siena Richard <sienar@codeaurora.org>
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2017-12-21 11:27:46 +05:30
Aditya Bavanari
7a5f4a39ac ASoC: msm: qdsp6v2: 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: I48a0f0f856d8b8b59b7e7361fae63283e0f87948
Signed-off-by: Siena Richard <sienar@codeaurora.org>
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2017-12-21 11:24:22 +05:30
Aditya Bavanari
36ed1afb56 ASoC: msm: qdsp6v2: 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: Ic07cb109b9e469dccf510f89ba9917e8c9eccbd8
Signed-off-by: Siena Richard <sienar@codeaurora.org>
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2017-12-21 11:11:41 +05:30
Linux Build Service Account
ae8fef7239 Merge "ASoC: msm: qdsp6v2: primary plus 8 interactive stream playback fix" 2017-10-05 03:06:33 -07:00
Linux Build Service Account
3e07e9cdb5 Merge "ASoC: msm: qdsp6v2: change to no-wait command for RTIC event" 2017-09-22 17:26:42 -07:00
Varun Balaraj
10b176a997 ASoC: msm: qdsp6v2: primary plus 8 interactive stream playback fix
Max ASM session upperbound condition is corrected to support
8 interactive plus a primary streams playback.

Change-Id: I5ec29c70941f52af020a64cc58bf10be52354f1b
Signed-off-by: Varun Balaraj <varunb@codeaurora.org>
2017-09-19 03:11:22 -07:00
Aditya Bavanari
adc8d80a00 ASoC: msm: qdsp6v2: Fix dangling pointer access
Fix access of a dangling pointer by assigning it to NULL.

CRs-Fixed: 2096407
Change-Id: I22c1d55ea611ac59cdca51924787f6831bad8c2b
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2017-09-13 10:57:17 +05:30
Vidyakumar Athota
a135611457 ASoC: msm: qdsp6v2: change to no-wait command for RTIC event
RTIC(runtime check) event ack command can execute asynchronously
along with other ASM commands. Using common cmd_state variable
to wake up the thread results synchronization issues. So use
no-wait command for RTIC event ack command.

Change-Id: Ie55ac6d50f83112e72de65c68340f7f7ba0923da
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2017-09-01 12:19:51 -07:00
Linux Build Service Account
f61a791dc1 Merge "ASoC: msm: qdspv2: add an API to destroy ion client" 2017-08-23 20:24:47 -07:00
Vidyakumar Athota
e4faef1e35 ASoC: msm: qdspv2: add an API to destroy ion client
Currently ion fd is used to extract ion handle to free ion client.
ION FD is not valid if user-space application is crashed so ion handle
is returned to the client during msm_audio_ion_phys_assign() API which
is used to destroy ion client in msm_audio_ion_phys_free() API.

Change-Id: Idcc4ca838741aac26662a679117af9d9c935e630
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2017-08-21 10:56:56 -07:00
Varun Balaraj
a935e0c8f8 ASoC: msm: Fix pan control param gain to accommodate Q28 format
Fix pan control gain param to accommodate Q28 format.
Convert 32bit gain to be inlined with 16bit mixer coefficients
of ADSP.

Change-Id: I85ebd11c49b4af982f34091937acabb9e6580e8f
Signed-off-by: Varun Balaraj <varunb@codeaurora.org>
2017-08-17 09:32:42 -07:00
Vidyakumar Athota
3ec77b8214 ASoC: msm: qdsp6v2: assign decoder memory to ADSP
Get the physical address of memory from ion FD and
assign it to ADSP for secure playback scenario.

Change-Id: I51019f5da6fb5fedefc81504b192f985b851ab12
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2017-08-07 22:44:23 -07:00
Manish Dewangan
ac162df12c ASoc: msm: qdspv2: Fix latency calculation in pcm offload path
Continuous latency for pcm offload is incorrect as buffer offset
is not getting considered while pattern matching.

Fix this by considering buffer offset while calculating
continuous latency.

CRs-Fixed: 2059729
Change-Id: I943da364f99a4152119d34a98b343e6e1cbad5b8
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
2017-07-16 23:19:03 -07:00
Varun Balaraj
701ac49eb7 ASoC: q6dspv2: Support for pan-scale and downmix set param
Add support for set params on ASM/ADM for MFC and
Volume modules. Make PSPD mitrix set param api generic.

Change-Id: I75a5b9e3fd2316b75be41439848f89190944bc36
Signed-off-by: Varun Balaraj <varunb@codeaurora.org>
2017-07-13 01:47:22 -07:00
Manish Dewangan
f5a7555de3 qdspv2: Add latency calculation support in pcm offload path
Update cold and continuous latency debug fs entries for offload
path to support latency calculation for pcm offload path.

CRs-Fixed: 2059729
Change-Id: Ic59c7b2fec76e682837c89926595fb3262d01aa8
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
2017-06-13 22:22:09 -07:00
Rohit Kumar
4282bbbb81 ASoC: msm: qdspv6: Fix wrong smmu sid for ULL playback
SMMU sid is set to 0 in q6asm_set_shared_circ_buff and
q6asm_set_shared_pos_buff in 32 bit arch. Fix it to
send proper SID to ADSP when sharing buffer.

Change-Id: I00cc0f881acd7a4a52292e65360ea7b03f2f0212
Signed-off-by: Rohit Kumar <rohitkr@codeaurora.org>
2017-06-12 23:02:49 -07:00
Siddartha Shaik
c340bec5c7 ASoC: msm: Add transcode loopback driver
Add DSP transcode loopback. Userspace can use this driver
to support TX to RX audio HW DSP loopback.

CRs-Fixed: 2049714
Change-Id: Ie83f5ca2c626c8fffbec4624f3e35c6c179d4c8c
Signed-off-by: Siddartha Shaik <sshaik@codeaurora.org>
2017-05-30 17:59:31 +05:30
Linux Build Service Account
33a94f46e5 Merge "ASoC: APR: Fix missing APR deregister from asm" 2017-05-26 06:31:12 -07:00
Linux Build Service Account
86552b6a63 Merge "ASoC: msm: Convert ALSA to ADSP format" 2017-05-26 06:30:48 -07:00
Siddartha Shaik
34fa162a86 ASoC: msm: Convert ALSA to ADSP format
In transcode loopback session open, ALSA to ASM format conversion is
incorrect. Update the format based on ASM defined formats.

CRs-Fixed: 2049714
Change-Id: Ie5ddb6a58a30b0d6b78bfc68cbbbcd3d92f28fb1
Signed-off-by: Siddartha Shaik <sshaik@codeaurora.org>
2017-05-24 19:07:23 +05:30
Siddartha Shaik
19fc81edfe ASoC: msm: add q6asm api for transcode loopback support
Transcode loopback api can be used by client to configure
compress loopback.

CRs-fixed: 2049714
Change-Id: I7286fbdfa89375d517f3dad7d04e1d2a360d6f7e
Signed-off-by: Siddartha Shaik <sshaik@codeaurora.org>
2017-05-22 23:03:16 -07:00
Ben Romberger
8f1e5633e3 ASoC: msm: qdsp6v2: Add IEC61937 compressed HDMI pass-though
Add support for IEC61937 which is an audio packaging
standard used for compressed HDMI pass-through. Any
audio format can be sent through HDMI pass-through
formatted as IEC61937.

Change-Id: I09821add306e2aeae6530cecbac189471a55e589
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
2017-05-18 18:11:32 -07:00
Ramprasad Katkam
8f0c7ae73c ASoC: APR: Fix missing APR deregister from asm
APR deregister is to be called for two ports from both
q6asm_callback(during RESET) and q6asm_audio_client_free.
In race condition between the two, APR deregister is called
only for one port. The mismatch in apr register-deregister
count causes apr not to reset service after ssr, causing
APR communication failure.

Change-Id: Ibd0528215bf2fb986eda03ae0d683b2af31358fe
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2017-05-18 21:59:39 +05:30
Linux Build Service Account
cf343cfb0f Merge "ASoC: msm: add support for new ADSP event APIs" 2017-05-16 06:49:43 -07:00
Linux Build Service Account
df2fff8d1d Merge "ASoC: msm: qdsp6v2: Add TrueHD to compressed open" 2017-05-10 23:03:58 -07:00
Linux Build Service Account
d575147a75 Merge "ASoC: msm: enhance ADSP Stream Callback" 2017-05-10 23:03:37 -07:00
Linux Build Service Account
4cb291c99a Merge "ASoC: msm: qdspv2: Add mixer controls for drift query" 2017-05-10 23:03:35 -07:00
Ben Romberger
4d021085de ASoC: msm: qdsp6v2: Add TrueHD to compressed open
Add TrueHD format selection to ASM compressed
open and remove it from non-compressed open.

Change-Id: I94b61958e71d3a0d3aec2aa0206cf35698399d34
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
2017-05-09 23:44:00 -07:00
Kuirong Wang
a50c958774 ASoC: msm: add support for new ADSP event APIs
Add support to handle new ADSP ASM stream event APIs for
different applications.

Change-Id: Id1e7b9b2841449ceb70099722d834b51c198f04e
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2017-05-09 10:32:33 -07:00
Xiaojun Sang
87cac622d8 ASoC: msm: enhance ADSP Stream Callback
Implement FIFO queue for multiple callback events. Events are
cleaned at stream close.

Change-Id: Id738326a20613d2f939e45204b2d46448a5b4759
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2017-05-04 15:21:27 +08:00
Linux Build Service Account
8d3c81087c Merge "ASoC: msm: q6dspv2: fix APR deregistration logic in ASM during ADSP SSR" 2017-05-01 23:56:51 -07:00
Linux Build Service Account
3e95a21f1f Merge "ASoC: qdsp6v2: Remove Eagle code" 2017-04-28 22:10:47 -07:00
Manish Dewangan
761f20e31b ASoC: msm: qdsp6v2: Add support for DSP clock recovery
ASM driver changes to apply DSP clock recovery.

Clients can issue clock recovery command with a positive value
to advance the clock or a negative value to delay the clock.

CRs-Fixed: 2036899
Change-Id: If2f10368afafe203ebdea219edcc2227cd381801
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
2017-04-28 02:39:49 -07:00
Alexy Joseph
4bf68bf13c ASoC: qdsp6v2: Remove Eagle code
Eagle driver is not in use any more.
Remove the code and associated calls
to it.

CRs-Fixed: 1103106
Change-Id: Ice5333861beda9538f0783b70b3267523d16fd2b
Signed-off-by: Alexy Joseph <alexyj@codeaurora.org>
2017-04-24 02:59:28 -07:00
Ben Romberger
30f17f05ef ASoC: msm: qdsp6v2: Add TrueHD HDMI compress pass-though
Add TrueHD audio format for compressed HDMI pass-through

Change-Id: Id8a0b8c3a01c881ae284f13c2c0a36959c2413ac
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
2017-04-17 23:26:35 -07:00
Banajit Goswami
2defb8c2bf ASoC: msm: q6dspv2: fix APR deregistration logic in ASM during ADSP SSR
When ADSP subsystem restart is triggered, apr_reset is called
from the ASM callback function, which internally calls
apr_deregister. At the same time, user space will clean up
all existing audio sessions when ADSP SSR happens. To avoid
any race condition, make sure only the ASM callback function
is allowed to handle the APR deregistration process, while the
other (session close) skips the step.

CRs-fixed: 2022490
Change-Id: I0c395c19d177e66a03fbb4cee3dd4b34f84e2d10
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
2017-04-13 00:48:08 -07:00