Commit Graph

445 Commits

Author SHA1 Message Date
Jon Hunter
34493872d9 ASoC: tegra-alt: Add DAPM Headphone and Mic widgets for I2S3
Tegra I2S3 interface on Jetson TX1 is not working because it is
missing the appropriate DAPM widgets to enable it. Add the
appropriate DAPM widgets for I2S3 (which is using prefix 'l' as
defined by device-tree).

Bug 2021397

Change-Id: I91e8bd13a247eaad4ce2bb1a9cd25d82b000a6c5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1596130
(cherry picked from commit 53647e30e43b72c0246d1ee542831092207258b8)
Reviewed-on: https://git-master.nvidia.com/r/1601697
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
d54626ee0e ASoC: tegra-alt: Add support for I2S5
I2S5 is not enable for Jetson-TX1 although the interface is available
on 30-pin header J26. Enable suppot for this interface so that it can
be tested.

Bug 2020869

Change-Id: I87fe177d2139fe94098cb02fadb490e2080dbb6c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1597135
(cherry picked from commit 8d5dc2df30835ecd3efec606c5f3e2d8ecec3d1a)
Reviewed-on: https://git-master.nvidia.com/r/1601696
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
Mohan Kumar
b9596edbb5 ASoC: tegra-alt: fix aud mclk reset
aud mclk reset is available only for t186, so move all the code
related to aud mclk reset under t186 chip check.

Bug 200365570

Change-Id: I2a7ff5eff583b138dca507336408779f5228a2d8
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1600769
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sameer Pujar <spujar@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
Hariharan Sivaraman
fbeffb7043 tegra-alt: ADSP IO to IO support for virt configs
Add handling for IO to IO use cases in ADSP for
virtualized configurations

Jira EMA-497
Bug 1990609

Change-Id: Ied779014ca2c484d6741329d94500c0e51e10b80
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1589042
(cherry picked from commit ea529d5d074c8ccb577341b5a1d834db2253ded2)
Reviewed-on: https://git-master.nvidia.com/r/1562134
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Stephen Warren
e8d6a15183 nvidia: use $(srctree.$(overlay))
Update all Makefiles to make use of the new srctree.$(overlay) variables
to remove hard-coding the path to any overlays. One direct reference
remains in a hard-coded include statement in drivers/misc/tegra-cec/.

Bug 1978395

Change-Id: I5cdce04e019567a9bbfffaf0e92a61bd16806e99
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1593800
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Timo Alho <talho@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
e9c51282bb ASoC: tegra-alt: Discontinue APE SPDIF support
As there are no real usecase for SPDIF currently and lack of
clock support for SPDIF, discontinuing the spdif support.

Bug 200355251

Change-Id: I9734915715ec21aabbf999c08cea588cf2fcb08f
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1584289
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
Puneet Saxena
fae9c0a600 sound: tegra: utils: replace dma_alloc_writecombine with coherent
dma_alloc_writecombine forces non-cached memory irrespective
HW module IO coherency.
Use dma_alloc_coherent API, which selects the right memory
type depending on HW module.

Bug 2003170

Change-Id: I686713291c1469e67f7430550ad20c01028bf636
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1589979
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Sameer Pujar
aa5200c4d8 ASoC: tegra-alt: remove LKM hack
Both t210 and t186 lkm_loader.sh script uses common xbar driver now.
Hence the temporary fix can be removed now.

Bug 200346429

Change-Id: I466ad9ed11b1418262a291aa6a414fa06b9014a2
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1585452
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@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
Stephen Warren
dbd5c4a30c nvidia: use kernel overlay features
Update all Kconfig files and Makefiles to rely on the kernel overlay
feature. In particular, don't include any Kconfig files or Makefiles
from other overlays. -I directives in CFLAGS are not yet cleaned up.

Bug 1978395

Change-Id: I425d37d55f8ea61fb3a082a1504f994ff30cec03
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1561187
Reviewed-by: Terje Bergstrom <tbergstrom@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
Sameer Pujar
d8cccfd903 ASoC: tegra-alt: remove devm_clk_put() APIs
Clock resource is associated with a device and when the device
is unbound, the resource is freed. Drivers get the clock handle
by using devm_clk_get(). No need for an explicit devm_clk_put()
to release the clock, this is handled automatically when the
device lifetime ends.

Bug 200346429

Change-Id: I0885723e3a9a3fb41e54524ddacc3415f571576c
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1574311
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
93e212df79 ASoC: tegra-alt: add amx auto disable support
Change adds support for auto enable/disable feature
in amx for t19x onward soc family.

Jira EMA-876

Change-Id: I8b9a63e6d186984632da6114c29e5fb8a0537b61
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1573651
Reviewed-by: Automatic_Commit_Validation_User
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
681288f1be ASoC: tegra-alt: restructure drivers
Because of the way in which Makefile is defined for the drivers,
each driver file is getting compliled as separate *.ko module.
This results in loading of all the *.ko modules for maintaining
the functionality.

Current patch re-organises makefile and thus terga-alt structure,
 - utils/ : will provide all the helper functions,
 - machine_drivers/ : lists all the machine specific drivers we have,
 - tegra-alt/*.c : ahub module drivers, each would have a separate
   driver module,
 - include/ : all the local header files needed for driver modules

Bug 200346429

Change-Id: Ic659879a0d6e8ef48b0d79b81059fba4c069591e
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1559745
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
0493b53a47 ASoC: tegra-alt: remove kernel version check
Version check is not required since 'struct component_driver' is
available on both kernel-4.4 and kernel-4.9. These checks are
earlier removed from t21x based module drivers. The same is done
now for t18x specific drivers.

Bug 200346429

Change-Id: Ie59600ed8fe4b6878ece58a055da522ce308300d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1573625
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@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: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
90ef4d49b0 sound: soc: tegra: Fix Tegra210 I2S Fsync Polarity
The 'normal' polarity of the fsync is dependent on the audio format.
For example, for I2S the 'normal' polarity for the fsync is
falling-edge/low, where as for r/l-justified or dsp modes A/B it is
rising-edge/high. This is detailed in the Tegra210 TRM in the table
titled "Programming I2S to Operate in Various Modes" and also in
the Linux kernel header file for include/sound/soc-dai.h.

The Tegra210 i2s driver always assumes that the fsync is low for
'normal' polarity and high for 'inverted' polarity and does not
account for the audio format. Correct the Tegra210 I2S driver to
set the polarity according the the audio format.

Bug 1788838
Bug 1993738

Change-Id: I5c7395f225ff8c25e2bb277c35e3ecb7a86f36cb
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1567742
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:30:21 +05:30
Sameer Pujar
52b1047acc ASoC: tegra-alt: avoid address hardcoding
xbar codec is registered as per the physical address and the same
is used while defining the dai links. This results in unnecessary
duplication of the code and this is not scalable for upcoming
platforms too. This patch removes such hardcodings for xbar and
adsp audio driver by using dev_set_name() api.

Bug 200346429

Change-Id: I16147b94cc1686ceb8b084ead91d2d35b1f0fbbd
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1568711
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
c56084f924 ASoC: tegra-alt: merge xbar driver code
xbar driver code is maintained separately for t210 and t186.
There are separate driver modules loaded for t210 and t186
platforms. The difference between two drivers is mostly some
soc specific data and structures. This patch merges both the
drivers. Going forward there will be one xbar module, but at
the moment duplicate copy of xbar driver with t186 name is
kept to maintain audio sanity.

Bug 200346429

Change-Id: Ic10ac7f2aca9a0da5caa0683bb7bdb51f14117a8
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1567256
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
fd1f50ee48 ASoC: tegra-alt: Avoid reg access after shutdown
Below are the hypothetical scenarios
- Drivers are in suspend state while reboot and PCM Open call from
  userspace is received after driver shutdown [APE is power gated
  already]
- PM domain handling doesn't ensure proper functionality after driver
  shutdown is called

The change handles with the below fix
- Will prevent any reg access in runtime resume of drivers and avoid
  opening pcm devices.

Bug 200333417

Change-Id: Ieba2a063342cd1e7becb79a0135cb2b8ec373a61
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1539396
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
a22ea5aac7 ASoC: allow switch to set source before playback
For switch currently we rely on setting switch source
after playback has started in null-sink mode. However
this will leads to missing few frames of intial data.
Thus change adds support to allow setting source to
switch before playback is started.

Jira EMA-528

Change-Id: I2301da6d8b256bb188a8c442058bd87cac5a48ca
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1517265
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit 313c392daeeb84a12a01b1befc47ab1826c2126e)
Reviewed-on: https://git-master.nvidia.com/r/1533084
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
d772f9ce82 ASoC: tegra-alt: override adsp fe-name
Change provide options to update fe-names.
This can be controlled via dt property
fe-info.

Jira EMA-421

Change-Id: Ie8c18e20f07d8a910e93f52720289a3ea70ee347
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1514371
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit ef7904abf93b0451761c304d19f2e6281672e2ab)
Reviewed-on: https://git-master.nvidia.com/r/1533083
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
b271d423d8 ASoC:tegra-alt: fix const char* crash
Observing runtime crash in adsp-alt probe
as we are trying to update const char* strings
to update plugin names. Change assign new
memory for all such plugin name updation
and update the respective pointer.

Jira EMA-421

Change-Id: Idc9861b6d00c6b3bb7241edc93dfdcda48b12589
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master/r/1513420
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit 216675854724320b66215395b1867fe825551f3a)
Reviewed-on: https://git-master.nvidia.com/r/1533082
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2022-09-29 15:30:21 +05:30
Ravindra Lokhande
078c0fef6f ASoC: tegra-alt: move codec driver members to component
Some members from struct snd_soc_codec_driver is moved to
struct snd_soc_component_driver

Bug 1856400

Change-Id: Icc0f83f7ed4ee8137c1b6e949cf9a6e8172d6ed2
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/1452899
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit 4e3aa2fe1524b3bf1b433869d67b28762b01bbd1)
Reviewed-on: https://git-master.nvidia.com/r/1533080
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2022-09-29 15:30:21 +05:30
Ravindra Lokhande
3025fca447 ASoC: tegra-alt: changes needed for kernel 4.9
This patch fixes compile errors for kernel 4.9. Kernel 4.9 has two
changes, struct snd_soc_codec_driver is modified and changed PCM
runtime array to a list from struct snd_soc_card.

Bug 1856400

Change-Id: I32d0d6d5d2cb79a3af27b81786d4e288d1be4d2d
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit 9528e52063467df94bc37fe2ad10d74a1c573848)
Reviewed-on: https://git-master.nvidia.com/r/1533079
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
f734578a22 ASoC: tegra-alt: send bytes for period size msg
tegra210_adsp_send_period_size_msg is sending size in period size
which is wrong and it should be no of bytes in the period size.

Bug 200329032

Change-Id: Ib43569d24dcfeeeac36c878a51affaa347eacf0b
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1519960
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1532211
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
11516ebd24 Makefile: unify makefiles and kconfig for audio
tegra-alt drivers are intended to be moved to common nvidia
repo. This patch combines the Makefile and Kconfig and also
puts conditional complilation for kernel-4.9, since for audio
the merge can be possible only when kernel-4.4 and kernel-4.9
are unified.

for kernel-4.4, all tegra-alt code is built from nvidia/
for kernel-4.9, t18x specific code is built from nvidia/ and
other drivers are built from kernel-4.9/

Bug 200325738

Change-Id: Id9d1cc9b129f61dc4b52d2e3c5466ec94415517c
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1529135
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
b958f3cad0 ASoC: tegra-alt: Fix system suspend handling
There are a couple issues with system suspend handling in the Tegra
ASoC codec drivers which are:

1. Most drivers the system suspend callback does nothing and this
   means that if the codec device is active when suspend occurs then
   the codec will not be suspended correctly. This has been seen to
   cause system crashes in the I2S driver when the system is suspended
   and resuming while audio playback is active.

2. The codec suspend handlers may be called twice when entering
   suspend. Suspend handlers should only be called once, but currently
   they are called twice; once by the PM core and once when the APE
   power-domain is turned off (if it is on when suspend occurs).

Fix the above two problems by:

a). Adding proper system suspend and resume handlers for all codec
    drivers, to suspend and resume the device if not runtime PM
    suspended on entering suspend.
b). Remove the code to call the PM callbacks from the APE power-domain
    code.

Finally, make the system suspend callbacks for these codec drivers
late suspend callbacks to ensure that the sound core has suspended
any on-going activity, before we attempt to suspend these codec
devices.

Bug 200275736

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: http://git-master/r/1488953
(cherry picked from commit 610f30df70a790733ed25a1be250e08cce19f368)

Change-Id: Ia0893c8373721ed16787a6c8243dca49f9672d34
Reviewed-on: https://git-master/r/1509428
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
8f377ebee8 ASoC: tegra-alt: Fix parent runtime PM handling
Linux runtime PM automatically handles the runtime resuming and
suspending of a parent device and therefore, it is not necessary
for a child device to explicitly runtime resume or suspend the
parent.

The various Tegra ASoC codec drivers explicitly runtime resume
and suspend the parent device from within their runtime PM callback
handler. This should not be necessary.

Furthermore, currently the various Tegra ASoC codec drivers are
not suspended correctly if active when system suspend occurs. During
system suspend it is common to directly call the runtime PM callbacks
to suspend and resume the device if active from the system suspend
callbacks. However, the APIs, pm_runtime_get/put(), cannot be called
during system suspend and so the runtime PM callbacks for these codec
drivers cannot be called from the context of the system suspend
callbacks.

Remove the calls to runtime resume and suspend the parent device from
the runtime PM callbacks for the various Tegra ASoC drivers. This will
allow us to fix suspending and resuming of the Tegra ASoC drivers
across system suspend.

Bug 200275736

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: http://git-master/r/1487805
(cherry picked from commit 60de6c68787ac100773a9f300d665266db25907c)

Change-Id: I67d429e779e84ad4c1978303ad08c4b89b95fb69
Reviewed-on: https://git-master/r/1509427
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
cb456f677b ASoC: tegra-alt: dmic rate control override
Support sampling rate override mixer control for dmic.

Bug  1936866

Change-Id: I9a1930bda5220e4668a32f142fa07c1dc4759883
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1505570
(cherry picked from commit 6b2799c34edec6ee2084dba1b1a55e34cf7d4aa5)
Reviewed-on: https://git-master/r/1508731
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Viswanath L
7a1abcd3f1 tegra-alt: mvc: Updated mixer controls
Following updates:
 - "input bit format" ctl to set RX CIF bit-width
 - 100x scaling to "Vol" ctl for more granularity
 - Fixes in mixer ctl "get" functions so that current value is read
 - Fix in "Curve Type" ctl so that default volume gets set

Bug 1936284

Change-Id: Ib54b17266c7c3a3e9e42cab13195389c5fa1fbe7
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1497628
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
Viswanath L
725219888e tegra-alt: dmic: Add output bit-width control
"output bit format" ctl added to set TX CIF bit-width

Bug 1936284

Change-Id: Ifeec48c9c8adc50c5ec16c237b39451511a8ceb0
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1499297
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
654d951c76 ASoC: tegra-alt: Dump APE register for debugging
Add support with a mixer control using which APE register
status can be dumped from userspace during an error or
while debugging.

Bug 200307023

Change-Id: I489bdaeeec16975a872b9b145a1672f3f4ef1928
Reviewed-on:http://git-master/r/#/c/1478879
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1499107
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Vandana Salve
e1e49b52f6 drivers: update kernel path to kernel/nvidia
Changing references of t18x/ to nvidia/
in linux-4.4

bug 200295104

Change-Id: I12013129e7d55434727f245c8de19d27e04cfdfc
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/1462293
Reviewed-by: svcboomerang <svcboomerang@nvidia.com>
Tested-by: svcboomerang <svcboomerang@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
50217466ed ASoC: tegra-alt: Avoid reg access after shutdown
Below are the hypothetical scenarios
- Drivers are in suspend state while reboot and PCM Open call from
  userspace is received after driver shutdown [APE is power gated
  already]
- PM domain handling doesn't ensure proper functionality after driver
  shutdown is called

The change handles with the below fix
- ALSA PCM Open API first executes runtime resume of each driver.
  So need to prevent any reg access in runtime resume of drivers.
- ALSA PCM Open executes ADMAIF startup after runtime resume of
  each driver. If ADMAIF startup returns failure based on shutdown,
  PCM Open operation will fail, this will break PCM Open path and
  will ensure no further ALSA APIs/Callbacks are called.

Bug 200289815

Change-Id: Ia03e035569375f37ae4b0faa1a4593ce121d2354
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1475208
(cherry picked from commit 3361e95850563f3009a428bb1c01941ed069a7b0)
Reviewed-on: http://git-master/r/1492664
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
6b67bfa9a0 ASoC: tegra-alt: switch support for adsp
Change allows support to select one FE among allowed
FE's to be routed to ahub, with rest of the inputs
in drain mode.

Jira EMA-389

Change-Id: I31889a52d67390dcfbf0f2d391acd86bb76cd64e
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1331535
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:30:21 +05:30
Sameer Pujar
3f5db4388d ASoC: tegra-alt: adsp: callback func ptr for adma
There is a function exported from adsp os code, nvadsp_set_adma_dump_reg,
to set the function pointer for adma regdump callback.

This patch uses the above exported api and sets the callback to
tegra_adma_dump_ch_reg, which is implemented by adma driver.
This is done during tegra210_adsp_init.

Bug 200289390

Change-Id: If1c2826928d5e5d51a805ed0a2211c20a1ecf6f8
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: http://git-master/r/1484830
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Shreshtha SAHU
81f6c7aac5 sound: tegra-alt: register ape-adma ISO_CLIENT only for t18x
Bug 200285287

Change-Id: I93a4cac1b5824db6c74fd833e83987c5c82cbbc9
Signed-off-by: Shreshtha SAHU <ssahu@nvidia.com>
Reviewed-on: http://git-master/r/1463850
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
9a3f4fe1d7 ASoC: tegra-alt: unify tegra-alt driver
Unify adsp and i2s driver to support kernel unification.

Bug 200257345

Change-Id: Ic472c4fec0e1febf9b26a9a0ad67138329a25884
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1477310
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Uday Gupta
f070dc4c40 ASoc: tegra-alt: ADMA channel property parsing
Add code to use the ADMA start channel number from DT
entry nvidia,adma_ch_start

Jira EMA-413

Change-Id: Iec098d133226f70e455dd8ff0b706636f678ab2f
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: http://git-master/r/1477152
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
104d2c7cea ASoC: tegra-virt-alt: Add 24 kHz support
Use SNDRV_PCM_RATE_KNOT instead of
SNDRV_PCM_RATE_8000_192000 to support 24 Khz
Sampling rate

Jira EMA-412

Change-Id: I05375f8203411d0366b7c0b5e2b4dca35d70342c
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: http://git-master/r/1475235
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Diwakar Paliwal
f2c8d09fea tegra-alt: adsp: Use devm_clk_get for t210
Use devm_clk_get for t210 during probe. This is
required for successful probe as t210 and t186
use common clock framework on K4.4.

Enable ADSP driver for t210 config.

Bug 200297206

Change-Id: I56a7f6196c07edb00548217fac1f69b03de3a882
Signed-off-by: Diwakar Paliwal <dpaliwal@nvidia.com>
Reviewed-on: http://git-master/r/1471996
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
af364ab0a2 tegra-alt: add drain feature
Change adds draining feature for adsp playback.
NULL-SINK's are used as dapm widgets for alsa
path completion.

Jira EMA-389

Change-Id: Ic4125fc4e1b6dab7f4886fe2ad2dfdefc6962209
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1327309
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Ahung Cheng
946277f5b6 ASoC: tegra-alt: add dma buffer size parse
Add dma-buffer-size parsing in device tree for pcm
driver to allocate required size for each pcm node

Bug 200299289

Change-Id: Ia579c66413912dd0ef7fda34cd47887eec3599f7
Signed-off-by: Ahung Cheng <ahcheng@nvidia.com>
Reviewed-on: http://git-master/r/1464607
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
bff751a2eb ASoc: tegra-alt: fix coverity
Change corrects:
1) Unsigned compared against 0
2) possible null pointer dereferencing.
3) Dereference before null check

Bug 200192143

Change-Id: Ib005e3bb808fb12cb5f8ee6911bd3c522c879b00
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1467216
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
9bdf181610 ASoC: tegra-alt: xbar unification changes
Unification changes for xbar driver to support all chips.

Bug 200257345

Change-Id: I291df54400e24a4a21b1490abb0c9f8ccef68116
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1286569
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
df7fa78105 ASoc: tegra-alt: increase adsp pcm dev
Change adds support to increase the number
of pcm devices exposed by adsp-alt driver.

Jira EMA-389

Change-Id: I34f23bd993c4d53619de7d74cad3c9dc2644afda
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1454052
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
7f5394e3f6 ASoC: tegra-alt: remove pcm ack dependency
Change remove dependency of ack by pcm ops to update
application pointer. MMAP mode can't be used with
ops ack. When trigger is called updated app pointer
info is passed to adma plugin. On adma period
completion callback, updated application pointer
is again passed to adma plugin.

Jira EMA-389

Change-Id: Iad1376cc218b2c7b49812db34e128ed43b10eddb
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1331554
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
76d48d8cd8 ASoC: 8 ch playback/capture support
Change adds support on adsp-alt:
- allows pcm_open for upto 8 channel.
- adds option to pass burst_size for HV
- allows BE to be configured with FE's params
  to be sent via ivc to audioserver.

Change-Id: Ib3ab3fb4d95bfc8335cd1d52eeb71cc4e5a538a5
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1317770
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
c85e969ca0 ASoC: tegra-alt: Unify the tegra-alt drivers
Unify the tegra alt drivers to support all chips.

Bug 200257345

Change-Id: Ie6bff2e421330b0fd9d1deb14f2afd1131d01a44
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1327760
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Ravindra Lokhande
30d77a84d6 ASoC: tegra-alt: Select ADSP if TEGRA_NVADSP is selected
SND_SOC_TEGRA210_ADSP_ALT depends on TEGRA_NVADSP so add condition
while selecting it.

As per Documentation/kbuild/kconfig-language.txt
select should be used with care. select will force a symbol to a
value without visiting the dependencies. By abusing select you are
able to select a symbol FOO even if FOO depends on BAR that is not
set.

Change-Id: Icb3824b93c4557ab730a06692b20c4e02784382e
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/1326953
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
2022-09-29 15:30:21 +05:30
Sharad Gupta
1317e44e89 ASoC: tegra-alt: ADMAIF driver unification
All chip ADMAIF header files are combined into one.
Modified the souce code to support all chipsets via
separate platform data structures. Chip specific parameters
are populated in the structure to beused at runtime.

Bug 200257345

Change-Id: Ib605e32e73ecc46e0a20ec4061149431035705e1
Signed-off-by: Sharad Gupta <sharadg@nvidia.com>
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1262332
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
00ff1f7baa ASoC: tegra-alt: AFC driver unification
T210 and T186 ADMAIF header files are combined into one.
Modified the souce code to support T186 and T210 chipsets via
separate platform data structures. Chip specific parameters
are populated in the structure to beused at runtime.

Bug 200257345

Change-Id: If05ad85e96aec177310491616d082b50b7454331
Signed-off-by: Sharad Gupta <sharadg@nvidia.com>
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: http://git-master/r/1266357
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
2022-09-29 15:30:21 +05:30