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>
Currently we maintain auxdata structure for Tegra210 and Tegra186. This
is nothing but a lookup table used for device names and platform data.
It is used to override device names when creating devices from DT. Since
we have moved all DAI links to DT and no more we rely on device names,
automatically generated device names should be good enough. Hence this
patch removes auxdata table and dev_set_name() calls from XBAR, AMX
drivers.
Some of the embedded platforms are using older machine utility code,
which are using these names. Hence the utility code is also updated to
use automatically generated device names.
Bug 200503387
Change-Id: I80c4fb3a5927001f58a54ca90437ec67ed14bf54
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2258385
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@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>
Machine DAPM widgets are currently defined in the driver and are used
to connect to DAPM input/output widgets of external codecs. This routing
map is exposed from DT. Since the machine driver is common to multiple
platforms, all widgets defined in the driver are not always required.
Instead of statically defining the widgets in the driver, these can be
exposed from DT. Any platform DT can then add required number of widgets
and can define a corresponding routing map.
This patch removes the static array for DAPM widgets and instead helper
function, snd_soc_of_parse_audio_simple_widgets(), is used to populate
given DAPM widgets for the sound card.
Bug 200503387
Change-Id: I8ff9f0d52e3c1cc10b6ab1682d05a7b7ef7e2684
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2257383
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Currently we are using static DAI links in machine-utils code and there
are some drawbacks associated with it.
* All DAI links are enabled, even though if a platform does not require.
For ex: ALSA ring buffers are allocated for all the ADMAIF PCM links.
Some platforms might want to enable a very few links, which is not
currently possible with static array in the driver code.
* No way to disable specific modules from DT. For example if any of the
module instances are disabled, sound card registration fails.
* CPU and CODEC names are hard coded in the DAI link arrays. With this
we need to pass instance-id properties from DT to identify or match
the correct instance names.
* One of the other concerns is about latency, where some platform want
to optimize this by only enabling required links.
Above issues can be addressed with DT based DAI links and going ahead
plan is to use upstream style of DT binding. This patch includes following
changes.
* Add new helper functions to parse all DAI links from DT. All code
related to this is added in a new file.
* Remove older helper functions for parsing. Please note that, not all
functions can be removed since few machine drivers rely on them.
* Common params structure is used for all codec-to-codec links. In machine
driver hw_params() callback all DAI link params are updated. Hence it
is not necessary to maintain separate structures.
* By default card->dapm.idle_bias_off is set to true. This means, codec
suspend() won't be called during STANDBY. The flag is set to true for
Tegra210 as well, where earlier it was set to false. This further helps
to remove soc_data structure.
* Module specific checks are not needed to manage DAI links now.
Bug 200538260
Change-Id: I210b70c23a8878f5b1733dfa9d2010834ae4a85a
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2229358
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-Avoided double compilation of machine driver as mobile
platforms >= t210 have common machine driver, through a
common config
-Removed SND_SOC_ASOC_MACHINE_ALT, SND_SOC_TEGRA_ALT_FORCE_CARD_REG
config as its not being used
Bug 200540133
Change-Id: I57271888581d6494e771be77a8fd2fe5b5adb015
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2233907
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@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 SW reset and register status polling timeout code is used in multiple
drivers. Since the logic is similar, the same code is duplicated at many
places. This can be avoided by relying on the kernel macro which provides
similar functionality, where sleep between polling and timeout can be
explicitly provided. For example, ADMA driver is using a similar kernel
macro and this can be used for Tegra ASoC drivers as well.
Currently this patch updates timeout code for ADMAIF and I2S to start with.
This helps for upstream as well. Other drivers will be taken care in a
separate patch. In doing so following changes are also needed,
* Few functions are optimized to simplify the code during stream start or
stop. This basically combines RX and TX handling in a single function
and thus helps to avoid code duplication.
* For ADMAIF, macros are used wherever register access for RX and TX paths
are needed. Existing CH_REG() macro is updated to facilitate this. RX
and TX paths can use CH_RX_REG() and CH_TX_REG() respectively to get
proper register offset. Accordingly the access is updated in the driver.
Bug 200566596
Bug 200503387
Change-Id: I6d46518dba09a936ad84799943eba8976a261faa
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2241448
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jonathan Hunter <jonathanh@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>
The I2S interfaces only support configurations where both the bit clock
and frame sync are master or are both slave. Therefore, remove support
for modes where the bit clock is master and frame sync is slave and
vice-versa from the 'I2Sx codec master mode' mixer controls.
Bug 2046053
Bug 2746555
Change-Id: I288a1a372fe200b5faf2eb0f3d7c481a34c1f545
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2230060
(cherry picked from commit 79a002b42a9c25cd26832c967f95f82e08935ca9)
Reviewed-on: https://git-master.nvidia.com/r/2237275
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>
Each I2S interface has a mixer control 'I2Sx codec master mode' to
set the master mode and 'I2Sx codec frame mode' to set the frame mode.
An issue with these mixer controls has been found where if the user
sets both of these, then whatever is set last will overwrite the other
resetting it back to its default value. For example, if 'I2Sx codec
master mode' configures the codec as the master, then set the 'I2Sx
codec frame mode' to say 'dsp-a', then setting the frame mode will
revert the master mode setting back to its default. Fix this by
ensuring the frame mode and master mode do not overwrite each other.
Bug 2046053
Bug 2746555
Change-Id: Ibd51a0462a4c02055075aee84808f7ddca0a9199
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2230059
(cherry picked from commit 70c45f196b76ce0d5e1e76153232cb3d35928262)
Reviewed-on: https://git-master.nvidia.com/r/2234917
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 is a preparatory patch for moving all DAI links to DT. With DT based
DAI links, we need to index through the DAI array. There are differences
between Tegra210 and Tegra186, which are listed below.
* OPE2 is removed in Tegra186
* AMX and ADX instances are increased to 4
* DSPK, ASRC and ARAD are added
* DMIC instances are increased to 4
* I2S instances are increased to 6
* ADMAIF channels are increased to 20 each for Tx and Rx
Above makes us to have separate headers in DT, containing macro defines,
for Tegra210 and Tegra186. This can be avoided by re-ordering the DAI array
to list common DAIs in the beginning and push the differences at the end.
As we can see adding instances can be easily handled by just listing out
the new DAIs at the end. But problem is when we remove an instance and it
requires some intelligence encoded in header files for optimization. In the
current case, OPE2 is being removed from Tegra186 onwards and hence this is
pushed to the end of Tegra210 DAI array.
Bug 200538260
Change-Id: I8f976ce08d6526357ab4578fa462ab53113c674d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2220276
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@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>
This is a preparatory patch for moving all DAI links to DT. With the DT
based DAI link approach, we need to index through the DSPK DAI array to
reference a particular interface. This patch re-orders DAI array to be
consistent with other drivers, where we always first list CIF DAI and
then followed by DAP and Dummy (wherever applicable). DT can use macros
for these indices and can be common if the same order is followed for
all modules.
Bug 200538260
Bug 200520821
Change-Id: Ib3ced6078b73bdf542891e28d8081e3dd38e1ab5
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2220275
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@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>
This is a preparatory patch for moving all DAI links to DT. Currently
ADMAIF is registering both a component and a codec. Also it maintains
two DAI arrays, tegra210_admaif_codec_dais[]/tegra186_admaif_codec_dais[]
for codec and tegra_admaif_dais[] for component. With the DT based DAI
link approach, we need to index through the DAI array depending on the
"sound-dai" property that cpu/codec subnodes of the dai-link can expose.
The sound core is looking at *_codec_dais[] array while getting the DAI
name from index and does not consider component DAI array. Similarly this
is true for ADSP device as well.
This patch combines both DAI arrays and registers ADMAIF and ADSP as a
codec device alone. Later versions of kernel move from codec to component,
during that transition we can register ADMAIF device as component only.
Also, for ADSP, hard-coding of DAI ID is avoided which further helps to
index the required DAI from DT. The fe_reg/be_reg value calculation, which
depends on the DAI ID, is updated accordingly.
Bug 200538260
Change-Id: Ia65b6c52796d3da73850ce1de6bf332ac723b871
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2218928
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jonathan Hunter <jonathanh@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>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
To allow loopbacks or dummy playback/capture from I/O modules to work
we have connected DAI links to spdif-dit dummy codecs, since generally
not all I/O modules have external codec connection. This helps to close
the DAPM path and audio path can be tested. The links or information
for these is exposed from DT.
In doing so, we require many instances of spdif-dit devices. For example,
for Tegra194 we have 6-I2S, 4-DMIC, 2-DSPK I/O modules. Hence we need
a maximum of 12 such spdif-dit codecs. This is populated in DT by exposing
entries for all these. Machine driver exposes routing paths for these with
random "prefix" naming.
Above can be easily avoided by doing following.
* Expose dummy DAIs for I/O modules and routing path in module drivers.
* Dummy speaker output and mic input DAPM widgets are added for path
completion.
* Routing path is added for connecting above.
* By default for all the instances of I/O, connect the modules to dummy
DAIs. This way we can make sure that the DAPM path is complete by
default.
Bug 200516191
Bug 200520821
Bug 200503387
Change-Id: I3bb34ae6e62f61b5b3e693c746cac6c312775912
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2177821
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>