Commit Graph

15 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
Sameer Pujar
38c963de57 ASoC:tegra: Remove OOT reference from compatibles
Kernel OOT audio support uses different compatibles to pick specific
OOT drivers for audio. This method requires additional compatible
overrides in the DT overlay which is not a very flexible way to pick
driver modules.

It is possible to pick specific driver modules by adding the not
needed ones to the denylist in the configuration files in the
'/etc/modprobe.d/'. This means different compatibles are not
necessary and modules can be filtered based on the name in
configuration files. With this it will be easier to switch between
driver modules and also will reduce the overrides in the overlay.
Thus remove all 'oot' reference from the driver compatibles.

Bug 4119612

Change-Id: I9496a7daf8b9c75c68b83557198a59f7d3903522
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2927028
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sheetal . <sheetal@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Tested-by: Sheetal . <sheetal@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-05 14:42:00 -07:00
Sameer Pujar
66a89e5506 ASoC: tegra: Add 'oot' suffix in compatibles
The audio drivers are getting upstreamed continuously with incremental
feature support. However, the OOT version of driver will be used till
all features are available from upstream driver.

Add the "-oot" prefix in the driver's name so that OOT version of driver
can be selected from the device tree file.

Bug 3583581

Change-Id: Iacc55c05bf07d6cc4a0d9745903b0fa92e60d9b3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2866070
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Sheetal . <sheetal@nvidia.com>
Tested-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-31 13:27:13 -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
c4ab6f5a0e ASoC: tegra: Align with new device model
PEQ and MBDRC are sub blocks of OPE module. So far, these sub blocks
were not represented by separate device nodes in DT. This has changed
now where PEQ and MBDRC are children of OPE block. For now the driver
structure is maintained as it is and explicitly parse PEQ and MBDRC
nodes to create corresponding regmap interfaces. With this there is
flexibility now to create separate device drivers for PEQ and MBDRC
if necessary in future.

Bug 3583581

Change-Id: I16ceb9b1a30b4ddb1a57fdef28db20c554c58b03
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2783022
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:57 -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
Mohan Kumar
85258fddea ASoC: tegra: Add support for S24_LE format
Add support for S24_LE format for all internal and IO AHUB
modules.
- Make the data to be S32_LE internal to AHUB modules.
- Conversion from 24 to 32 or vise-versa will happen at ADMAIF, or
at the IO modules CIF to maintain consistency across modules.

Bug 200755886

Change-Id: I175e4177ec76baf7ead9b89276a70a4b454756fa
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2578280
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:50:28 +05:30
Sameer Pujar
ae473fa8b4 ASoC: tegra: OPE DAPM path uses wrong regmap
OPE enable is not happening even though the DAPM path is complete.
This seems to happen because ASoC core does not use correct regmap
interface for the DAPM route listed by driver. The driver makes use
of multiple regmap interfaces (one each for OPE, PEQ and MBDRC).
The core populates component regmap using dev_get_regmap(), which
actually returns the last registered interface in the OPE driver
probe() call.

Since the same callback function is not available in later versions
of kernel for component driver, use component probe() call to setup
the regmap.

Bug 200750067
Jira EMA-393

Change-Id: Ib509a9f95f4c152c2210f88975a1f7572d79ba08
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: http://git-master/r/1318570
(cherry picked from commit 545ee019fc4a7c5b0b92a488cd3d16dbbcefbba9 in
partial and updated logic for it to work on newer kernel)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2558375
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sheetal . <sheetal@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Sheetal . <sheetal@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:50:28 +05:30
Sameer Pujar
b754b2459e ASoC: tegra: Populate non_legacy_dai_naming flag for codec components
The simple-card or audio-graph-card mark the DAI links as codec2codec
if all the components in a link have "non_legacy_dai_naming" flag set.
Thus populate this flag for all codec components.

Bug 200692799

Change-Id: Iaf7a030a0603034a1c594b9952bd8dbcf0551ef8
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
2022-09-29 15:50:28 +05:30
Sameer Pujar
576a3a348a ASoC: tegra: Simplify various API usage (Tegra210 and later)
Some of the upstream comments on intitial driver upstream phase were
generic and are equally applicable to remianing set of drivers. Thus
following changes are made based on this:

  - Remove explicit of_match_device() from drivers which don't have to
    maintain chip specific data.
  - Replace both platform_get_resource() and devm_ioremap_resource() with
    a single API devm_platform_ioremap_resource().
  - Use devm_snd_soc_register_component() and re-order pm_runtime_enable()
    in probe() function. The remove() path need not explicitly unregister
    the component.
  - Use 'err' variable instead of 'ret' for function returns and error
    checking.
  - Remove explicit runtime_suspend() call from remove() path.
  - Use consistent error print patterns across drivers
  - Some cosmetic changes

Bug 200698314

Change-Id: Id53420aab863062d7a5cf4aa5171b1af038ce83f
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
2022-09-29 15:50:28 +05:30
Sameer Pujar
b32bd99824 ASoC: tegra: Trivial cleanup (Tegra210 and later)
This performs following trivial cleanup:
  - Remove explicit THIS_MODULE assignment in platform_driver struct.
  - Remove DRV_NAME macro and assign the name directly in platform_driver
    struct.
  - Add SPDX-License-Identifier to header files
  - Sort header file inclusions

Bug 200698314

Change-Id: Ic1e2166b6a8257cd3b462cc8b2a9719e25c7bbb8
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
2022-09-29 15:50:28 +05:30
Sameer Pujar
fe40005d9b ASoC: tegra: cosmetic changes for Tegra210
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>
2022-09-29 15:35:11 +05:30
Sameer Pujar
0978d6b988 Revert "ASoC: tegra-alt: remove S24_LE format"
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>
2022-09-29 15:30:21 +05:30
Sameer Pujar
ec0813dbd1 ASoC: tegra: move remaining AHUB devices to component
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>
2022-09-29 15:30:21 +05:30
Sameer Pujar
39e4507117 ASoC: tegra: merge 'tegra' and 'tegra-alt' directories
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>
2022-09-29 15:30:21 +05:30