712 Commits

Author SHA1 Message Date
Jon Hunter
5e32b94e91 ASoC: tegra-alt: Remove unsupported modes from I2S control
The I2S interfaces only support configurations where both the bit clock
and frame sync are master or are both slave. Therefore, remove support
for modes where the bit clock is master and frame sync is slave and
vice-versa from the 'I2Sx codec master mode' mixer controls.

Bug 2046053
Bug 2746555

Change-Id: I288a1a372fe200b5faf2eb0f3d7c481a34c1f545
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2230060
(cherry picked from commit 79a002b42a9c25cd26832c967f95f82e08935ca9)
Reviewed-on: https://git-master.nvidia.com/r/2237275
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
Asha Talambedu
3b9d9c345c ASoC: tegra-alt: Remove redundant configs
Removed redundant configs TEGRA210_AMX_MAP_READ
and TEGRA210_ADX_MAP_READ

Bug 200540133

Change-Id: I84404731dd277385d1432c5d235c36805f2da4f5
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2233899
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
84cc33a1b6 ASoC: tegra-alt: Prevent I2S controls overwriting each other
Each I2S interface has a mixer control 'I2Sx codec master mode' to
set the master mode and 'I2Sx codec frame mode' to set the frame mode.
An issue with these mixer controls has been found where if the user
sets both of these, then whatever is set last will overwrite the other
resetting it back to its default value. For example, if 'I2Sx codec
master mode' configures the codec as the master, then set the 'I2Sx
codec frame mode' to say 'dsp-a', then setting the frame mode will
revert the master mode setting back to its default. Fix this by
ensuring the frame mode and master mode do not overwrite each other.

Bug 2046053
Bug 2746555

Change-Id: Ibd51a0462a4c02055075aee84808f7ddca0a9199
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2230059
(cherry picked from commit 70c45f196b76ce0d5e1e76153232cb3d35928262)
Reviewed-on: https://git-master.nvidia.com/r/2234917
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
0ac26664d6 ASoC: tegra-alt: move OPE2 to the end of dai array
This is a preparatory patch for moving all DAI links to DT. With DT based
DAI links, we need to index through the DAI array. There are differences
between Tegra210 and Tegra186, which are listed below.
 * OPE2 is removed in Tegra186
 * AMX and ADX instances are increased to 4
 * DSPK, ASRC and ARAD are added
 * DMIC instances are increased to 4
 * I2S instances are increased to 6
 * ADMAIF channels are increased to 20 each for Tx and Rx

Above makes us to have separate headers in DT, containing macro defines,
for Tegra210 and Tegra186. This can be avoided by re-ordering the DAI array
to list common DAIs in the beginning and push the differences at the end.
As we can see adding instances can be easily handled by just listing out
the new DAIs at the end. But problem is when we remove an instance and it
requires some intelligence encoded in header files for optimization. In the
current case, OPE2 is being removed from Tegra186 onwards and hence this is
pushed to the end of Tegra210 DAI array.

Bug 200538260

Change-Id: I8f976ce08d6526357ab4578fa462ab53113c674d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2220276
Reviewed-by: Automatic_Commit_Validation_User
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
Sameer Pujar
efee3b9c95 ASoC: tegra-alt: update dai order for DSPK
This is a preparatory patch for moving all DAI links to DT. With the DT
based DAI link approach, we need to index through the DSPK DAI array to
reference a particular interface. This patch re-orders DAI array to be
consistent with other drivers, where we always first list CIF DAI and
then followed by DAP and Dummy (wherever applicable). DT can use macros
for these indices and can be common if the same order is followed for
all modules.

Bug 200538260
Bug 200520821

Change-Id: Ib3ced6078b73bdf542891e28d8081e3dd38e1ab5
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2220275
Reviewed-by: Automatic_Commit_Validation_User
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
Sameer Pujar
456a60cebe ASoC: tegra-alt: one dai array for ADMAIF and ADSP
This is a preparatory patch for moving all DAI links to DT. Currently
ADMAIF is registering both a component and a codec. Also it maintains
two DAI arrays, tegra210_admaif_codec_dais[]/tegra186_admaif_codec_dais[]
for codec and tegra_admaif_dais[] for component. With the DT based DAI
link approach, we need to index through the DAI array depending on the
"sound-dai" property that cpu/codec subnodes of the dai-link can expose.
The sound core is looking at *_codec_dais[] array while getting the DAI
name from index and does not consider component DAI array. Similarly this
is true for ADSP device as well.

This patch combines both DAI arrays and registers ADMAIF and ADSP as a
codec device alone. Later versions of kernel move from codec to component,
during that transition we can register ADMAIF device as component only.

Also, for ADSP, hard-coding of DAI ID is avoided which further helps to
index the required DAI from DT. The fe_reg/be_reg value calculation, which
depends on the DAI ID, is updated accordingly.

Bug 200538260

Change-Id: Ia65b6c52796d3da73850ce1de6bf332ac723b871
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2218928
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jonathan Hunter <jonathanh@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>
2022-09-29 15:30:21 +05:30
Sameer Pujar
4ac7c86445 ASoC: tegra-alt: add dummy DAI for I/O modules
To allow loopbacks or dummy playback/capture from I/O modules to work
we have connected DAI links to spdif-dit dummy codecs, since generally
not all I/O modules have external codec connection. This helps to close
the DAPM path and audio path can be tested. The links or information
for these is exposed from DT.

In doing so, we require many instances of spdif-dit devices. For example,
for Tegra194 we have 6-I2S, 4-DMIC, 2-DSPK I/O modules. Hence we need
a maximum of 12 such spdif-dit codecs. This is populated in DT by exposing
entries for all these. Machine driver exposes routing paths for these with
random "prefix" naming.

Above can be easily avoided by doing following.
 * Expose dummy DAIs for I/O modules and routing path in module drivers.
 * Dummy speaker output and mic input DAPM widgets are added for path
   completion.
 * Routing path is added for connecting above.
 * By default for all the instances of I/O, connect the modules to dummy
   DAIs. This way we can make sure that the DAPM path is complete by
   default.

Bug 200516191
Bug 200520821
Bug 200503387

Change-Id: I3bb34ae6e62f61b5b3e693c746cac6c312775912
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2177821
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
e263ddd04d ASoC: tegra-alt: remove redundant drivers
- remove unused code
- update hypervisor check condition

Bug 200552920

Change-Id: Ie2ca3542d8dc50191f402c9d4c96d56e4c89db7a
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2200432
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Tested-by: Uday Gupta <udayg@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
be22100ee2 ASoC: tegra-alt: Fix machine driver
ASRC config was enabled for all chip versions and this leads to
writing in the dai_links array for T210 platforms which is not
acceptable as there was no ASRC present on it. Fix this issue
by having extra runtime compatible check for t210.

Bug 200555164

Change-Id: I3714d4aed77b6cecc262db443219920f872c3e17
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2210518
(cherry picked from commit f9598cb45db19454a77fd78f680cc2b8db50cc7b)
Reviewed-on: https://git-master.nvidia.com/r/2210938
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@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
Jonathan Hunter
a1372cf4d0 ASoC: tegra-alt: Prevent ALSA restore overriding I2S DT settings
When booting L4T, the I2S configuration for DAI format is defined by
properties in device-tree for the DAI link. However, mixer controls
for controlling the 'codec master mode' and 'codec frame mode' have
been added to the Tegra ASoC machine driver to that the DAI format can
also be configured from userspace. The problem is that if the
device-tree blob is updated and reflashed, any new settings in
device-tree for the DAI format although are applied initially during
boot, they are overwritten by the ALSA restore service that restores
the previous settings. The mixer controls should not override the DT
settings by default unless the user has explicitly set them via the
mixer controls.

Fix this by storing the state of the 'codec master mode' and 'codec
frame mode' mixer controls in a separate variable from the actual DAI
link format data.

Bug 2665590

Change-Id: I1405b1e8a3bb67e619fb43c3f9142e8a050e04c6
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2190010
(cherry picked from commit f5cf6f5b3532deec65b01b2a26a5373614a11bf6)
Reviewed-on: https://git-master.nvidia.com/r/2193535
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
51d0fedb09 ASoC: tegra-alt: add i2s sync input clock
By default we are using plla_out0 as the clock source of I/O modules.
Similarly, these modules can use SYNC_CLK as the clock source. SYNC_CLK
is a MUX of I2Sx bit clocks and few other clocks. Hence it is possible
to use I2Sx bit clock as parent for I2Sy module or for any DMIC or DSPK
instance.

This patch adds SYNC_INPUT support for I2S bit clocks and set rate for
the same as per bit clock rate. If some I/O module wants to use this
bit clock as reference, then corresponding module can use assigned-clocks
DT bindings to setup proper clock relationships.

As an example, consider the case where I2S2 wants to use I2S1 bit clock as
reference. Clock relation looks like below(from clk_tree dump),
* i2s1_sync_input
    |__
       |
     i2s2_sync_clk
        |__
           |
         i2s2
DT binding to establish above relation is(Tegra194 taken as reference),
 i2s@2901100 {
     ...

     assigned-clocks = <&bpmp TEGRA194_CLK_I2S2>,
                       <&bpmp TEGRA194_CLK_SYNC_I2S2>;
     assigned-clock-parents = <&bpmp TEGRA194_CLK_SYNC_I2S2>,
                              <&bpmp TEGRA194_CLK_I2S1_SYNC_INPUT>;

     ...
 };

In default case, i2s2 clock relation is like below,
* pll_a
    |__
       |
     plla_out0
        |__
           |
         i2s2
And the corresponding DT binding is,
 i2s@2901100 {
     ...

     assigned-clocks = <&bpmp TEGRA194_CLK_I2S2>;
     assigned-clock-parents = <&bpmp TEGRA194_CLK_PLLA_OUT0>;

     ...
 };

Bug 200544085

Change-Id: I5d8d773616cecb4ccc43a5cf1f89845a68c861d4
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189715
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@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
Asha Talambedu
d5be4c92a4 ASoC: tegra-alt: Fix MVC mute issue
MVC Mute Mixer ctrl setting is not reflecting correct
status as the mute ctrl register is not cached and therefore
getting reset to default in resume call that is being called
after reading the mixer ctrl.

To avoid this, MVC mute register is made non-volatile and
get_sync/put_sync is avoided for reading this cached register

Mute status reset in cache everytime after setting volume
for proper reflection of mute status in mixer controls. Note
that cached value will be synced to hardware on resume.

Bug 200532059

Change-Id: I9ee072d84c8103facdad22b2708113c4bcdda039
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2165774
(cherry picked from commit 85badb30954b503121f139a66eba4dc02eb90068)
Reviewed-on: https://git-master.nvidia.com/r/2185120
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
aa1f1ad292 ASoC: tegra-alt: Remove on fly curve change support
on the fly curve type change needs hw soft reset or MVC disable
and enable programming sequence to be followed with re-programming
all the required register. Current driver code support is not
fully compliant with the IAS programming sequence. So to better
handling remove the on fly curve type support from the mvc driver.

Bug 200532059

Change-Id: I55a44134b07d1ddfebf103796d47930158ff770d
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2180060
(cherry picked from commit 608bcd2adf33b3f1daa5dad37441295351ea6e0c)
Reviewed-on: https://git-master.nvidia.com/r/2184303
GVS: Gerrit_Virtual_Submit
Reviewed-by: Asha Talambedu <atalambedu@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
Dipesh Gandhi
b6debbfd49 ASoC: tegra-alt: correct stale data clear logic
dmaengine_pcm_pointer return number of frames. Present clean
in drain state is incorrectly treating frames as bytes which
can lead to clear more than expected data.

This change make sure addition call byte_to_frames() is
not done.

Bug 200530292

Change-Id: I6daf696e14333cd914329e5c12b8052e4c7fdf4f
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2159316
(cherry picked from commit a86d579f9eaaf422e656b29965a2bc2371aefca4)
Reviewed-on: https://git-master.nvidia.com/r/2159286
Tested-by: Poojashree M S <pms@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Asha Talambedu
fd7fd450b6 ASoC: tegra-alt: Modified ADSP config and prompts
a) Both ADSP audio driver and OS are compiled with the same
config setting. Therefore, defined a config to enable disablement
of ADSP audio driver.
b) In addition, removed prompts for symbols related
to tegra-alt module drivers as the drivers as dependencies are not
properly defined which can lead to illegal confgurations that might
result in runtime failures

Bug 200536088

Change-Id: I2a7e31d604cca6f86f9db47dc0a7f91e96c6605a
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2159728
(cherry picked from commit 626e9724092aec5f0a39368cb51278a873cd7dfe)
Reviewed-on: https://git-master.nvidia.com/r/2176657
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
Sameer Pujar
a4107ebd5d ASoC: tegra-alt: remove nvidia,mclk-rate property
Currently MCLK rate depends on following DT properties,
 * 'mclk-fs' : This is a scaling factor depending on which MCLK rate
   is calculated at runtime [rate = scale * sample_rate]. Different
   codecs might expect different scale factors and hence DT property
   is useful here.
 * 'nvidia,mclk-rate' : This is used to provided fixed rate for MCLK.
   This overrides scale property, when specified.

Since the requirement is either to have fixed or dynamic rate for MCLK,
this can be managed with single property like below.
 * Use 'assigned-clocks' and 'assigned-clock-parents' to specify parent
   clock for MCLK.
 * Use preferred rate during initialization with 'assigned-clock-rates'
   DT binding. This can be the required fixed rate as well.
 * If dynamic scaling is required, then use 'mclk-fs' property.
   Otherwise system uses fixed rate.

Since rt565x audio codecs expect scaling factor of 256, all platforms
which use such codecs must be populated with "mclk-fs" property. This
is taken care in other patches in the series.

Bug 200542485
Bug 200516191
Bug 200503387

Change-Id: I1fc31626929bab9d4707d2a1b74c8f1749412ea4
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2173560
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@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
c051f5fb23 ASoC: tegra-alt: remove function propotype defines
tegra_machine_driver_mobile.c declares function protoypes in the
beginning. This was done to avoid compiler build errors related
to unresolved symbols, when function is used before its definition.

With this patch, code is re-organised and these function prototypes
are no more needed.

Bug 200503387
Bug 200516191

Change-Id: I35519faf39059af5f0c9adf81712008ce61d8614
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2173559
Reviewed-by: Automatic_Commit_Validation_User
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
Mohan Kumar
919e8b00bd ASoC: tegra-alt: Fix MVC gain issues
The Applied gain in dB never reflected in the output data with
the current driver code. There was few issues related to the
way we program the sequences. As a first step cleaning up the
driver to make sure the applied gain is proper in the output and
bitmatch works with multiple runs.

- Do MVC soft reset to clear the state in the hw_params before
processing the input data.
- Assign the init volume and target volume to the same value at
start of processing.
- Trigger the switch only after programming all the registers related
to Volume, duration and polynomial coefficients.

Bug 200532059

Change-Id: I2c77bd225284f31892ed8c2ff7c228dd19f8c63e
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2170333
(cherry picked from commit 6f56c3df3f2f6a55e33d9071cb5d05d0992a6b28)
Reviewed-on: https://git-master.nvidia.com/r/2173817
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
Sameer Pujar
a4c55519f8 ASoC: tegra-alt: clock cleanup for AHUB drivers
Currently we pass module clocks and related parents from DT bindings. The
driver gets these clock handles and does enable/disable() or sets rate
or parents whenever required. But passing the parent clock is not necessary
always, unless we want to change the rate dynamically.

For example consider the case of i2s device. Possible parents of i2s are,
 * PLLA_OUT0, PLLA1_OUT1, SYNC_CLK, PLLP_OUT0, CLK_M
DT binding currently has entries for few of these clocks. This is not
needed, since we don't have requirement to set the parent dynamically.
Generally it is statically configured. Hence "assgigned-clocks" and
"assigned-clock-parents" DT binding can be used to specify the child and
parent relation.

In summary,
 * devm_clk_get() functions are removed for parent and sync clocks. Only
   for xbar, parent clock would be needed since we change the clock rate
   dynamically depending on playback/capture rate. In most of the cases
   only module clocks are sufficient and are retained.
 * sync clocks are currently not used for L4T/Android. It could be later
   required. Hence DT binding for it will be retained (mostly sync_input
   would be needed). Required driver support will be added later.
 * clk_set_parent() calls are removed, since DT clock binding takes care
   of this.
 * removed clk_ape and clk_apb2ape from xbar driver, since just enable
   or disable of these is performed in the driver, which is not really
   required. Because this is taken care in parent(ACONNECT) device node.
 * Few clock names are updated as below in devm_clk_get()
   * DSPK module clock --> "dspk"
   * I2S module clock  --> "i2s"
   * XBAR parent clock --> "parent"

Bug 200503387

Change-Id: I29b77e32cf1f950d9ea3bb66d27b4a8482bf9926
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2159592
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
2f0a260959 ASoC: tegra-alt: remove is_playback from DAI init
pcm_hw_params() and compr_set_params() functions set "is_playback" flag to
true for SNDRV_PCM_STREAM_PLAYBACK and SND_COMPRESS_PLAYBACK respectively.
The flag is then passed to tegra_machine_dai_init() function. However this
flag is not used by DAI init function and appears to be redundant.

Hence this patch removes is_playback argument from DAI init function and
cleans up pcm_hw_params() and compr_set_params() functions.

Bug 200516191
Bug 200503387

Change-Id: I759181a53fa2e599ca338b4004451183813a5fc5
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2172229
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
b4955d4ea6 ASoC: tegra-alt: remove shutdown handling
commit b4bc1cf56020("ASoC: tegra-alt: Avoid reg access after shutdown")
avoided device register access after shutdown() has been called. This
otherwise resulted in occasional SError and resulted in crash. The reason
for this was runtime PM does not work after shutdown and it was seen on
vK4.4

Looks like the issue has been fixed from vK4.5 onwards, where PM domain
detach is avoided during shutdown. Following is the upstream commmit.
"platform: Do not detach from PM domains on shutdown"

Bug 200503387

Change-Id: I5f3d18f05e434d5a1ed5b597362a39ec9a9f010b
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2161809
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
3f3a331b56 Revert "ASoC: tegra-alt: add dma_set_mask parse"
This reverts commit 4ccb56ad195d811303051c067fd1c8915588767c.

Jira EMA-1251

Change-Id: I6997bb04ab801bf2c1de3bfe90bcdfc70c4c8c4a
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2166540
Reviewed-by: Mohan Kumar D <mkumard@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
Sameer Pujar
18c581a03e ASoC: tegra-alt: clock cleanup for machine driver
Highlights from current clock handling in machine driver(L4T/Android)
 * Tegra210 and Tegra186/194 have different approaches to update clock
   rates for pll_a, pll_a_out0, mclk and ahub.
   -> Tegra210 uses static method, where base pll_a rate is hardcoded
      in the driver.
   -> Tegra186/194 use DT driven approach, where sound node passes rates
      for above clocks. Two sets of rates are passed, one to support odd
      sample rates and one for even.
 * Some of the functions from tegra_asoc_utils_alt.c are unused
 * clock names are not really generic.

This patch has following updates.
 * Unify clock update approach. Use static array for base pll rates.
   This also helps to get rid of following sound node DT properties.
   "nvidia,num-rates"
   "nvidia,clk-rates"
 * Remove below unused functions.
   tegra_alt_asoc_utils_lock_clk_rate()
   tegra_alt_asoc_utils_register_ctls()
   tegra_alt_asoc_utils_tristate_dap()
 * clk_set_parent() functions are not needed. Instead the relationship
   can be set from DT through "assigned-clocks" binding.
 * update clock handle names to be more meaningful. However, clock names
   that are parsed in devm_clk_get() are not changed because these names
   are used in Automotive DT files under "sound_ref" node. Scope of
   current patch is limited to L4T/Android drivers and DT files.

Bug 200503387
Bug 200516191

Change-Id: Ideaf150e6e200ffbba4dcbdec4c49f1127ea25db
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2164482
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@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>
2022-09-29 15:30:21 +05:30
Sameer Pujar
5a727dbebb ASoC: tegra-alt: remove DAI init for SFC
tegra_machine_sfc_init() is used to initialize input and output rates
for SFC module. In fact, this is done for only SFC1 instance. Machine
driver does this setup by calling snd_soc_dai_set_sysclk() for input
and output. SFC driver has a callback function implemented to take
care of this.

Above is not really required. By default srate_in and srate_out have
value 0 and hence SFC would operate in bypass mode. Already mixer
controls are exposed from the driver to set SFC input and output sample
rates and the same should be used for the required rate conversions.
Thus this patch removes following functions,
 * tegra_machine_sfc_init() from machine driver
 * tegra210_sfc_set_dai_sysclk() from SFC driver

Bug 200503387

Change-Id: Iada1b4748413debd0eb7d7f9a951069bda15af22
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2165143
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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
Kwangwoo Lee
4f168be948 ASoC: tegra-alt: check the allocation of dai link
kzalloc() can be failed under low memory condition. In such a case, the
following memcpy() can cause a panic. Thus, the return value of
kzalloc() should be checked. If tegra_machine_get_dai_link_t18x() is
called, the return value should also be checked.

Bug 2647682

Change-Id: Ia200436a3b1877933932b9a086862f5507c8da54
Signed-off-by: Kwangwoo Lee <kwangwool@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2159959
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@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
425bac4962 ASoC: tegra-alt: cleanup old DAI link related code
Machine driver has moved to newer versions of dai-link helpers. Unused
older functions now can be removed to simplify the code. Hence following
are removed.
 * dai_link_setup()
 * removed following callback functions from soc_data.
   (*get_dai_link)()
   (*get_codec_conf)()
   (*append_dai_link)()
   (*append_codec_conf)()
 * Machine driver probe() is cleaned up

Bug 200516191
Bug 200503387

Change-Id: Ia4e636f97e94cec51cd3b67ce27f1bec16caab09
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2151461
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@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
7bed49cfba ASoC: tegra-alt: use new DAI link helpers
With this patch tegra_machine_driver_mobile.c uses newly exposed helper
for dai link setup, add_dai_links(). The soc_data is populated with dai
link and codec conf members to take care of t21x and t18x platforms.
Older function, dai_link_setup(), is marked as __maybe_unused. This will
be removed in subsequent patches in the series.

Bug 200516191
Bug 200503387

Change-Id: If7ae36acc932cc8c146d59c03fd3ab6732c7ff35
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2151460
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
c2a88a3b26 ASoC: tegra-alt: new helpers to manage DAI links
Idea is to expose dai links or codec confs via members of machine driver
structure. The 'struct tegra_asoc' is used to group dai link related
members, which would be included in the 'struct tegra_machine'. This helps
to simplify the code like mentioned below.
 * no need of having t21x or t18x specific helper functions
 * no need of having global variables. Currently we use few global members
   for t21x.
 * currently we have separate helpers to first pass DT dai-links and then
   append with the dai-links defined in machine-alt utility code. In the
   current patch new helper{tegra_asoc_populate_dai_links()} combines both
   of the operations. The same is true for codec conf helpers as well and
   tegra_asoc_populate_codec_confs() alone is sufficient.
 * machine driver codec_init() and set_dai_ops() for easy reading.

In summary,
 tegra_asoc_populate_dai_links() combines following.
   * tegra_machine_new_codec_links()
   * tegra_machine_append_dai_link()
   * tegra_machine_append_dai_link_t18x()

 tegra_asoc_populate_codec_confs() combines following.
   * tegra_machine_new_codec_conf()
   * tegra_machine_append_codec_conf()
   * tegra_machine_append_codec_conf_t18x()

 machine->asoc->dai_links/codec_confs replaces below helpers.
   * tegra_machine_get_dai_link()
   * tegra_machine_get_dai_link_t18x()
   * tegra_machine_get_codec_dai_link_idx_t18x()
   * tegra_machine_get_codec_conf()
   * tegra_machine_get_codec_conf_t18x()

Machine driver(tegra_machine_driver_mobile.c) exposes add_dai_links()
helper to setup dai links. This will be used in the subsequent patches in
the series. Few structures are moved to machine-alt header files for reuse
if needed by other machine drivers. Also release_asoc_phandles() is exposed
to balance refcounts, during error paths, by calling of_node_put() for DAI
links and codec conf.

Bug 200503387
Bug 200516191

Change-Id: I39c888068b8a1e8e0b1ca277270e9dd84044b150
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2151459
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@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
807ca5b006 ASoC: tegra-alt: Fix MIXER1-7 codec dai name
The MIXER1-7 dai uses RX6 as codec dai which is wrong as it has
to use RX7, due to this RX7 path was never been used for t18x
and t19x platforms. Fix this issue by using RX7 as the codec
dai.

Bug 200534612

Change-Id: Ia0ad7ddf518ae4b113e2a0b095c3ee3893697064
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2155817
(cherry picked from commit f1890d288f2167055e3f32ef9ca61539c73a6c20)
Reviewed-on: https://git-master.nvidia.com/r/2158792
Reviewed-by: Automatic_Commit_Validation_User
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
Mohan Kumar
5caff633f6 ASoC: tegra-alt: Remove pinctrl support in driver
Dynamic pinmux support through DT entries are no longer
supported for audio. This will make the pinctrl handling
in the audio drivers redundant and can be removed to be
inline with the policy followed for dynamic pinmux.

Bug 200533287

Change-Id: I37f958ab50afa88377ae4d6c50941241326dbbd3
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2151022
(cherry picked from commit 1b68ce5a60ae93de6f65d965570f091a7c10ac31)
Reviewed-on: https://git-master.nvidia.com/r/2153101
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
446bac0918 ASoC: tegra-alt: probe() cleanup for AHUB modules
Cleanup probe() functions for AHUB module drivers and following is the
summary of changes. This helps later in upstream too.
 * avoid unnecessary goto labels by updating return paths
 * removed following unused header files wherever applicable.
   linux/pinctrl/consumer.h
   linux/version.h
   linux/debugfs.h
   linux/slab.h
 * redundant pm_runtime_get/put removed in tegra186_xbar_registration()
 * Redundant error print during memory allocation failure is removed
 * runtime PM is enabled as late as possible and before the codec
   registration is done.
 * explicit calls to runtime_resume/suspend is avoided in probe(). For
   upstream, PM is enforced and the same can be done in downstream too.
   Hence no need to handle !PM case in driver probe()
   Ref: http://patchwork.ozlabs.org/patch/1048746/
 * IS_ERR() check is sufficient for error handling in case of
   devm_clk_get().

Bug 200520821
Bug 200503387

Change-Id: Ie4192036e72db161fa7d8ff4c6c0b28c17635793
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2153956
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
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
87dc6dec32 ASoC: tegra-alt: cleanup resource ioremap
Currently drivers for resource ioremap does following explicit operations.
 * error check for platform_get_resource()
 * call devm_request_mem_region()
 * call devm_ioremap()

Instead of above explicit calls, devm_ioremap_resource() function can be
used, which covers all of the above. As per this scheme all drivers are
updated for memory region request and ioremapping.

Bug 200503387

Change-Id: I7b8df29742e8236d315369ef76aa57d47f47aac7
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2152456
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
b289cafe0e ASoC: tegra-alt: fix channel conversions for dmic
DMIC controller can be configured to receive data in both left and right
channels or in just the left channel or the right channel. Currently we
have dmic->ch_select to configure the same. There are few issues w.r.t
the way this is used.
  * dmic->ch_select overrides both client and audio channels of TX CIF.
  * channels in params_channels(params) is not used and hence requested
    number of channels in hw_param() callback is not considered.
  * stereo to mono conversion at TX CIF is not supported

This patch addresses all above issues with following
  * expose a mixer control, "Channel Select", for channel override for
    CIF channels.
  * dmic->ch_select is only used to override client channels.
  * by default ch_select is set to stereo and "None" option is removed
  * expose mixer control, "stereo to mono", for stere->mono conversion
    This can be used to select one of the following methods for conversion
      CH0 --> pick the first channel
      CH1 --> pick the second channel
      AVG --> (CH0 + CH1) / 2
  * "None" is not required for mono->stereo and hence removed and only
    below are sufficient.
      ZERO --> zero out the second channel
      COPY --> copy the first channel to the second channel
  * Replaced "TX" prefix for mixer controls with "Capture". This aligns
    with the policy we used for ADMAIF and I2S.
  * "Channel Select" control is replaced with "Controller Channel Select",
    as the control is related to DMIC controller and will be more
    meaningful.

Bug 200520821
Bug 200503387

Change-Id: I8a103f67dc75ca651ee3df3d8594971327364c84
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2151729
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Jonathan Hunter
e6d271554b ASoC: tegra-alt: Remove 'is_hs_supported' variable
Device-tree for all Tegra platforms has been updated to only populate
the link-name 'rt565x-playback' if the RT5658 codec is present. Note
that this is handled by the plug-in manager. Therefore, we no longer
need the additional test in the Tegra machine driver and we can
completely remove the variable 'is_hs_supported'.

Bug 200503387

Change-Id: I6070032f1d2f8d12245b1a2de5abcf60e97ec884
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2147460
(cherry picked from commit e987036cccf5a0a735bf3bc8e2c7147c89318cfa)
Reviewed-on: https://git-master.nvidia.com/r/2153227
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
3f7068fe52 ASoC: tegra-alt: program bclk_ratio in i2s driver
Currently machine driver provides a mixer control to override BCLK ratio.
This override is global and the ratio is updated for all dai links. Thus it
limits the simultaneous usage of I2S instances for multiple BCLK ratios.

To overcome above limitation this patch does following,
 * Move BCLK override to I2S driver by exposing a mixer control. This
   provides flexibility in modifying the ratio for test or debug purposes.
 * Since BCLK ratio is used only by I2S, a DT entry for it is more suitable
   in I2S device node. Hence add parsing logic for property "bclk-ratio".
   Subsequently DT patches would be pushed.
 * Finally remove BCLK related code from machine driver. The helper APIs
   tegra_machine_get_bclk_ratio() and tegra_machine_get_bclk_ratio_t18x()
   cannot be removed completely, since other machine drivers use this.
   Hence the references are not removed.

Bug 200503387
Bug 200516191

Change-Id: I96ba9b4b1ebe7913bb637ed7abd534b724ecec15
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2147207
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@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
Asha T
4b8543e6e1 ASoC: tegra-alt: Added support for all rate conv.
Current SFC driver does not have coefficients to support all the
conversions supported by hardware. Therefore, added coefficients to
support all possible conversions.

Bug 200528035

Change-Id: I987fba6ac933962ddf963d40494983b9bcba79af
Signed-off-by: Asha T <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2138084
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Sameer Pujar
8f563d5978 ASoC: tegra-alt: remove simpler APIs
Some of the helper APIs are really simple and just return members.
Removed following helpers to help simplify the code.
 * tegra_machine_set_num_dai_links()
 * tegra_machine_get_num_dai_links()
 * tegra_machine_set_machine_links()
 * tegra_machine_get_machine_links()
 * tegra_machine_set_machine_codec_conf()
 * tegra_machine_get_machine_codec_conf()
 * tegra_machine_get_bclk_ratio_array()
 * tegra_machine_get_rx_mask_array()
 * tegra_machine_get_tx_mask_array()
 * tegra_machine_get_num_links_t18x()

Bug 200503387

Change-Id: I3864b8e8a48590ee480fccaa092cfb61579c80e4
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2146324
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jonathan Hunter <jonathanh@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
600cfeccca ASoC: tegra-alt: remove set_bclk_ratio() callbacks
snd_soc_dai_ops has a callback function pointer to set bclk ratio.
For DMIC, DSPK and SPDIF drivers though the callback is implemented
but looks redundant. Such callbacks are removed from the driver
and a NULL check for set_bclk_ratio function ptr is added in machine
driver.

Bug 200503387
Bug 200520821

Change-Id: Ia3b96d0e0f4789f8bc54960b3a7ebaf482da1434
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2144430
Reviewed-by: Automatic_Commit_Validation_User
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
Sameer Pujar
c81c7a81e5 ASoC: tegra-alt: DMIC clk cleanup
Current patch includes following,
* update clk_pll_a_out0 with generic clk_parent name
* commit 0d63fa3078d7 ("ASoc: tegra-alt: support dmic parent rate control")
  introduced setting of parent clk rate. This was specifically added for
  Mystique platform and used only on Tegra194. Removed this as Mystique is
  dropped and further helps to align for upstreaming.

Bug 200520821
Bug 200503387

Change-Id: I6389199e5a3398e996f215f176934a79370b879a
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2144218
Reviewed-by: Automatic_Commit_Validation_User
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
Mohan Kumar
f1e0181664 ASoC: tegra-alt: fix dspk driver issues
- Make the primary dais to be in sync with other ahub drivers
by renaming it to DAP/CIF, this would remove the dependency on
the link name dspk-playback-l/r for dspk and can use any generic
name.

- The second dais which was used for dual mono codec path can
avoid using the dai_ops callback, as there is no need of calling
hw_params, set_bclk etc.. multiple times per pcm_open. Only the
primary dai with name DAP will be used for callbacks.

- Support S32_LE format support for the dais.

- Change SND_SOC_DAPM_AIF_IN to SND_SOC_DAPM_AIF_OUT as the dspk is
audio output interface.

- Add proper DAPM route entry to machine driver and remove any check
 with dspk-playback-l to make it more generic usage.

- Cleanup aud_mclk parent configuration

Bug 200525217

Change-Id: I3a718f72ea0b442a7cf1716540e79d69a05a220a
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2133518
(cherry picked from commit a3233ef7bc78953a264c2729ace9ea0a0da59814)
Reviewed-on: https://git-master.nvidia.com/r/2145942
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Sameer Pujar
bb5f984534 ASoC: tegra-alt: remove unused macros for DMIC
This patch includes following,
  * remove unused macros and header files
  * update macros to respect 80 characters per line
  * OSR related macros moved to enum
  * other minor changes related to alignment

Bug 200520821
Bug 200503387

Change-Id: I3d8006e3369709338806314e706d47dbe3896ea4
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2144217
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Sameer Pujar
7d7012a9aa ASoC: tegra-alt: cleanup driver codec_probe
snd_soc_codec_driver probe() callback for most of the drivers appear to be
redundant, as only some member initialization is done. The same can be done
in platform_driver probe(). Hence codec_probe is removed from drivers
except OPE driver, where peq and mbdrc initialization is done.

Bug 200503387
Bug 200520821

Change-Id: Icd03df1d65d61388bf563468eb86bc134701479f
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2144216
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
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