Commit Graph

13 Commits

Author SHA1 Message Date
Jon Hunter
59b14ea0b8 ASoC: tegra: Avoid kernel version checks
Rather than using kernel version checks to determine which kernel APIs
to use, add the necessary tests to the conftest script to determine
which kernel APIs are present in the kernel.

Note that the function snd_soc_dai_init_dma_data() has been present
in the Linux kernel since v3.13 and so use this for all kernel versions.
In Linux v6.3, the 'playback_dma_data' and 'capture_dma_data' members of
the snd_soc_dai_driver structure were replaced and so these could no
longer be set directly. However, the arguments to
snd_soc_dai_init_dma_data() have not changed and so can be used for
older kernels and well has the current.

This is beneficial for working with 3rd party Linux kernels that may
have back-ported upstream changes into their kernel and so the kernel
version checks do not work.

Bug 4221847

Change-Id: Ibac0c6bab78e93f03981dfe3d1b2025ea19d4c92
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2993795
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-12 20:29:24 -07:00
Jon Hunter
2cc58560db ASoC: tegra: Fix build for Linux v6.4
In Linux v6.4, the 'params' member of the snd_soc_dai_link was replaced
with the 'c2c_params' member. Add a new test to the conftest script that
checks if the 'c2c_params' structure member is present and use the
definition created by conftest to select which structure member is used.

Bug 4221847

Change-Id: I7ebb4187fd1cd70097bf65409bda3b2a6830a303
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989731
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-07 13:03:26 -07:00
Sameer Pujar
1e35fdd8c5 ASoC: tegra: Align with upstream DT for compatible and clock name
It is nice to have downstream DTB working well with upstream kernel
drivers. This gives a flexibile option for users to choose between
out-of-tree and upstream audio drivers by selectively adding either
of these to deny list.

For clock PLLA_OUT0, upstream DT uses 'plla_out0' clock name where
as downstream uses 'pll_a_out0'. So aligning with upstream DT makes
probe to fail. Thus update the clock name in driver to match upstream
DT bindings.

The sound DT supports compatibles to either work with upstream or
downstream machine drivers. Earlier the source 'tegra_codecs.c' was
modified to make it potentially usable for upstream machine driver
as well and thus it has upstream compatible checks. This check is
now replaced with a flag which is known to be set only during
upstream machine driver probe.

Bug 4119612

Change-Id: Icd5d97343029e35a5702ff4dc527881fb9277346
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2948525
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-10 00:33:15 -07:00
Mohan Kumar
c9217a1b82 ASoC: tegra: Fix build for Linux v6.1
Upstream Linux kernel commit 3989ade2d1e7 ("ASoC: soc.h: remove
num_cpus/codecs") removes the 'num_cpus' member from the
'snd_soc_pcm_runtime' structure because this is also available under the
dai_link structure. This breaks building the Tegra ASoC drivers for
Linux v6.1 and so update the Tegra ASoC drivers to align the latest
mainline.

Bug 3772918
Bug 3890034

Change-Id: If436222ec9e9a97acf82d50c5f9ce80e08ca1f1c
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2819691
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-07 01:54:06 -08:00
Mohan Kumar D
f9d418aa6a Revert "Revert "ASoC: tegra: Single cpu multi codec dai support""
This reverts commit 43ae0060cd.

Reason for revert: Fixed the build issue on sidecar branch

Bug 3772918

Change-Id: Ib02496f93fe79aec04f3b5b1c78a5681b1e56819
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2819603
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-07 01:53:53 -08:00
Armandeep Singh
43ae0060cd Revert "ASoC: tegra: Single cpu multi codec dai support"
This reverts commit dc9fe67430.

Reason for revert: Causing GVS build failure

Change-Id: I7d021a38792cb928461ef4acc1f9f8443b9ede8d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2819363
Tested-by: Armandeep Singh <armandeeps@nvidia.com>
Reviewed-by: Armandeep Singh <armandeeps@nvidia.com>
2022-11-30 17:34:53 -08:00
Mohan Kumar
dc9fe67430 ASoC: tegra: Single cpu multi codec dai support
Add driver support for single cpu dai connected to multiple
codec dai.

Tested on Concord board with one DSPK cpu dai connected to
two TAS2552 codec dai present on Super-io module connected
to 40 pin header.

Bug 3772918

Change-Id: I6cf33c2a4736dc27a44b5db136ebabe88f55ab65
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2795021
(cherry picked from commit 8e2485e8ff53581acb4aa6fae739114490c77238)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2815755
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-30 06:24:18 -08:00
Jon Hunter
541420a420 ASoC: tegra: Fix build for Linux v6.1
Upstream Linux kernel commit 3989ade2d1e7 ("ASoC: soc.h: remove
num_cpus/codecs") removes the 'num_cpus' member from the
'snd_soc_pcm_runtime' structure because this is also available under the
dai_link structure. This breaks building the Tegra ASoC drivers for
Linux v6.1 and so update the Tegra ASoC drivers to align the latest
mainline. Note that this also works for earlier kernel versions and so
no need to check for kernel version.

Bug 3835208

Change-Id: Ib846e937d761b65276ace73f7817ef8bd21c21d8
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2795754
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-21 05:54:58 -07:00
Sameer Pujar
47b127bd17 ASoC: tegra: Fix build errors with kstable
Build errors seen in following contexts with kstable:

  - The 'non_legacy_dai_naming' flag is not available in struct
    'snd_soc_component_driver' in v6.0. Instead it is replaced
    with flag 'legacy_dai_naming' and default value works fine.
    To fix build error on kstable exclude the removed flag for
    kernel v6.0 onward.

  - Signature of snd_soc_card_jack_new() has changed in v5.19
    which drops struct 'snd_soc_jack_pins' related members. These
    were unused for Tegra and is safe to just update the funcion
    call. Fix this by using correct function signature based on
    kernel version checks.

With above fixed now, remove workaround from Makefile and enable
Audio OOT driver builds again with kstable.

Bug 3831575

Change-Id: I7b65c89e8140f6e085528fb827d47c3909233db1
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2793430
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-19 11:57:01 -07:00
Sameer Pujar
796fd3534c ASoC: tegra: Fix header paths
OOT drivers cannot directly access private headers of core kernel.
This is a standard policy adopted by kernel distributors and to
workaround this problem copy headers to OOT path. Update the usage
references as well.

Bug 3583581

Change-Id: I1b99e17c60294a1cb257eb5b80837faa896d3f8d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2774429
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-01 10:51:21 -07:00
Sheetal
9841017f33 ASoC: tegra: Add internal PLL support for RT5640
RT5640 codec has internal PLL which can be used to
derive SYSCLK and internal PLL can take I2S BCLK as a
reference clock

Bug 3520437

Signed-off-by: Sheetal <sheetal@nvidia.com>
Change-Id: I3b88d3bf75146532bda669d961c6ff6bb52603f5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2662478
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:57:12 +05:30
Sameer Pujar
7d0726f36b ASoC: tegra: Add support for RT5640 codec
Due to a shortage of RT5658 codec parts, search was going on for an
alternative codec. As a replacement, RT5640 codec is finalized now.
The upcoming Concord boards (EB3 to begin with) will have this codec.
This commit adds required support in the machine driver.

Machine driver update is needed for following reasons:
 * The RT5640 codec driver expects sysclk configuration from machine
   driver. This requirement is similar to what we have today for
   RT5658 codec. This handling is done under "rt5640-playback" DAI
   link name.

 * RT5640 DAI link init is added for jack setup. Since it is mostly
   similar to RT5658 handling, the existing init helper function is
   re-used. The component driver jack setup callback is used to make
   this simple.

Bug 200766032

Change-Id: I41ee0022c22fd50e9baf80aa765b2b3ede4e85c7
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2625064
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
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>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:50:28 +05:30
Sameer Pujar
ae9fe52e1e ASoC: tegra: External codec setup in Tegra audio graph card
Tegra platforms support multiple external codecs which in some cases
require initial setup or runtime setup. Since common machine driver is
used, it uses DAI link names passed from DT to apply specific settings.
Use the same logic for Tegra audio graph card driver as well. In doing
so separate out codec setup part and move the same to tegra_codec.c
source file. This is reference in current downstream machine driver
and future Tegra audio graph card driver.

Going ahead alternate solution need to be identified to avoid dependency
on DAI link names. Upstream generic audio graph driver does not support
such method and passing DAI link names from DT won't be entertained in
upstream.

Bug 200692799

Change-Id: I40d134e89405fd8bb2d9aebfe2bce82816b545bd
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
2022-09-29 15:50:28 +05:30