Commit Graph

670 Commits

Author SHA1 Message Date
Sameer Pujar
1742937d04 ASoC: tegra-alt: remove control_data
control_data field in snd_soc_codec is not used and hence there is
no need for initialization with driver regmap.

Bug 200503387
Bug 200520821

Change-Id: Icc6892674b7b27baf5739fcae1d6162d185acd09
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2144215
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Asha T
a5f383efa7 tegra-alt: i2s: Modified i2s clock handling
Renamed i2s clock parent's property name in DT and changed this driver
to reflect the same. Sync related clock usage is broken as of now. So DTs
have removed sync related entries. Modified driver code to not result in
error due to absence of sync clocks

Bug 200515690

Change-Id: Ifa32dc35b7fbda23574a576597c9cc9e79b00ada
Signed-off-by: Asha T <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2137230
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
73897f2f3c ASoC: tegra-alt: remove Mystique support from DMIC
As part of support to Mystique platform DMIC enable/disable and a callback
helpers were provided (bug 200404157 and bug 200391366). Following commits
were pushed related to this.
 commit b48f5902966a ("ASoC: tegra_alt: add DMIC enable/disable functions")
 commit aac60cf54481 ("tegra-alt: dmic: add start callback support")

This patch removes references to above for following reasons,
 * Mystqiue support is dropped
 * Cleanup is required as part of DMIC upstream work

Bug 200520821
Bug 200503387

Change-Id: I626f65b06fce0d1cec916eb8d4a495d864256f62
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2143613
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
3e7b3ff421 ASoC: tegra-alt: remove unused macros for xbar
Some of the macros defined in tegra210_xbar_alt.h are not used anywhere,
hence removed such macros. Also fixed lines to respect 80 character limit
per line.

Bug 200503387

Change-Id: Ieeb32ef62180fc6ae41e978ac54fb89d44a2486a
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2143068
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
e2163ab452 ASoC: wake up tasks unconditionally on path break
The PCM open flags may be changed on the fly with ALSA calls like
snd_pcm_nonblock which only change the flags associated with file
descriptor and not the substream. Hence checking the flags before
wake_up may not be correct and leads to problem where processes may
remain blocked on path disconnect. Removing the check solves the problem.

Bug 2603764

Change-Id: I4abaa5448e4bfbdd304b80d02314ca48b26fa955
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2126458
(cherry picked from commit 323eeb48634b9f6da890ce3a25fe616b9695d17d)
Reviewed-on: https://git-master.nvidia.com/r/2142901
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
91b569eecb ASoC: adsp: remove fe to be mapping
Find correct ADSP-FE to ADSP-ADMAIF mapping by traversing through
the plugins and reading the source reg value instead of looking up
from pcm_path array.

Bug 2567523

Change-Id: I1177c3d5de7d3f3e5cd26fccb9a973bd252f657a
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2109933
(cherry picked from commit 591268f8067da50f0cc66f49b1ebf7f4d65d56fd)
Reviewed-on: https://git-master.nvidia.com/r/2125969
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
9313373d8f ASoC: tegra-alt: remove soc_data for ope driver
OPE driver has soc_data structure to populate function pointers for PEQ
and MBDRC modules. Instead of using soc_data, the functionality can be
replicated with direct calls to the required helper functions. This in
turn helps to cleanup and remove soc_data code from the driver.

Bug 200503387

Change-Id: Ib37c33edb79a523f2d42f4cb4991c948c6303ddf
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2140591
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
a0deb314ae ASoC: tegra-alt: cleanup soc_data for drivers
Some of the AHUB module drivers have soc_data information only
to define a function pointer for calling tegra210_xbar_set_cif().
This function is implemented in xbar utils driver and exported.

This patch removes function pointer reference to above and instead
make calls directly. This helps to cleanup soc_data for all modules
and further for few modules soc_data is completely removed.

Bug 200503387

Change-Id: If919e5f7a7a92351940bf46f7302fd40c76c7ea3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2140228
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
49ddbfe999 ASoC: tegra-alt: remove tegra186-i2s compatible
Separate compatible is not needed for Tegra186/Tegra194 i2s devices since
i2s_soc_data is now removed and they can rely on "nvidia,tegra210-i2s"
compatible property which is used by Tegra210 as well. The same needs to
be reflected in device tree too.

tegra210_xbar_auxdata is updated with regards to above, along with this
device names for i2s is updated in tegra186_xbar_codec_conf structure.

Bug 200503387

Change-Id: I2f6171d3df04b91cbfbaab6d8c0784ddcd529589
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2132447
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
8f9baab4fa ASoC: tegra-alt: Don't resume the I2S to update registers
When configuring the I2S DAI format, setting the loopback mode and
setting the frame-sync width the I2S driver unnecessarily resumes the
I2S controller to update the registers. This is not necessary because
the driver uses regmap and so if the device is disabled, the regmap
will not update the actual registers until the I2S controller is
resumed.

Furthermore, it was observed that when the I2S controller DAI format
is set, by resuming the I2S controller momentarily, this causes some
of the I2S pins (SCLK and FS) to toggle. Although this is probably
harmless, it is better to only resume the I2S controller when it is
actually being used.

Bug 2414131

Change-Id: I9989deed67db83e6b23d278ba3a130a8661d722a
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2128015
(cherry picked from commit d8378bd21c39290072ad5d1e862d5386b2529a9f)
Reviewed-on: https://git-master.nvidia.com/r/2133385
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
91021c920e ASoC: tegra-alt: get rid of i2s_soc_data
soc_data structure for i2s appears to be redundant for following reasons.
 * is_soc_t210 is unused. For older kernels this was added to implement
   MBIST WAR, bug 200035860. WAR is not required for kernel > k4.4 and
   hence cleaned up as part of bug 2485656.
 * set_audio_cif and set_slot_ctrl point to the same functions for
   Tegra210 and Tegra186. Thus there is no need to have soc_data members
   for it.

Hence references to soc_data is removed from the i2s driver.

Bug 200503387

Change-Id: I597bd594da70f2d27d9c330b871d26cf3651f7af
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2132446
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Dipesh Gandhi
a897a5ec97 ASoC: tegra-alt: clear stale data in drain state
For continuous mode dma, if callback for dma completion is late
their is possiblity that old state data is played out. Change
make sure once state is set to DRAINING, buffer is set to play
null samples if dma stop is late.

Bug 2456491
Bug 2456315

Change-Id: I98272205668b36faac789c2e5d683bc3bf8e835f
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1989238
(cherry picked from commit 72222b7a7177fae6f09ee4b7124d3df30fe685f3)
Reviewed-on: https://git-master.nvidia.com/r/1989190
(cherry picked from commit 01e09612056e78b7b0542f1884bc43f559c59956)
Reviewed-on: https://git-master.nvidia.com/r/2125790
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
f0c6c418c5 adsp: Fix crash in fe_widget_event after pcm close
Dangling reference to pcm runtime data in app->private_data was
leading to a kernel crash. Assigning null in pcm close callback
and validating appropriately in fe_widget_event() solves the
problem.

Bug 2402965

Change-Id: I72b9008fde83ac55d032670b9ecd95560ef89e3a
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1979759
(cherry picked from commit d03c2843e9376d0e674236b40bf516b91f808820)
Reviewed-on: https://git-master.nvidia.com/r/2126291
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Tested-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Hariharan Sivaraman
281827694d tegra-alt: stop adsp playback when path breaks
Currently during fe playback path disconnect,
processes using snd_pcm_write times out after 10 seconds
while those using MMAP simply remain blocked. Fixing
issue by
- Set runtime state to SNDRV_PCM_STATE_DISCONNECTED
- Wakeup process blocked in poll() for mmap mode
- Wakeup process blocked on snd_pcm_write for normal mode.

Bug 2459153

Change-Id: Ieef6802e2ca19321c7ba061bfa7d2cbaaca4cc2c
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975073
(cherry picked from commit 1c976b1de54ffe4b7d603a5ad7c8b6765a2ac8d5)
Reviewed-on: https://git-master.nvidia.com/r/2126290
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Tested-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Hariharan Sivaraman
6d267cc2f6 adsp: add buffer size constraint for pcm buffer
During pcm_open for ADSP pcm devices, the buffer allocated
is not constrained to be multiple of 4. This results in
the apm_process being called continuously for this APM since
data is available. However ADMA is not started because of
the size mismatch. Setting constraint of period and buffer size
(in frames) to be multiple of 4 fixes these issues

Bug 2599016

Change-Id: Idaabba29142d9577a4dc72d97aa6bb3cd4f791de
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2122112
(cherry picked from commit 82d702154bf2c1a903f32e50a9bc4afdf271d74f)
Reviewed-on: https://git-master.nvidia.com/r/2124176
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
f10af03058 ASoC: tegra-alt: Remove support for Orca-Viper
The Orca-Viper project has been shelved and so remove the associated
audio driver and references.

Bug 2602567

Change-Id: I365113b8c081e1ced257b93e1bf23b7e52278315
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2122061
(cherry picked from commit 692cc28614d9b79af99883ca5ecf215a8eeaf75a)
Reviewed-on: https://git-master.nvidia.com/r/2123572
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
e34a9de325 ASoC: tegra-alt: Check if pinctrl state is NULL
If the pinctrl node is not present in device-tree for the DMIC, DSPK
or I2S, then the pinctrl states will not be initialised during device
probe. This can cause the kernel to crash by attempting to dereference
a NULL pointer when setting the pinctrl state. Fix this by verifying
that the pinctrl state is not an error pointer or NULL before attempting
to use it.

Bug 1665446

Change-Id: I917141325f12bbf87371eb59a320fe08e65f0934
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2120320
(cherry picked from commit f3aa620e26af45a6bafe5acb65f2b06df0b877e8)
Reviewed-on: https://git-master.nvidia.com/r/2122730
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
52f2d67cf4 ASoC: tegra-alt: aud mclk clock control via DT
Added support to control the aud mclk parent, rate and scaling factor
from the dt entry which can be optional. With this support, the aud mclk
can be set to all possible aud mclk clock parent, also can set the desired
fixed rate and scale the aud_mclk as a function of Fs.

Bug 200513507

Change-Id: I80d776b7d157c49040d2da8b95b046c21926003b
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111340
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@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>
2022-09-29 15:30:21 +05:30
Sameer Pujar
7c8718b81e ASoC: tegra-alt: remove redundant variable from dma data
Structure tegra_alt_pcm_dma_params has member 'wrap', which is not used
anywhere except for initialization in admaif driver. Hence removed from
the dma data structure.

Bug 200503387

Change-Id: I8cf9d0eb5f2c05c79a472f9143dfe2e96083b8e3
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2102677
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
2c39ffad8a ASoC: tegra-alt: remove redundant system sleep APIs
Late system sleep callbacks just invoke runtime PM calls if the device
is not in the desired state. There is no need to have separate APIs for
this, instead it can directly rely on pm_runtime_force_suspend/resume()
APIs to achieve similar behavior.

Another reason for this patch is, currently ACONNECT driver is using
pm_runtime_force_*() to indirectly invoke runtime PM callbacks. Runtime
suspend of ACONNECT fails complaining that there is an active child.
Though all XBAR devices are runtime suspended, the runtime PM state of
the corresponding device does not reflect it. Hence there is an error
in __pm_runtime_set_status() for ACONNECT. This is seen when the audio
playback is active and system tries to enter suspend. On system resume,
audio fails to resume playback and kernel panic is seen. Hence current
patch moves to pm_runtime_force_*() calls for system sleep for all XBAR
devices.

Bug 200509219
Bug 200503387

Change-Id: I5d531b0aa1a347686f7cca21fc40fe926b34f3a5
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093331
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
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>
2022-09-29 15:30:21 +05:30
Mohan Kumar
28684681fa ASoC: tegra-alt: remove extra check for pinctrl
is_pinctrl variable check is redundant check which can be removed
from the dmic and dspk drivers.

Bug 200500656

Change-Id: I3dee030a198a3f398550de9c88a9f3b4f5d0f6fb
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084602
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
834b540cf9 ASoC: tegra-alt: fix admaif mono/stereo conv
The admaif cif conversion from mono to stereo and vise-versa config
will take effect only when client/xbar channels are 1/2 or 2/1. If
this condition doesn't satisfy, the configured bit-field for mono_conv
and stereo_conv in cif ctrl register will not take effect.

Considering this the current code needs to be fixed.

- For Playback path:
 The Client and Audio channels won't be different as the data flows
from external memory to ahub. So override channel control have no say
on this path, for client_channel=1 and if "mono to stereo conv" control
was set then override audio_channel=2 for stereo conversion.

- For Capture path:
  The Client channel will be based on params_channels() and the xbar
channels can be different from client channel as it comes from other
ahub modules which can output different channel number compared to
client, So the "ADMAIFx Channel" wil be used for capture path to feed
proper xbar channel available. During stereo to mono conversion i.e
when audio_channel=2 and client_channel=1, the configuration in the
bitfield mono_conv will take effect.

Bug 200500656

Change-Id: Ie61aed848eb35715414a7d8f0e00eae9066b32d3
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2080175
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
95dd5b9e73 ASoC: tegra-alt: fix admaif regmap callback func
The regmap read, write and volatile callback functions are not
handling the register address checks correctly. Due to this the
regmap dump from sysfs node was not reflecting the correct state
of the register values. Fix the issue and makesure all regmap
register values are reflecting proper values.

Bug 200500656

Change-Id: Ifb5827d1b86384f835c010138275121a87a397ba
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2080753
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
c9afbf06b8 ASoC: tegra-alt: Rename ADMAIF RX/TX controls
The ADMAIF RX/TX cif conversion mixer controls are renamed as
ADMAIF Playback/Capture which will be more meaningful for the
userspace to understand.

Bug 200500656

Signed-off-by: Mohan Kumar <mkumard@nvidia.com>

Change-Id: I046b7653b7c386a5ab393bffe654d2758685869e
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2078005
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
006ee15c23 ASoC: tegra-alt: stop adsp os during shutdown
The ADSP OS needs to be stopped during the flow of shutdown callback
of the system. Keeping the ADSP OS booted and in suspend mode during
the shutdown callback resulting in mc_err.

Bug 200499707

Change-Id: I80d0c7096b71e953143f70667cec936e6b787db8
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2076325
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
cacbb942a8 ASoC: tegra-alt: Prepare for removal of rt565x_manage_codec_sysclk
The function rt565x_manage_codec_sysclk() only exists in the downstream
kernel and is only currently used for the audio supermodule. It is not
necessary to port this function to the upstream kernel because we can
simply implement the same functionality within the machine driver by
calling the snd_soc_dai_set_pll() and snd_soc_dai_set_sysclk() APIs.
Therefore, update the Tegra machine to avoid using the function
rt565x_manage_codec_sysclk() so we can remove from downstream.

Bug 1665446

Change-Id: Id7e941368740f28cb74e6a04556e7b00abae119d
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2073779
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
1785c1bee4 ASoC: tegra-alt: Trivial clean-up for tegra_alt_asoc_utils_init()
Trivial clean-up to the tegra_alt_asoc_utils_init() function to improve
readability and simplify by ...

1. Removing 'goto' statements because we only return the error code on
   error and there is no clean-up that needs to be done in the error
   path.
2. Move the code to request the clk_cdev1_rst reset from under the
   "data->soc > TEGRA_ASOC_UTILS_SOC_TEGRA210" check because we only
   use this reset for Tegra186 and there is an additional check for this
   device.

Bug 1665446

Change-Id: I23aa8978721f677204a929c8fdebea1f9081793f
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2016370
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
ce50d17412 ASoC: tegra-alt: Remove redundant clock utils function
The function tegra_alt_asoc_utils_set_parent() is only used by the Orca
Viper machine driver. Update the Orca Viper machine driver to use the
tegra_alt_asoc_utils_set_extern_parent() instead which also sets the
extern parent clock and remove the redundant
tegra_alt_asoc_utils_set_parent() function.

Please note that the Orca Viper platform is no longer supported and in
future will be removed.

Bug 1665446

Change-Id: I51ac355e92a1c3dbb65f94bff081edd1837f7bc6
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2016369
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
dba7c3da80 ASoC: tegra-alt: Remove unused variables
Remove unused variables for the various Tegra sound driver files. Note
that these variables are not flagged by the compiler because they are
initialised but they are not actually used anywhere.

Bug 1665446

Change-Id: Id10bb316780813565847492b19025ba369188c09
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2016368
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
84e75ee269 Revert "ASoC: Machine: ignore suspend for dai-links"
This reverts commit 1114afa7e3d861631d0585d76ca54363f46361c3
(manual revert done to resolve conflicts)

Earlier suspend was ignored for Android because of high suspend
latency in snd_soc_suspend(), this was breaking system suspend
KPIs. This alone was contributing to around 3 seconds of latency.
One more reason to ignore suspend was, during Android playback or
capture, device cannot go suspend because of acquired wake locks.

There was an issue in ASoC core which is fixed now in upstream,
which helps to reduce the suspend times. The same is available
in downstream kernel and below is the commit.
"ASoC: core: Don't schedule DAPM work if already in target state"

With this patch suspend/Resume latency for ASoC in 3 trials are
7.362/0.091, 5.445/0.088 and 5.096/0.087 ms respectively.

Bug 200390814

Change-Id: Iae3b4f19f34568585ed120460f173d4b234a3eb1
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1971226
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
503eb55823 adsp: fix tlv read write issues
Change fixes problems caused in tlv read and write
synchronization with other messages
- Add separate spinlock completions for tlv read
- Add separate spinlock completions for tlv write
- Add separate ack for raw (tlv) messages
- Print msgq indexes when queue or dequeue fails

Bug 2420196

Change-Id: I405e3a9939ec804dc65875d900ba635d2dc15ee3
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975072
(cherry picked from commit 1df184d908c84c8f4e15b48cdd9ada90da313169)
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1986443
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
4a6ee45df7 ASoC: tegra-alt: fix dynamic pinmux config
Currently dynamic pinmux configuration for I2S, DMIC, DSPK modules
are present in runtime_resume() function which can be called even
without any audio usecase active on these modules. So this destroy
the purpose of programming pinmux only during stream active state.

This change has moved the dynamic pinmux code in these drivers to
dai ops callback of startup and shutdown which will ensure the
pinmux config happens only during the stream playback/capture.

Bug 200497486

Change-Id: I3c4e8a96d0d066b38c9aba5ffe530db5cf5246fc
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2029745
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
9050c3e455 adsp: Make set_eos method generic
- Create generic nvfx_method_set_eos
- Required for plugin specific EOS handling

Bug 2402965

Change-Id: I4e52eca46769862e13ca947a27fcabccc3a1d70d
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1974986
(cherry picked from commit 9b48f057c2629bc000b745409551a80597aa4aab)
Reviewed-on: https://git-master.nvidia.com/r/2027461
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
9b9a66eba7 ASoC: tegra-alt: Remove I2S RX/TX controls
The I2S RX/TX mixer controls are replaced by I2S Playback/Capture,
removing the support of RX/TX as userspace support has deprecated the
usage of these controls.

Bug 2494697

Change-Id: I5ed36c1c00666381a534efc74c8d0a5f3bd5eada
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2024574
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
736ce72f4b ASoC: tegra-alt: Make ADSP parameter controls write-only
Currently, the ADSP is not booted or if the ADSP is booted but the
plugin is not connected for the ADSP APP, then it is not possible to
configure the various ADSP parameter mixer controls. This causes a lot
of messages to be displayed when the ALSA restore systemd service is
enabled because on boot it will try to restore all mixer controls.

The ADSP mixer controls for setting APP parameters are by default
read/write, however, the function to return the current APP parameters,
tegra210_adsp_get_param(), simply returns zeros and not the actual
parameters. Therefore, make these mixer controls write-only so that
the ALSA restore service will not attempt to save and restore them.

Bug 200458098

Change-Id: Ia61329c4dc338a1973e755ece23082bd2411f9be
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2019227
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
29bfa0b857 ASoC: tegra-alt: Don't display error if app not available
Rather than displaying an error message is an app cannot be loaded,
print a message to indicate that an app was loaded successfully. For
L4T applications such as MP3 decode are not available and this avoids
unnecessary error messages.

Bug 200458098

Change-Id: I2e3acbf2977797c79a0eabee6b7c8c49b33b0df1
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2007328
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
8054d6f242 ASoC: tegra-alt: Always allow ADSP APM controls to be set
Currently, the ADSP is not booted or if the ADSP is booted but the
plugin is not set for the ADSP APP, then it is not possible to
configure the various APM mixer controls. This causes a lot of
messages to be displayed when the ALSA restore systemd service is
enabled because on boot it will try to restore all mixer controls.

Rather than prevent the user from being able to set APM mixer
controls until the ADSP is booted and the plugin is set, always
store the APM settings. If the ADSP is booted or the plugin is not
set when the APM controls are set, then when the ADSP is booted and
the plugin is set, send the APM settings to the ADSP at this time.

Bug 200458098

Change-Id: I8899d876d1d10bd0e07e7c54d6674ca29aef0558
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1973345
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Mohan Kumar
9320c90d73 ASoC: tegra-alt: Boot the ADSP OS during probe
Currently the ADSP OS is booted only when the mixer control
'ADSP Init' is set, So ADSP OS won't be booted and during
alsa-restoring of service it lead to os not booted error
message.

So try booting the ADSP OS as soon as ADSP tegra-alt driver
is registered.

Bug 200458098

Change-Id: I3cd123bdb5d5f87ba8c9329d0e43241189ffdb66
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1935089
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Uday Gupta
d9625a21e3 tegra-alt: Increase max period bytes
Max buffer bytes is increase through DT but
this does not get reflected in max period bytes.

Change max_period_bytes if max buffer bytes are updated by DT

Bug 2448519
Bug 200463529

Change-Id: I079615df7139228731b7a29461ae03407ecd19c0
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1961715
(cherry picked from commit 21d9f725aef8d4405eaf24a7a52efa962be4e2e6)
Reviewed-on: https://git-master.nvidia.com/r/1963255
(cherry picked from commit db8f94ae8de2f6468d9066afa8d7cc5d864405d6)
Reviewed-on: https://git-master.nvidia.com/r/1996558
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Ketan Patil
ddbf36f10e nvidia: Clean up t210 MBIST WAR handling
On k4.4 and earlier, t210 MBIST workaround was handled with notifier
callbacks within the drivers. Remove all such calls to the functions
slcg_register_notifier and slcg_unregister_notifier.

Also remove the functions nvhost_pd_slcg_install_workaround and
nvhost_pd_slcg_remove_workaround which ultimately call the
slcg_register_notifier and slcg_unregister_notifier functions
respectively.

Bug 2485656

Change-Id: I6445e07e5d2a4aa6360fff0bbd32ceebbc0e62e4
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2003556
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
5936a0e40d ASoC: tegra-alt: Add new controls for I2S mono/stereo conversion
The names of the I2S mixer controls for mono/stereo conversion are
confusing from a user perspective because the controls 'I2Sx TX mono
to stereo conv' and 'I2Sx TX stereo to mono conv' are for capture and
the controls 'I2Sx RX mono to stereo conv', 'I2Sx RX stereo to mono
conv' and 'I2Sx Rx fifo threshold' are for playback. The naming
convention  for these controls comes from the XBAR CIF and makes sense
from that standpoint. However, from a user and userspace perspective
the names are confusing and misleading. Therefore, add new controls
that are explicitly named "Capture" and "Playback" so it is clear
which should be used.

The legacy controls will be kept for Android until the appropriate
userspace changes have been made so that these can be removed
completely.

Bug 200469957

Change-Id: I93ae9339128a056e2144ba751a86f9df21b3dfda
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
(cherry picked from commit 843dfa3a418d336bca49144e065556dce8d0cd4e)
Reviewed-on: https://git-master.nvidia.com/r/2002204
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
c935ff0f9b ASoC: tegra-alt: Fix I2S slot mask
When the number of channels for an I2S interface is overridden from
userspace, if the I2S interface is being used in TDM mode where there
are more than 2 channels, the I2S SLOT_CTRL register may not be
configured correctly.

For example, if using the AMX to the multiplex 4 mono channels into
a single 4 channel TDM stream that is then routed to an I2S interface,
the number of channels seen by the I2S interface is 4 where as each
input stream to the AMX only has a single channel. Therefore, the
number of channels for the I2S interface needs to be manually set to
4 from userspace. However, when this is done the I2S SLOT_CTRL
register is still configured with the default RX and TX slot mask.
To fix this, if the number of channels for the I2S interface is
overridden from userspace, then if using TDM modes, also override
the RX and TX slot mask.

Bug 2382530

Change-Id: I2df564c8e8ad5d7463a767a1e2197e26fe0c57e5
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2000401
(cherry picked from commit b888cf568c726fed1e97882b9fe8deae4d6df6d9)
Reviewed-on: https://git-master.nvidia.com/r/2002199
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Sameer Pujar
4924fdfe32 ASoC: tegra: remove suport for older kernels
Support for kernel versions < kernel-4.9 is discontinued on stage-main.
Thus linux version checks have to be reviewed and removed. Any code under
LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) can simply be removed.

This patch removes version checks and older code.

Change-Id: I2df56fb9cc313a6f4328c5ec19fcab8457c65972
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1998289
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jon Hunter
71e47ae39e ASoC: tegra-alt: Add support for FE-PI audio Z V2 board
Add support for the FE-PI audio Z V2 board which includes the NXP
SGTL5000 audio codec. The FE-PI audio Z V2 board is an audio hat
for Raspberry-PI and is compatible with the Jetson 40-pin header.

Bug 1654376

Change-Id: I7b16b38acb91ac18c00cabc98c9e2dbe1eb9e94e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
(cherry picked from commit 0b303ebc3efc77b4e7a8bca1d62ef412873c336b)
Reviewed-on: https://git-master.nvidia.com/r/1779054
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
a7307c2d19 ASoC: tegra-alt: Add mixer controls for configuring the ADX
The AMX driver provides userspace mixer controls for configuring the
module. This provides a much simpler way of configuring and using the
AMX versus the alternative where the AMX is configured via device-tree.

Currently, the ADX can only be configured by device-tree and so for
users that wish to use the ADX both the device-tree and audio machine
driver need to be updated. Add similar mixer controls for the ADX that
exist for the AMX so that the ADX can be easily configured via
userspace.

Bug 2382530

Change-Id: Idf8dc0ba3fe4bf30168c01318b9a5e169a8985d6
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1987561
(cherry picked from commit 1b2a25b33f972193ce25ee0b61d612266a9cae05)
Reviewed-on: https://git-master.nvidia.com/r/1991929
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
eabaeedaa6 ASoC: tegra-alt: Set device data before initialising RPM
The device data for a given driver must be set before enabling
runtime-pm otherwise this could results in a crash if the runtime-pm
callback is called before the device data is set where it is expected
that the device data has been initialised.

Furthermore, most drivers will directly call the runtime-pm callback
to power-up the device if runtime-pm is not enabled in the kernel
config and so many drivers would crash if runtime-pm is not enabled.

Fix this by setting the device data early in the driver probe.

Bug 2478690

Change-Id: I5beb1607aa4715651cf4b9ac8e8068e7f8e3a2a7
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
(cherry picked from commit 9d656fcc96e85d38d120a430f83f2b734e19fe07)
Reviewed-on: https://git-master.nvidia.com/r/1991204
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
5e0682c2e7 ASoC: tegra-alt: Fix failure path and removal of ADSP
If the ADSP fail during the probe after the ADSP component is
registered, the ADSP component will not be unregistered and this will
cause the kernel to crash when attempting to the probe the component.
Furthermore, if the removal of the ADSP device, the component and codec
register by the ADSP driver are not removed. Fix these items by ensuring
the the ADSP component and codec are removed as necessary during the
probe failure path and driver removal.

Finally, clean-up some of the prints in the driver probe to drop the
unnecessary print when the netlink is created and use the dev_xxx
functions instead of the pr_xxx functions.

Bug 200458098

Change-Id: I4b51949e1c10c86952008ebe5676832e381a68f4
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1974520
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Viswanath L
dc841995d9 tegra-alt: adsp: Do not adjust Compress PCM pos
PCM pointer in compress path need not be adjusted for sample rate
conversion as rate conversion always happens in AHUB (ASRC) and not
in ADSP; cases where rate conversion happens in ADSP will no longer
return correct position

Bug 200430129

Change-Id: I93e3f0680260ce057a17c70f037c9093be3e17cf
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959444
(cherry picked from commit fd33d1360f3a2e684363eecf9f0570b66fa2f51d)
Reviewed-on: https://git-master.nvidia.com/r/1984711
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Niranjan Dighe
f4a50891b0 sound: soc: Separate ADSP driver for virt/non-virt
- Copied the adsp driver from tegra-alt to tegra-virt-alt
- Modified tegra-virt-alt Kconfig and Makefile to make it
  dependent on SND_SOC_TEGRA_VIRT_T210REF_PCM and
  TEGRA_NVADSP
- Make the drivers exclusive with respect to device tree
  node compatibility
- Remove all the code guarded under SND_SOC_TEGRA_VIRT_IVC_COMM
  from tegra-alt ADSP driver .
- Remove all the #ifdefs from the tegra-virt-alt ADSP driver.
- Change ADSP drv name used by dai_links
- Update dai_links with new name
- add -EPROBE_DEFER on sound card register failure. This may
  be required if we decide to remove virt drivers from
  /etc/modules and /etc/modprobe.d/blacklist.conf
- Cleanup in case of deferred probe

Jira: EMA-904
Jira: EMA-1158

Change-Id: I0e707eca1bfa27b3f1814e367baa16e97bf464e5
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1966030
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30
Jonathan Hunter
1120a5768f ASoC: tegra-alt: Reading Mixer RX Gain always returns 0
Reading the mixer RX Gain always returns 0 and this is because
the function to return the gain setting has not been implemented
completely. Fix this by returning the programmed gain value in the
function tegra210_mixer_get_format().

Bug 2438553

Change-Id: I4e6e5a6fe3373982cbb063ce3276428e0a1a2c1a
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1945622
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-09-29 15:30:21 +05:30