Commit graph android_kernel_sony_sdm845/techpack/audio
Message SHA1
techpack: audio: Optimize audio codec
-> Better audio quality;
-> Louder;
-> Clean;
-> Safe.

Modified!

Signed-off-by: Rizky Benggolo <travarilo@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Charsi-Tejas <tejas@m.ms.evolution-x.org>
Signed-off-by: Edwiin Kusuma Jaya <kutemeikito0905@gmail.com>
Signed-off-by: KanonifyX Tzy <kanonify01@gmail.com>

Rizky Benggolo   authored and   Sorayukii   commited 2026-05-15 17:48:19 +07:00
6e3629067d
techpack: audio: fix audio cracks
This nice finding was done by @lostark13 and published at [1]. Let's reuse
this change but reduce sleep range

[1] 91cf3ba1b1

See-Also: https://github.com/nE0sIghT/android_kernel_xiaomi_msm8953/issues/11
Signed-off-by: Albert I <kras@raphielgang.org>
Change-Id: I301955c1456000b7ce5f82c9be11694b55d5a0cc
Signed-off-by: TogoFire <togofire@mailfence.com>
Signed-off-by: Sorayukii <sorayukii69@gmail.com>

Yuri Konotopov   authored and   Sorayukii   commited 2026-05-15 17:48:19 +07:00
b2e15201f6
techpack: audio: Increase wsa881x buffer size
This silences the following compiler warning:

../techpack/audio/asoc/codecs/wsa881x.c:392:9: error: 'snprintf' size argument
      is too large; destination buffer has size 20, but size argument is 25
      [-Werror,-Wfortify-source]
                len = snprintf(tmp_buf, 25, "0x%.3x: 0x%.2x\n", i,
                      ^

Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: Sorayukii <sorayukii69@gmail.com>

0ctobot   authored and   Sorayukii   commited 2026-05-15 17:48:19 +07:00
65b7b4410b
techpack: audio: Import Sony changes
* Sony package version: 52.1.A.0.618

Change-Id: I19a0e5766f0b50e2557cd2a004bc3873689c6441
Signed-off-by: Sorayukii <sorayukii69@gmail.com>

Olivier Karasangabo   authored and   Sorayukii   commited 2026-05-15 17:48:11 +07:00
3e33fa4759
ASOC: Remove support for ANC headphones
ANC headphones are no longer supported, removed dead code related to the feature.

Change-Id: I3dd51b5b1d9f77fd870947608f8a14fc3f7aeed0
Signed-off-by: Akhil Karuturi <akarutur@codeaurora.org>

Akhil Karuturi   authored and   Michael Bestas   commited 2026-01-06 16:27:33 +02:00
c7ff74cdcc
dsp: q6voice: Switch to __builtin_add_overflow
As seen on newer kernels

Change-Id: I87f0a408c211f956ebe8acaf23cbdd8c89fef9e5

Michael Bestas   commited 2024-10-13 16:46:44 +03:00
8918f14a62
Merge tag 'LA.UM.8.3.c25-09700-sdm845.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel into android13-4.9-sdm845
"LA.UM.8.3.c25-09700-sdm845.0"

* tag 'LA.UM.8.3.c25-09700-sdm845.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
  dsp: q6voice: Adds checks for an integer overflow
  dsp: q6lsm: Address use after free for mmap handle
  ASoC: msm-pcm-host-voice: Check validity of session idx
  ASoC: msm-pcm-voip: Avoid interger underflow
  ASoC: msm-pcm-voip: Avoid interger underflow
  ASoC: msm-pcm-host-voice: Address buffer overflow in hpcm capture copy
  dsp: add change to enable preemption at cal_utils_dealloc_cal.
  dsp: add change to handle use-after-free in cal_utils_is_cal_stale

 Conflicts:
	techpack/audio/asoc/msm-pcm-host-voice-v2.c
	techpack/audio/asoc/msm-pcm-voip-v2.c

Change-Id: Ia26d572cbea1cacdca69055aedcf631e8541689a

Michael Bestas   commited 2024-10-10 16:49:37 +03:00
5b256169c5
BACKPORT: ASoC: msm-pcm-q6-v2: Add dsp buf check
Current logic copies user buf size of data
from the avail dsp buf at a given offset.
If this offset returned from DSP in READ_DONE event
goes out of bounds or is corrupted, then it can lead to
out of bounds DSP buffer access, resulting in memory fault.
Fix is to add check for this buf offset, if it is within
the buf size range.

Original-Change-Id: I7753cc6db394704dbb959477150141d42b836bef
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

(cherry-picked from 28658bc2a0a290fdfcab61bed67e89874e99ca47)
[ Re-picking to adapt 1ee23bd8c3 for dsp buf check ]
Change-Id: Ie028d928492e5d113285416226abbeee8e6bfc20
Signed-off-by: Han Sol Jin <hansol@hansol.ca>

Soumya Managoli   authored and   Han Sol Jin   commited 2024-07-21 16:18:11 -07:00
604621a904
asoc: Update copy_to_user to requested buffer size
Avoid copy to user more than requested buffer size
to avoid memory corruption.

Change-Id: Ibf1607f777a358ebd16fd8b8728809afda34eba7
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>

Laxminath Kasam   authored and   Han Sol Jin   commited 2024-07-21 16:04:03 -07:00
d80e8e755a
asoc: msm-pcm-q6-v2: Update memset for period size
tinycap test can attempt with different size to
read from driver and need to avoid access more
than period size.

Change-Id: Ifa4ddfb086bd83aa981da62e88da3a9395f5aabc
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>

Laxminath Kasam   authored and   Han Sol Jin   commited 2024-07-21 16:03:38 -07:00
6ef6d4154a
asoc: Reset the buffer if size is partial or zero
Sometimes during device switch in recording,
observe size 0 is return from DSP due to EOS
handling. For ALSA pcm_read to unblock, buffer
appl_ptr is elapsed without actually updating
the buffer. And userspace copies the stale
data(old buffer) causing issue sometimes.
Reset the buffer for that period_size in
such cases instead of transfer stale data.

Change-Id: I0d3ac133a8d95fad0710586e3e947410a41c9c5a
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>

Laxminath Kasam   authored and   Han Sol Jin   commited 2024-07-21 16:03:38 -07:00
1ee23bd8c3
ASoC: wcd_cpe_core: Fix buffer overflow in wcd_cpe_init
Clang warns:

../techpack/audio/asoc/codecs/wcd_cpe_core.c:1981:2: warning: 'snprintf'
size argument is too large; destination buffer has size 11, but size
argument is 13 [-Werror,-Wfortify-source]
        snprintf(proc_name, (sizeof("cpe") + sizeof("_state") +
        ^
1 warning generated.

Fixes: 8e2277f79f ("audio-lnx: Initial change for techpack of audio
drivers.")
Change-Id: Ide9f1ba2b854ca854918f8ebfd22f8d24c12164b
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Nathan Chancellor   authored and   Sebastiano Barezzi   commited 2024-02-12 18:29:49 +01:00
70eb2136c8
ASoC: wcd_cpe: Fix enum-conversion warnings
techpack/audio/asoc/codecs/wcd_cpe_services.c:658:17: error: implicit
conversion from enumeration type 'enum cpe_svc_result' to different
enumeration type 'enum cmi_api_result' [-Werror,-Wenum-conversion]
        notif.result = result;
                     ~ ^~~~~~
techpack/audio/asoc/codecs/wcd_cpe_services.c:1350:8: error: implicit
conversion from enumeration type 'enum cpe_svc_result' to different
enumeration type 'enum cpe_process_result' [-Werror,-Wenum-conversion]
                rc = cpe_send_msg_to_inbox(t_info, 0, m);
                   ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Change-Id: Ib9fce60017066e9c96e79195d7dba9ffb9177148

siimsek   authored and   Sebastiano Barezzi   commited 2024-02-12 18:21:06 +01:00
581fe8ff77
dsp: q6lsm: Address use after free for mmap handle
The global declared mmap_handle can be left dangling
for case when the handle is freed by the calling function.
Fix is to address this. Also add a check to make sure
the mmap_handle is accessed legally.

Change-Id: I367f8a41339aa0025b545b125ee820220efedeee
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

Soumya Managoli   authored and   Michael Bestas   commited 2024-01-04 19:23:58 +00:00
5320a64c2f
ASoC: msm-pcm-host-voice: Check validity of session idx
Added check for voice session index.

Change-Id: Ifff36add5d62f2fdc3395de1447075d297f2c2df
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

Soumya Managoli   authored and   Michael Bestas   commited 2024-01-04 19:23:58 +00:00
876b393aca
ASoC: msm-pcm-voip: Avoid interger underflow
There is no check for voip pkt pkt_len,if it contains the
minimum required data. This can lead to integer underflow.
Add check for the same.

Change-Id: I91d4f2ad8dfb060cdb2ab9e36dc9f886ea40908a
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

Soumya Managoli   authored and   Michael Bestas   commited 2023-11-07 01:14:05 +02:00
f00103486c
ASoC: msm-pcm-host-voice: Address buffer overflow in hpcm copy
Add check for the max hpcm_buf_node size before copy to avoid
buffer out of bounds issue.

Change-Id: Id647888430ce302359a857ef54d321bee99889bf
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

Soumya Managoli   authored and   Michael Bestas   commited 2023-11-07 01:13:50 +02:00
1ca577a790
ASoC: msm-pcm-q6-v2: Add dsp buf check
Current logic copies user buf size of data
from the avail dsp buf at a given offset.
If this offset returned from DSP in READ_DONE event
goes out of bounds or is corrupted, then it can lead to
out of bounds DSP buffer access, resulting in memory fault.
Fix is to add check for this buf offset, if it is within
the buf size range.

Change-Id: I7753cc6db394704dbb959477150141d42b836bef
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

Soumya Managoli   authored and   Michael Bestas   commited 2023-06-06 17:43:24 +03:00
873bce734f
techpack: audio: Update SOC_SINGLE_SX_TLV to SOC_SINGLE_S8_TLV
ASoC CTLs with negative minimum values were changed to use S8_TLV
controls on the upstream audio-kernel.
This is a backport of the upstream change [1] as it didn't land
into any sdm845 tag.

[1] 30fad2dc20

Change-Id: Id4b3038eb5d79a027f063869136ecebc83ee873d

Tan Nayir   authored and   Michael Bestas   commited 2023-05-20 17:47:47 +03:00
1d2326b3a1
techpack: audio: Make all sdm845auto drivers built in
Change-Id: I6e63a2de8caae25f298aa868d2b8b4367603bb23

LuK1337   authored and   Michael Bestas   commited 2023-01-09 18:44:13 +02:00
d54aefd880
techpack: makefile: do not export all the variables
This patch fixes an issue with all the functions defined in
scripts/Makefile.lib gets called everytime when this makefile is
included thus causing the build to slow down.

Bug: 118818737
Change-Id: I4929e64d53a0bc865b12a27cce37520be52c9744
Signed-off-by: Thierry Strudel <tstrudel@google.com>

Thierry Strudel   authored and   Michael Bestas   commited 2023-01-09 18:44:13 +02:00
076fd255de
Revert "techpack: audio: Construct and add audio techpack Kconfig to build"
This reverts commit f93ab4827b.

Change-Id: I1b0e294bdcd0cc0fbdadb6746edb78c515dd3a88

LuK1337   authored and   Michael Bestas   commited 2023-01-09 18:44:13 +02:00
fe340e18cc
Merge tag 'LA.UM.10.3.r1-01000-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel into android12-4.9-sdm845
"LA.UM.10.3.r1-01000-sdm845.0"

* tag 'LA.UM.10.3.r1-01000-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel:
  dsp: adm: add to check output/input channel
  Asoc: check for invalid voice session id
  asoc: add code change for pseudo playback and capture BE DAIs.

Change-Id: Ic53db8ee0144214c719593b442d25b24fe651ceb

Michael Bestas   commited 2022-03-31 20:20:56 +03:00
86a1457cf2
Merge tag 'LA.UM.9.3.r1-01600-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel into lineage-18.1-caf-sdm845
* tag 'LA.UM.9.3.r1-01600-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel:
  dsp: add change to enable preemption at cal_utils_dealloc_cal.
  dsp: add change to handle use-after-free in cal_utils_is_cal_stale
  dsp: q6adm: add ADM_LSM_AUDPROC_PERSISTENT cal type
  dsp: q6adm: add ADM_LSM_AUDPROC_PERSISTENT cal type
  uapi: msm_audio_calibration: add new cal type for ADM_LSM
  uapi: msm_audio_calibration: add new cal type for ADM_LSM
  dsp: add change to enable preemption at cal_utils_dealloc_cal.
  dsp: add change to handle use-after-free in cal_utils_is_cal_stale

Change-Id: Iebd2905a0e98737416b255dd3b4110fcb5b7d422

Michael Bestas   commited 2021-04-20 02:23:36 +03:00
63c8a0b915
asoc: msm-lsm-client: Fix inconsistent locking
This patch addresses the following locking error:

msm-lsm-client.c:337 lsm_event_handler() warn: inconsistent returns
'spin_lock:&prtd->event_lock'

Bug: 77543262
Test: build & boot
Change-Id: I6e492df8f90ba25ec17d548249b29b8ba1a87a29
Signed-off-by: David Lin <dtwlin@google.com>

David Lin   authored and   Michael Bestas   commited 2021-03-31 23:58:20 +03:00
81a0bad831
dsp: Fix inconsistent locking
This patch addresses the following locking error:

q6asm_callback() warn: inconsistent returns 'irqsave:flags'

Bug: 77543262
Test: build & boot
Change-Id: Iecf73f5985e2a7dfe96bafcf7cf387631a33677d
Signed-off-by: David Lin <dtwlin@google.com>

David Lin   authored and   Michael Bestas   commited 2021-03-31 23:58:19 +03:00
c51fc468a0
dsp: fix issue with unbalanced mutex
q6voice.c:6389 voc_set_device_config() warn: inconsistent returns
'mutex:&v->lock'

Bug: 77543262
Change-Id: Ib95e3915a1e7f5a61f0331610824118f88b382fb
Signed-off-by: David Lin <dtwlin@google.com>

David Lin   authored and   Michael Bestas   commited 2021-03-31 23:58:19 +03:00
719a946b5e
asoc: sdm845: remove wsa codec log spam
This removes the following logspam on boards without WSA codec:

[    6.548448]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[    8.354834]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[    8.501192]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[    8.643592]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[    8.870054]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[    9.007772]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[    9.144575]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[   13.487951]  msm_init_wsa_dev: Max WSA devices is 0 for this target?
[   14.061869]  Sound card sdm845-tavil-tdm-snd-card registered

Change-Id: Ifc29034e23d6b968c473e9f2d0f312cae27c49b5
Signed-off-by: David Lin <dtwlin@google.com>

David Lin   authored and   Michael Bestas   commited 2021-03-31 23:58:14 +03:00
8f06f305ce
ASoC: fix snprintf size arguments
../techpack/audio/asoc/codecs/wsa881x.c:392:9: error: 'snprintf' size argument is too large; destination buffer has size 20, but size argument is 25 [-Werror,-Wfortify-source]
                len = snprintf(tmp_buf, 25, "0x%.3x: 0x%.2x\n", i,
                      ^
1 error generated.

The warnings are correct. Fix the size arguments by only allowing the
amount of bytes that the size of the char arrays are.

Signed-off-by: shagbag913 <sh4gbag913@gmail.com>
Signed-off-by: Khusika Dhamar Gusti <mail@khusika.com>
Change-Id: I31366b5cd2f13f6d168111a4b0a2f013bd6b92f7

shagbag913   authored and   Michael Bestas   commited 2021-01-17 05:14:18 +02:00
8c99743127
Merge tag 'LA.UM.8.3.r1-08800-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel into lineage-17.1-caf-sdm845
* tag 'LA.UM.8.3.r1-08800-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel:
  asoc: add new path for in call recording

Change-Id: I4de3f068d74ea57cf1b9f275652824b881b7f1b4

Michael Bestas   commited 2021-01-17 04:20:05 +02:00
1f33cf6e7f
techpack: audio: Construct and add audio techpack Kconfig to build
This is the only way to solve the mess that happens whenever
we try to rebuild the kernel without mrproper'ing it first.

It's the most dirty thing on Earth, but it's really the only
possible option.

Change-Id: Ie72adbb63d8c0a9c2d53cd4a9e8610ad9ccfef9b

Angelo G. Del Regno   authored and   Michael Bestas   commited 2020-06-30 02:48:34 +03:00
f93ab4827b
Merge tag 'LA.UM.8.3.r1-07900-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel into HEAD
* tag 'LA.UM.8.3.r1-07900-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel:
  asoc: msm-compress: Add lock in controls _put() and _get() callback
  Revert "rtac: Add mutex protection for rtac cal apis"
  asoc: msm-routing: Fix array out of bounds issue.
  asoc: msm-compress: Replace goto with return in case of invalid value.
  asoc: fix for fm not routing to speaker
  asoc: msm-compress: Added missing mutex initialization for pdata
  rtac: Add mutex protection for rtac cal apis
  ASoC: fix compilation warnings after enabling LLVM

Change-Id: Ib02bb0c221bb89d317cf79dc90476b6211819465

Michael Bestas   commited 2020-06-30 02:08:21 +03:00
faf58f3284
Import tag 'LA.UM.8.3.r1-07200-sdm845.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel/
Change-Id: Ic797bb237b29e0ddc5925e64191bad72d0ea3def
git-subtree-dir: techpack/audio
git-subtree-mainline: b0e9337da1
git-subtree-split: 4f7d3b88983d4ac4f5dd5425f0b08ef61d56e133

Bruno Martins   commited 2020-02-09 07:57:57 +00:00
bf2a78dd67