Hi everyone. I'm using nvidia-jetson-tk1 board.I need work wm8978 audio codec.How to work wm8978?

My control interface i2c0. I used i2cdetect but not see wm8978 address

Hi tserensodnom, do you use TK1 or TX1?

I’m use TK1

Hi tserensodnom,
We have rt5639 on TK1 by default, so you will need to check the source files
sound/soc/tegra/tegra_rt5639.c
arch/arm/mach-tegra/board-ardbeg.c

And make relevant changes for wm8978.

Hi Danill my kernel configuration
kernel/sound/soc/tegra/Kconfig:
config MACH_HAS_SND_SOC_TEGRA_WM8978C
bool
help
Machines that use the SND_SOC_TEGRA_WM8978C driver should select
this config option, in order to allow the user to enable
SND_SOC_TEGRA_WM8978C.

config SND_SOC_TEGRA_WM8978C
tristate “SoC Audio support for Tegra boards using a WM8978 codec”
depends on SND_SOC_TEGRA && I2C && TEGRA_DC
depends on MACH_HAS_SND_SOC_TEGRA_WM8978C
select SND_SOC_WM8978 if SND_SOC_I2C_AND_SPI
select SND_SOC_TEGRA20_I2S if ARCH_TEGRA_2x_SOC
select SND_SOC_TEGRA30_I2S if !ARCH_TEGRA_2x_SOC
select SND_SOC_TEGRA20_SPDIF if ARCH_TEGRA_2x_SOC
select SND_SOC_TEGRA30_SPDIF if !ARCH_TEGRA_2x_SOC[url][/url]
select SND_SOC_TEGRA30_I2S if !ARCH_TEGRA_2x_SOC
//select SND_SOC_WM8978C
select SND_SOC_TEGRA30_DAM if !ARCH_TEGRA_2x_SOC
//select SND_SOC_WM8978
select SND_SOC_SPDIF
select SND_SOC_TEGRA30_AVP if !ARCH_TEGRA_2x_SOC
help
Say Y or M here if you want to add support for SoC audio on Tegra
boards using the WM8978 codec. Currently, only supported board is
Pluto.
kernel/sound/soc/tegra/Makefile:
snd-soc-tegra-wm8978-objs := tegra_wm8978.o
obj-$(CONFIG_SND_SOC_TEGRA_WM8978C) += snd-soc-tegra-wm8978.o
kernel/arch/arm/boot/dts/tegra124-jetson_tk1-pm375-000-c00-00.dts:
i2c@7000c000 {
wm8978: wm8978@1a {
#sound-dai-cells = <0>;
compatible = “wlf,wm8978”;
status = “okay”;
reg = <0x1a>;
};
};

My problem is do not read and write via i2c controller

root@tegra-ubuntu:/home/ubuntu# i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – UU – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – 36 – – – – – – – – –
40: – – – – – – – – – – – – 4c – – 4f
50: 50 – – – – – 56 – – – – – – – – –
60: – – – – – – – – – – – 6b – – – –
wm8978 slave adrress 0x1a
Result when working driver:
root@tegra-ubuntu:/home/ubuntu# i2cdump -f -y -r 0x00-0xff 0 0x1a
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX

Hi tserensodnom,
Do you apply the same to arch/arm/mach-tegra/board-ardbeg.c ? It reads information from the board file, not device tree.

How do apply board-ardbeg.c ?

Hi tserensodnom,
You need to check the following source codes

danel@ce-tw-daneliu:~/r21_5/kernel$ grep 'tegra-snd-rt5639' ./ -r
./arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-fixed-pm375-0000-c00-00.dtsi:                                        regulator-consumer-device = "tegra-snd-rt5639.0";
./arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-fixed-pm375-0000-c00-00.dtsi:                                        regulator-consumer-device = "tegra-snd-rt5639.0";
./arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-fixed-pm375-0000-c00-00.dtsi:                                        regulator-consumer-device = "tegra-snd-rt5639.0";
./arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-fixed-pm375-0000-c00-00.dtsi:                                        regulator-consumer-device = "tegra-snd-rt5639.0";
./arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-fixed-pm375-0000-c00-00.dtsi:                                        regulator-consumer-device = "tegra-snd-rt5639.0";
./arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-fixed-pm375-0000-c00-00.dtsi:                                         regulator-consumer-device = "tegra-snd-rt5639.0";
./arch/arm/mach-tegra/board-ardbeg.c:   .name = "tegra-snd-rt5639",
./sound/soc/tegra/tegra_rt5639.c:#define DRV_NAME "tegra-snd-rt5639"

and replace all ‘tegra-snd-rt5639’ with all your settings.

Thanks DaneL for your help