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>
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>
When using the ALSA 'alsactl' tool to save and restore mixer settings
the following type of errors are observed ...
alsactl: set_control:1461: Cannot write control '2:0:0:ADMAIF1 Channels:0' : Invalid argument
...
alsactl: set_control:1461: Cannot write control '2:0:0:AMX1 Output Channels:0' : Invalid argument
...
alsactl: set_control:1461: Cannot write control '2:0:0:RX1 Channels:0' : Invalid argument
...
alsactl: set_control:1461: Cannot write control '2:0:0:TX1 Channels:0' : Invalid argument
...
alsactl: set_control:1461: Cannot write control '2:0:0:TX5 Channels:0' : Invalid argument
...
alsactl: set_control:1461: Cannot write control '2:0:0:SFC1 Channels:0' : Invalid argument
...
alsactl: set_control:1461: Cannot write control '2:0:0:MVC1 Bits:0' : Invalid argument
These are just a few examples but these errors are seen for all
instances of the devices. The problem is that the 'put' handler for
the above mixer controls treats '0' as an invalid setting and so if
the default value is '0', then when we try to restore the setting to
'0' it fails because this is consider an 'invalid argument'. However,
'0' is not a invalid argument, it simply means that we are not
overriding this setting from userspace.
Furthermore, if someone happens to set an of the above mixer controls
to a non-zero value, then it is not possible to set it back to '0'
again.
Fix this by allowing userspace to set the above mixer controls to '0'.
Bug 2058979
Change-Id: Icd543c2ea956cb0690238d9a1f184c144a572029
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1675098
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>
When using ADMAIF9/10 channels for audio playback/capture on Tegra210,
the soft-reset of the ADMAIF is failing when playback finishes ...
Playing WAVE 'rec.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
[ 260.094969] tegra210-ape-admaif tegra210-admaif: Failed at ADMAIF0_TX sw reset
There are a couple issues here ...
1. The ADMAIF that fails is reported as 'ADMAIF0' although in the above
test ADMAIF9 is being used. This is purely an error in the driver
which is using 'dev-id' as the ADMAIF ID instead of 'dai->id'. Hence
the above error message is misleading.
2. The soft reset fails because the regmap configuration for the ADMAIF
registers on T210 is incorrect. In the function,
tegra210_admaif_volatile_reg(), only the ADMAIF registers between
offset 0x000 and 0x500 are considered volatile. The problem is that
the ADMAIF channel registers for T210 actually span 0x000-0x280 (for
RX) and 0x300-0x580 (for TX). This means that for TX, the ADMAIF9/10
channel registers are not considered volatile and hence, polling the
soft reset register is failing.
Fix the above two issues by correcting the ADMAIF ID reported for any
soft reset failures, and correct the address range for ADMAIF volatile
registers.
Bug 2037162
Change-Id: If22eba754ab4bf2bf5acc3c9da51388b7208c749
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1620448
(cherry picked from commit 1cd55ec115b7235343f09ec524a2c4cb2253ef33)
Reviewed-on: https://git-master.nvidia.com/r/1642335
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>
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>
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>
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>
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>
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>
Certain usecase requires different audio and client channels settings
inside ahub, so this needs to be handled with dedicated Channels mixer
control for each module.
This change will introduce channels mixer control and cif controls to
admaif,dmic,i2s and all other internal module is control with a single
channel control.
-Support mono channel SFC
-Support mono channel Mixer
-Cleanup drivers
Bug 1839027
Change-Id: Id997519ebdc9f518c83debc2d4cd58fde34e79b6
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: http://git-master/r/1258877
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
mach/clk.h just include the linux/clk/tegra.h and hence directly
include this header instead of via mach/clk.h.
bug 200259454
Change-Id: Iae9061f88ae47ddbc2985a2e8e4268a094c0dba3
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/1263982
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
amdaif fifo sizes and start addresses were being
set such that amdaif x and admaif x+16 fifos were
overlapping causing audio data corruption when used
simultaneously.
use the reset values for fifo sizes and start
adddresses to avoid this overlap
Bug 1748018
Change-Id: I8a87e83d1cbebcd6dc2f487a5925756fd47004a3
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: http://git-master/r/1171651
(cherry picked from commit efef0eaf1434b550e93016264491a16555d7b3de)
Reviewed-on: http://git-master/r/1238417
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
ADMAIF channels used by ADSP are enabled/disable from ADSP.
So mark ENABLE register as volatile to avoid CPU writing
incorrect values into it.
Bug 200173637
Change-Id: Ic441d890e90dd087ae6bdd2a0b9ef8ceec0bb333
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/1013345
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
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>
Move register store/restore from pm API's to
runtime API's for platforms, with CONFIG_PM_SLEEP
not enabled, to work.
Bug 200166409
Change-Id: Ifcdd78206b3ac59edc8ba1279316cfa8c87e7204
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: http://git-master/r/932101
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Nitin Pai <npai@nvidia.com>
add check for context pointer before accessing it in suspend.
Also move setting of driver data at the end of probe function.
Change-Id: I5724ee810dd3ca409412aa21d61d35519b1432a3
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/921743
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Add controls for configuring CIF channels for AMX and ADMAIF.
Add controls for CIF stereo/mono conversion for SFC.
Remove non-zero check in put_byte_map() to update byte mask.
Due to this check, byte 0 map wasn't getting updated for valid
value of 0.
Bug 200100724
Change-Id: I37b96594464f699db93552f5c1e148c51e963c5e
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/760115
(cherry picked from commit 8c2d36d0303aac45553cc64c148d8c62a8bcf880)
Reviewed-on: http://git-master/r/772770
(cherry picked from commit d17f88c03e55d8f0a250cd013b7d18a27c0d789c)
Reviewed-on: http://git-master/r/781739
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
1. Remove replicate bit and add fifo_size_downshift bit
in cif
2. Update mask value for dma_fifo_size, dma_fifo_start_addr
and dma_fifo_threshold in admaif driver
3. Update the copyright
4. Add run time check function to detect FPGA
Bug 1582514
Bug 1582510
Change-Id: I40a8172ebc3713ead4cb5764f291f04d548c7a75
Signed-off-by: Junghyun Kim <juskim@nvidia.com>
Reviewed-on: http://git-master/r/751602
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Tested-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
- removed snd_soc_codec_set_cache_io function
- use snd_soc_kcontrol_codec instead of snd_kcontrol_chip
- use codec->component.val_bytes instead of codec->val_bytes
- use devm_ioremap_resource instead of devm_request_and_ioremap
- snd_soc_dapm_mux_update_power prototype is changed
Change-Id: Ieb699a0e8a12b341c6823337ef2deb0d99292240
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
ADMAIF Global can get disabled before ADSP disables
its ADMA channels. This is not recommended as per
programming guidelines. So set ADMAIF Global Enable
bit in probe and keept is set always.
Bug 200069840
Change-Id: I73b38c4554b33c1af9d9027333ad12c55892ed7c
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/668983
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Set default register values for AHUB modules in regmap. This will
ensure after runtime suspend/resume AHUB register POR values
does not get reset to 0.
Bug 200039212
Change-Id: I38e4c04721450b7511404c0db2911b314b68a880
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/603339
remove admaif clk get apis from admaif driver.
admaif module is under ahub clock and no separate
clock for this module.
Change-Id: I5354aff4aba5c1d3c5c759704e35e53803e67242
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: http://git-master/r/555497
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Set idle_bias_off for all t210 xbar modules to ensure module runtime
suspend/resume works when module is idle.
Ensure regcache is synced back to hardware during runtime resume so
that register content does not get lost if it is written during
runtime suspend state.
Add suspend APIs for all module to mark regcache dirty while device
goes into suspend to ensure register values does not get lost across
system suspend/resume.
Change-Id: I2828beeed859df4f8084dd70bbcde5ed62f2525c
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/555028
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
GVS: Gerrit_Virtual_Submit
Instead of using duplicate clock of "d_audio" for all AHUB modules
get/put runtime pm reference of the parent module from runtime_pm
suspend/resume routine of all AHUB modules. This will ensure AHUB
xbar is up before other drivers tries to access any register. Also
it will ensure both d_audio and APE clocks are enabled when needed.
Bug 200042312
Change-Id: I0346728f15b135bb619de40fbd3fc440a5505940
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/554863
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
GVS: Gerrit_Virtual_Submit
When using RBTREE cache, there can be allocations the first time
a register is accessed. This can cause an attempt to schedule while
atomic in the case that the regmap is using a spinlock. This can be
resolved by using a flat cache.
Bug 200041820
Change-Id: Id69592cd5fadbb5ad9ccfdbb1f184733a332512c
Signed-off-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Reviewed-on: http://git-master/r/552940
Allow mono config in dai params where missing.
Required for BT SCO where user space needs to
open alsa device with mono config
Bug 200032907
Change-Id: I2456700ea618dbf84ecece1cf45e67a6a9b14616
Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/499374
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Tested-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
This is a preparation change for ADSP audio driver. When audio is
rendered from ADSP, ADSP driver will act as cpu driver and ADMAIF
should act as codec driver. This changes exposes ADMAIF ports as
codec. Each ADMAIF port have two codec DAIs, 'ADMAIF CIF' is the
XBAR facing DAI and 'ADMAIF FIFO' is the ADMA facing DAI.
Change-Id: I1153d6bfc961549f0ade269f5da19c2531d382c0
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/420099
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Reviewed-by: Songhee Baek <sbaek@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
This change is to use DMA channel name from DT when pcm driver
requests the dma channel to dma engine.
Bug 1488342
Change-Id: I4b2518ce14caa366b834848571577273c4144ac6
Signed-off-by: Songhee Baek <sbaek@nvidia.com>
Reviewed-on: http://git-master/r/401167
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>