Commit Graph

33 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
Jon Hunter
7f2c6fcd8c ASoC: tegra: Fix build for Linux v6.3
Upstream Linux commit ("3653480c6812 ASoC: soc-dai.h: cleanup
Playback/Capture data for snd_soc_dai") removes the capture_dma_data
and playback_dma_data variables from snd_soc_dai structure and this
breaks building the Tegra210 ADMAIF driver. Fix this by using the
appropriate API for Linux v6.3.

Bug 4014315

Change-Id: I76c8401571130a3d7ebaecacdfc299d59c1eaf8e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2867123
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-03-18 16:18:39 -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
Sameer Pujar
1e77ef2504 ASoC: tegra: Remove slave_id access
The struct 'snd_dmaengine_dai_dma_data' no more has 'slave_id'
member in newer kernels. This presently causes build failure
in GVS for 'linux-stable'.

Remove access to this member to fix build issue with OOT driver.
Also upstream ADMA driver does not depend on it anymore, so
commit 32de4745e20a ("dmaengine: tegra210-adma: Override ADMA FIFO
size") needs to be backported to avoid related functional issue.

Bug 3583581

Change-Id: Ib865bdc5d2b2ceb9d57511c3618e5fe607acab09
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2776075
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:52 -07:00
Sameer Pujar
11a70ecd46 ASoC: tegra: Update compatible names
Following drivers are upstreamed (and present in v5.15) but not yet
feature complete:

  tegra186_dspk.c
  tegra210_admaif.c
  tegra210_ahub.c
  tegra210_dmic.c
  tegra210_i2s.c

To use these drivers, device nodes in DT can use OOT specific
compatibles. Update compatibles in drivers to facilitate this.

Bug 3583581

Change-Id: I1a9e31fc5f1b2d2539f644a413ba0c06c6da2110
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2774435
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:48 -07:00
Sameer Pujar
cb024c2001 TEMP: ASoC: tegra: Disable ADMA register dump call
tegra_adma_dump_ch_reg() is implemented by downstream ADMA driver only
which is not upstreamed yet. This causes build error with Kernel OOT
because upstream ADMA driver is used. Disable this call temporarily
until future is decided for this helper.

Bug 3583581
Bug 3798682

Change-Id: Ifb625509fe8354e65f40d4047e4e80ef6a5e287f
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2774433
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:38 -07:00
Sameer Pujar
c61527fb8f ASoC: tegra: remove superflous code
This is inspired from following upstream commit:

------------------------------------------------------------------------
  commit 189364872fba07291db7f68fe0161f97e5b61bb1
  Author: Takashi Iwai <tiwai@suse.de>
  Date:   Mon Aug 2 09:28:09 2021 +0200

  ASoC: tegra: Use managed buffer allocation

  As the standard buffer allocation helper supports WC pages now, we can
  convert imx-pcm-rpmsg driver to use that.  This allows us to remove
  lots of superfluous code.

  Acked-by: Mark Brown <broonie@kernel.org>
  Link: https://lore.kernel.org/r/20210802072815.13551-10-tiwai@suse.de
  Signed-off-by: Takashi Iwai <tiwai@suse.de>
------------------------------------------------------------------------

Above is required to avoid build errors related to non existent
callbacks in 'snd_soc_component_driver' structure.

Bug 3583581

Change-Id: Id1a930db0e41a51be35813aed67183974d1eec57
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2774431
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:29 -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
Rajesh Gumasta
0142517e63 Merge mainline tag v5.10.87 into dev-main-5.10
Merge remote-tracking branch 'origin/dev/linux-5.10.87'
into dev-main-5.10.87

Merge v5.10.66 to v5.10.87

Summary of changes since TOT revision v5.10.65

Changes in v5.10.87 (total commits 33)
arm: ioremap: don't abuse pfn_valid() to check if pfn is in RAM
arm: extend pfn_valid to take into account freed memory map alignment
fuse: make sure reclaim doesn't write the inode

Changes in v5.10.86 (total commits 1)
netfilter: selftest: conntrack_vrf.sh: fix file permission

Changes in v5.10.85 (total commits 132)
Documentation/Kbuild: Remove references to gcc-plugin.sh
MAINTAINERS: adjust GCC PLUGINS after gcc-plugin.sh removal
doc: gcc-plugins: update gcc-plugins.rst
kbuild: simplify GCC_PLUGINS enablement in dummy-tools/gcc
xhci: avoid race between disable slot command and host runtime suspend
dt-bindings: net: Reintroduce PHY no lane swap binding

Changes in v5.10.84 (total commits 125)
parisc: Mark cr16 CPU clocksource unstable on all SMP machines
serial: tegra: Change lower tolerance baud rate limit for tegra20 and tegra30
ASoC: tegra: Fix kcontrol put callback in AHUB
ASoC: tegra: Fix kcontrol put callback in DSPK
ASoC: tegra: Fix kcontrol put callback in DMIC
ASoC: tegra: Fix kcontrol put callback in I2S
ASoC: tegra: Fix kcontrol put callback in ADMAIF
ASoC: tegra: Fix wrong value type in DSPK
ASoC: tegra: Fix wrong value type in DMIC
ASoC: tegra: Fix wrong value type in I2S
ASoC: tegra: Fix wrong value type in ADMAIF

Changes in v5.10.83 (total commits 121)
net: ipv6: add fib6_nh_release_dsts stub
ipv6: fix typos in __ip6_finish_output()
mmc: sdhci: Fix ADMA for PAGE_SIZE >= 64KiB

Changes in v5.10.82 (total commits 153)
scsi: ufs: core: Fix task management completion timeout race
scsi: ufs: core: Fix task management completion
net: reduce indentation level in sk_clone_lock()
net-zerocopy: Refactor skb frag fast-forward op.
sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain()

Changes in v5.10.81 (total commits 21)
thermal: Fix NULL pointer dereferences in of_thermal_ functions
PCI: Add MSI masking quirk for Nvidia ION AHCI
PCI/MSI: Deal with devices lying about their MSI mask capability
PCI/MSI: Destroy sysfs before freeing entries
loop: Use blk_validate_block_size() to validate block size

Changes in v5.10.80 (total commits 570)
soc/tegra: pmc: Fix imbalanced clock disabling in error code path
dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`
soc/tegra: Fix an error handling path in tegra_powergate_power_up()
rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()
serial: core: Fix initializing and restoring termios speed

Changes in v5.10.79 (total commits 19)
printk/console: Allow to disable console output by using console="" or console=null

Changes in v5.10.78 (total commits 14)
scsi: core: Put LLD module refcnt after SCSI device is released

Changes in v5.10.77 (total commits 77)
net: Prevent infinite while loop in skb_tx_hash()
mmc: sdhci: Map more voltage level to SDHCI_POWER_330

Changes in v5.10.76 (total commits 94)
scsi: core: Fix shost->cmd_per_lun calculation in scsi_add_host_with_dma()
dma-debug: fix sg checks in debug_dma_map_sg()

Changes in v5.10.75 (total commits 101)
acpi/arm64: fix next_platform_timer() section mismatch error
platform/mellanox: mlxreg-io: Fix read access of n-bytes size attributes
platform/mellanox: mlxreg-io: Fix argument base in kstrtou32() call
net/mlx5e: Mutually exclude RX-FCS and RX-port-timestamp
net/mlx5e: Fix memory leak in mlx5_core_destroy_cq() error path

Changes in v5.10.74 (total commits 22)
sched: Always inline is_percpu_thread()
perf/core: fix userpage->time_enabled of inactive events

Changes in v5.10.73 (total commits 81)
RISC-V: Include clone3() on rv32
i2c: acpi: fix resource leak in reconfiguration device addition
net: prefer socket bound to interface when not in VRF
net/mlx5: E-Switch, Fix double allocation of acl flow counter
net/mlx5e: IPSEC RX, enable checksum complete

Changes in v5.10.72 (total commits 29)
tools/vm/page-types: remove dependency on opt_file for idle page tracking

Changes in v5.10.71 (total commits 92)
mm: don't allow oversized kvmalloc() calls
crypto: ccp - fix resource leaks in ccp_run_aes_gcm_cmd()
debugfs: debugfs_create_file_size(): use IS_ERR to check for error
cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory
cpufreq: schedutil: Use kobject release() method to free sugov_tunables
tty: Fix out-of-bound vmalloc access in imageblit

Changes in v5.10.70 (total commits 102)
spi: Fix tegra20 build with CONFIG_PM=n
thermal/core: Potential buffer overflow in thermal_build_list_of_policies()

Changes in v5.10.69 (total commits 64)
sched/idle: Make the idle timer expire in hard interrupt context
thermal/core: Fix thermal_cooling_device_register() prototype
PM: sleep: core: Avoid setting power.must_resume to false

Changes in v5.10.68 (total commits 125)
PCI: Sync __pci_register_driver() stub for CONFIG_PCI=n
tracing/boot: Fix a hist trigger dependency for boot time tracing
PCI: tegra: Fix OF node reference leak
PCI: tegra194: Fix MSI-X programming
PCI: tegra194: Fix handling BME_CHGED event
fuse: fix use after free in fuse_read_interrupt()

Changes in v5.10.67 (total commits 305)
cpufreq: powernv: Fix init_chip_info initialization in numa=off
net/mlx5: DR, Enable QP retransmission
net/mlx5: DR, fix a potential use-after-free bug
mmc: core: Return correct emmc response in case of ioctl error
ARM: tegra: tamonten: Fix UART pad setting
ARM: tegra: acer-a500: Remove bogus USB VBUS regulators
media: tegra-cec: Handle errors of clk_prepare_enable()
arm64: tegra: Fix Tegra194 PCIe EP compatible string
pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
crypto: public_key: fix overflow during implicit conversion

Changes in v5.10.66 (total commits 4)
Revert "time: Handle negative seconds correctly in timespec64_to_ns()"
Revert "posix-cpu-timers: Force next expiration recalc after itimer reset"
Revert "block: nbd: add sanity check for first_minor"
Revert "Bluetooth: Move shutdown callback before flushing tx and rx queue"

Bug 200712834

Change-Id: Iaf76032e92a2e31d457bc39c5b110605f5e20f39
Signed-off-by: Rajesh Gumasta <rgumasta@nvidia.com>
2022-09-29 15:57:12 +05:30
Sameer Pujar
67d8d5800e ASoC: tegra: Fix kcontrol put callback in ADMAIF
commit e2b87a18a60c02d0dcd1de801d669587e516cc4d upstream.

The kcontrol put callback is expected to return 1 when there is change
in HW or when the update is acknowledged by driver. This would ensure
that change notifications are sent to subscribed applications. Update
the ADMAIF driver accordingly.

Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver")
Suggested-by: Jaroslav Kysela <perex@perex.cz>
Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/1637219231-406-8-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-29 15:56:06 +05:30
Sameer Pujar
75d1e83e5e ASoC: tegra: Fix wrong value type in ADMAIF
commit 884c6cb3b7030f75c46e55b9e625d2372708c306 upstream.

The enum controls are expected to use enumerated value type.
Update relevant references in control get/put callbacks.

Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver")
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/1637219231-406-2-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-29 15:50:28 +05:30
Sheetal
f9f0e26a20 ASoC: tegra: Memory leak due to BE HW constraint
- The issue was happening because dapm core was not deallocating
  the hw contraints rules memory.
  Memory leak backtrace from cat /sys/kernel/debug/kmemleak:
    [<0000000046fdaf4f>] slab_post_alloc_hook+0x6c/0x3e0
    [<00000000989dfc0e>] __kmalloc_track_caller+0x1b8/0x400
    [<00000000505e39ec>] krealloc+0xe8/0x160
    [<000000009cc82a21>] snd_pcm_hw_rule_add+0x164/0x1a0
    [<00000000aa77851e>] snd_pcm_hw_constraint_list+0x28/0x30
    [<000000009b2cd5c6>] tegra210_ahub_write_ram+0xa8/0xb60
    [<00000000a61d7069>] snd_soc_dai_startup+0x40/0xa0
    [<00000000a7452879>] snd_soc_dai_link_event+0x334/0x600
    [<000000008c5771de>] dapm_seq_check_event+0x120/0x330
    [<00000000be740a3d>] dapm_seq_run_coalesced+0xb0/0x250
    [<0000000003732007>] dapm_seq_run+0xf0/0x510
    [<00000000cbb85eb0>] dapm_power_widgets+0x58c/0xac0
    [<00000000b96c5548>] snd_soc_dapm_stream_event+0x128/0x170
    [<0000000027bb14bc>] soc_pcm_prepare+0x70/0x110
    [<00000000d44b9075>] snd_pcm_do_prepare+0x34/0x50
    [<000000005664d4d5>] snd_pcm_action_single+0x4c/0xa0

- For BE dais HW constraints won't take any impact and only for FE
  dais it is required. So added it in component driver open callback.

Bug 200773796

Signed-off-by: Sheetal <sheetal@nvidia.com>
Change-Id: Ic4c1bf881b914bda03bda8e97816cf1c6dee4052
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2596443
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@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>
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
sheetal
78f655e85e ASoC: tegra: Add support for 24KHz and 64KHz rate
- Fix the issues with 24KHz and 64KHz sample rate.
- In machine driver, 24KHz and 64KHz were not supported, add
  the rates into the list.
- 24KHz is not supported by ALSA, to support it mentioned dai rates
  as SNDRV_PCM_RATE_KNOT. Using KNOT chip can support unconventional rates,
  defined in hw constraints list.
- The change is added for FE links only,  for BE links its not required as
  it will be taken care by FE links.

Bug 200757915

Change-Id: I348368420316ba78b303cd27a413048b6cab2dd7
Signed-off-by: sheetal <sheetal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2571687
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
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
Sameer Pujar
e834adbfba ASoC: tegra: Fix build warnings in ADMAIF driver
Following build warnings have popped up after 'is_isomgr_client' flag
is cleaned up from the ADMAIF driver.

  tegra210_admaif.c: In function ‘tegra_admaif_prepare’:
  tegra210_admaif.c:271:23: warning: unused variable ‘admaif'
    struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai);
                       ^~~~~~
  tegra210_admaif.c: In function ‘tegra_admaif_shutdown’:
  tegra210_admaif.c:281:23: warning: unused variable ‘admaif’
    struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai);
                       ^~~~~~
  tegra210_admaif.c: In function ‘tegra_admaif_remove’:
  tegra210_admaif.c:1141:23: warning: unused variable ‘admaif’
    struct tegra_admaif *admaif = dev_get_drvdata(&pdev->dev);
                       ^~~~~~

Fix these by removing unused variable ‘admaif' from above functions.

Jira TAS-1059

Change-Id: I323df87415727b3deae0e5ba2aa05ef735c047da
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2414632
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:50:28 +05:30
Mohan Kumar
30706b0cef ASoC: tegra: Add Interconnect support for ADMA
Add Interconnect API support for ADMA Memory bandwidth requirement
handling.

From Kernel 4.14 and beyond
- On T23X and newer platforms, the interconnects driver will be initialized
  and calls to BWMGR will be stubbed out.
- On T194 and earlier platforms, BWMGR driver will be initialized and calls
  to interconnect framework will be stubbed out.

Jira TAS-1059

Change-Id: I7a26f61517937ac3103222a43f08ee7c4e4ad484
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2408552
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:50:28 +05:30
Sameer Pujar
79d734adb3 ASoC: tegra: Rebase drivers with v5.9-rc4
Some of the audio drivers have been upstreamed recently as part of
following series, https://lkml.org/lkml/2020/7/21/1357.

In upstream, DPCM solution is proposed which is different from what
is currently used in downstream. Hence there are conflicts related
to audio routing. To resolve the differences use 'CONFIG_TEGRA_DPCM'
checks. Once the DPCM proposal gets accepted and all remaining
drivers are updated to work with DPCM, the config and legacy routing
can be dropped.

K5.9 removes snd_soc_component_read and uses prototype
of snd_soc_component_read32. Hence update the call in tegra210_ahub.c

Bug 200597174

Change-Id: I9e563e3d8a62f335ba8c22397c0750bf29810d3d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
2022-09-29 15:50:28 +05:30
Bitan Biswas
4701ef0763 Merge tag 'v5.9-rc4' into dev-main-5.9
Linux 5.9-rc4

Change-Id: If605aee594aacf04e2e27863abf7bfddf3127dd3
2022-09-29 15:50:28 +05:30
Sameer Pujar
9f4e9f0c9b ASoC: tegra: Fix card registration failure on Tegra210
Commit cd6917c3e602 ("ASoC: tegra: Add admaif routes relevant to adsp")
added missing routes required for ADSP. This causes card registration
failure on Tegra210 platforms and probe() fails with following errors.

 ASoC: no source widget found for ADMAIF11 FIFO Transmit
 ASoC: Failed to add route ADMAIF11 FIFO Transmit -> direct -> ADMAIF11 FIFO RX
 ASoC: no sink widget found for ADMAIF11 CIF Receive
 ASoC: Failed to add route ADMAIF11 CIF TX -> direct -> ADMAIF11 CIF Receive
 ASoC: no source widget found for ADMAIF11 CIF Transmit
 ASoC: Failed to add route ADMAIF11 CIF Transmit -> direct -> ADMAIF11 CIF RX
 ASoC: no sink widget found for ADMAIF11 FIFO Receive
 ASoC: Failed to add route ADMAIF11 FIFO TX -> direct -> ADMAIF11 FIFO Receive
 ...
 (Similarly errors are seen for ADMAIF12, ADMAIF13 ... ADMAIF20)

This happens because a common structure is used for routes between Tegra210 and
Tegra186. Fix this problem by using appropriate size for routes which takes into
account of maximum available ADMAIF channels for a given SoC. This is inline
with what we have for previous kernels.

Bug 200628802

Change-Id: I18305e99781a0f91dc7886d3e06f2acaa5b69d9b
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2407491
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>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-09-29 15:48:19 +05:30
Asha Talambedu
8692668188 ASoC: tegra: Add admaif routes relevant to adsp
dapm routes in admaif driver used in ADSP audio path is enabled
through this patch

Bug 200568556

Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Change-Id: I4a351a011172222f71d691706c5b2bc8031e25fe
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2403773
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@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:48:19 +05:30
Takashi Iwai
0c06d02af4 ASoC: tegra: tegra210_admaif: Fix compile warning with CONFIG_PM=n
Fix trivial compile warnings wrt unused functions by adding
__maybe_unused prefix:
  sound/soc/tegra/tegra210_admaif.c:232:12: warning: 'tegra_admaif_runtime_resume' defined but not used [-Wunused-function]
  sound/soc/tegra/tegra210_ahub.c:567:12: warning: 'tegra_ahub_runtime_suspend' defined but not used [-Wunused-function]

Fixes: f74028e159bb ("ASoC: tegra: Add Tegra210 based ADMAIF driver")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200803141850.23713-3-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-29 15:46:21 +05:30
Sameer Pujar
2b34b94604 ASoC: tegra: Add Tegra210 based ADMAIF driver
ADMAIF is the interface between ADMA and AHUB. Each ADMA channel that
sends/receives data to/from AHUB must intreface through an ADMAIF channel.
ADMA channel sending data to AHUB pairs with an ADMAIF Tx channel and
similarly ADMA channel receiving data from AHUB pairs with an ADMAIF Rx
channel. Buffer size is configurable for each ADMAIF channel, but currently
SW uses default values.

This patch registers ADMAIF driver with ASoC framework. The component
driver exposes DAPM widgets, routes and kcontrols for the device. The DAI
driver exposes ADMAIF 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 ADMAIF device can be enabled in the DT via
"nvidia,tegra210-admaif" compatible binding.

Tegra PCM driver is updated to expose required PCM interfaces and
snd_pcm_ops callbacks.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1595134890-16470-8-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-29 15:46:21 +05:30
Sameer Pujar
bcd452f7b1 ASoC: tegra: propagate slave_id info to DMA engine
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>
2022-09-29 15:35:11 +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
435468ef49 ASoC: tegra: add register dump feature for ADMAIF
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
2022-09-29 15:35:11 +05:30
Sameer Pujar
ee22e8b8ce ASoC: tegra: expose DAIs/routes for ADSP Audio
ADMAIF driver is currently rebased as per the patch sent for upstream
review and it does not include interfaces/routing required for ADSP
audio. Since ADSP audio is required in downstream, DAIs, DAPM widgets
and DAPM routes are added for ADSP audio to be part of APE sound card.

Bug 2845498
Bug 200593718

Change-Id: I900963cac25e7ac4fcc4be1e35d1c2f839e965cc
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.9/+/2354011
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
2022-09-29 15:35:11 +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
Bitan Biswas
539a7841f3 drivers: fix k5.9 build errors
Fix linux-5.7-rc5 build in below source files:
	- mmc.c __mmc_switch 7th argument removed for downstream patches.
	- pwm-fan.c - remove unmatched #if PM_SLEEP
	- i2c-tegra.c , arm-smmu-nvidia.c and tegra_machine_driver.c

Bug 200617764

Change-Id: I5a98693219e431f25a101a13f9fc2f6d29829e73
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
2022-09-29 15:35:11 +05:30
Sameer Pujar
5cbf657e1a ASoC: tegra: move ISOBW_MGR source to tegra
For 5.4 kernel AHUB drivers are put under kernel specific folder and plan
is to discontinue 'tegra-alt' directory. This patch moves ISOBW_MGR code
to 'tegra' and updates ADMAIF driver for BW requests.

Bug 2845498

Change-Id: Ib36b00482319f8d266e85b0a80a44b489db3e291
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.4/+/2328028
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>
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
6b98f0a740 ASoC: tegra: update AHUB drivers as per upstream
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>
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