Commit Graph

445 Commits

Author SHA1 Message Date
Jonathan Hunter
cacbb942a8 ASoC: tegra-alt: Prepare for removal of rt565x_manage_codec_sysclk
The function rt565x_manage_codec_sysclk() only exists in the downstream
kernel and is only currently used for the audio supermodule. It is not
necessary to port this function to the upstream kernel because we can
simply implement the same functionality within the machine driver by
calling the snd_soc_dai_set_pll() and snd_soc_dai_set_sysclk() APIs.
Therefore, update the Tegra machine to avoid using the function
rt565x_manage_codec_sysclk() so we can remove from downstream.

Bug 1665446

Change-Id: Id7e941368740f28cb74e6a04556e7b00abae119d
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2073779
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
1785c1bee4 ASoC: tegra-alt: Trivial clean-up for tegra_alt_asoc_utils_init()
Trivial clean-up to the tegra_alt_asoc_utils_init() function to improve
readability and simplify by ...

1. Removing 'goto' statements because we only return the error code on
   error and there is no clean-up that needs to be done in the error
   path.
2. Move the code to request the clk_cdev1_rst reset from under the
   "data->soc > TEGRA_ASOC_UTILS_SOC_TEGRA210" check because we only
   use this reset for Tegra186 and there is an additional check for this
   device.

Bug 1665446

Change-Id: I23aa8978721f677204a929c8fdebea1f9081793f
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2016370
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
ce50d17412 ASoC: tegra-alt: Remove redundant clock utils function
The function tegra_alt_asoc_utils_set_parent() is only used by the Orca
Viper machine driver. Update the Orca Viper machine driver to use the
tegra_alt_asoc_utils_set_extern_parent() instead which also sets the
extern parent clock and remove the redundant
tegra_alt_asoc_utils_set_parent() function.

Please note that the Orca Viper platform is no longer supported and in
future will be removed.

Bug 1665446

Change-Id: I51ac355e92a1c3dbb65f94bff081edd1837f7bc6
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2016369
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
dba7c3da80 ASoC: tegra-alt: Remove unused variables
Remove unused variables for the various Tegra sound driver files. Note
that these variables are not flagged by the compiler because they are
initialised but they are not actually used anywhere.

Bug 1665446

Change-Id: Id10bb316780813565847492b19025ba369188c09
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2016368
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
84e75ee269 Revert "ASoC: Machine: ignore suspend for dai-links"
This reverts commit 1114afa7e3d861631d0585d76ca54363f46361c3
(manual revert done to resolve conflicts)

Earlier suspend was ignored for Android because of high suspend
latency in snd_soc_suspend(), this was breaking system suspend
KPIs. This alone was contributing to around 3 seconds of latency.
One more reason to ignore suspend was, during Android playback or
capture, device cannot go suspend because of acquired wake locks.

There was an issue in ASoC core which is fixed now in upstream,
which helps to reduce the suspend times. The same is available
in downstream kernel and below is the commit.
"ASoC: core: Don't schedule DAPM work if already in target state"

With this patch suspend/Resume latency for ASoC in 3 trials are
7.362/0.091, 5.445/0.088 and 5.096/0.087 ms respectively.

Bug 200390814

Change-Id: Iae3b4f19f34568585ed120460f173d4b234a3eb1
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1971226
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
503eb55823 adsp: fix tlv read write issues
Change fixes problems caused in tlv read and write
synchronization with other messages
- Add separate spinlock completions for tlv read
- Add separate spinlock completions for tlv write
- Add separate ack for raw (tlv) messages
- Print msgq indexes when queue or dequeue fails

Bug 2420196

Change-Id: I405e3a9939ec804dc65875d900ba635d2dc15ee3
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975072
(cherry picked from commit 1df184d908c84c8f4e15b48cdd9ada90da313169)
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1986443
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
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
4a6ee45df7 ASoC: tegra-alt: fix dynamic pinmux config
Currently dynamic pinmux configuration for I2S, DMIC, DSPK modules
are present in runtime_resume() function which can be called even
without any audio usecase active on these modules. So this destroy
the purpose of programming pinmux only during stream active state.

This change has moved the dynamic pinmux code in these drivers to
dai ops callback of startup and shutdown which will ensure the
pinmux config happens only during the stream playback/capture.

Bug 200497486

Change-Id: I3c4e8a96d0d066b38c9aba5ffe530db5cf5246fc
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2029745
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
9050c3e455 adsp: Make set_eos method generic
- Create generic nvfx_method_set_eos
- Required for plugin specific EOS handling

Bug 2402965

Change-Id: I4e52eca46769862e13ca947a27fcabccc3a1d70d
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1974986
(cherry picked from commit 9b48f057c2629bc000b745409551a80597aa4aab)
Reviewed-on: https://git-master.nvidia.com/r/2027461
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
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
9b9a66eba7 ASoC: tegra-alt: Remove I2S RX/TX controls
The I2S RX/TX mixer controls are replaced by I2S Playback/Capture,
removing the support of RX/TX as userspace support has deprecated the
usage of these controls.

Bug 2494697

Change-Id: I5ed36c1c00666381a534efc74c8d0a5f3bd5eada
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2024574
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
736ce72f4b ASoC: tegra-alt: Make ADSP parameter controls write-only
Currently, the ADSP is not booted or if the ADSP is booted but the
plugin is not connected for the ADSP APP, then it is not possible to
configure the various ADSP parameter mixer controls. This causes a lot
of messages to be displayed when the ALSA restore systemd service is
enabled because on boot it will try to restore all mixer controls.

The ADSP mixer controls for setting APP parameters are by default
read/write, however, the function to return the current APP parameters,
tegra210_adsp_get_param(), simply returns zeros and not the actual
parameters. Therefore, make these mixer controls write-only so that
the ALSA restore service will not attempt to save and restore them.

Bug 200458098

Change-Id: Ia61329c4dc338a1973e755ece23082bd2411f9be
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2019227
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
29bfa0b857 ASoC: tegra-alt: Don't display error if app not available
Rather than displaying an error message is an app cannot be loaded,
print a message to indicate that an app was loaded successfully. For
L4T applications such as MP3 decode are not available and this avoids
unnecessary error messages.

Bug 200458098

Change-Id: I2e3acbf2977797c79a0eabee6b7c8c49b33b0df1
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2007328
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
8054d6f242 ASoC: tegra-alt: Always allow ADSP APM controls to be set
Currently, the ADSP is not booted or if the ADSP is booted but the
plugin is not set for the ADSP APP, then it is not possible to
configure the various APM mixer controls. This causes a lot of
messages to be displayed when the ALSA restore systemd service is
enabled because on boot it will try to restore all mixer controls.

Rather than prevent the user from being able to set APM mixer
controls until the ADSP is booted and the plugin is set, always
store the APM settings. If the ADSP is booted or the plugin is not
set when the APM controls are set, then when the ADSP is booted and
the plugin is set, send the APM settings to the ADSP at this time.

Bug 200458098

Change-Id: I8899d876d1d10bd0e07e7c54d6674ca29aef0558
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1973345
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
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
9320c90d73 ASoC: tegra-alt: Boot the ADSP OS during probe
Currently the ADSP OS is booted only when the mixer control
'ADSP Init' is set, So ADSP OS won't be booted and during
alsa-restoring of service it lead to os not booted error
message.

So try booting the ADSP OS as soon as ADSP tegra-alt driver
is registered.

Bug 200458098

Change-Id: I3cd123bdb5d5f87ba8c9329d0e43241189ffdb66
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1935089
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
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
d9625a21e3 tegra-alt: Increase max period bytes
Max buffer bytes is increase through DT but
this does not get reflected in max period bytes.

Change max_period_bytes if max buffer bytes are updated by DT

Bug 2448519
Bug 200463529

Change-Id: I079615df7139228731b7a29461ae03407ecd19c0
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961715
(cherry picked from commit 21d9f725aef8d4405eaf24a7a52efa962be4e2e6)
Reviewed-on: https://git-master.nvidia.com/r/1963255
(cherry picked from commit db8f94ae8de2f6468d9066afa8d7cc5d864405d6)
Reviewed-on: https://git-master.nvidia.com/r/1996558
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Ketan Patil
ddbf36f10e nvidia: Clean up t210 MBIST WAR handling
On k4.4 and earlier, t210 MBIST workaround was handled with notifier
callbacks within the drivers. Remove all such calls to the functions
slcg_register_notifier and slcg_unregister_notifier.

Also remove the functions nvhost_pd_slcg_install_workaround and
nvhost_pd_slcg_remove_workaround which ultimately call the
slcg_register_notifier and slcg_unregister_notifier functions
respectively.

Bug 2485656

Change-Id: I6445e07e5d2a4aa6360fff0bbd32ceebbc0e62e4
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2003556
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
5936a0e40d ASoC: tegra-alt: Add new controls for I2S mono/stereo conversion
The names of the I2S mixer controls for mono/stereo conversion are
confusing from a user perspective because the controls 'I2Sx TX mono
to stereo conv' and 'I2Sx TX stereo to mono conv' are for capture and
the controls 'I2Sx RX mono to stereo conv', 'I2Sx RX stereo to mono
conv' and 'I2Sx Rx fifo threshold' are for playback. The naming
convention  for these controls comes from the XBAR CIF and makes sense
from that standpoint. However, from a user and userspace perspective
the names are confusing and misleading. Therefore, add new controls
that are explicitly named "Capture" and "Playback" so it is clear
which should be used.

The legacy controls will be kept for Android until the appropriate
userspace changes have been made so that these can be removed
completely.

Bug 200469957

Change-Id: I93ae9339128a056e2144ba751a86f9df21b3dfda
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
(cherry picked from commit 843dfa3a418d336bca49144e065556dce8d0cd4e)
Reviewed-on: https://git-master.nvidia.com/r/2002204
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
c935ff0f9b ASoC: tegra-alt: Fix I2S slot mask
When the number of channels for an I2S interface is overridden from
userspace, if the I2S interface is being used in TDM mode where there
are more than 2 channels, the I2S SLOT_CTRL register may not be
configured correctly.

For example, if using the AMX to the multiplex 4 mono channels into
a single 4 channel TDM stream that is then routed to an I2S interface,
the number of channels seen by the I2S interface is 4 where as each
input stream to the AMX only has a single channel. Therefore, the
number of channels for the I2S interface needs to be manually set to
4 from userspace. However, when this is done the I2S SLOT_CTRL
register is still configured with the default RX and TX slot mask.
To fix this, if the number of channels for the I2S interface is
overridden from userspace, then if using TDM modes, also override
the RX and TX slot mask.

Bug 2382530

Change-Id: I2df564c8e8ad5d7463a767a1e2197e26fe0c57e5
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2000401
(cherry picked from commit b888cf568c726fed1e97882b9fe8deae4d6df6d9)
Reviewed-on: https://git-master.nvidia.com/r/2002199
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
4924fdfe32 ASoC: tegra: remove suport for older kernels
Support for kernel versions < kernel-4.9 is discontinued on stage-main.
Thus linux version checks have to be reviewed and removed. Any code under
LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) can simply be removed.

This patch removes version checks and older code.

Change-Id: I2df56fb9cc313a6f4328c5ec19fcab8457c65972
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1998289
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
71e47ae39e ASoC: tegra-alt: Add support for FE-PI audio Z V2 board
Add support for the FE-PI audio Z V2 board which includes the NXP
SGTL5000 audio codec. The FE-PI audio Z V2 board is an audio hat
for Raspberry-PI and is compatible with the Jetson 40-pin header.

Bug 1654376

Change-Id: I7b16b38acb91ac18c00cabc98c9e2dbe1eb9e94e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
(cherry picked from commit 0b303ebc3efc77b4e7a8bca1d62ef412873c336b)
Reviewed-on: https://git-master.nvidia.com/r/1779054
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
a7307c2d19 ASoC: tegra-alt: Add mixer controls for configuring the ADX
The AMX driver provides userspace mixer controls for configuring the
module. This provides a much simpler way of configuring and using the
AMX versus the alternative where the AMX is configured via device-tree.

Currently, the ADX can only be configured by device-tree and so for
users that wish to use the ADX both the device-tree and audio machine
driver need to be updated. Add similar mixer controls for the ADX that
exist for the AMX so that the ADX can be easily configured via
userspace.

Bug 2382530

Change-Id: Idf8dc0ba3fe4bf30168c01318b9a5e169a8985d6
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1987561
(cherry picked from commit 1b2a25b33f972193ce25ee0b61d612266a9cae05)
Reviewed-on: https://git-master.nvidia.com/r/1991929
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
eabaeedaa6 ASoC: tegra-alt: Set device data before initialising RPM
The device data for a given driver must be set before enabling
runtime-pm otherwise this could results in a crash if the runtime-pm
callback is called before the device data is set where it is expected
that the device data has been initialised.

Furthermore, most drivers will directly call the runtime-pm callback
to power-up the device if runtime-pm is not enabled in the kernel
config and so many drivers would crash if runtime-pm is not enabled.

Fix this by setting the device data early in the driver probe.

Bug 2478690

Change-Id: I5beb1607aa4715651cf4b9ac8e8068e7f8e3a2a7
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
(cherry picked from commit 9d656fcc96e85d38d120a430f83f2b734e19fe07)
Reviewed-on: https://git-master.nvidia.com/r/1991204
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
5e0682c2e7 ASoC: tegra-alt: Fix failure path and removal of ADSP
If the ADSP fail during the probe after the ADSP component is
registered, the ADSP component will not be unregistered and this will
cause the kernel to crash when attempting to the probe the component.
Furthermore, if the removal of the ADSP device, the component and codec
register by the ADSP driver are not removed. Fix these items by ensuring
the the ADSP component and codec are removed as necessary during the
probe failure path and driver removal.

Finally, clean-up some of the prints in the driver probe to drop the
unnecessary print when the netlink is created and use the dev_xxx
functions instead of the pr_xxx functions.

Bug 200458098

Change-Id: I4b51949e1c10c86952008ebe5676832e381a68f4
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1974520
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
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
dc841995d9 tegra-alt: adsp: Do not adjust Compress PCM pos
PCM pointer in compress path need not be adjusted for sample rate
conversion as rate conversion always happens in AHUB (ASRC) and not
in ADSP; cases where rate conversion happens in ADSP will no longer
return correct position

Bug 200430129

Change-Id: I93e3f0680260ce057a17c70f037c9093be3e17cf
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959444
(cherry picked from commit fd33d1360f3a2e684363eecf9f0570b66fa2f51d)
Reviewed-on: https://git-master.nvidia.com/r/1984711
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
f4a50891b0 sound: soc: Separate ADSP driver for virt/non-virt
- Copied the adsp driver from tegra-alt to tegra-virt-alt
- Modified tegra-virt-alt Kconfig and Makefile to make it
  dependent on SND_SOC_TEGRA_VIRT_T210REF_PCM and
  TEGRA_NVADSP
- Make the drivers exclusive with respect to device tree
  node compatibility
- Remove all the code guarded under SND_SOC_TEGRA_VIRT_IVC_COMM
  from tegra-alt ADSP driver .
- Remove all the #ifdefs from the tegra-virt-alt ADSP driver.
- Change ADSP drv name used by dai_links
- Update dai_links with new name
- add -EPROBE_DEFER on sound card register failure. This may
  be required if we decide to remove virt drivers from
  /etc/modules and /etc/modprobe.d/blacklist.conf
- Cleanup in case of deferred probe

Jira: EMA-904
Jira: EMA-1158

Change-Id: I0e707eca1bfa27b3f1814e367baa16e97bf464e5
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966030
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
1120a5768f ASoC: tegra-alt: Reading Mixer RX Gain always returns 0
Reading the mixer RX Gain always returns 0 and this is because
the function to return the gain setting has not been implemented
completely. Fix this by returning the programmed gain value in the
function tegra210_mixer_get_format().

Bug 2438553

Change-Id: I4e6e5a6fe3373982cbb063ce3276428e0a1a2c1a
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1945622
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Hariharan Sivaraman
0f9b5bd384 tegra-alt: fix order for ADSP IO to IO ivc msg
For start of any usecase, the DMA and AHUB blocks
should be enabled in the order from sink to source.
For stop, blocks should be disabled from source
to sink.

Previously, DMA was triggered first then ADMAIF
enable/disable messages were done. Fixed order to:

Start:
 - send start playback IVC
 - trigger DMA by sending active state msg to ADSP
 - send start capture IVC

Stop:
 - send stop capture IVC
 - trigger DMA by sending inactive state msg to ADSP
 - send stop playback IVC

Bug 2407746

Change-Id: Icf25422eccb16af8fa40357910f79320dbd92a0f
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1932277
(cherry picked from commit efead3a657c2b38ec359ad19573d0b3f20e8fb49)
Reviewed-on: https://git-master.nvidia.com/r/1938889
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
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
82b4e51656 ASoC: tegra-alt: Support for secure playback
Add support for secure audio playback in adsp driver
- Add Secure Mode control to set whether an APM memory will be APR or not.
- Send message for all the plugins within apm to allocate apr memory before
the start of pcm/compress playback.

Bug 200235401

Change-Id: I0aba7197b10a4aab05fff5564e33c529cd2f68f5
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1602237
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
22fa30cd39 tegra-virt-alt: nvaudio_ivc_send_receive added
Currently exposed api's have limitations of receive
request getting processed out of order. Change make
sure to process ack/receive based message before
queueing other. Also removing unused api's as code
cleanup.

Bug 2403937

Change-Id: Ic3141aac53bc0904dfcad699d419b9ca8aaea155
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1927929
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
(cherry picked from commit d6c592f7ada5ecbcd9af290149af01b52b89b8a3)
Reviewed-on: https://git-master.nvidia.com/r/1753352
GVS: Gerrit_Virtual_Submit
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
spujar
737cefc6e0 tegra-alt: adsp: release socket in device remove
Following error is seen during multiple unload/load of driver,
 Error creating socket
 tegra210-adsp: probe of tegra210-adsp failed with error -1
This is resulting in kernel panic and device reboot.

Following is the crash,
===============================================================================
Unable to handle kernel NULL pointer dereference at virtual address 00000010
Mem abort info:
 ESR = 0x96000005
 Exception class = DABT (current EL), IL = 32 bits
 SET = 0, FnV = 0
 EA = 0, S1PTW = 0
Data abort info:
 ISV = 0, ISS = 0x00000005
 CM = 0, WnR = 0
user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc3e5a09000
[0000000000000010] *pgd=0000000000000000, *pud=0000000000000000
Internal error: Oops: 96000005 [#1] PREEMPT SMP
PC is at soc_probe_component+0x90/0x350
LR is at soc_probe_component+0x34/0x350
pc : [<ffffff8008d59fb0>] lr : [<ffffff8008d59f54>] pstate: 40400045
sp : ffffffc38bbab8c0
x29: ffffffc38bbab8c0 x28: 0000000000000000
x27: 0000000000000000 x26: ffffff80018f19b8
x25: ffffffc3e5acf800 x24: ffffffc3e8b44e00
x23: 00000000000000f8 x22: 0000000000000001
x21: ffffff80018f19b8 x20: ffffff800a067000
x19: ffffffc35b93aa50 x18: 000000003e48590c
x17: 00000022d6c5fcd0 x16: ffffff8008153de0
x15: 0000000300000000 x14: 0000000000000000
x13: 0000000000000003 x12: 0000000000000026
x11: 0000000000000005 x10: 0101010101010101
x9 : 0000000000000000 x8 : 7f7f7f7f7f7f7f7f
x7 : 2f30316071666473 x6 : 070b035f125d521d
x5 : 1d525d125f030b07 x4 : 0000000000000000
x3 : 6dcc85ae6dec65a0 x2 : 000000000000008c
x1 : ffffff80094aa810 x0 : 0000000000000000
Process insmod (pid: 5755, stack limit = 0xffffffc38bba8028)
Call trace:
[<ffffff8008d59fb0>] soc_probe_component+0x90/0x350
[<ffffff8008d5afc8>] snd_soc_instantiate_card+0x4d8/0xb58
[<ffffff8008d5b7a4>] snd_soc_register_card+0x15c/0x200
[<ffffff80018ed630>] tegra_machine_driver_probe+0x3d0/0x5a0
[<ffffff80087c3da0>] platform_drv_probe+0x60/0xc8
[<ffffff80087c1278>] driver_probe_device+0xd0/0x410
[<ffffff80087c16dc>] __driver_attach+0x124/0x128
[<ffffff80087beba8>] bus_for_each_dev+0x88/0xe8
[<ffffff80087c0a68>] driver_attach+0x30/0x40
[<ffffff80087c0438>] bus_add_driver+0x1f8/0x2b0
[<ffffff80087c2648>] driver_register+0x68/0x100
[<ffffff80087c3ce4>] __platform_driver_register+0x5c/0x68
[<ffffff8001276018>] tegra_asoc_machine_driver_init+0x18/0x30
[<ffffff80080832ac>] do_one_initcall+0x5c/0x170
[<ffffff80081ba740>] do_init_module+0x68/0x1b8
[<ffffff80081538dc>] load_module+0x1004/0x1320
[<ffffff8008153ef0>] SyS_finit_module+0x110/0x128
[<ffffff8008083040>] el0_svc_naked+0x34/0x38
---[ end trace 39fa2dd2a3c341ef ]---
===============================================================================

Fix info,
This patch releases the socket in device removal and adsp probe succeeds
Thus avoid above crash during sound card registration.

Bug 200453666

Change-Id: Idb113b9aca71f830cd33cd8f9c3d742ad86280bb
Signed-off-by: spujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1847927
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
spujar
113a32d573 Revert "tegra-alt: adsp: disable remove() callback"
This reverts commit 7d761982ba0689d7d6c933dd17397624bc47a350.
(manual revert since there were conflicts)

Bug 200453666

Change-Id: I904f5d9b915de95f5b1256104d2473008252dd8a
Signed-off-by: spujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1847926
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
dipeshg
92d1ab20d3 tegra-alt: adsp: ignore drain msg to audioserver
On drain trigger no special handling is required on
audioserver side. Change adds case to ignore drain
message to audioserver.

Bug 2117496

Change-Id: I575b895651ed21179c743a0aa0e5f63eea354a5a
Signed-off-by: dipeshg <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1812302
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dara Ramesh
0a22d4871d ASoC: tegra-alt: add dma_set_mask call
enable dma_set_mask_and_coherent call even
if CONFIG_SND_SOC_TEGRA210_ADSP_ALT
is not enabled, This will allow pcm
driver to start allocations start from the
specified address and downwards.

Bug 200423087

Change-Id: Ib1a2f2361f15d1191258fbb0ca4a620d1b2a7c8b
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1809568
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
ffdbb9edcd tegra-alt: adsp: Add pcm_drain functionality
- TRIGGER_DRAIN support is added in pcm_trigger, which sends EOS
    message to ADSP; this is needed so that ADSP sends notification
    for last consumed buffer
 - DRAIN handling in pcm path is as per the implementation in native
    PCM driver

Bug 2117496

Change-Id: I530c16aaea3993569ecf2733f01d43b37df604c1
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1792940
Reviewed-on: https://git-master.nvidia.com/r/1806327
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Nicolin Chen
8b02cb388e ASoC: tegra-alt: Do not select all modules for T210REF_MOBILE_ALT
Not all platforms have to support modules such as AMX, ADX, MVC, and
etc, so selecting all the audio modules by default is wasting memory
for them.

This patch drops DMIC, AMX, ADX, AFC, MVC, OPE and ADSP from CONFIG
SND_SOC_TEGRA_T210REF_MOBILE_ALT, and keeps only essential ones. In
order not to break any exisiting use case, these CONFIGs will be set
to "def_tristate" so all platforms build them as usual. This means
anyone who does not need them will need to specifically disable them
in the defconfig.

Meanwhile, this patch adds IS_ENABLED() check at corresponding files.

Bug 2284925

Change-Id: I2e3853b5499046fc8de7256899c30d764160aebe
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1803446
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
85868d43dc ASoC: tegra-alt: Optimise suspend support
Suspending all the DAI links for Tegra on entering suspend is taking
between 1-2 seconds which is far too long. To ensure that any active
audio playback and/or capture resumes following suspend, it is only
necessary to suspend the DAI links for ADMAIF and it is safe to set
the '.ignore_suspend' flag for all the other DAI links.

With this change the min/ave/max time for executing the 'snd_soc_suspend()'
function is reduced from 419ms/1056ms/2021ms to 49ms/287ms/766ms. This is
measured using the ftrace function graph feature to measure the total time
for 'snd_soc_suspend()' to execute.

Bug 200390943

Change-Id: I498643eb069a1bc72d72b86930ab5b6e54e44b76
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1799943
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
68f28205ff ASoC: tegra-alt: adsp_audio suspend/resume handling
Change adds suspend/resume to adsp_audio driver.
Also updating pcm_trigger to set FE to inactive state. Setting to
inactive state will make sure dma is paused and not stop when suspend
request is received.

Jira EMA-641

Change-Id: Iadf577266b8f7452acc72526f72f059cfd06ab49
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1689151
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dara Ramesh
99e73baabe ASoC: tegra-alt: remove legacy powergating
- remove legacy powergating code from
  i2s driver

- powergate for APE module is handle by
  acconect bus (genpd)

bug 200406253

Change-Id: If70ecb3dedbb9c2795add28808f1339a4195c72a
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1790032
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Joseph Lo <josephl@nvidia.com>
Tested-by: Joseph Lo <josephl@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
eb75a4c48f ASoC: tegra-alt: Consolidate machine controls/widgets
The Tegra machine driver controls and widgets are generic and can be
used by any board that uses the generic machine driver. Therefore
consolidate the controls and widgets used for all boards.

This also fixes a problem for the Tegra194 Rey platform which does not
have an on-board RT5658 codec and so the generic controls and widgets
are not populated. These controls and widgets are still needed for
testing I2S, DMIC and DSPK.

Finally, to improve the readability don't use 'snd_soc_tegra_card' in
the function dai_link_setup() and just use the 'card' pointer instead.

Bug 200417361

Change-Id: I863a0d5c03a61fe5b9e36fdfd5356900aac9d456
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1775296
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
c11cadfde1 ASoC: tegra-alt: Remove legacy unused platform data
The Tegra ASoC platform data is never used by any current audio machine
driver and so get rid of the platform data and the associated code.

Bug 200417361

Change-Id: I1ef8ce331b67c85aea95b4a143a6982a32fefe93
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1784822
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
dfc52a8512 ASoC: tegra-alt: Add device table for Tegra XBAR driver
The Tegra XBAR driver is not being automatically loaded when booting
with Linux kernel v4.14. Add the device table for this driver to fix
this.

Bug 200422801

Change-Id: Ie6171b7ac4750afb5b09920065d1ebff75870073
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1783951
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Gaurav Tendolkar
df31a96ba7 tegra-alt: adsp: add adsp fe switch support
Adding ADSP FE widget event which enables/disables
ADMA when using ADSP pcm device, pause the DMA on
path disconnect event. This prevents glitches
if another app starts writing on same ADMAIF
using another ADSP pcm device

Bug 200298756
Bug 2119806

Change-Id: I96f27be3b9616954f7b5acc12deb5935ba770180
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1462190
(cherry picked from commit 93eac105424234b082d7f13ee2ba443594604116)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1732695
(cherry picked from commit 957029384bc4d51ab79b6e2bef2b9093819b54d5)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1730254
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
5da3305cdf ASoC: tegra-alt: Fix support for I2S mono playback
Mono playback via the RT5658 codec on the Jetson TX1/TX2/Xavier is
distorted. Although the RT5658 codec is configured for standard I2S
timings (implying 2 channels), the Tegra XBAR should convert the mono
audio track from one channel to two channels. The problem is caused
because the 'CHANNEL_BIT_CNT' field in the I2S Timing Register is
being configured incorrectly. For mono playback in I2S mode (or LRCK
mode) the CHANNEL_BIT_CNT is being set to 31 instead of 15 by fixing
this mono playback works as expected.

Please note that the 'bitcnt' value programmed into the I2S Timing
Register is verified to see that it is not bigger than the mask for
the CHANNEL_BIT_CNT field. However, this is done before we shift the
bitcnt by 1 for I2S mode. Therefore, ensure the bitcnt is shifted by
1 before we do the check.

Mono playback has been tested by playing the following audio clip ...

aplay -D hw:1,0 /usr/share/sounds/alsa/Front_Center.wav

Bug 2257806

Change-Id: I4d306ccef891282e96c300d90bad2a5b6efc9968
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1777096
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Hariharan Sivaraman
cb3d3637bf tegra-alt: adsp: update index for send bytes ctrl
Number of ADSP plugins were increased to 20. The
PLUGIN_SEND_BYTES_IDX macro should be updated to reflect
the same.

Bug 2048629

Change-Id: Ia02361600530f88b133eae1a67e440570e19dfb4
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1775907
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
a143f333df nvadsp: prevent race in os_queue for app
Change add spinlock to nvadsp app start and init
functions for os_queue write protection. It make
sure only one app from different context can update
queue at given time.
Also added some debug info to adsp driver for providing
extra info for debugging purpose.

Bug 2060866

Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Change-Id: If1bbfdb233d2af984f62bb02ed515eec1ab8a492
Reviewed-on: https://git-master.nvidia.com/r/1655974
(cherry picked from commit 7edeb242aba4cabc517b6e270b254777e3ea66ea)
Reviewed-on: https://git-master.nvidia.com/r/1775133
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
ff4cc3116a ASoC: tegra-alt: Fix Tegra186 ARAD regmap
The Tegra186 ARAD driver lists the TEGRA186_ARAD_LANE_ENABLE register
as volatile implying that the register has status bits that may change
automatically. The ARAD Lane Enable register for both Tegra186 and
Tegra194 have 6 bits which are enable bits and no status bits.
Therefore, this register is not volatile and should not be listed as
volatile. Furthermore, during overnight stress testing, I sometimes see
one of the ARAD lanes become enabled randomly (by diff'ing the ALSA
state, as shown below, before and after running a test that is not using
ARAD). So far after making the ARAD Lane Enable register non-volatile
this has no longer been seen.
2022-09-29 15:30:21 +05:30
Dara Ramesh
155bf200a9 tegra-alt: adsp: include linux/clk.h
include linux/clk.h to fix build error
on T210 platform when compile ADSP without
enabling T210Ref machine driver for K4.14.

Bug 200406253

Change-Id: I3843962d303320e1f6322a578c9aa9add3ab8c9b
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1764177
Reviewed-by: Joseph Lo <josephl@nvidia.com>
Tested-by: Joseph Lo <josephl@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
c01285e57a ASoC: tegra-alt: Remove jack-detection WAR for RT565x
Now that jack-detection across suspend for the RT565x has been fixed in
the RT565x codec driver, we no longer need to call the
'trigger_jack_status_check' function from the Tegra machine driver.

Bug 2208756

Change-Id: I79961f9eb99c629eaace9ca35f8bb8a984c4dd38
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1758197
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dara Ramesh
edd7311299 ASoC: tegra-alt: add dma_set_mask parse
Add dma-mask parsing in device tree for pcm
driver to start allocations start from the
specified address and downwards.

Bug 200385990
Bug 200406253

Change-Id: I0443f9535eab76f24437544c5e684d9bc63f4b85
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1755673
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
ff20d62dc4 ASoC: tegra-alt: Add support for multiple jacks
For Tegra194 Galen there can be multiple RT565x codecs if the audio
supermodule is connected and therefore, the RT565x sound card can
have multiple jacks. Add support for multiple jacks by allocating
the jack structure dynamically and creating the jack mixer control
dynamically.

Bug 2187533

Change-Id: Ia17cf4ddb1bb971e0973ea5b03f0c2cd6d9b1d5e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1748233
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
064224a173 ASoC: tegra-alt: Create jack mixer dynamically
For debug/testing purposes the Tegra audio machine driver creates a
'Jack-state' mixer control to allow the user to query/set the jack
state. Currently, the machine driver assumes that there is only one
jack, but on Galen there can be two jacks if the supermodule is used.
Therefore, add a helper function to create the 'Jack-state' mixer
control dynamically and append the codec prefix-name to the mixer
control name so that it has a unique name.

Bug 2187533

Change-Id: Iac4351c319944e3d2c01d053fce9ea390c3f8db1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1748232
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30