Commit Graph

13 Commits

Author SHA1 Message Date
Jon Hunter
f01227d4ea drivers: Drop inline from driver remove wrapper
The driver remove function is a function pointer and therefore, it does
not make sense to define the function as an 'inline'. Update the
coccinelle script and drivers to remove the inline statement.

Bug 4749580

Change-Id: Ia03691b75c4edffe609f27468b911a92a5ddbd68
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233980
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Jon Hunter
951b2423a8 drivers: Fix platform_driver remove for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update all the impacted drivers
as necessary to fix this.

Bug 4749580

Change-Id: I3bb5c549777f7ccad0e3f870373fdd25726ad7ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3182878
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-11 17:20:34 -07:00
Aditya Bavanari
e7b93be004 ASoC: tegra: Invoke multi instance APIs
- Invoke the new multi instance ADSP OS and app
  APIs in the adsp and virt-alt adsp ASoC drivers.
- Currently, it is hardcoded to get the ADSP0 handle
  and invoke the respective APIs. Multi instance
  support is to be added later in these drivers.

Bug 4606840
Bug 4635899

Change-Id: I6c95693d738a2b77e953195698bfe2cab8f13dba
Signed-off-by: Aditya Bavanari <abavanari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3145896
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Mohan kumar <mkumard@nvidia.com>
2024-08-09 21:41:31 -07:00
Sameer Pujar
ea7af586a7 ASoC: tegra: cleanup legacy code
Upstream sound card machine driver is used now and legacy machine driver
is not required anymore. Hence following cleanups are made:

  - Remove legacy machine driver 'tegra_machine_driver.c'.

  - With legacy driver removal many of the APIs in tegra_asoc_machine.c
    are not required. So remove all such APIs and update the header file
    as well.

  - The ASoC utils 'tegra_asoc_utils.c' is not needed after removal of
    legacy machine driver. Remove the corresponding header as well.

  - BW manager support needs to be pushed in upstream and it is needed
    for ADMAIF and ADSP ASoC drivers. The downstream BW manager code
    can't be used by the ADMAIF driver. So remove downstream BW manager
    code and put FIXME item in ADSP driver.

Bug 4596865

Change-Id: Iac154b00759571a5593c3d75bbacbae5a68385e2
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3110862
Reviewed-by: Mohan kumar <mkumard@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-21 16:36:31 -07:00
Dara Ramesh
ee8a8e9853 ASoC: tegra: add adsp audio driver
Added ADSP audio driver support for tegra soc and tegra virt alt.

Below are the changes made with respect to Kernel 5.10:

- Removed the ADSP COMPR DAI links due to differences in compress DAI
  link registration in Android (ACK 6.6) which causes build issues.

- Omitted the callback function for dumping ADMA registers, as the
  upstream ADMA driver does not support it.

Bug 3910602
Bug 4635899

Change-Id: I63ea878ef2e9a960d127d02470e8048535878518
Signed-off-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3132128
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-10 04:30:57 -07:00
Sameer Pujar
19292f7cb8 ASoC: tegra: Fix PCM and Compress device IDs
DAI links are getting parsed in a reverse order with Kernel OOT,
where the DAI link nodes are now defined in overlays which gets
applied to the upstream DTB. Due to this PCM and compress devices
get a very large number which makes existing applications fail.

This seems to be expected as the overlay subnodes are merged just
after the parent properties. Each subnode comes just after the
properties. Because of this the later merged subnodes come before
the earlier merged nodes and eventually the DAI link nodes, in
this case, get reversed.

Given above it would be better to not assume DAI link node order.
To fix this use full name of DAI link nodes and identify the DAI
link index from it during parsing in kernel. The DAI link nodes
are named as 'nvidia-audio-card,dai-link@<xxx>', where <xxx>
signifies link index. Parse this info and store it under DAI link
ID. With this the PCM and Compress device IDs do not depend anymore
on the parsing order of DAI links.

Bug 3583581

Change-Id: I3d0e7ed9fb0edfe1f066e12527b44a85c2716df0
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2776061
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-10-21 20:23:55 -07: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
Asha Talambedu
b4b4cc0717 ASoC: tegra: Handle adsp OS start crash
In case of nvadsp_os_start crash, the host adsp audio driver
is still getting registered and this is leading to kernel
panic during shutdown. Added code to propgate start status to
probe so host adsp audio driver register fails on adsp os crash

Bug 3391964

Change-Id: I361c1a1a0409e81ddfce2413debe63ba5d65d07d
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2627904
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@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
Asha Talambedu
39cc4081e3 ASoC: tegra: Add shutdown callback
- Added mutex protection for init_done flag reads in
  mixer control callbacks relevant to "ADSP init". Otherwise
  during shutdown sequence that includes alsa store service,
  this leads to inconsistent behaviour
- Shutdown callback is added to deinit ADSP OS during
  abrupt shutdown.
- In case ADSP OS is crashed during boot/boot has not
  started yet, shutdown does not issue OS deinit as
  init is not complete yet

Bug 3391964

Change-Id: I207e2141af9386f5914e07a8dd231d0fcd803a6e
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2607727
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
d4d56e2908 ASoC: tegra: Expose ack() callback for component
On later kernels 'snd_pcm_ops' structure is removed from the
'snd_soc_component_driver' and instead explicit callbacks were
provided in the component driver structure. In doing so ack()
callback was left out for PCM interface. This was probably
intentional because there are currently no users for this
callback in upstream.

But in downstream we have ADSP audio driver which relies on
this callback to communicate buffer positions with ADSP and
currently DMA transfer is not happening due to missing ack()
callback. Issue is fixed by exposing ack() callback from the
core.

Bug 200568556

Change-Id: I76e9fcf21e087bb2c470868a2bd1eb668345e382
Reported-by: Asha Talambedu <atalambedu@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2414392
Tested-by: Asha Talambedu <atalambedu@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:50:28 +05:30
Bitan Biswas
8e36d59756 k5.9: Fix linux-5.8-rc3 merge build
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>
2022-09-29 15:37:14 +05:30
Sameer Pujar
8799f04efd ASoC: tegra: Audio is broken on v5.7-rc7
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
2022-09-29 15:35:11 +05:30
Sameer Pujar
a99eabde9e ASoC: tegra: update ADSP audio driver for 5.4
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
2022-09-29 15:35:11 +05:30