Hello Jonathanh,
I made changes in tegra_machine_driver_mobile.c and DT following below.
diff --git a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
index fbca4699d..fe73a70c2 100644
--- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
+++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -30,6 +30,7 @@
#include <dt-bindings/sound/tas2552.h>
#include "rt5659.h"
#include "sgtl5000.h"
+#include "tlv320aic32x4.h"
#include "tegra_asoc_machine_alt.h"
#include "tegra210_xbar_alt.h"
@@ -283,7 +284,7 @@ static int tegra_machine_set_params(struct snd_soc_card *card,
static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
unsigned int rate, unsigned int channels,
- u64 formats)
+ u64 formats, bool is_palyback)
{
struct snd_soc_card *card = runtime->card;
struct tegra_machine *machine = snd_soc_card_get_drvdata(card);
@@ -310,7 +311,6 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
err = tegra_machine_set_params(card, machine, rate, channels, formats);
if (err < 0)
return err;
-
rtd = snd_soc_get_pcm_runtime(card, "rt565x-playback");
if (rtd) {
dai_params =
@@ -327,6 +327,23 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
return err;
}
}
+//Added TLV320AIC32X4
+ rtd = snd_soc_get_pcm_runtime(card, "ti-capture");
+ if (rtd) {
+ dai_params =
+ (struct snd_soc_pcm_stream *)rtd->dai_link->params;
+
+ dai_params->rate_min = srate;
+ dai_params->formats = (machine->fmt_via_kcontrol == 2) ?
+ (1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats;
+ err = snd_soc_dai_set_sysclk(rtd->codec_dai, RT5659_SCLK_S_MCLK,
+ aud_mclk, SND_SOC_CLOCK_IN);
+ if (err < 0) {
+ dev_err(card->dev, "codec_dai clock not set\n");
+ return err;
+ }
+ }
+//Ended
rtd = snd_soc_get_pcm_runtime(card, "rt565x-codec-sysclk-bclk1");
if (rtd) {
@@ -440,10 +457,17 @@ static int tegra_machine_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_card *card = rtd->card;
int err;
+ bool is_playback;
+
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ is_playback = true;
+ else
+ is_playback = false;
err = tegra_machine_dai_init(rtd, params_rate(params),
params_channels(params),
- 1ULL << params_format(params));
+ (1ULL << (params_format(params))),
+ is_playback);
if (err < 0) {
dev_err(card->dev, "Failed dai init\n");
return err;
@@ -593,7 +617,29 @@ static int tegra_machine_rt565x_init(struct snd_soc_pcm_runtime *rtd)
return 0;
}
+//Added tlv320aic32x4
+
+static int tegra_machine_aic32x4_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct device *dev = rtd->card->dev;
+ int err;
+
+// codec_rate = tegra_machine_srate_values[machine->rate_via_kcontrol];
+// clk_rate = (machine->rate_via_kcontrol) ? codec_rate : rate;
+
+// clk_out_rate = machine->audio_clock.clk_out_rate;
+
+ err = snd_soc_dai_set_sysclk(rtd->codec_dai, AIC32X4_FREQ_25000000, 12288000,
+ SND_SOC_CLOCK_IN);
+ if (err) {
+ dev_err(dev, "failed to set aic32x4 sysclk! \n");
+ return err;
+ }
+
+ return 0;
+}
+//Ended
static int codec_init(struct tegra_machine *machine)
{
struct snd_soc_dai_link *dai_links = machine->asoc->dai_links;
@@ -611,6 +657,8 @@ static int codec_init(struct tegra_machine *machine)
dai_links[i].init = tegra_machine_rt565x_init;
else if (strstr(dai_links[i].name, "fe-pi-audio-z-v2"))
dai_links[i].init = tegra_machine_fepi_init;
+ else if (strstr(dai_links[i].name, "ti-capture"))
+ dai_links[i].init = tegra_machine_aic32x4_init;
}
return 0;
DT changes
diff --git a/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi b/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
old mode 100644
new mode 100755
index 9416a21..f32ca45
--- a/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
+++ b/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
@@ -166,6 +166,16 @@
rom-val = /bits/ 8 <0x05>;
};
};
+ aic32x4: tlv320aic32x4.1-0018@18 {
+ compatible = "ti,tlv320aic32x4";
+ status = "okay";
+ reg = <0x18>;
+ clocks = <&tegra_car TEGRA186_CLK_AUD_MCLK>;
+ clock-names = "mclk";
+ dv-supply = <&battery_reg>;
+ av-supply = <&battery_reg>;
+ iov-supply = <&battery_reg>;
+ };
};
i2c@c240000 {
@@ -668,7 +678,8 @@
#endif
ahub {
/* I2S6 */
- i2s@2901500 {
+ i2s@2901100 {
+ status = "okay";
bclk-ratio = <4>;
};
@@ -695,15 +706,24 @@
tegra_sound: sound {
compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
- nvidia,num-codec-link = <12>;
- clocks = <&tegra_car TEGRA186_CLK_PLLA>,
- <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
- <&tegra_car TEGRA186_CLK_AUD_MCLK>;
- clock-names = "pll_a", "pll_a_out0", "extern1";
- assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
- <&tegra_car TEGRA186_CLK_AUD_MCLK>;
- assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
- <&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
+ nvidia,num-codec-link = <13>;
+ nvidia,num-clk = <8>;
+ nvidia,clk-rates = < 270950400 /* PLLA_x11025_RATE */
+ 11289600 /* AUD_MCLK_x11025_RATE */
+ 45158400 /* PLLA_OUT0_x11025_RATE */
+ 45158400 /* AHUB_x11025_RATE */
+ 245760000 /* PLLA_x8000_RATE */
+ 12288000 /* AUD_MCLK_x8000_RATE */
+ 49152000 /* PLLA_OUT0_x8000_RATE */
+ 49152000 >;/* AHUB_x8000_RATE */
+ clocks = <&tegra_car TEGRA186_CLK_PLLP_OUT0>,
+ <&tegra_car TEGRA186_CLK_PLLA>,
+ <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
+ <&tegra_car TEGRA186_CLK_AHUB>,
+ <&tegra_car TEGRA186_CLK_CLK_M>,
+ <&tegra_car TEGRA186_CLK_AUD_MCLK>;
+ clock-names = "pll_p_out1", "pll_a", "pll_a_out0", "ahub",
+ "clk_m", "extern1";
resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
reset-names = "extern1_rst";
@@ -745,6 +765,7 @@
name-prefix = "x";
status = "okay";
};
+/*
nvidia,dai-link-2 {
link-name = "spdif-dit-1";
cpu-dai = <&tegra_i2s2>;
@@ -757,8 +778,9 @@
num-channel = <2>;
ignore_suspend;
name-prefix = "y";
- status = "okay";
+ status = "disabled";
};
+*/
nvidia,dai-link-3 {
link-name = "spdif-dit-2";
cpu-dai = <&tegra_i2s3>;
@@ -770,8 +792,8 @@
srate = <48000>;
num-channel = <2>;
ignore_suspend;
- name-prefix = "z";
- status = "okay";
+ name-prefix = "a";
+ status = "disabled";
};
nvidia,dai-link-4 {
link-name = "spdif-dit-3";
@@ -785,7 +807,7 @@
num-channel = <2>;
ignore_suspend;
name-prefix = "m";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-5 {
link-name = "spdif-dit-4";
@@ -799,7 +821,7 @@
num-channel = <2>;
ignore_suspend;
name-prefix = "n";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-6 {
link-name = "spdif-dit-6";
@@ -816,7 +838,7 @@
num-channel = <1>;
ignore_suspend;
name-prefix = "o";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-7 {
link-name = "spdif-dit-7";
@@ -830,7 +852,7 @@
ignore_suspend;
num-channel = <2>;
name-prefix = "a";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-8 {
link-name = "spdif-dit-8";
@@ -844,7 +866,7 @@
ignore_suspend;
num-channel = <2>;
name-prefix = "b";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-9 {
link-name = "spdif-dit-9";
@@ -858,7 +880,7 @@
ignore_suspend;
num-channel = <2>;
name-prefix = "c";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-10 {
link-name = "spdif-dit-10";
@@ -872,7 +894,7 @@
ignore_suspend;
num-channel = <2>;
name-prefix = "d";
- status = "okay";
+ status = "disabled";
};
nvidia,dai-link-11 {
link-name = "dspk1-playback";
@@ -886,7 +908,7 @@
num-channel = <2>;
ignore_suspend;
name-prefix = "d3";
- status = "okay";
+ status = "disabled";
};
dspk_1_dai_link: nvidia,dai-link-12 {
link-name = "dspk-playback-l";
@@ -914,10 +936,31 @@
num-channel = <2>;
ignore_suspend;
name-prefix = "d2";
- status = "okay";
- };
- };
+ status = "disabled";
+ };
+ nvidia,dai-link-2 {
+ link-name = "ti-capture";
+ cpu-dai = <&tegra_i2s1>;
+ codec-dai = <&aic32x4>;
+ cpu-dai-name = "I2S1";
+ codec-dai-name = "tlv320aic32x4-hifi";
+ tx-mask = <0xFF>;
+ rx-mask = <0xFF>;
+ format = "i2s";
+ bitclock-slave;
+ frame-slave;
+ bitclock-noninversion;
+ frame-noninversion;
+ bit-format = "s16_le";
+ bclk_ratio = <1>;
+ srate = <44100>;
+ num-channel = <2>;
+ ignore_suspend;
+ name-prefix = "z";
+ status = "okay";
+ };
+ };
backlight {
status = "okay";
panel-s-wuxga-8-0-bl {
Dmesg logs are here
dmesg | grep ASoC
[ 2.411212] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_R
[ 2.411215] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_R → 10 kOhm → CM_R to Right Mixer Negative Resistor
[ 2.411238] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_R
[ 2.411241] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_R → 20 kOhm → CM_R to Right Mixer Negative Resistor
[ 2.411265] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_R
[ 2.411268] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_R → 40 kOhm → CM_R to Right Mixer Negative Resistor
[ 2.416418] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_L
[ 2.416420] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_L → 10 kOhm → CM_L to Left Mixer Negative Resistor
[ 2.416457] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_L
[ 2.416459] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_L → 20 kOhm → CM_L to Left Mixer Negative Resistor
[ 2.416480] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_L
[ 2.416482] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_L → 40 kOhm → CM_L to Left Mixer Negative Resistor
[ 2.426113] tegra-asoc: sound: ASoC: failed to init ti-capture: -22
[ 2.426115] tegra-asoc: sound: ASoC: failed to instantiate card -22
dmesg | grep asoc
[ 2.426108] tegra-asoc: sound: failed to set aic32x4 sysclk!
[ 2.426113] tegra-asoc: sound: ASoC: failed to init ti-capture: -22
[ 2.426115] tegra-asoc: sound: ASoC: failed to instantiate card -22
[ 2.432065] tegra-asoc: sound: snd_soc_register_card failed (-22)
[ 2.432227] tegra-asoc:: probe of sound failed with error -22
Could you please let me know how to add the sysclk for TLV320AIC32X4 device.
Regards,
Parashuram