Commit Graph

16 Commits

Author SHA1 Message Date
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
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
Sameer Pujar
9d520f3d07 ASoC: tegra: Don't deprecate master volume control
There was a plan to deprecate master volume control since it was thought
that per channel control will be sufficient and master volume application
can be emulated in user space by programming same volume to all channels.
But this means we would not really use a HW feature which has a provision
to automatically apply CH0 volume settings to all remaining channels.

HW has a per channel control bit, based on which it decides to apply a
channel specific setting or a common setting across all channels. Driver
has both master volume and per channel volume mixer controls. Based on
the control user updates, enable or disable the per channel control.

Use below scheme for volume updates:

 * If master volume mixer control is updated, disable per channel control
   and only CH0 volume register is programmed. SW can store same volume
   across all channels.

 * If a channel specific control is updated, enable per channel control
   and program specific channel volume register.

Above applies to mute/unmute functions as well and thus corresponding
control blocks are similarly updated.

The volume settings are stored in SW and the same is used for the user
space queries via mixer controls. But mute settings are not stored in
SW and are always directly read from HW since it belongs to a volatile
register. The mute control read function is modified to return proper
settings when queried from user space.

Bug 200766084

Change-Id: Iad8b5c09c424731e841863bfd5ce32d07ff9e684
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2599601
Reviewed-by: Sheetal . <sheetal@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@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>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:50:28 +05:30
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
sheetal
47e3d32fc0 ASoC: tegra: Add MVC Bypass support
- Add "MVC Bypass" kcontrol to enable MVC Bypass
  mode.
- The change is required to verify MVC bypass mode
  during bring up.

Bug 200683609

Change-Id: Ic0f2c947fa2e9bd6e9b429b86ff35e053775ec80
Signed-off-by: sheetal <sheetal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2546568
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: 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>
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
Asha Talambedu
a740b0f4eb ASoC: tegra: Per channel vol/mute support
Per channel volume/mute control is possible with MVC
and the support is enabled through mixer ctrls for volume
settings of each channel and per channel mute mask
while retaining previous Mute and Vol controls.
Eventually Mute and Vol would be deprecated

Bug 200532059

Change-Id: I7c731276cfc6df7d268e398215d18a978213e521
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2400678
(cherry picked from commit 74eaf197c10db33631b574c1c3ac8cce82af925a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2535583
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:50:28 +05:30
Sameer Pujar
72643a1be8 ASoC: tegra: Rename MVC mixer controls
Similar to upstreamed AHUB drivers, follow standard naming convention
for MVC mixer controls. Right now there is no requirement to have
separate channel or bit format controls on input/output and AHUB/client
side. Single channel or bit format control is used for all. Hence rename
bit format control to look consistent with channel control.

Bug 200698314

Change-Id: I76976823d03ef3e3a47346aa928c11f9b26052c6
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
2022-09-29 15:50:28 +05:30
Sameer Pujar
48bff81383 ASoC: tegra: Cleanup macros in MVC driver
Remove unused macros in MVC driver and use shorter names for remaining
macros wherever possible. This makes code look relatively compact and
cleaner. Also provide separate callbacks for readable/writable_reg()
and use register ranges for case statments.

Bug 200698314

Change-Id: Ia61a824fce5531b74b67b6ebf8e5216c7a982c17
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