MODS build has 'CONFIG_TEGRA_ISOMGR' enabled and it is resulting in
following build errors.
ERROR: modpost: "tegra_isomgr_register"
[sound/soc/tegra/snd-soc-tegra-utils.ko] undefined!
ERROR: modpost: "tegra_set_latency_allowance"
[sound/soc/tegra/snd-soc-tegra-utils.ko] undefined!
ERROR: modpost: "tegra_isomgr_realize"
[sound/soc/tegra/snd-soc-tegra-utils.ko] undefined!
ERROR: modpost: "tegra_isomgr_reserve"
[sound/soc/tegra/snd-soc-tegra-utils.ko] undefined!
ERROR: modpost: "tegra_isomgr_unregister"
[sound/soc/tegra/snd-soc-tegra-utils.ko] undefined!
This happens because TEGRA_ISOMGR is not functionally up on v5.9.
Actually it has dependency over 'CONFIG_NV_TEGRA_MC' and thus build
issue is fixed by adding an explicit check for it. On L4T this issue
is not seen because 'CONFIG_TEGRA_ISOMGR' is not enabled.
Bug 200622929
Change-Id: Iceebf0df6e33386a5df06c5263a4a46b5bcd5d42
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2404198
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rajesh Gumasta <rgumasta@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Rajesh Gumasta <rgumasta@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Fix trivial compile warnings wrt unused functions by adding
__maybe_unused prefix:
sound/soc/tegra/tegra210_i2s.c:167:12: warning: 'tegra210_i2s_runtime_suspend' defined but not used [-Wunused-function]
sound/soc/tegra/tegra210_i2s.c:179:12: warning: 'tegra210_i2s_runtime_resume' defined but not used [-Wunused-function]
Fixes: c0bfa98349d1 ("ASoC: tegra: Add Tegra210 based I2S driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200803141850.23713-6-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Fix trivial compile warnings wrt unused functions by adding
__maybe_unused prefix:
sound/soc/tegra/tegra210_dmic.c:43:12: warning: 'tegra210_dmic_runtime_suspend' defined but not used [-Wunused-function]
sound/soc/tegra/tegra210_dmic.c:55:12: warning: 'tegra210_dmic_runtime_resume' defined but not used [-Wunused-function]
Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200803141850.23713-5-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Fix trivial compile warnings wrt unused functions by adding
__maybe_unused prefix:
sound/soc/tegra/tegra210_ahub.c:567:12: warning: 'tegra_ahub_runtime_suspend' defined but not used [-Wunused-function]
sound/soc/tegra/tegra210_ahub.c:579:12: warning: 'tegra_ahub_runtime_resume' defined but not used [-Wunused-function]
Fixes: 16e1bcc2caf4 ("ASoC: tegra: Add Tegra210 based AHUB driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200803141850.23713-4-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Fix trivial compile warnings wrt unused functions by adding
__maybe_unused prefix:
sound/soc/tegra/tegra210_admaif.c:232:12: warning: 'tegra_admaif_runtime_resume' defined but not used [-Wunused-function]
sound/soc/tegra/tegra210_ahub.c:567:12: warning: 'tegra_ahub_runtime_suspend' defined but not used [-Wunused-function]
Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200803141850.23713-3-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Fix trivial compile warnings wrt unused functions by adding
__maybe_unused prefix:
sound/soc/tegra/tegra186_dspk.c:74:12: warning: 'tegra186_dspk_runtime_suspend' defined but not used [-Wunused-function]
sound/soc/tegra/tegra186_dspk.c:86:12: warning: 'tegra186_dspk_runtime_resume' defined but not used [-Wunused-function]
Fixes: 327ef6470266 ("ASoC: tegra: Add Tegra186 based DSPK driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200803141850.23713-2-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Build errors are seen on 32-bit platforms because of a plain 64-by-32
division. For example, following build erros were reported.
"ERROR: modpost: "__udivdi3" [sound/soc/tegra/snd-soc-tegra210-dmic.ko]
undefined!"
"ERROR: modpost: "__divdi3" [sound/soc/tegra/snd-soc-tegra210-dmic.ko]
undefined!"
This can be fixed by using div_u64() helper from 'math64.h' header.
Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595492011-2411-1-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
ADMAIF is the interface between ADMA and AHUB. Each ADMA channel that
sends/receives data to/from AHUB must intreface through an ADMAIF channel.
ADMA channel sending data to AHUB pairs with an ADMAIF Tx channel and
similarly ADMA channel receiving data from AHUB pairs with an ADMAIF Rx
channel. Buffer size is configurable for each ADMAIF channel, but currently
SW uses default values.
This patch registers ADMAIF driver with ASoC framework. The component
driver exposes DAPM widgets, routes and kcontrols for the device. The DAI
driver exposes ADMAIF interfaces, which can be used to connect different
components in the ASoC layer. Makefile and Kconfig support is added to
allow to build the driver. The ADMAIF device can be enabled in the DT via
"nvidia,tegra210-admaif" compatible binding.
Tegra PCM driver is updated to expose required PCM interfaces and
snd_pcm_ops callbacks.
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595134890-16470-8-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
The Digital Speaker Controller (DSPK) converts the multi-bit Pulse Code
Modulation (PCM) audio input to oversampled 1-bit Pulse Density Modulation
(PDM) output. From the signal flow perpsective, the DSPK can be viewed as
a PDM transmitter that up-samples the input to the desired sampling rate
by interpolation then converts the oversampled PCM input to the desired
1-bit output via Delta Sigma Modulation (DSM).
This patch registers DSPK component with ASoC framework. The component
driver exposes DAPM widgets, routes and kcontrols for the device. The DAI
driver exposes DSPK interfaces, which can be used to connect different
components in the ASoC layer. Makefile and Kconfig support is added to
allow to build the driver. The DSPK devices can be enabled in the DT via
"nvidia,tegra186-dspk" compatible binding. This driver can be used
on Tegra194 chip as well.
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595134890-16470-7-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
The Audio Hub (AHUB) comprises a collection of hardware accelerators for
audio pre/post-processing and a programmable full crossbar (XBAR) for
routing audio data across these accelerators in time and in parallel.
AHUB supports multiple interfaces to I2S, DSPK, DMIC etc., XBAR is a
switch used to configure or modify audio routing between HW accelerators
present inside AHUB.
This patch registers AHUB component with ASoC framework. The component
driver exposes DAPM widgets, routes and kcontrols for the device. The DAI
driver exposes AHUB interfaces, which can be used to connect different
components in the ASoC layer. Currently the driver takes care of XBAR
programming to allow audio data flow through various clients of the AHUB.
Makefile and Kconfig support is added to allow to build the driver. The
AHUB component can be enabled in the DT via below compatible bindings.
- "nvidia,tegra210-ahub" for Tegra210
- "nvidia,tegra186-ahub" for Tegra186 and Tegra194
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595134890-16470-6-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
The Inter-IC Sound (I2S) controller implements full-duplex, bi-directional
and single direction point to point serial interface. It can interface
with I2S compatible devices. Tegra I2S controller can operate as both
master and slave.
This patch registers I2S controller with ASoC framework. The component
driver exposes DAPM widgets, routes and kcontrols for the device. The DAI
driver exposes I2S interfaces, which can be used to connect different
components in the ASoC layer. Makefile and Kconfig support is added to
allow to build the driver. The I2S devices can be enabled in the DT via
"nvidia,tegra210-i2s" compatible binding.
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595134890-16470-5-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
The Digital MIC (DMIC) Controller is used to interface with Pulse Density
Modulation (PDM) input devices. The DMIC controller implements a converter
to convert PDM signals to Pulse Code Modulation (PCM) signals. From signal
flow perspective, the DMIC can be viewed as a PDM receiver.
This patch registers DMIC component with ASoC framework. The component
driver exposes DAPM widgets, routes and kcontrols for the device. The DAI
driver exposes DMIC interfaces, which can be used to connect different
components in the ASoC layer. Makefile and Kconfig support is added to
allow to build the driver. The DMIC devices can be enabled in the DT via
"nvidia,tegra210-dmic" compatible string. This driver can be used for
Tegra186 and Tegra194 chips as well.
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595134890-16470-4-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Resolve linux-5.8-rc3 merge conflicts in k5.9 branch
(currently tracking mainline with linux-5.7.0)
Fix build errors in k5.9 branch after merge of linux-5.8-rc3
bug 200617764
Change-Id: I3a358fef6e8b7c5926fd0de05a03cee539547e8f
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
As part of upstream alignment all audio drivers have been moved to
'tegra' path and are upgraded to work with 5.9 kernel. References
to older versions can be removed now. Earlier these were moved to
retain the commit history.
Summary on files that are being removed:
* Legacy FPGA code is dropped
* PCM driver changes already integrated
* ASoC Utils changes already integrated
* Makefile/Kconfig changes are aligned as per upstream plan
Bug 2845498
Change-Id: I645f94852d7137915ff4045be31e5a943a3fa6b3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2364087
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
ADMAIF default channel FIFO size is different depending on Tegra210 and
Tegra186 (and later). There is a guideline from HW that FIFO size of
ADMAIF channel should be same as the corrpsonding mapped DMA channel.
Commit 8c0d5ea47d21 ("dmaengine: tegra210-adma: override ADMA FIFO size")
updates FIFO size based on 'slave_id' info. Current patch passes the
'slave_id' information to DMA engine.
Following are the original commits from where the changes have been
manually cherry picked.
- commit 34aa1f405069 ("ASoC: tegra-alt: T210 AHUB drivers")
- commit 938afdfeea42 ("ASoC: tegra-alt: Alternative DAPM-based driver")
Also updated copyright info for Tegra PCM driver.
Bug 2845498
Change-Id: I6c748b94544bc22c21a43b731e43862592047c09
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2356716
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Following changes are pushed as part of this commit:
- Update copyright signature as per new format.
- Remove references to "_ALT_" in header macros.
- Fix copyright year for I2S, DMIC, DSPK, ADMAIF and XBAR drivers.
- Fix file name in source header for Machine Utility driver.
Bug 2845498
Change-Id: I18b040a9d48a86a33f3ac6b6932d55e81d6414ac
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2354014
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This is based on the following original commit for 'tegra-alt' version.
Commit fd0548f8eb8f ("ASoC: tegra-alt: Dump APE register for debugging")
Following minor changes are done:
- The device reference is available in component structure and the same
is used to get 'tegra_admaif' structure in *_dump() function. Hence no
need to separately save device reference.
- The pm_runtime_get_*() call on child device will first resume parent
device and hence it would be sufficient to have RPM calls on ADMAIF
device alone.
- Since device reference is available in *_dump() function now, pr_info()
calls are replaced by dev_info().
Bug 2845498
Change-Id: Ib8d8ff7af543a79c34bfa476ddbace1826167a8e
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2354012
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Commit 209e5c7b4144 ("drivers: fix k5.9 build errors") fixes few build
errors, associated with audio, which are required for initial kernel-5.9
setup. However there are functional issues on TOT, where APE sound card
registration fails. The root cause of this problem is because of below
listed changes in ASoC core:
- 'snd_soc_ops' member is removed from 'component_driver' structure.
The PCM callbacks now have to be directly populated in the component
driver structure. ADMAIF and ADSP drivers are updated and Tegra PCM
driver is cleaned up accordingly.
- 'of_node' and 'dev_name' members are removed from 'snd_soc_codec_conf'
structure now and instead wrapper for these is provided under 'dlc'.
- Signature of 'snd_soc_get_pcm_runtime()' has changed now and it no
more accepts DAI link name as argument. But since we require specific
'rtd' based on DAI link names, the older version is duplicated in
machine driver.
- There are changes in trigger() order for start and stop now.
*_trigger_start()
|
|--> rtd trigger()
|--> component trigger()
|--> dai trigger()
*_trigger_stop()
|
|--> dai trigger()
|--> component trigger()
|--> rtd trigger()
Above is resulting in following:
|-> start ADMA
|-> start ADMAIF
|-> ...
|-> stop ADMAIF
|-> stop ADMA (unable to stop DMA channel print is seen here)
Current order in downstream for previous kernel versions is:
|-> start ADMA
|-> start ADMAIF
|-> ...
|-> stop ADMA
|-> stop ADMAIF
This issue is addressed by invoking DMA trigger() call from ADMAIF dai
trigger() itself to avoid the error during stop.
Bug 2845498
Change-Id: I1011555f51f5e0b0a448125a46b47df50e366d6f
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2353304
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This patch registers ADSP device as a component with ASoC core. Necessary
changes are made to work with 5.4 kernel and driver need not register a
separate platform and codec device.
Along with this following cleanup is done:
- Move driver to 'tegra' directory.
- Wherever possible, fix ACV issues in the driver. Not all of them can be
fixed at the moment.
Bug 200593718
Change-Id: Ic60c7f59095bbe9f84d25077e4d4469544ca7783
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.4/+/2342897
(cherry picked from commit d927c5daa951a58924e25d32b8002eb682e43aa0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2353303
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tegra PMC clock clk_out_1 is dedicated for audio mclk from Tegra30
through Tegra210 and currently Tegra clock driver keeps the audio mclk
enabled.
With the move of PMC clocks from clock driver into pmc driver, audio
mclk enable from clock driver is removed and this should be taken care
of by the audio driver.
tegra_asoc_utils_init() calls tegra_asoc_utils_set_rate() and audio mclk
rate configuration is not needed during init and the rate is actually
set during the ->hw_params() callback.
So, this patch removes tegra_asoc_utils_set_rate() call and just leaves
the audio mclk enabled.
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Tegra PMC clock clk_out_1 is dedicated for audio mclk from Tegra30
through Tegra210 and currently Tegra clock driver does the initial
parent configuration for audio mclk and keeps it enabled by default.
With the move of PMC clocks from clock driver into PMC driver, audio
clocks parent configuration can be specified through the device tree
using assigned-clock-parents property and audio mclk control should be
taken care of by the audio driver.
This patch has implementation for parent configuration when default
parent configuration through assigned-clock-parents property is not
specified in the device tree.
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
tegra_asoc_utils uses clk_get() to get the clock and clk_put() to free
them explicitly.
This patch updates it to use device managed resource API devm_clk_get()
so the clock will be automatically released and freed when the device is
unbound and removes tegra_asoc_utils_fini() as its no longer needed.
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
I2S bit clock is derived from PLLA_OUT0 and sample size of 24 bits
results in fractional value. Clock is not accurate because of this
and noisy playback is observed. To avoid this sample size of 32 bits
can be used to derive I2S bit clock. This means there are additional
bit clocks (8 cycles) per channel which are ignored. Codec picks up
data for the other channel when LRCK toggles. The same is true for
capture as well.
For I2S Tegra-Slave mode this problem is not seen because the clock
signals are driven from the codec and above fix is not necessary for
it.
Bug 200594265
Bug 2845498
Change-Id: Ifa17e65a814fab060ab4762d19edfe34420524ce
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2303591
(cherry picked from commit 1bc9e1904454b359361da6682517952fd0108b46)
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.4/+/2312716
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This reverts commit 9ac3457ed88631ef035fe9aa6baa4ce0cf2d5d5d
There are some conficts mainly because the revert is being done
on 5.4 kernel drivers and these are resolved manually.
Tegra can support S24_LE and the way it works is as follows.
* S24_LE is a 32-bit container with 24-bit data in LSBs and the
DMA is configured for 32-bit.
* When ADMAIF client channel is configured for 24-bits, it picks
up 24-bit(starting from LSB) from the ADMAIF FIFO. Higher 8-bits
are sign extended.
Earlier the confusion was primarily because of the way data gets
picked up from FIFO and the way data conversion happens at CIF.
Bug 200590182
Bug 2845498
Change-Id: Icd0d9fb8fdd0a08d39cb45d23b3f441eaba5a98c
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.4/+/2308468
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
As part of upstream alignment all drivers are moved to "tegra" path and
"utils/tegra210_xbar_utils_alt.c" is no more used now. Hence this patch
removes this source file. The helper functions are already moved to AHUB
driver. Currently there are other files related to ISO BW manager, ADSP
audio and FPGA in "tegra-alt" path. These will be cleaned up in subsequent
patches.
Bug 2845498
Change-Id: Iee52eb71bbc3c1996ea75777d3806ef76652848c
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.4/+/2307646
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
There seems to be kernel panic happening when rt5659_set_jack_detect()
is called from the machine driver.
For now the jack detection is disabled to unblock 5.4 bringup and
can be separately tracked. A FIXME item is put. Once the issue is
resolved this patch can be reverted.
Bug 2845498
Change-Id: Ieb67e783a1dbcfb9ebbeb2bf301a818c94e38457
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
DAI link structure has changed in 5.4 and memory needs to be allocated
for DAI link cpu/codec/platform components. The same is done with the
current patch to avoid the crash.
Bug 2845498
Change-Id: I2d69517120b6debbd0bb8d6a51ab9c5f6d47a401
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
This patch enables Tegra machine driver used on Jetson platform.
Tegra210 and later Jetson platforms use the same machine driver.
Following is the summary from the patch:
* Enable the driver build in defconfig
* Remove "tegra-alt" ASoC utility file
* Renmae "tegra-alt" parser source file "tegra_asoc_dt_parser.c"
to "tegra_asoc_machine.c" and move it to "tegra" directory.
* Similarly "tegra_asoc_machine_alt.h" is renamed to
"tegra_asoc_machine.h" and moved to "tegra".
* Updated "tegra" ASoC utility files for supporting Tegra210 and
later.
* Rename machine driver file.
* The older parsing code is removed.
Bug 2845498
Change-Id: I42d9d2da59febb99ce00a29ce65d7a16f96b1327
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Following AHUB modules are considered as part of this series. This updates
all drivers to use component structure. Initially AHUB, I2S, DMIC, DSPK
and ADMAIF drivers were updated.
FPGA code is removed from the related drivers. This can be cherry-picked
if it is really required.
Bug 2845498
Change-Id: Ia3f60257c225d281d86ad83325fb517969259cb4
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
For upstream initially ADMAIF and I/O modules are considered. And the
these drivers are rebased in previous commit. This patch tracks the
addition of DAIs in AHUB driver which are needed for other AHUB modules.
Bug 2845498
Change-Id: I16e04a3bcf1118d66a57da2db07c3155ec9fe1a3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
AHUB and few components have been pushed for upstream review. Though the
changes are still under review, we can leverage the work done on upstream
5.x and use the same here on 5.4 kernel. This helps to align the downstream
code. Any changes that happen because of upstream review can be cherry
picked here. If we plan for any downstream changes, upstream patch needs to
be pushed to keep the code in sync.
As of today current snapshot is pulled from v3 of AHUB series,
http://patchwork.ozlabs.org/project/linux-tegra/list/?series=159664
Above series was worked on later versions of linux-next and hence following
are the changes required for porting back on 5.4
* tegra_pcm_new() and tegra_pcm_free() are exposed from tegra_pcm.c and
component driver callbacks use these.
* Callback functions required for snd_pcm_ops in component driver are
implemented by tegra_pcm.c
* With this ADMAIF driver need not register platform device with ASoC
core.
For components (AHUB, ADMAIF, I2S, DMIC and DSPK) the downsream code
differs in few aspects from the code that was pushed for v3. Some of them
are listed below.
* I2S driver in downstream implements startup()/shutdown() calls for DAI,
which does some setup related to pinconfig and regulators. The same is
true for DMIC and DSPK drivers as well.
* Downstream ADMAIF drivers makes bandwidth requests in startup/shutdown()
calls and has helper function for dumping registers. It also has
additional DAI interfaces which are used for ADSP audio.
* Downstream AHUB driver has DAI interfaces for connecting to all other
modules.
These differences will be cherry-picked as and when it is necessary.
Bug 2845498
Change-Id: Id374967ecae26f6b7334a959fb23308d383c15f2
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Tegra210 and later audio drivers have been using 'tegra-alt' directory
from the beginning. As per the upstream roadmap, we plan to use the
same 'tegra' directory and place all the drivers under it. This patch
thus moves all the drivers to 'tegra' and renames the files accordingly.
The '_alt' suffix is removed from header and source files.
For some files still the '_alt' suffix is retained because 'tegra'
already has the corresponding files. Manual merge of following files is
needed and will be done in separate commits.
* tegra_asoc_utils_alt.c and tegra_asoc_utils.c
* tegra_asoc_utils_alt.h and tegra_asoc_utils.h
* tegra_pcm_alt.c and tegra_pcm.c
* tegra_pcm_alt.h and tegra_pcm.h
* Corresponding Makefile and Kconfig files.
* Source files related to ADSP audio, FPGA, bandwidth manager are not
considered at the moment and will be tracked separately.
Bug 2845498
Change-Id: I51dae3971c72b58d921dc19f0553a83422fd3f9e
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
AHUB clock currently uses pll_a_out0 derivative clock from plla source
but the max frequency for pll_a_out0 was limited to ~49MHz to derive
all possible clock rates for i2s sampling rates. This limits the AHUB
clock rate to be used at peak possible rate for ahub which can help in
some high bandwidth usecase. Considering this AHUB rate can be derived
from PLLP clock to support max possible rate for AHUB.
Making use of assigned-clock-rates and assigned-clock-parents to set the
desired settings as per dvfs table for a given platforms.
Bug 200537672
Change-Id: Ica556fc68456b52516c82b6601b54cae0b5d1b73
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2204283
(cherry picked from commit add574aa21b447b61391f51650fe52175190064b)
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Change-Id: I655337be86d37b05843a9a9b4238001779653eeb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2280448
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Following print is seen while using regmap_read_poll_timeout() macro
in snd_soc_dai_ops trigger() callback in ADMAIF driver,
*** BUG: scheduling while atomic ***
and kernel panic happens there after. This happens because above macro
is not atomic safe and trigger() is called in atomic context.
Earlier this addressed by using readx_poll_timeout_atomic() macro.
Though this works fine driver needs to keep a reference to base address.
To avoid this new macro was pushed and is accepted in upstream and
following is the commit - https://lkml.org/lkml/2020/1/9/985
This patch makes use of regmap macros where there is a need of timeout
functionality. Following is the guideline that can be followed.
* use regmap_read_poll_timeout_atomic() where the caller is in atomic
context.
ex: trigger() etc.,
* use regmap_read_poll_timeout() when the caller is known to be running
in non-atomic context.
ex: hw_param(), prepare() etc.,
Based on this audio drivers are updated. ASRC and ARAD drivers will be
taken up in a separate change.
Bug 200566596
Change-Id: Iea88adc60de5919e456a36a30152212652a8ecd3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2274874
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This patch optimizes following functions on the usage of local
variables and removal of redundant loops, thus making these
functions more readable.
* tegra_xbar_get_value_enum()
* tegra_xbar_put_value_enum()
Bug 200503387
Change-Id: I32989d0cf46ad50bf47a0127bac1eb7c1ed32ff2
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2268611
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
S24_LE is a 32-bit container with 24-bit data in LSBs, with zeroes in
most significant byte. S32_LE can act as 32-bit container for 24-bit
data where data is pushed to MSBs and zeroes are filled in least
significant byte. For example below is how the data is represented
for different containers, where 'abc' is 24-bit data.
0abc (S24_LE)
abc0 (S32_LE)
As per IAS, most significant bits are pushed first when data moves
in AHUB. For any down conversion LSBs are discarded, where as for any
up conversion, zeroes are filled in the LSBs. Hence extraction of
S24_LE results in data loss. Mentioned below are some of the examples
to illustrate this.
Consider for playback path, where data flow is from memory to AHUB and
its clients, where 'abc' is valid data and 'x' is to ignore.
* S32_LE
abc0 --> audio = 32, client = 32 --> abc0
abc0 --> audio = 32, client = 24 --> abcx
abc0 --> audio = 32, client = 16 --> abxx
* S24_LE
0abc --> audio = 32, client = 32 --> 0abc
0abc --> audio = 32, client = 24 --> 0abx (data loss)
0abc --> audio = 32, client = 16 --> 0axx (data loss)
Thus this patch removes S24_LE format from the drivers since Tegra audio
HW is not designed to support this. Also S24_LE is not a commonly used
format.
Bug 200568187
Change-Id: I778d2f70527c17f00728fce75fe152d902c5aaa0
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2264822
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Viswanath L <viswanathl@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>
XBAR related code is currently put under source files "tegra210_xbar_alt.c"
and "tegra210_xbar_utils_alt.c". For upstream we are planning to use a
single source file. Thus code in downstream is re-organized so that all
XBAR code is moved under a single file.
Following is the summary of changes,
* All XBAR specific code is moved under,
"tegra210_xbar_alt.c" and "tegra210_xbar_alt.h"
* Only common code, which is required for other modules, remains in
"tegra210_xbar_utils_alt.c"
* unused macros or functions are removed
Bug 200503387
Change-Id: I11cb93d3cdc07e14ef2e0b3b23ba6a98020a0373
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2265584
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Currently in downstream,
* we pass FSYNC width from DT for LRCK and FSYNC modes. We also have a
mixer control to override the width. If the property is missing a
default width of "31" is set.
* DT property, "enable-cya", is used on Tegra210 to enable pad controls
for I2S4. This is not required for other instances of I2S on Tegra210
and not required for any instance on Tegra186/Tegra194.
With current patch,
* DT property "fsync-width" is removed
- LRCK mode does not require FSYNC width to be configured.
- Reset value (one-bit-clock wide) is what we are using for DSP modes.
- If specific width needs to be configured, mixer control is already
available. Generally for FSYNC modes, the width depends on the codec
and in such cases mixer control is helpful.
* DT property "enable-cya" is removed
- By default the corresponding bit is enabled.
- For other instances of I2S on Tegra210 and for any instance on
Tegra186/Tegra194, this bit is unused.
* updated the channel that needs to be used for CIF and I2S control.
For example, for CIF configuration audio channels is used and
for BCLK rate or channel bit count calculation, client channel is
used.
* helper function tegra210_i2s_set_timing_params() is added to program
I2S clock and timing related registers.
* I2S global enable is moved to default list. The enable status on TX/RX
channel is controlled via DAPM widget.
Bug 200503387
Change-Id: Iafe62e8816f6d8702a325c8466d6b6fda5514d66
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2244478
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Currently CIF channels are overridden based on mono/stereo settings.
This can be problematic for multi-channel use cases or the cases where
user is intentionally overriding channels through mixer control. In such
cases hard coding based on CIF mono/stereo settings can result in wrong
behavior.
Following are the changes in current patch,
* Decouple CIF mono/stereo and CIF channel settings. It means that, user
can override audio channels and CIF settings independently. Also these
controls are provided for both playback and capture paths.
* For ADMAIF, channel overrides are provided for both audio and client
channels in both playback and capture paths.
* For I2S, separate channel overrides for client channels is not needed
in playback and capture paths. Hence a common client channel override
control is provided. However for audio channels it is similar to the
controls provided for ADMAIF.
* Similar to channels, for I2S, audio bit format control is updated and
provided separate controls in playback and capture paths.
* "None" option is removed for mono/stereo to match HW register spec.
Earlier channel was hard coded based on this.
* For I2S, audio channels are used for CIF configuration and for the slot
control client channels are used (earlier audio channels were getting
used for slot control)
* For upstream, we are standardizing mixer control names. For now, only
relevant controls are updated. Going forward we need to take similar
approach for all controls/modules. This needs to be reflected in
test scripts and documentation as well.
Bug 200503387
Change-Id: I04df9a3bda41e028edc46e86ecd1d80966bc83e1
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2244477
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
ADMAIF may hit timeout in closing sequence, if some bits remain
unconsumed in FIFO, which may happen if the sink gets closed/blocked
ahead of source. As such the status register of ADMAIF remaining
uncleared is not a catastrophic error and the channel will be
available after reset, hence timeout merits a warning print.
Above issue gets hit in two test scripts:
- tegra-audio-amx-to-adx.sh, where closing aplay at any one input
port of AMX causes the module to block other substreams. This
is a HW bug, fixed in T194 upwards.
- tegra-audio-admaif-testsuite.sh, where running aplay and arecord
without any flow control does not ensure that aplay always drains
its bits.
The warning print here, in playback path, is whitelisted for GVS runs.
Bug 200569324
Change-Id: I12984d08c6f43f41f3b85bb066d42b6883249060
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2258180
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
For AHUB modules instance number is passed with a DT property. For example,
"nvidia,ahub-i2s-id" property is used in I2S nodes. Similarly other modules
use "nvidia,ahub-<module>-id" property, where <module> is "dmic" or "dspk"
or other corresponding module names. With DAI links in DT now, this is not
required any more. Hence the parsing code for such properties is removed.
Bug 200503387
Change-Id: Ia372044ebecfe090668953b8da81028c63812a4f
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2146859
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>