45 Commits

Author SHA1 Message Date
Sebastiano Barezzi
59e5f6a91c Merge remote-tracking branch 'qcom_sdm845/lineage-20' into lineage-21
Change-Id: Ie555470f4164e62e16c597a23d53e14b2786cf82
2024-04-13 13:43:17 +02:00
Nathan Chancellor
70eb2136c8 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>
2024-02-12 18:29:49 +01:00
siimsek
581fe8ff77 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
2024-02-12 18:21:06 +01:00
Ivan Vecera
56976255d1 Merge branch 'lineage-20' of https://github.com/LineageOS/android_kernel_qcom_sdm845 into lineage-20
Change-Id: I0e7aeaf59808561e6b902dd06013313152ba14ed
2024-01-22 19:58:33 +01:00
Soumya Managoli
5320a64c2f 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>
2024-01-04 19:23:58 +00:00
Soumya Managoli
876b393aca 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>
2024-01-04 19:23:58 +00:00
Soumya Managoli
f00103486c 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>
2023-11-07 01:14:05 +02:00
Soumya Managoli
1ca577a790 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>
2023-11-07 01:13:50 +02:00
Sebastiano Barezzi
6a733d92c6 techpack: audio: config: Enable Elliptic Ultrasound driver
Change-Id: I8e3a1d156a80f88f42593f6f90176e9df75a3e01
2023-07-22 18:52:02 +02:00
Sebastiano Barezzi
e520b67b35 Merge remote-tracking branch 'qcom_sdm845/lineage-20' into lineage-20
Change-Id: Ia265042b444262e031e5c075955ee9c18f850938
2023-06-25 01:42:13 +02:00
Sebastiano Barezzi
24e3c6e005 techpack: audio: Drop custom Kconfig entries
Change-Id: I4906734950411d8c47781851293407cfbbe786a0
2023-06-25 01:27:12 +02:00
Sebastiano Barezzi
f8432bd7e5 fixup! techpack: audio: Import modified Xiaomi changes
Change-Id: I42d695f0b8df36de301c0ace6cd430e470e87af5
2023-06-25 01:26:23 +02:00
Soumya Managoli
873bce734f 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>
2023-06-06 17:43:24 +03:00
Tan Nayir
1d2326b3a1 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
2023-05-20 17:47:47 +03:00
LuK1337
d54aefd880 techpack: audio: Make all sdm845auto drivers built in
Change-Id: I6e63a2de8caae25f298aa868d2b8b4367603bb23
2023-01-09 18:44:13 +02:00
Thierry Strudel
076fd255de 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>
2023-01-09 18:44:13 +02:00
LuK1337
fe340e18cc Revert "techpack: audio: Construct and add audio techpack Kconfig to build"
This reverts commit f93ab4827b.

Change-Id: I1b0e294bdcd0cc0fbdadb6746edb78c515dd3a88
2023-01-09 18:44:13 +02:00
Ivan Vecera
be6ca5c2b9 techpack: audio: Import modified Xiaomi changes
Import changes from Xiaomi + modifications from [1] (commit f35d72f92f175)

[1] https://github.com/xiaomi-sdm710-devs/android_kernel_xiaomi_sdm710/tree/techpack-audio

Change-Id: Idd2e228d9e67b247870cfb5d240added0ef4d79e
2022-12-23 14:26:49 +01:00
Ivan Vecera
00620b292b techpack/audio/asoc: fix initialization of updt_params
updt_params is an array of uint32_t with MAX_ENABLE_CMD_SIZE elements.
Fix 2 memset that initialize only first quarter of the array.

Signed-off-by: Ivan Vecera <ivan@cera.cz>
Change-Id: I2649109c8c889f7a8a9ceca05d135e8d84cf76ff
2022-12-23 14:23:44 +01:00
Soumya Managoli
d7389a2c97 ASoC: sdm660_cdc: Update mbhc reg struct for IN2P_CLAMP_STATE
Since entry for "WCD_MBHC_IN2P_CLAMP_STATE" is missing
in mbhc reg struct of sdm660_cdc, mbhc reg indexing
is going wrong. Update this missing entry to align
with the mbhc driver reg function indexing.

Change-Id: I4e3daa9c0f3efe9523fd0d4d3ab7cd04815dc30d
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2022-12-23 14:23:44 +01:00
Yaroslav Furman
4cbca54517 techpack: audio: pinctrl-lpi: initialise at late_initcall
Fixes booting with techpack online and modules disabled.
Without this it spits out a nasty NULL pointer dereference.

Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Change-Id: Ib51f186ccff1c7f7c7aed27d4ef8319561b3dba4
2022-12-23 14:23:44 +01:00
Sujin Panicker
8c27058e48 asoc: sdm660_cdc: Set speaker amplifier enable bit
During playback on speaker mute is observed if spk
amplifier is not enabled.
Enable speaker amplifier when SPK PA is enabled

CRs-Fixed: 2374703
Change-Id: Ib4d65bc5cc82ba54aae35a6a8000596be3c1aff7
Signed-off-by: Sujin Panicker <spanic@codeaurora.org>
2022-12-23 14:23:44 +01:00
Josh Kirsch
0e64ea800f audio-kernel: asoc: Remove extra const def
Remove extra const definition. Causing compilation
error on ARM compiler.

Change-Id: I56961168c8a4fc1248d5d43661159b9cf1ff2d98
Signed-off-by: Josh Kirsch <jkirsch@codeaurora.org>
2022-12-23 14:23:44 +01:00
Soumya Managoli
207975a0ce ASoC: sdm660_cdc: Fix for low spkr volume post SSR
Modify lineout PA teardown sequence to reset RX_LO_EN_CTL
register as per HW sequence.
Change based on commit: 7ccfaadc92d

Change-Id: Idab557947a43ab7d66ff8d83ac1ffeee9b2031ec
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2022-12-23 14:23:43 +01:00
Vatsal Bucha
7b6265bacc ASoC: sdm660_cdc: Fix pop after PDR on SDM670 internal codec
Pop is heard after PDR is triggered. This is
resolved by delay sequence change for PA disable
and boost discharge.

CRs-Fixed: 2234580
Change-Id: I3b6f2ae00f5396358c2c166c3b84bd162290c716
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2022-12-23 14:23:43 +01:00
Aditya Bavanari
d61626934b asoc: codecs: msm_sdw: Fix serv_reg ack timeout in PDR
Excessive error logging makes the service registration
ack of audio notifier callback timeout. Make the
sound card status offline as soon as the
Audio PD down notification comes in soundwire
audio notifier callback function to fix this.

CRs-Fixed: 2202427
Change-Id: Iea06977bcd0a9d2562b8089ee8549cd7fb4018a3
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2022-12-23 14:23:43 +01:00
Aditya Bavanari
d569c356af asoc: codecs: Fix LPASS register access during bootup
In analog codec and soundwire codec probe functions,
ADSP Audio PD up status is not checked which leads
to LPASS registers access during bootup
even before ADSP is ready.
Check for ADSP ready state in the respective
probe functions to fix this.

CRs-Fixed: 2202958
Change-Id: I8e05d30ef55cde58e8002d1040b3701280b91861
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2022-12-23 14:23:43 +01:00
Tanya Dixit
dcbe77e2b5 asoc: codecs: Set DAC_RESET bit to normal at DAPM UP
Speaker DAC is not set to the proper state due to
race condition after SSR. Set it to proper state
during widget power up.

Change-Id: I38f05e00fc493dab10712375e920aee8c3bdca0d
Signed-off-by: Tanya Dixit <tdixit@codeaurora.org>
2022-12-23 14:23:43 +01:00
Ramprasad Katkam
fea3164a18 ASoC: sdm660_cdc: Fix HPH PA mute during ssr
Add 2ms delay before power up to avoid PA wrong
state issues seen during ssr because of rapid
power down and power up.

Change-Id: Icc140ec5eb11cdbc1aaccdba170d75916ea70bf1
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
2022-12-23 14:23:43 +01:00
Laxminath Kasam
181105ae35 ASoC: sdm660_cdc: Fix ear_pa_gain control
In analog codec, EAR PA gain control get
function is updated with input value again
resulting in override. Remove the override
of control value again.

CRs-Fixed: 2161617
Change-Id: I7ddd252adf53666a6c9adc1bc92e840067fa932c
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2022-12-23 14:23:43 +01:00
Michael Bestas
86a1457cf2 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
2022-03-31 20:20:56 +03:00
Michael Bestas
63c8a0b915 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
2021-04-20 02:23:36 +03:00
David Lin
81a0bad831 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>
2021-03-31 23:58:20 +03:00
David Lin
c51fc468a0 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>
2021-03-31 23:58:19 +03:00
David Lin
719a946b5e 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>
2021-03-31 23:58:19 +03:00
David Lin
8f06f305ce 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>
2021-03-31 23:58:14 +03:00
shagbag913
8c99743127 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
2021-01-17 05:14:18 +02:00
Michael Bestas
1f33cf6e7f 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
2021-01-17 04:20:05 +02:00
Angelo G. Del Regno
f93ab4827b 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
2020-06-30 02:48:34 +03:00
Luca Stefani
0887e7b9ee techpack: Hardcode modules list
Change-Id: Ieb7c1476d4d56553692e7286f2540135b306b42c
2020-06-30 02:45:04 +03:00
Luca Stefani
b6d8eecc06 techpack: Remove .gitignore
Change-Id: Ia13c96b2d902f2fd2880b1b50f90f1475932510e
2020-06-30 02:45:04 +03:00
Michael Bestas
faf58f3284 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
2020-06-30 02:08:21 +03:00
Bruno Martins
bf2a78dd67 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
2020-02-09 07:57:57 +00:00
Neeraj Upadhyay
8cd4682934 techpack: Gitignore all subdirs except stub
Gitignore all subdirs except stub under techpack.

Change-Id: Ic3e8910865aec83424b989286cc461f757d8522d
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2017-12-04 17:12:35 +05:30
Bryan Huntsman
5df1dce16d techpack: add tech package support
Enable tech packages to have kernel drivers that are physically
located in the kernel source tree but not present in the kernel
repository. This is done via a manifest line item to fetch a
techpackage-module into $KERNEL/techpack/$techpackage-module.
$KERNEL/techpack/Kbuild will automatically detect any
subdirectories and link them to the kernel's kbuild system.

The resulting layout of techpack within kernel source would be as
follows :-

    kernel/
    ├── techpack/
        ├── Kbuild
        └── stub
        │    ├── Makefile
        │    ├── include
        │    │   └── uapi
        │    │       └── Kbuild
             └── stub.c
        ├── techpackage-module
            ├── Makefile
            ├── include
            │   └── uapi
            │       ├── Kbuild


$KERNEL/techpack only contains Kbuild (no Makefile) at the
toplevel and this Kbuild takes care of both compiling the
subdirectories and of exporting the needed header files therein.
The reason for having only Kbuild at the top is that Kbuild
and Makefile cannot exist together in same directory and Makefile
doesn't cater to uapi header installation.

stub is an empty techpackage-module which serves both as a sample
layout and satisfies the requirement of kernel build system, by
providing necessary buit-in.o, when no other techpackage-module has
been pulled under techpack/.

$KERNEL/techpack/techpackage-module should have a Makefile at the
top and Kbuild under $KERNEL/techpack/techpackage-module/include/uapi
directory. The uapi headers pertaining to a techpackage-module
should reside under $KERNEL/techpack/techpackage-module/include/uapi
and associated Kbuild should have necessary rules to export it.

Change-Id: I0d0ced38566907d2074831edde0934833f666eff
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
Signed-off-by: Imran Khan <kimran@codeaurora.org>
2017-07-26 16:31:52 +05:30