Hi
Thank you very much for your support ,the audio problem on NX and TX2 platforms has been solved . es8316 can play music normally on NX and TX2 platforms. But I had a problem on the Jeston Nano platform. There are no signals on MCK, SCK and LRCK pins
Jeston NX platform, the audio is OK:
amixer -c es8316tegra cset name="I2S5 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left Hp mixer Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right Hp mixer Right DAC Switch" 1
aplay -D hw:es8316tegra test.wav
“tegra194-audio-p3668.dtsi” and “tegra194-p3668-common.dtsi”:
#include <audio/tegra-platforms-audio-dai-links.dtsi>
/ {
aconnect@2a41000 {
status = "okay";
agic-controller@2a41000 {
status = "okay";
};
adsp@2993000 {
status = "okay";
};
};
hda@3510000 {
hda,card-name = "tegra-hda-xnx";
status = "okay";
};
tegra_sound: sound {
status = "okay";
compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
nvidia,model = "es8316-tegra";
clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
<&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
<&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
clock-names = "pll_a", "pll_a_out0", "extern1";
assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
<&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
<&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;
nvidia,audio-routing =
"x Headphone", "x HPOL",
"x Headphone", "x HPOR",
"y Headphone", "y OUT",
"y IN", "y Mic",
"z Headphone", "z OUT",
"z IN", "z Mic",
"m Headphone", "m OUT",
"m IN", "m Mic",
"n Headphone", "n OUT",
"n IN", "n Mic",
"o Headphone", "o OUT",
"o IN", "o Mic",
"a IN", "a Mic",
"b IN", "b Mic",
"c IN", "c Mic",
"d IN", "d Mic",
"d1 Headphone", "d1 OUT",
"d2 Headphone", "d2 OUT";
nvidia,xbar = <&tegra_axbar>;
mclk-fs = <256>;
nvidia,dai-link-1 {
name-prefix = "n";
};
hdr40_snd_link_i2s: nvidia,dai-link-5 {
name-prefix = "x";
link-name = "es8316-playback";
codec-dai = <&es8316_codec>;
codec-dai-name = "es8316-hifi";
status = "okay";
};
};
};
+++ b/common/tegra194-p3668-common.dtsi
@@ -26,6 +26,7 @@
#include <t19x-common-platforms/tegra194-no-pll-aon-clock.dtsi>
#include "tegra194-p3668-pcie-plugin-manager.dtsi"
#include "tegra194-plugin-manager-p3668.dtsi"
+#include <dt-common/jetson/tegra194-p3668-all-p3509-0000.h>
/ {
nvidia,fastboot-usb-vid = <0x0955>;
@@ -79,6 +80,56 @@
};
};
+
+ pinmux@2430000 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&hdr40_pinmux>;
+
+ hdr40_pinmux: header-40pin-pinmux {
+ pin7 {
+ nvidia,pins = HDR40_PIN7;
+ nvidia,function = HDR40_CLK;
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin12 {
+ nvidia,pins = HDR40_PIN12;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin35 {
+ nvidia,pins = HDR40_PIN35;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin38 {
+ nvidia,pins = HDR40_PIN38;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin40 {
+ nvidia,pins = HDR40_PIN40;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+ };
+ };
+
+ };
Jeston TX2 platform, the audio is OK:
amixer -c es8316tegra cset name="I2S1 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right DAC Switch" 1
aplay -D hw:es8316tegra test.wav
“tegra186-p3636-0001-a00-audio.dtsi” and “tegra186-p3636-0001-common.dtsi”:
#include <audio/tegra-platforms-audio-dai-links.dtsi>
/ {
i2s@2901000 {
status = "okay";
bclk-ratio = <4>;
};
hda@3510000 {
status = "okay";
};
tegra_sound: sound {
status = "okay";
compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
nvidia,model = "es8316-tegra";
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>;
resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
reset-names = "extern1_rst";
mclk-fs = <256>;
nvidia,audio-routing =
"x Headphone", "x HPOL",
"x Headphone", "x HPOR",
"y Headphone", "y OUT",
"y IN", "y Mic",
"z Headphone", "z OUT",
"z IN", "z Mic",
"m Headphone", "m OUT",
"m IN", "m Mic",
"n Headphone", "n OUT",
"n IN", "n Mic",
"o Headphone", "o OUT",
"o IN", "o Mic",
"a IN", "a Mic",
"b IN", "b Mic",
"c IN", "c Mic",
"d IN", "d Mic",
"d1 Headphone", "d1 OUT",
"d2 Headphone", "d2 OUT";
nvidia,xbar = <&tegra_axbar>;
/* TODO Avoid rt565x_dai_link definition by modifying common base file
* since current base does not have definition of dai link as
* rt565x_dai_link, had to add here
*/
hdr40_snd_link_i2s: rt565x_dai_link: nvidia,dai-link-1 {
name-prefix = "x";
link-name = "es8316-playback";
codec-dai = <&es8316_codec>;
codec-dai-name = "es8316-hifi";
status = "okay";
};
hdr40_i2c1: i2c@c240000 { };
};
};
--- a/kernel-dts/common/tegra186-p3636-0001-common.dtsi
+++ b/kernel-dts/common/tegra186-p3636-0001-common.dtsi
@@ -36,6 +36,7 @@
#include "tegra186-p3636-0001-a00-comms.dtsi"
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/gpio/tegra186-gpio.h>
+#include <dt-common/jetson/tegra186-p3509-0000-p3636-0001.h>
#define EXTCON_NONE 0
#define EXTCON_USB 1
@@ -64,6 +65,7 @@
};
serial@c280000 {
+ compatible = "nvidia,tegra186-hsuart";
status = "disabled";
};
@@ -78,19 +80,78 @@
status="okay";
};
+ pinmux@2430000 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&hdr40_pinmux>;
+
+ hdr40_pinmux: header-40pin-pinmux {
+ pin7 {
+ nvidia,pins = HDR40_PIN7;
+ nvidia,function = HDR40_CLK;
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin12 {
+ nvidia,pins = HDR40_PIN12;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin35 {
+ nvidia,pins = HDR40_PIN35;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin38 {
+ nvidia,pins = HDR40_PIN38;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_ENABLE>;
+ nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+ };
+
+ pin40 {
+ nvidia,pins = HDR40_PIN40;
+ nvidia,function = HDR40_I2S;
+ nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+ nvidia,tristate = <TEGRA_PIN_DISABLE>;
+ nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+ };
+ };
+
+ };
i2c@3160000 {
status="okay";
es8316_codec: es8316@10 {
compatible = "everest,es8316";
reg = <0x10>;
status = "okay";
};
};
The following is the driver of the es8316:
es8316.c (37.6 KB)
Changes to “tegra_machine_driver_mobile.c” are as follows :
--- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
+++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -29,10 +29,16 @@
#include <sound/soc.h>
#include <dt-bindings/sound/tas2552.h>
#include "rt5659.h"
+#include "es8316.h"
#include "sgtl5000.h"
#include "tegra_asoc_machine_alt.h"
#include "tegra210_xbar_alt.h"
+enum {
+ ES8316_SCLK_S_MCLK = 0,
+ ES8316_SCLK_S_PLL1,
+ ES8316_SCLK_S_RCCLK,
+};
#define DRV_NAME "tegra-asoc:"
#define PARAMS(sformat, channels) \
@@ -169,6 +175,8 @@ static const struct snd_soc_dapm_widget tegra_machine_dapm_widgets[] = {
SND_SOC_DAPM_LINE("y Line Out", NULL),
SND_SOC_DAPM_LINE("x Line In", NULL),
SND_SOC_DAPM_LINE("y Line In", NULL),
+ SND_SOC_DAPM_LINE("x IN", NULL),
+ SND_SOC_DAPM_LINE("x OUT",NULL),
};
static struct snd_soc_pcm_stream tegra_machine_asrc_link_params[] = {
@@ -335,13 +343,33 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
aud_mclk = machine->audio_clock.set_aud_mclk_rate;
- pr_debug("pll_a_out0 = %u Hz, aud_mclk = %u Hz, sample rate = %u Hz\n",
+ printk("pll_a_out0 = %u Hz, aud_mclk = %u Hz, sample rate = %u Hz\n",
machine->audio_clock.set_pll_out_rate, aud_mclk, srate);
err = tegra_machine_set_params(card, machine, srate, channels, formats);
if (err < 0)
return err;
+ rtd = snd_soc_get_pcm_runtime(card, "es8316-playback"); //wxz
+ if (rtd) {
+ printk("%s===========8316=======es8316-playback=========== %d\n",__func__,__LINE__);
+ dai_params =
+ (struct snd_soc_pcm_stream *)rtd->dai_link->params;
+
+ dai_params->formats = (machine->fmt_via_kcontrol == 2) ?
+ (1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats;
+
+ dai_params->rate_min = srate;
+ dai_params->channels_min = channels;
+
+ //err = es8316_set_dai_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK,aud_mclk, SND_SOC_CLOCK_IN);
+ err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 12288000,SND_SOC_CLOCK_IN);
+ if (err < 0) {
+ dev_err(card->dev, "codec_dai clock not set\n");
+ return err;
+ }
+ }
+
rtd = snd_soc_get_pcm_runtime(card, "rt565x-playback");
if (rtd) {
dai_params =
@@ -541,6 +569,21 @@ static int tegra_machine_fepi_init(struct snd_soc_pcm_runtime *rtd)
return 0;
}
+static int tegra_machine_es8316_init(struct snd_soc_pcm_runtime *rtd) //wxz
+{
+ struct device *dev = rtd->card->dev;
+ int err;
+
+ //err = es8316_set_dai_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 11289600,SND_SOC_CLOCK_IN);
+ err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 12288000,SND_SOC_CLOCK_IN);
+ if (err) {
+ dev_err(dev, "failed to set es8316 sysclk!\n");
+ return err;
+ }
+
+ return 0;
+}
+
static int tegra_machine_rt565x_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
@@ -602,6 +645,8 @@ static int codec_init(struct tegra_machine *machine)
dai_links[i].init = tegra_machine_fepi_init;
else if (strstr(dai_links[i].name, "respeaker-4-mic-array"))
dai_links[i].init = tegra_machine_respeaker_init;
+ else if (strstr(dai_links[i].name, "es8316-playback")) //wxz
+ dai_links[i].init = tegra_machine_es8316_init;
}
return 0;
@@ -784,8 +829,8 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
ret = snd_soc_register_card(card);
if (ret) {
- dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
- ret);
+ dev_err(&pdev->dev, "snd_soc_register_card failed (%d) %s %d\n",
+ ret,__FILE__,__LINE__);
goto cleanup_asoc;
}
But I had a problem on the Jeston nano platform, I think I2S is not working, and there is no signal on MCK, SCK and LRCK pins :
1, the U-Boot command line:
Tegra210 (P3450-Porg) # mw 0x6000d204 0
2, “tegra210-porg-pinmux-p3448-0002-b00.dtsi” file:
--- a/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
+++ b/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
@@ -497,7 +497,7 @@
/* GPIO Pin Configuration */
aud_mclk_pbb0 {
nvidia,pins = "aud_mclk_pbb0";
- nvidia,function = "rsvd1";
+ nvidia,function = "aud";^M
nvidia,pull = <TEGRA_PIN_PULL_UP>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -673,7 +673,7 @@
dap4_din_pj5 {
nvidia,pins = "dap4_din_pj5";
- nvidia,function = "rsvd1";
+ nvidia,function = "i2s4b";^M
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -681,7 +681,7 @@
dap4_dout_pj6 {
nvidia,pins = "dap4_dout_pj6";
- nvidia,function = "rsvd1";
+ nvidia,function = "i2s4b";^M
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -689,7 +689,7 @@
dap4_fs_pj4 {
nvidia,pins = "dap4_fs_pj4";
- nvidia,function = "rsvd1";
+ nvidia,function = "i2s4b";^M
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -697,7 +697,7 @@
dap4_sclk_pj7 {
nvidia,pins = "dap4_sclk_pj7";
- nvidia,function = "rsvd1";
+ nvidia,function = "i2s4b";^M
nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_ENABLE>;
3, tegra210-porg-gpio-p3448-0002-b00.dtsi:
--- a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-b00.dtsi
+++ b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-b00.dtsi
@@ -26,7 +26,6 @@
gpio_default: default {
gpio-input = <
- TEGRA_GPIO(BB, 0)
TEGRA_GPIO(B, 4)
TEGRA_GPIO(B, 5)
TEGRA_GPIO(B, 6)
@@ -43,10 +42,6 @@
TEGRA_GPIO(V, 0)
TEGRA_GPIO(V, 1)
TEGRA_GPIO(Z, 0)
- TEGRA_GPIO(J, 5)
- TEGRA_GPIO(J, 6)
- TEGRA_GPIO(J, 4)
- TEGRA_GPIO(J, 7)
TEGRA_GPIO(G, 2)
TEGRA_GPIO(G, 3)
TEGRA_GPIO(C, 0)
4, “tegra210-porg-p3448-common.dtsi” about es8316:
756 hdr40_i2c0: i2c@7000c000 {
765 es8316_codec: es8316@10 {
766 compatible = "everest,es8316";
767 reg = <0x10>;
768 status = "okay";
769 };
771 };
5, cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep i2s:
type: MUX_GROUP controller 700008d4.pinmux group: dmic1_clk_pe0 (52) function: i2s3 (24)
type: MUX_GROUP controller 700008d4.pinmux group: dmic1_dat_pe1 (53) function: i2s3 (24)
type: MUX_GROUP controller 700008d4.pinmux group: dmic2_clk_pe2 (54) function: i2s3 (24)
type: MUX_GROUP controller 700008d4.pinmux group: dmic2_dat_pe3 (55) function: i2s3 (24)
type: MUX_GROUP controller 700008d4.pinmux group: dap2_din_paa2 (89) function: i2s2 (23)
type: MUX_GROUP controller 700008d4.pinmux group: dap2_dout_paa3 (90) function: i2s2 (23)
type: MUX_GROUP controller 700008d4.pinmux group: dap2_fs_paa0 (88) function: i2s2 (23)
type: MUX_GROUP controller 700008d4.pinmux group: dap2_sclk_paa1 (91) function: i2s2 (23)
type: MUX_GROUP controller 700008d4.pinmux group: dap4_din_pj5 (93) function: i2s4b (26)
type: MUX_GROUP controller 700008d4.pinmux group: dap4_dout_pj6 (94) function: i2s4b (26)
type: MUX_GROUP controller 700008d4.pinmux group: dap4_fs_pj4 (92) function: i2s4b (26)
type: MUX_GROUP controller 700008d4.pinmux group: dap4_sclk_pj7 (95) function: i2s4b (26)
6, cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep aud:
type: MUX_GROUP controller 700008d4.pinmux group: aud_mclk_pbb0 (107) function: aud (0)
type: CONFIGS_GROUP controller 700008d4.pinmux group aud_mclk_pbb0 (107)config pull=2
type: MUX_GROUP controller 700008d4.pinmux group: gpio_x1_aud_pbb3 (110) function: rsvd0 (41)
type: CONFIGS_GROUP controller 700008d4.pinmux group gpio_x1_aud_pbb3 (110)config pull=1
type: MUX_GROUP controller 700008d4.pinmux group: gpio_x3_aud_pbb4 (111) function: rsvd0 (41)
type: CONFIGS_GROUP controller 700008d4.pinmux group gpio_x3_aud_pbb4 (111)config pull=1
type: CONFIGS_PIN controller pinctrl-pmc-io-pads pin audio (0)config 00008000
type: CONFIGS_PIN controller pinctrl-pmc-io-pads pin audio-hv (1)config 00008000
7, cat /sys/kernel/debug/tegra_gpio :
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
A: 0:0 64 40 40 04 00 00 000000
B: 0:1 f0 00 00 00 00 00 000000
C: 0:2 1f 00 00 18 00 00 000000
D: 0:3 00 00 00 00 00 00 000000
E: 1:0 40 00 00 40 00 00 000000
F: 1:1 00 00 00 00 00 00 000000
G: 1:2 0c 00 00 0c 00 00 000000
H: 1:3 fd 99 00 60 00 00 000000
I: 2:0 07 07 03 00 00 00 000000
J: 2:1 00 00 00 00 00 00 000000
K: 2:2 00 00 00 00 00 00 000000
L: 2:3 00 00 00 00 00 00 000000
M: 3:0 00 00 00 00 00 00 000000
N: 3:1 00 00 00 00 00 00 000000
O: 3:2 00 00 00 00 00 00 000000
P: 3:3 00 00 00 00 00 00 000000
Q: 4:0 00 00 00 00 00 00 000000
R: 4:1 00 00 00 00 00 00 000000
S: 4:2 a0 80 00 20 00 00 000000
T: 4:3 01 01 00 00 00 00 000000
U: 5:0 00 00 00 00 00 00 000000
V: 5:1 03 00 00 01 00 00 000000
W: 5:2 00 00 00 00 00 00 000000
X: 5:3 78 08 08 70 00 60 606000
Y: 6:0 06 00 00 02 00 00 000000
Z: 6:1 0b 08 00 01 00 00 000000
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 01 00 00 01 00 00 000000
CC: 7:0 92 80 80 00 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000
scontrols.txt (25.8 KB)
controls.txt (29.7 KB)
contents.txt (143.4 KB)
According to the reference here, I found that my uboot does not have a ”pinmux-config-p3450-porg.h“ file.
My uboot is downloaded here:
https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/sources/t210/public_sources.tbz2
Hope to get your help, thank you
wangxiaozhuang