Commit Graph

138 Commits

Author SHA1 Message Date
Viswanath L
fa52637ec3 tegra-alt:adsp: NULL check for app variable
ADSP app variables are not initialized in all cases (like at APM
output pin) causing NULL pointer access to app->override_freq_work

NULL check fixes this; override_freq_work will get called at widget
ON event

Bug 200245012

Change-Id: Ie6161c0247d8b15db88bdef706ab6c3b472fa977
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1244336
(cherry picked from commit 6f6c38a0413b20111ff95d3e0d26c631f0a7a639)
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1252706
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
445605513d tegra-alt: adsp: avoid sleep in send msg
Do not use blocking flag for mailbox send function.
Use mdelay instead of msleep

Bug 200222934

Change-Id: I9c121f50debb46b191ad735f7445bbe5c026e30a
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1217913
(cherry picked from commit 7cd8a2d558c7d59b020c39f6177b263242c1641a)
Reviewed-on: http://git-master/r/1252705
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
77c3fa9449 tegra-alt: adsp: schedule work for freq override
Schedule worker function for frequency override to avoid
adsp_override_freq() and clk_set_rate() getting called
from atomic context.

Bug 200222934

Change-Id: Ia65ce4a617bfd4494d04bdfac8b28e6d8260943c
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1211239
(cherry picked from commit 008fa5cd7722e3cdcb4ec96b13a73fda7e6bc2ad)
Reviewed-on: http://git-master/r/1252704
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Viswanath L
efd1112f5c tegra: adsp: Max ADSP clock at APM active
Spike ADSP freq. to max when app transitions to active so that ADSP
does not starve

Bug 200196267

Change-Id: I11863b2449cfecc47aefd9bc41059b634b3b2acd
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1154410
(cherry picked from commit 9e6163d9c1f2f07c9b4510d609aa974a75da96c7)
Reviewed-on: http://git-master/r/1236637
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Uday Gupta
a304847e65 tegra-alt: adsp: Pass ADMA CH page to ADSP
ADSP NVADMA driver needs to program different ADMA channel
page based on which guest ADSP is assigned to in case of
virtualization

Jira EMA-358

Change-Id: I601965d255ef3ced6c5d8873a21890910689ab9a
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: http://git-master/r/1251785
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
sdash
08899c1d36 adsp_alt audio: Add checks for Plugin connections
Added checks whether plugins within and across APM are
connected or not,before sending any control message to adsp
for that plugin.

Bug 1797920

Change-Id: I880d129bac1ec4a885bb60ef6e5eb3d0bb1c8afb
Signed-off-by: sdash <sdash@nvidia.com>
Reviewed-on: http://git-master/r/1203078
(cherry picked from commit 05b04db52c0d35b78291dad8ce107481a78a3aef)
Reviewed-on: http://git-master/r/1216725
(cherry picked from commit 115d61defe5967c6eb66ae0ddcaf92ab705d8d6a)
Reviewed-on: http://git-master/r/1249615
GVS: Gerrit_Virtual_Submit
Tested-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Uday Gupta
995c9c85a2 tegra-virt-alt: Add adsp virtualization support
Implemented tegra-alt adsp driver to be used as
common adsp driver for both native and hypervisor
mode.
Added ADSP DAI links in tegra virt alt machine
driver
ADMA Channel 16 onwards to be used for ADSP in
case of hypervisor mode
Added support for sending IVC messages from
tegra-virt-alt adsp driver for admaif cif settings,
and start/stop of playback/capture
Disabled the registration of AMC error interrupt
in case of hypervisor mode

Jira EMA-27
Jira EMA-29
Bug 200172732
Bug 200221932

Change-Id: I9973bd9fcc358786f4d3e9c7eae49def63747e16
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Signed-off-by: Sidharth <svarier@nvidia.com>
Reviewed-on: http://git-master/r/1159268
(cherry picked from commit 49072c9ec35e5b65f41abc8900c402794982a0c8)
Reviewed-on: http://git-master/r/1243043
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
404df98a3c tegra-alt: adsp: Add S32_LE playback/capture support
Currently adsp pcm device allows only S16_LE. For rest of format
it throws not supported error. Change will allow playback and
capture for S8/S24/S32 formats also.
However machine driver should make sure same format info is
configured for ADSP-ADMAIFx and ADMAIFx dai-links.

Bug 1756112

Change-Id: Iac76d022adc57ea88e6208a66086fdb29bff8c66
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1156127
(cherry picked from commit 39bc390bce81ea8538b3bca0116e3e7c4fa2745e)
Reviewed-on: http://git-master/r/1238420
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
4a5d4c683c ASoC: tegra-alt: Separate out adma as rx and tx
As adma plugin allocates static ARAM memory, having single plugin for both
rx and tx will be waste of ARAM memory, as MEM to AHUB don't need to allocate
memory during plugin loading.

Bug 200220099

Change-Id: I5d713ebd5718e751d341d8d64889a36327277b1c
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1184236
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shashank Verma <shashankv@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Gaurav Singh
368b5bcd4c Fix kernel warnings
These warnings do not cause any issue.
Making them as dev_info.

Bug 1774835

Change-Id: I04357d9465d0113d262f9d1034233ce59b82ee2a
Signed-off-by: Gaurav Singh <gaursingh@nvidia.com>
Reviewed-on: http://git-master/r/1201945
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
62fba33a1a ASoC: tegra-alt: fix the component probe
The component probe callback needs to be called for K4.4
inorder to assign the component read and write callback
functions implemented in the adsp driver.

Bug 200224813

Change-Id: I63874543411f5ffa10db99a94fb63e0dbb91a925
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1196926
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Tested-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2022-09-29 15:30:21 +05:30
Vandana Salve
abd65aedf7 tegra-alt: adsp: fix coverity issue
Fix coverity defects, Resource leak
Coverity id 33603

Bug 1781383

Change-Id: If03f2854ae58d3a2218d6df392d12a11d1c510dc
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/1173653
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
0ec788ec71 tegra-alt: adsp: disable remove() callback
The adsp audio driver is not hot-pluggable at the moment.
It might cause issues if the driver has to be loaded or
unloaded. The remove() callback is disabled until we have
proper support for hot-plug.

Bug 1779074

Change-Id: I530d50bc1cad3917c712a4322f27256166422bd5
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: http://git-master/r/1168492
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
f05cbe122b tegra-alt: adsp: supress bind/unbind attributes
Driver binding/unbinding is causing crash on the driver. The bind/unbind
options are supressed from the driver until there is plan to support this,
since it requires to take care of lot of other dependencies.

Bug 1779074

Change-Id: I61b41d425dac21b1bae1a21d36d0ca22dd4c7c20
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: http://git-master/r/1166724
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
fcd36dccf3 tegra-alt: adsp: increase space for widget name
Memory for widget names is allocated statically by default widget
name "PLUGINx". If a plugin has longer widget name, then it will
corrupt the widget name memory and tegra210_adsp_routes. This
creates issue in DAPM and playback fails.

Use long name as default plugin name: PLUGINx-PLACE-HOLDER to have
bigger memory. Also add a length check on plugin's widget name.

Bug 200207626

Change-Id: I2442b07492a795ed120766eaee3a0083f80f6cf3
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1164763
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
c279bec375 tegra-alt: adsp: clk to adsp_audio
Currently adsp_audio rely on xbar device to keep clock enable.
For some of corner cases it is observed that xbar devices gets to
suspend state leading to disabling of ahub clock, however nvadma
still trying to program adma. This leads to adsp crash.

This change adds support for adsp_audio to enable and disable
clocks as per its runtime_resume and runtime_suspend calls.

Bug 1756112

Change-Id: I5697853d901eed1059bd1ce29099a74cf62d46a3
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1149568
(cherry picked from commit 17d84bd026751e1bc380d69bd89c4a034d9398fc)
Reviewed-on: http://git-master/r/1155917
(cherry picked from commit 0ef2ab54b1da6a9573c863ac8e60e7192ae3b2d6)
Reviewed-on: http://git-master/r/1163157
GVS: Gerrit_Virtual_Submit
Tested-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Ravindra Lokhande
962185df88 ASoC: tegra-alt: changes for kernel-4.4 transition
This commit has changes needed for audio on kernel 4.4
- select SND_DYNAMIC_MINORS for tegra-alt
- use snd_soc_new_compress callback function in snd_soc_dai_driver
  instead of setting compress_dai = 1
- use snd_soc_dapm_to_codec() to access codec from widget

Bug 200193757

Change-Id: I1744ca93786086691cb6eabdde33125a995de9e7
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/1158639
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2022-09-29 15:30:21 +05:30
Gaurav Tendolkar
ff10659ee8 tegra-alt: adsp: change local function to static
Fixed following sparse warning by making local
function static:
$TOP/kernel-3.18/sound/soc/tegra-alt/tegra210_adsp_alt.c:2846:5:
warning: symbol 'tegra210_adsp_tlv_callback' was not declared.
Should it be static?

Bug 200088648

Change-Id: Ia4d78e297da3aa3bd9fe9effd64ddec30c2b67fc
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: http://git-master/r/1131635
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
f230f18f24 Revert "Revert "tegra-alt: adsp: add support for 4kb read/write""
This reverts commit f75f4be594f2182d6c422d94fd11f88211b58ed0.

Original change was reverted because dependency was not
integrated from main to dev-kernel and original change
was causing GVS failures. Now putting it back.

Bug 1723185

Change-Id: Ifffcfb019237b448ba6ccd9bcae0423d36eb788e
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1127945
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
6477cf9ec9 Revert "tegra-alt: adsp: add support for 4kb read/write"
This reverts commit 7a72df25d0004716e03d8b062906d132baa265dd.

Change-Id: I941acae01ae163863c15d756c003cb0979c06d54
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1127324
Reviewed-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
Tested-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
72cf476367 tegra-alt: adsp: fix adsp mux texts
This corrects the ordering in tegra210_adsp_mux_texts for
ADSP-EAVB widget. Also remove unnecessary comments which were
incorrect.

Bug 200189793

Change-Id: Ie32aef90ca0b1fd688ca5888a3947f7b2ab37f6a
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1125908
Reviewed-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
Tested-by: Ishwarya Balaji Gururajan <igururajan@nvidia.com>
2022-09-29 15:30:21 +05:30
Gaurav Tendolkar
df8a0d1503 tegra-alt: adsp: add support for 4kb read/write
- added support for reading upto 4k bytes from APM
- increased write suppport to 4k bytes

Bug 1723185

Change-Id: I154bb6f699ce4eb441a0e5e0374770d40e7b631f
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: http://git-master/r/1019963
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
07fa34730b sound: soc: tegra-alt: Fix Out-of-bounds read
It fixes Coverity defect of logically Out-of-bounds
read.
Coverity ID: 20425

Bug 200116059

Change-Id: I77c0c90f23beb7bf8938fc9ab3701d1ad8065267
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1115850
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Gaurav Tendolkar
1c5a5afe43 tegra-alt: adsp: request correct adma isomg bw
ALSA does not know pcm stream rate, format etc in
pcm_open call. Hence wrong bw was getting set.
Moved set_bw call to pcm_prepare

Bug 200187675

Change-Id: I715c9e035d0212251c7f7a867abd93f8ac728d8d
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: http://git-master/r/1119585
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
5766c8f102 tegra-alt: adsp: update adsp pointer in apm_out
Bug 200164448
Bug 200149702

Change-Id: I7352de827cd9fcae90931816bcaa0b3f2c23ee5f
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1118335
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Tested-by: Dara Ramesh <dramesh@nvidia.com>
2022-09-29 15:30:21 +05:30
Nitin Kumbhar
2d905f4eb5 ASoC: tegra-alt: use generic tegra pd api
Instead of ape specific power domain apis use generic tegra
power domain APIs to add/remove devices to/from ape power domain
mentioned in DT. These apis internally set up tegra pd ops.

Bug 200178663

Change-Id: Ifd7c73a44d0d7b729f593e6e3047b56b7f773be4
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/1028814
2022-09-29 15:30:21 +05:30
Viraj Karandikar
b302d0a2a0 tegra-alt: adsp: request ACK when closing PCM stream
Request ACK and wait when closing PCM stream.

Bug 200100724

Change-Id: I1a12a3a8efff0e25152c148e4b74b163f0b4f63d
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/834456
(cherry picked from commit 21b996e65952154add4238e87c690a7e086c89c5)
Reviewed-on: http://git-master/r/840362
Reviewed-on: http://git-master/r/921976
(cherry picked from commit 58c0b15e4912538f6da2e7437a6f111f9b47a07a)
Reviewed-on: http://git-master/r/1000803
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Sumit Singh
bf77cfbf26 ALSA: HDA: Replace CONFIG_PM_RUNTIME with CONFIG_PM
After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
depending on CONFIG_PM_RUNTIME may now be changed to depend on
CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under
sound/.

JIRA TPM-704

Change-Id: I5807fa8d35b3fbbd1afdb69d2dbba760abb80e27
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
f5e1951ebe tegra-alt: adsp: messaging fixes
Request acknowledge for params sent via mixer controls. This
ensures parameter messages are processed before suspend.
Use a default message handler to flag completion event when APM
is used in cases other than offload and PCM streams.

Send all messages (connect, io buffer etc.) immediately.

If message queue is full, then trigger APM via maibox interrupt,
wait and attempt to queue again.

Fix check for wait timeout.

Print error if message queues are not empty when suspending.

Bug 200149702

Change-Id: Iddb1d8d62c659949294cfe258f88bad22e28cc92
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1112097
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Viswanath L
93b24a451e tegra-alt:adsp: Allow "Min ADSP Clock" ctl always
"Min ADSP Clock" for the APM is set at the widget ON event, which
sometimes occurs immediately on closing the APM connections (like for
SPKPROT); allowing "Min ADSP Clock" setting only if APM is initialized
causes this to be missed at times

Allowing to set "Min ADSP Clock" before APM is initialized will ensure
that it's always available at the subsequent widget event

Bug 200170455

Change-Id: I5500484f42a23abb290431a8e329e57e741a0e14
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1027039
(cherry picked from commit a3ceb08c60ecb398a192dc607c1587b797ca79b7)
Reviewed-on: http://git-master/r/1029374
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
6c30a39444 tegra-alt: adsp: add APM input mode control
APM input mode can be set to PUSH or PULL.
In PUSH mode, APM blocks if there is no input available. Usually
a continuous mode ADMA sends interrupt when input data is available.
In PULL mode, APM blocks only if there is no input available and
a input fetch request is pending. Usually a one shot mode ADMA
fetches input data when required and signals event to wake up APM.

Control "APMx Input Mode" is provided to set input mode.
Default mode remains PUSH.

Bug 200150727

Change-Id: I10efd78ab593beb2e8a4b999dfa088e48f1e965b
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1017553
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Ajay Nandakumar
a15d51b4ab sound: tegra-alt: Route interrupts from DT
Routing ADMA interrupts to ADSP or HOST from Device tree. This reduces
adding un-necessary code for routing interrupts using
tegra_agic_route_interrupt for statically routing.

Bug 200152320

Change-Id: I15df7a9c65f1ec0322122bb7301900217b8d36d2
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/1000827
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
2f07906bd0 ASoC: tegra-alt: Support adma iso client
Support adma as a part iso client to calculate the adma bandwidth based
on the usecase on both cpu and adsp side. This will help the iso manager
to alter the emc frequency.

Bug 1675078

Change-Id: I301aa710929665ea56f8183de8d22851913afa9c
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/924061
Reviewed-by: Ayoosh Bansal <ayooshb@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Uday Gupta
287853b54f tegra-alt: adsp: Add eavb dma source codec
Add eavb dma plugin interface params
Call eavb dma plugin init when path is complete
Add ADSP-EAVB widget and dai-links

Bug 1704053

Change-Id: Iaf817f3fcabc349bbcad7d71d3f0c00fabe12c2a
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Signed-off-by: Arun Mankuzhi <amankuzhi@nvidia.com>
Reviewed-on: http://git-master/r/840906
Reviewed-by: Nitin Pai <npai@nvidia.com>
Tested-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
ea7da663e0 ASoC: tegra-alt: add adsp admaif dai
Change adds dais for adsp-admaif dai
links.

Bug 200130700

Change-Id: I9d7ca54b760e77295d6a898ead01bb1033b0dce9
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/934517
Reviewed-by: Nitin Pai <npai@nvidia.com>
Tested-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
46bfef7068 tegra-alt: adsp: add ADMA plugin param controls
Add controls for sending parameters to ADMA plugin

Bug 200100724
Bug 200150727

Change-Id: I2d8c0dcebf679886d966fc45e96035f963740e10
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/925794
(cherry picked from commit d3b6b4071619d8745ff62b2249a3653e83bf26d4)
Reviewed-on: http://git-master/r/928686
(cherry picked from commit 5c3833b564d826dabaacf527d49a5a21e7fafc23)
Reviewed-on: http://git-master/r/928998
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
56e4b6edb2 ASoC: tegra-alt: fix the error check
Fix the error check in function tegra210_adsp_app_init(), as return value
is from ERR_PTR this needs to be checked with IS_ERR macro.

Bug 200154983

Change-Id: I951cccf6a65bdfd829da1bd79e2622a40ecf30cd
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: http://git-master/r/926309
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
700c482239 tegra-alt: adsp: wait for adsp ack on reset
Add mechanism to wait for ADSP acknowledgement.

ACK is requested when resetting to ensure that ADSP is
suspended only after APM stop processing is complete.
This prevents case of ADMA not getting stopped/reset
before suspend.

Bug 200130757

Change-Id: Ia86a31c996d40192210837e61aa95d8f920ee7f5
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/772220
(cherry picked from commit 72a04194685b299a959ecf64b92ba7f160e197f0)
Reviewed-on: http://git-master/r/795560
(cherry picked from commit 6a4a2211bfd1561d96ace832e1b45bee23d9ef3d)
Reviewed-on: http://git-master/r/799367
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
22733ae2b1 tegra-alt: adsp: use nvadsp_mbox_send() for mailbox send
Use nvadsp_mbox_send() to send mailbox message. This allows
blocking functionality with time out when sending messages.

Add runtime PM get/put when sending APM messages from widget
events as it was seen that this function is called even when
runtime resume had failed in one of the error cases.

Bug 200123443

Change-Id: I29e0860eadc73af2f32af58c1ca614806741709b
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/779898
(cherry picked from commit 7cb1c2b7b51010ab97e4125825f4658b32479487)
Reviewed-on: http://git-master/r/785351
(cherry picked from commit a150b9f3fc50ed1f6c0df71cad02a8a24b1a866f)
Reviewed-on: http://git-master/r/791628
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
1d0e9b5b6b tegra-alt: adsp: add runtime get failure checks
Add pm_runtime_get* failure checks. This also captures any
failures in starting ADSPOS.

Remove redundant pm_runtime_* calls from DAPM widget events.
These are not needed as driver's runtime resume and suspend
functions are called before starting and after stoppping the
playback.

Bug 200123443

Change-Id: I2c1f8fcff892634d4129e6cb08d6e21a7d63fdcd
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/746123
(cherry picked from commit 093dc626c51467f3f85d10c3deb97df861ff85dc)
Reviewed-on: http://git-master/r/784832
(cherry picked from commit c5a457bce02fd9bcc5c9e7e89fe4baee7189a075)
Reviewed-on: http://git-master/r/791043
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
1b05a7ad2c tegra-alt: adsp: reset handler on close
Set message handler to NULL on stream close.
Acquire lock when calling msg handler to avoid
race condition.

Bug 200121246

Change-Id: Ia1182a787f00c2ee9b092a9822a6d5c8404e3b12
Reviewed-on: http://git-master/r/768309
(cherry picked from commit 116260c46c2c0aa077bf2ca57ea2227a56ebd718)
Reviewed-on: http://git-master/r/770473
(cherry picked from commit 2100a3c5f70877dd566c201ffd6c4d033ed819e1)
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/781737
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Viraj Karandikar
47cc203e9c tegra-alt: adsp: add control to set min ADSP clock
Certain cases like speaker protection which involve
real-time input require sudden increase in ADSP load.
ADSP DFS fails to cater such sudden increase in load
without compromising power.

Per APM control is added to set min ADSP clock when
APM is running. Min clock is restored when APM stops.

Bug 200126105
Bug 200126363

Change-Id: Icff8cee0b464f9621db0f8ba506d2e3ba307c683
(cherry picked from commit cb5c4c718ea2e8a26126cf70da2c44e26673d531)
Reviewed-on: http://git-master/r/779169
(cherry picked from commit 07e0d3265656ec0a263d9b55e2c9c51d72dc8d17)
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/781741
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Ravindra Lokhande
756058e785 ASoC: tegra-alt: use #ifdef for suspend/resume function
suspend/resume function is used when CONFIG_PM_RUNTIME is defined, if
this is not defined then compiler errors about unused-function.
put suspend/resume function under #ifdef CONFIG_PM_RUNTIME.

Change-Id: Ibad9d7a0528ed5be536e987075cbc26a71487d56
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/766222
Reviewed-on: http://git-master/r/769291
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Tested-by: Sumit Bhattacharya <sumitb@nvidia.com>
2022-09-29 15:30:21 +05:30
Nitin Kumbhar
e493cee37f platform: ape: add tegra_pd_ops for power domains
Add tegra_pd_ops for ape and adsp power domains so
that driver's *runtime_suspend() and *runtime_resume()
routines are called as part of stop_dev() and
start_dev() and not at the last when power domain is
being powered off.

Remove power down delay for APE power domain.

Bug 200090996

Change-Id: Ie7d69964d647b0392728b9f5b147818f4a525928
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/735632
(cherry picked from commit 37ca24d340ddf0b70b406d04bf98ee686ad280a7)
Reviewed-on: http://git-master/r/752259
(cherry picked from commit 0ca955773e6cbd942c2de6f8ed28673ef34b5bbf)
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/766594
2022-09-29 15:30:21 +05:30
Nitin Kumbhar
953c677578 platform: ape: add adsp sub-domain
Add adsp sub-domain for nvadsp and adsp_audio drivers. This
ensures that adsp can be handled differently compared to ape.

Bug 200090996

Change-Id: Ic7222606db977c46120370ea98f665fd2ba58ecf
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/735615
(cherry picked from commit 8b5ce0eb1f754373f848892a5c23c82269e18a19)
Reviewed-on: http://git-master/r/741162
(cherry picked from commit 195dd00c017abaaa3eecc744f927ac4f9bbac1f9)
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/766593
2022-09-29 15:30:21 +05:30
Viraj Karandikar
df11e734e5 tegra-alt: adsp: free compress buffer on stream close
Free of compress stream buffer.
Fix freeing of PCM capture buffer.

Bug 200056741

Change-Id: Ia64ba3206563f0d22f30bca1bab9349a7a5ca0dd
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/748714
(cherry picked from commit 9cc04c256d3e8b56f4264d5f246d773a3192a1ca)
Reviewed-on: http://git-master/r/751863
2022-09-29 15:30:21 +05:30
Viraj Karandikar
c7fd07080a tegra-alt: adsp: remove broken app deinit code
Existing app deinit code is setting info and other pointers
to NULL, but not calling nvadsp_app_deinit() to close instance
on ADSP. Due to this multiple instances app get created on ADSP
and causing memory leaks.

Current usecases use static paths so app_deinit functionality
is not needed and adds overhead of freeing and allocating apps
everytime. So making tegra210_adsp_app_deinit() a empty function
for now. Proper app deinit functionality will be added in future
if needed.

Bug 200106688

Change-Id: I2b57efa6fa57253ee249c3dc3c43b5843109e2ae
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/744945
(cherry picked from commit ad17bed71e23a978202de7f7a695a4c4cede5dc7)
Reviewed-on: http://git-master/r/747320
2022-09-29 15:30:21 +05:30
Viraj Karandikar
1a83c79388 tegra-alt: adsp: get/put from compress open/free
During device switch, runtime count becomes zero and
runtime_suspend gets called which suspends ADSP OS.
ADSP OS is resume immediately when resuming playback
on new device. ADSP OS suspend/resume can happen while
ADMA is running, which disturbs SW/HW sync causing
noisy output.

Prevent ADSP OS suspend as long as compress stream
is open by acquiring a runtime get() from stream open
and releasing it in stream free.

Bug 200100093

Change-Id: Id0da81c16efa3682131e98f6132aa02c8e7cfcab
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/742105
(cherry picked from commit 6f11140bb41166a9797b2d7fe3bfb1610b55b513)
Reviewed-on: http://git-master/r/747319
2022-09-29 15:30:21 +05:30
Gaurav Tendolkar
3afd0a2243 ASoC: tegra-alt: Create p2382ref machine driver
- Added machine driver for board p2382ref
- Removed board specific checks from machine driver

Bug 200113249

Change-Id: I03eced9f30b5a642b71cb8d6a0e4d332cb005f64
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: http://git-master/r/763461
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
2022-09-29 15:30:21 +05:30
Uday Gupta
4aff5a0e14 tegra-alt: adsp: fix crash in apm_get/apm_put
Change merged from Kernel 3.10 is not
compatible with Kernel 3.18.

Make changes as per kernel 3.18 to fix the
crash.

Bug 1653770

Change-Id: I8b9e416f9dd4a905a465f6bd06732a2ec782995a
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: http://git-master/r/755197
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Tested-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
2022-09-29 15:30:21 +05:30