WM8978 on Colibri iMX7

Hello together,

on this topic i wanted to implement an Wolfson WM8978 on a Colibri imx6.
(Configure external audio codec (Wolfson WM8978) - Technical Support - Toradex Community)

Finally it worked but later on we deciced to switch to an Colibri imx7d.
I’ve ported the code to the imx7.

/dts-v1/;
#include "imx7d-colibri-emmc.dtsi"
#include "imx7-colibri-eval-v3.dtsi"

/ {
	model = "Toradex Colibri iMX7D 1GB on Colibri Evaluation Board V3";
	compatible = "toradex,colibri_imx7d_emmc-eval", "toradex,colibri_imx7d_emmc", \
		     "fsl,imx7d";
};


/*
 * interner audio codec colibri modul
 * SGTL5000
 */
/ {
     /delete-node/sound;
 };
&sai1 {
    status = "disabled";
};


&iomuxc {

	pinctrl_sai2: sai2-grp {
		fsl,pins = <
			MX7D_PAD_SAI2_TX_BCLK__SAI2_TX_BCLK  0x1f /* 0x130b0 */
			MX7D_PAD_SD2_DATA3__SAI2_TX_DATA0  0x1f
			MX7D_PAD_SD2_DATA2__SAI2_TX_SYNC  0x30
			MX7D_PAD_SD2_DATA0__SAI2_RX_DATA0  0x1f
		>;
	};
	pinctrl_i2c3: i2c3grp {
		fsl,pins = <
			MX7D_PAD_I2C3_SCL__I2C3_SCL        0x4000007f /* SODIMM 81 */
			MX7D_PAD_I2C3_SDA__I2C3_SDA        0x4000007f /* SODIMM 94 */
		>;
	};

};

&i2c3 {
    clock-frequency = <400000>;
	pinctrl-names = "default";
	status = "okay";
	pinctrl-0 = <&pinctrl_i2c3>;

    wm8978: wm8978@1a {
        #sound-dai-cells = <0>;
        compatible = "wlf,wm8978";
	    reg = <0x1a>;
    };
};


/*
 * Audio:
 * Audio Multiplexer mit Audiokanal 4
 * I2C mit Wolfson WM8978
 */
/ {
    sound-wm8978 {
        compatible = "simple-audio-card";
		status="okay";
        simple-audio-card,name = "Wolfson WM8978";

			simple-audio-card,widgets =
				"Microphone", "Built-in Microphone",
				"Line", "Line-in Jack",
				"Line", "Aux-in Jack",
				"Headphone", "Headphone Jack",
				"Speaker", "Built-in Speaker";
			simple-audio-card,routing =
				"LMICP", "Built-in Microphone",
				"RMICP", "Built-in Microphone",
				"L2", "Line-in Jack",
				"R2", "Line-in Jack",
				"LAUX", "Aux-in Jack",
				"RAUX", "Aux-in Jack",
				"Headphone Jack", "LHP",
				"Headphone Jack", "RHP";
		simple-audio-card,format = "i2s";
		simple-audio-card,cpu {
              sound-dai = <&sai2 0>;
              system-clock-frequency = <3072000>;
              bitclock-master;
              frame-master;
        };
		simple-audio-card,codec {
            sound-dai = <&wm8978 0>;
            system-clock-frequency = <1228800>;
    	};


    };
};


&sai2 {
	fsl,mode = "i2s-master";
	pinctrl-0 = <&pinctrl_sai2>;
	status = "okay";

};


/*&codec {
    status = "disabled";
};*/

&lcdif {
    status = "disabled";
};

//disabling backlight
&bl {
    status = "disabled";
};


&usbotg2 {
	vbus-supply = <&reg_usbh_vbus>;
	status = "okay";
};


/*

Weitere GPIOS:
LED1a - 125 - EPDC_D7 - gpio2.IO[7]
LED1b - 
LED2a - 123 - EPDC_D6 - gpio2.IO[6]
LED2b - 113 - EPDC_D1 - gpio2.IO[1]
LED3a - 111 - EPDC_D0 - gpio2.IO[0]
LED3b - 
LED4a - 
LED4b - 




*/

Here i’ve ran into several problems:

  1. I could not make use of the pinctrl_i2c3 because it was already used by another port (I fixed by going into the imported files - imx7d.dtsi) and removed the corresponding codes. It worked but that’s not the correct solution in my opinion. So what can I do here to get it right ?

  2. When trying to play a sound with aplay I get the following errors:

    root@colibri-imx7-emmc:~# aplay piano2.wav
    [ 1109.593258] wm8978 2-001a: ASoC: can’t set wm8978-hifi hw params: -22
    ALSA lib …/…/…/alsa-lib-1.1.4.1/src/pcm/pcm_direct.c:1271:(snd1_pcm_direct_initialize_slave) unable to install hw params
    ALSA lib …/…/…/alsa-lib-1.1.4.1/src/pcm/pcm_dmix.c:1111:(snd_pcm_dmix_open) unable to initialize slave
    aplay: main:807: audio open error: Invalid argument

This error already occured once, but was also fied by setting system-clock-frequency to simple-audio-card,cpu

Sorry for bad formating here … it won’t work as i expect …

Best Regards
p_nies

Greetings @p_nies!

Which OS and version are you using? Since you’ve shown your device tree overlay, I assume you’re either using Torizon or BSP 5, but it would be nice to know the exact version of things we’re talking about.

For your first issue, we usually do not remove nodes and there’s no elegant way to do so by using device tree overlays. The best way to do this is to add status = "disabled" for the particular node you want to disable on your overlay. Once I know which kernel version you’re using, we can figure out the proper way to do this.

Regarding your second issue, the driver is specifically complaining of an invalid argument. On that other topic, I saw you were using kernel 4.9 (branch toradex_4.9-2.3.x-imx) on the Colibri iMX6. If you’re working with any other kernel version, it’s possible that the device tree bindings and the driver itself have changed.

@p_nies,

Did you solve the issue with pinctrl_sai2?

If not, can you please share a log so we can investigate?

Hi @gustavo.tx

Thanks for your advices.

The Used Kernel version is: 4.9.220-2.8.7+g57229263ff65

So first of all I changed:

 /*
  * interner audio codec colibri modul
  * SGTL5000
  */
 / {
      /delete-node/sound;
  };
 &sai1 {
     status = "disabled";
 };

To

 &sai1 {
     status = "disabled";
 };

Anyway there was a Problem with

     pinctrl_sai2: sai2-grp {
         fsl,pins = <
             MX7D_PAD_SAI2_TX_BCLK__SAI2_TX_BCLK  0x1f /* 0x130b0 */
             MX7D_PAD_SD2_DATA3__SAI2_TX_DATA0  0x1f
             MX7D_PAD_SD2_DATA2__SAI2_TX_SYNC  0x30
             MX7D_PAD_SD2_DATA0__SAI2_RX_DATA0  0x1f
         >;
     };

Where Colibri noticed that the ports are already in use on startup …

Best regards

Patrick Nies

Hello @gustavo.tx

I solved with changing imx7-colibri.dtsi.

I’ve changed the following block:

pinctrl_gpio2: gpio2-grp { /* On X22 Camera interface */
        fsl,pins = <
            MX7D_PAD_SD1_CD_B__GPIO5_IO0        0x74 /* SODIMM 69 */
            MX7D_PAD_I2C4_SDA__GPIO4_IO15       0x14 /* SODIMM 75 */
            MX7D_PAD_ECSPI1_MISO__GPIO4_IO18    0x14 /* SODIMM 79 */
            /*MX7D_PAD_I2C3_SCL__GPIO4_IO12     0x14*/ /* SODIMM 81 */
            MX7D_PAD_ECSPI2_MISO__GPIO4_IO22    0x14 /* SODIMM 85 */
            MX7D_PAD_ECSPI1_SS0__GPIO4_IO19     0x14 /* SODIMM 97 */
            MX7D_PAD_ECSPI1_SCLK__GPIO4_IO16    0x14 /* SODIMM 101 */
            MX7D_PAD_ECSPI1_MOSI__GPIO4_IO17    0x14 /* SODIMM 103 */
            /*MX7D_PAD_I2C3_SDA__GPIO4_IO13     0x14*/ /* SODIMM 94 */
            MX7D_PAD_I2C4_SCL__GPIO4_IO14       0x14 /* SODIMM 96 */
            MX7D_PAD_SD2_RESET_B__GPIO5_IO11    0x14 /* SODIMM 98 */
        >;
    };

Made a comment out of lines 6 and 11.

When changing it back to normal, following Errors occur:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.220-2.8.7+g57229263ff65 (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #17 SMP Fri Nov 13 13:14:11 UTC 2020
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Toradex Colibri iMX7D 1GB on Colibri Evaluation Board V3
[    0.000000] Reserved memory: created CMA memory pool at 0xac000000, size 320 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] percpu: Embedded 13 pages/cpu s21836 r8192 d23220 u53248
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096
[    0.000000] Kernel command line: ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait console=tty1 console=ttymxc0,115200n8 consoleblank=0 video=mxsfb:640x480M-16@60
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 698996K/1048576K available (7168K kernel code, 311K rwdata, 2336K rodata, 1024K init, 385K bss, 21900K reserved, 327680K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc0800000 - 0xff800000   (1008 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xc0000000   (1024 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x80800000   (8160 kB)
[    0.000000]       .init : 0x80b00000 - 0x80c00000   (1024 kB)
[    0.000000]       .data : 0x80c00000 - 0x80c4df60   ( 312 kB)
[    0.000000]        .bss : 0x80c4f000 - 0x80caf4d0   ( 386 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] arm_arch_timer: Architected cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000006] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000019] Switching to timer-based delay loop, resolution 125ns
[    0.000338] Ignoring duplicate/late registration of read_current_timer delay
[    0.000355] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns
[    0.001918] Console: colour dummy device 80x30
[    0.002588] console [tty1] enabled
[    0.002619] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=80000)
[    0.002667] pid_max: default: 32768 minimum: 301
[    0.002778] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002810] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.003534] CPU: Testing write buffer coherency: ok
[    0.003867] Setting up static identity map for 0x80100000 - 0x80100058
[    0.005971] Brought up 2 CPUs
[    0.006009] SMP: Total of 2 processors activated (32.00 BogoMIPS).
[    0.006035] CPU: All CPU(s) started in SVC mode.
[    0.006833] devtmpfs: initialized
[    0.020682] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.021016] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.021074] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.032546] pinctrl core: initialized pinctrl subsystem
[    0.033690] NET: Registered protocol family 16
[    0.039204] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.070001] cpuidle: using governor menu
[    0.081120] DDR type is DDR3!
[    0.088993] imx7d_enet_clk_sel: fec1: failed to get enet_out clock, assuming ext. clock source
[    0.089087] imx7d_enet_clk_sel: fec2: found enet_out clock, assuming internal clock source
[    0.089171] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.089213] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.089570] imx7d-pinctrl 302c0000.iomuxc-lpsr: initialized IMX pinctrl driver
[    0.091089] imx7d-pinctrl 30330000.iomuxc: initialized IMX pinctrl driver
[    0.092043] imx-gpcv2 30000000.aips-bus:pgc: mipi regulator not ready.
[    0.092646] MU is ready for cross core communication!
[    0.116116] mxs-dma 33000000.dma-apbh: initialized
[    0.117694] VCC_USB[1-4]: supplied by 5V
[    0.118357] SCSI subsystem initialized
[    0.118656] usbcore: registered new interface driver usbfs
[    0.118758] usbcore: registered new interface driver hub
[    0.118883] usbcore: registered new device driver usb
[    0.119103] 30800000.aips-bus:usbphynop1 supply vcc not found, using dummy regulator
[    0.119368] 30800000.aips-bus:usbphynop2 supply vcc not found, using dummy regulator
[    0.120510] i2c i2c-0: IMX I2C adapter registered
[    0.120549] i2c i2c-0: can't use DMA, using PIO instead.
[    0.120719] imx7d-pinctrl 30330000.iomuxc: pin MX7D_PAD_I2C3_SCL already requested by 30330000.iomuxc; cannot claim for 30a40000.i2c
[    0.120771] imx7d-pinctrl 30330000.iomuxc: pin-86 (30a40000.i2c) status -22
[    0.120803] imx7d-pinctrl 30330000.iomuxc: could not request pin 86 (MX7D_PAD_I2C3_SCL) from group i2c3grp  on device 30330000.iomuxc
[    0.120849] imx-i2c 30a40000.i2c: Error applying setting, reverse things back
[    0.120889] imx-i2c: probe of 30a40000.i2c failed with error -22
[    0.121402] i2c i2c-3: IMX I2C adapter registered
[    0.121436] i2c i2c-3: can't use DMA, using PIO instead.
[    0.121600] Linux video capture interface: v2.00
[    0.121683] pps_core: LinuxPPS API ver. 1 registered
[    0.121710] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.121768] PTP clock support registered
[    0.122355] imx rpmsg driver is registered.
[    0.122551] Advanced Linux Sound Architecture Driver Initialized.
[    0.123993] clocksource: Switched to clocksource arch_sys_counter
[    0.124131] VFS: Disk quotas dquot_6.6.0
[    0.124212] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.134991] NET: Registered protocol family 2
[    0.135637] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.135762] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.135925] TCP: Hash tables configured (established 8192 bind 8192)
[    0.136013] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.136085] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.136270] NET: Registered protocol family 1
[    0.136718] RPC: Registered named UNIX socket transport module.
[    0.136751] RPC: Registered udp transport module.
[    0.136775] RPC: Registered tcp transport module.
[    0.136799] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.138596] Bus freq driver module loaded
[    0.139803] Initialise system trusted keyrings
[    0.140172] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[    0.148172] NFS: Registering the id_resolver key type
[    0.148223] Key type id_resolver registered
[    0.148248] Key type id_legacy registered
[    0.148281] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.148871] ntfs: driver 2.1.32 [Flags: R/W].
[    0.149237] fuse init (API version 7.26)
[    0.155121] Key type asymmetric registered
[    0.155161] Asymmetric key parser 'x509' registered
[    0.155212] io scheduler noop registered
[    0.155237] io scheduler deadline registered
[    0.155460] io scheduler cfq registered (default)
[    0.158756] imx-sdma 30bd0000.sdma: no iram assigned, using external mem
[    0.162461] imx-sdma 30bd0000.sdma: loaded firmware 4.3
[    0.163848] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 53, base_baud = 1500000) is a IMX
[    0.904916] console [ttymxc0] enabled
[    0.909389] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 54, base_baud = 1500000) is a IMX
[    0.918855] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 55, base_baud = 1500000) is a IMX
[    0.935171] loop: module loaded
[    0.943653] vdd1p0d: supplied by DCDC3
[    0.958539] spi_imx 30840000.ecspi: dma setup error -19, use pio
[    0.965299] spi_imx 30840000.ecspi: probed
[    0.969900] libphy: Fixed MDIO Bus: probed
[    0.977820] pps pps0: new PPS source ptp0
[    0.986591] libphy: fec_enet_mii_bus: probed
[    0.991812] fec 30be0000.ethernet eth0: registered PHC device 0
[    0.997962] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.004537] ehci-mxc: Freescale On-Chip EHCI Host driver
[    1.010087] usbcore: registered new interface driver usb-storage
[    1.016263] usbcore: registered new interface driver usbserial
[    1.022160] usbcore: registered new interface driver usbserial_generic
[    1.028759] usbserial: USB Serial support registered for generic
[    1.034845] usbcore: registered new interface driver ftdi_sio
[    1.040642] usbserial: USB Serial support registered for FTDI USB Serial Device
[    1.048043] usbcore: registered new interface driver pl2303
[    1.053669] usbserial: USB Serial support registered for pl2303
[    1.060737] 30b10200.usbmisc supply vbus-wakeup not found, using dummy regulator
[    1.068324] 30b30200.usbmisc supply vbus-wakeup not found, using dummy regulator
[    1.075947] 30b20200.usbmisc supply vbus-wakeup not found, using dummy regulator
[    1.087416] ci_hdrc ci_hdrc.0: EHCI Host Controller
[    1.092350] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[    1.134012] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[    1.140386] hub 1-0:1.0: USB hub found
[    1.144222] hub 1-0:1.0: 1 port detected
[    1.149122] mousedev: PS/2 mouse device common for all mice
[    1.157781] input: AD7879 Touchscreen as /devices/soc0/soc/30800000.aips-bus/30a20000.i2c/i2c-0/0-002c/input/input0
[    1.172967] rtc-ds1307 3-0068: rtc core: registered m41t0 as rtc0
[    1.179746] snvs_rtc 30370000.snvs:snvs-rtc-lp: rtc core: registered 30370000.snvs:snvs- as rtc1
[    1.188724] i2c /dev entries driver
[    1.194800] imx2-wdt 30280000.wdog: timeout 60 sec (nowayout=0)
[    1.202161] sdhci: Secure Digital Host Controller Interface driver
[    1.208440] sdhci: Copyright(c) Pierre Ossman
[    1.212830] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.219478] sdhci-esdhc-imx 30b40000.usdhc: Got CD GPIO
[    1.284159] mmc1: SDHCI controller on 30b40000.usdhc [30b40000.usdhc] using ADMA
[    1.354019] mmc0: SDHCI controller on 30b60000.usdhc [30b60000.usdhc] using ADMA
[    1.362282] caam 30900000.caam: ERA source: CCBVID.
[    1.374746] caam 30900000.caam: device ID = 0x0a16030000000000 (Era 8)
[    1.374746] job rings = 3, qi = 0
[    1.385739] caam_jr 30901000.jr0: Entropy delay = 3200
[    1.391026] caam_jr 30901000.jr0: Instantiated RNG4 SH0.
[    1.450430] caam_jr 30901000.jr0: Instantiated RNG4 SH1.
[    1.463006] caam algorithms registered in /proc/crypto
[    1.483007] random: fast init done
[    1.487641] caam_jr 30901000.jr0: registering rng-caam
[    1.493130] caam 30900000.caam: caam pkc algorithms registered in /proc/crypto
[    1.501380] hidraw: raw HID events driver (C) Jiri Kosina
[    1.507147] usbcore: registered new interface driver usbhid
[    1.512807] usbhid: USB HID core driver
[    1.522453] coresight-etm3x 3007c000.etm: ETM 3.5 initialized
[    1.528813] coresight-etm3x 3007d000.etm: ETM 3.5 initialized
[    1.536691] sgtl5000 0-000a: sgtl5000 revision 0x11
[    1.548151] mmc0: new HS200 MMC card at address 0001
[    1.553688] mmcblk0: mmc0:0001 Q2J54A 3.64 GiB
[    1.560524] mmcblk0boot0: mmc0:0001 Q2J54A partition 1 2.00 MiB
[    1.566755] mmcblk0boot1: mmc0:0001 Q2J54A partition 2 2.00 MiB
[    1.570105] Netfilter messages via NETLINK v0.30.
[    1.570117] nfnl_acct: registering with nfnetlink.
[    1.570338] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[    1.570606] nf_tables: (c) 2007-2009 Patrick McHardy <kaber@trash.net>
[    1.570861] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.571449] NET: Registered protocol family 10
[    1.572488] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    1.572555] NET: Registered protocol family 17
[    1.572616] Bridge firewalling registered
[    1.572676] 8021q: 802.1Q VLAN Support v1.8
[    1.572714] Key type dns_resolver registered
[    1.582565] Registering SWP/SWPB emulation handler
[    1.583230] registered taskstats version 1
[    1.583233] Loading compiled-in X.509 certificates
[    1.588770] Loaded X.509 cert 'Build time autogenerated kernel key: 6d956b24a9f82fc8c248024afb292a82b1150742'
[    1.620298] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    1.620317] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 2
[    1.644015] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    1.644918] hub 2-0:1.0: USB hub found
[    1.644958] hub 2-0:1.0: 1 port detected
[    1.646472] imx_thermal 30000000.aips-bus:tempmon: Extended Commercial CPU temperature grade - max:105C critical:105C passive:95C
[    1.647973] input: gpio-keys as /devices/soc0/gpio-keys/input/input1
[    1.650932] rtc-ds1307 3-0068: setting system clock to 2020-12-18 10:05:39 UTC (1608285939)
[    1.669150] ALSA device list:
[    1.669153]   No soundcards found.
[    1.712145]  mmcblk0: p1 p2
[    1.726809] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.735145] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.744518] devtmpfs: mounted
[    1.748672] Freeing unused kernel memory: 1024K
[    1.853406] systemd[1]: systemd 234 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ +LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 +IDN default-hierarchy=hybrid)
[    1.874690] systemd[1]: Detected architecture arm.

@p_nies,

Perfect, thank you for your feedback!

@gustavo.tx do you have any further instructions where to go from here?

The imx6 was working, the imx7 won‘t give me any Sound Output at all.
Also the given Problem with my dts files when trying to override MX7DPAD… is still present

Best Regards

@p_nies,

Are you still having issues with the pin assignments? Commenting those lines on the pinctrl_gpio2 group would be the way to go to avoid this.

Can you please provide a dmesg output with those lines commented?

@gustavo.tx here is my dmesg:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.220-2.8.7+g57229263ff65 (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #17 SMP Fri Nov 13 13:14:11 UTC 2020
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Toradex Colibri iMX7D 1GB on Colibri Evaluation Board V3
[    0.000000] Reserved memory: created CMA memory pool at 0xac000000, size 320 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 262144
[    0.000000] free_area_init_node: node 0, pgdat 80c4d340, node_mem_map ab75a000
[    0.000000]   Normal zone: 2048 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 262144 pages, LIFO batch:31
[    0.000000] percpu: Embedded 13 pages/cpu s21836 r8192 d23220 u53248
[    0.000000] pcpu-alloc: s21836 r8192 d23220 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096
[    0.000000] Kernel command line: ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait console=tty1 console=ttymxc0,115200n8 consoleblank=0 video=mxsfb:640x480M-16@60
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 698996K/1048576K available (7168K kernel code, 311K rwdata, 2336K rodata, 1024K init, 385K bss, 21900K reserved, 327680K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc0800000 - 0xff800000   (1008 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xc0000000   (1024 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x80800000   (8160 kB)
[    0.000000]       .init : 0x80b00000 - 0x80c00000   (1024 kB)
[    0.000000]       .data : 0x80c00000 - 0x80c4df60   ( 312 kB)
[    0.000000]        .bss : 0x80c4f000 - 0x80caf4d0   ( 386 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] arm_arch_timer: Architected cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000007] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000019] Switching to timer-based delay loop, resolution 125ns
[    0.000340] Ignoring duplicate/late registration of read_current_timer delay
[    0.000358] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns
[    0.001919] Console: colour dummy device 80x30
[    0.002589] console [tty1] enabled
[    0.002620] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=80000)
[    0.002670] pid_max: default: 32768 minimum: 301
[    0.002780] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002812] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.003540] CPU: Testing write buffer coherency: ok
[    0.003873] Setting up static identity map for 0x80100000 - 0x80100058
[    0.005977] Brought up 2 CPUs
[    0.006015] SMP: Total of 2 processors activated (32.00 BogoMIPS).
[    0.006041] CPU: All CPU(s) started in SVC mode.
[    0.006862] devtmpfs: initialized
[    0.020724] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.021053] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.021111] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.032560] pinctrl core: initialized pinctrl subsystem
[    0.033708] NET: Registered protocol family 16
[    0.039086] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.069999] cpuidle: using governor menu
[    0.081099] DDR type is DDR3!
[    0.088966] imx7d_enet_clk_sel: fec1: failed to get enet_out clock, assuming ext. clock source
[    0.089064] imx7d_enet_clk_sel: fec2: found enet_out clock, assuming internal clock source
[    0.089150] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.089192] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.089547] imx7d-pinctrl 302c0000.iomuxc-lpsr: initialized IMX pinctrl driver
[    0.091039] imx7d-pinctrl 30330000.iomuxc: initialized IMX pinctrl driver
[    0.091990] imx-gpcv2 30000000.aips-bus:pgc: mipi regulator not ready.
[    0.092590] MU is ready for cross core communication!
[    0.116031] mxs-dma 33000000.dma-apbh: initialized
[    0.117624] VCC_USB[1-4]: supplied by 5V
[    0.118284] SCSI subsystem initialized
[    0.118584] usbcore: registered new interface driver usbfs
[    0.118684] usbcore: registered new interface driver hub
[    0.118810] usbcore: registered new device driver usb
[    0.119029] 30800000.aips-bus:usbphynop1 supply vcc not found, using dummy regulator
[    0.119298] 30800000.aips-bus:usbphynop2 supply vcc not found, using dummy regulator
[    0.120452] i2c i2c-0: IMX I2C adapter registered
[    0.120491] i2c i2c-0: can't use DMA, using PIO instead.
[    0.121004] i2c i2c-2: IMX I2C adapter registered
[    0.121038] i2c i2c-2: can't use DMA, using PIO instead.
[    0.121592] i2c i2c-3: IMX I2C adapter registered
[    0.121626] i2c i2c-3: can't use DMA, using PIO instead.
[    0.121783] Linux video capture interface: v2.00
[    0.121850] pps_core: LinuxPPS API ver. 1 registered
[    0.121877] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.121936] PTP clock support registered
[    0.122523] imx rpmsg driver is registered.
[    0.122715] Advanced Linux Sound Architecture Driver Initialized.
[    0.124169] clocksource: Switched to clocksource arch_sys_counter
[    0.124307] VFS: Disk quotas dquot_6.6.0
[    0.124387] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.135114] NET: Registered protocol family 2
[    0.135746] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.135870] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.136033] TCP: Hash tables configured (established 8192 bind 8192)
[    0.136118] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.136190] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.136379] NET: Registered protocol family 1
[    0.136832] RPC: Registered named UNIX socket transport module.
[    0.136865] RPC: Registered udp transport module.
[    0.136889] RPC: Registered tcp transport module.
[    0.136913] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.138712] Bus freq driver module loaded
[    0.139914] Initialise system trusted keyrings
[    0.140273] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[    0.148284] NFS: Registering the id_resolver key type
[    0.148334] Key type id_resolver registered
[    0.148359] Key type id_legacy registered
[    0.148393] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.149006] ntfs: driver 2.1.32 [Flags: R/W].
[    0.149363] fuse init (API version 7.26)
[    0.155549] Key type asymmetric registered
[    0.155591] Asymmetric key parser 'x509' registered
[    0.155640] io scheduler noop registered
[    0.155665] io scheduler deadline registered
[    0.155878] io scheduler cfq registered (default)
[    0.159152] imx-sdma 30bd0000.sdma: no iram assigned, using external mem
[    0.162875] imx-sdma 30bd0000.sdma: loaded firmware 4.3
[    0.164397] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 53, base_baud = 1500000) is a IMX
[    0.871425] console [ttymxc0] enabled
[    0.875902] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 54, base_baud = 1500000) is a IMX
[    0.885346] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 55, base_baud = 1500000) is a IMX
[    0.901608] loop: module loaded
[    0.910151] vdd1p0d: supplied by DCDC3
[    0.925049] spi_imx 30840000.ecspi: dma setup error -19, use pio
[    0.931776] spi_imx 30840000.ecspi: probed
[    0.936467] libphy: Fixed MDIO Bus: probed
[    0.944349] pps pps0: new PPS source ptp0
[    0.953060] libphy: fec_enet_mii_bus: probed
[    0.958331] fec 30be0000.ethernet eth0: registered PHC device 0
[    0.964473] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.971025] ehci-mxc: Freescale On-Chip EHCI Host driver
[    0.976611] usbcore: registered new interface driver usb-storage
[    0.982754] usbcore: registered new interface driver usbserial
[    0.988690] usbcore: registered new interface driver usbserial_generic
[    0.995331] usbserial: USB Serial support registered for generic
[    1.001404] usbcore: registered new interface driver ftdi_sio
[    1.007234] usbserial: USB Serial support registered for FTDI USB Serial Device
[    1.014669] usbcore: registered new interface driver pl2303
[    1.020295] usbserial: USB Serial support registered for pl2303
[    1.027367] 30b10200.usbmisc supply vbus-wakeup not found, using dummy regulator
[    1.034980] 30b30200.usbmisc supply vbus-wakeup not found, using dummy regulator
[    1.042574] 30b20200.usbmisc supply vbus-wakeup not found, using dummy regulator
[    1.054042] ci_hdrc ci_hdrc.0: EHCI Host Controller
[    1.059053] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[    1.094198] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[    1.100560] hub 1-0:1.0: USB hub found
[    1.104408] hub 1-0:1.0: 1 port detected
[    1.109327] mousedev: PS/2 mouse device common for all mice
[    1.117957] input: AD7879 Touchscreen as /devices/soc0/soc/30800000.aips-bus/30a20000.i2c/i2c-0/0-002c/input/input0
[    1.133208] rtc-ds1307 3-0068: rtc core: registered m41t0 as rtc0
[    1.139969] snvs_rtc 30370000.snvs:snvs-rtc-lp: rtc core: registered 30370000.snvs:snvs- as rtc1
[    1.148969] i2c /dev entries driver
[    1.155190] imx2-wdt 30280000.wdog: timeout 60 sec (nowayout=0)
[    1.162567] sdhci: Secure Digital Host Controller Interface driver
[    1.168857] sdhci: Copyright(c) Pierre Ossman
[    1.173247] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.179901] sdhci-esdhc-imx 30b40000.usdhc: Got CD GPIO
[    1.244340] mmc1: SDHCI controller on 30b40000.usdhc [30b40000.usdhc] using ADMA
[    1.314194] mmc0: SDHCI controller on 30b60000.usdhc [30b60000.usdhc] using ADMA
[    1.322515] caam 30900000.caam: ERA source: CCBVID.
[    1.338787] caam 30900000.caam: device ID = 0x0a16030000000000 (Era 8)
[    1.338787] job rings = 3, qi = 0
[    1.349640] caam_jr 30901000.jr0: Entropy delay = 3200
[    1.354972] caam_jr 30901000.jr0: Instantiated RNG4 SH0.
[    1.414384] caam_jr 30901000.jr0: Instantiated RNG4 SH1.
[    1.431496] caam algorithms registered in /proc/crypto
[    1.440073] caam_jr 30901000.jr0: registering rng-caam
[    1.445118] random: fast init done
[    1.448924] caam 30900000.caam: caam pkc algorithms registered in /proc/crypto
[    1.457037] hidraw: raw HID events driver (C) Jiri Kosina
[    1.458052] mmc0: new HS200 MMC card at address 0001
[    1.467734] mmcblk0: mmc0:0001 Q2J54A 3.64 GiB 
[    1.467809] usbcore: registered new interface driver usbhid
[    1.467811] usbhid: USB HID core driver
[    1.478230] coresight-etm3x 3007c000.etm: ETM 3.5 initialized
[    1.478681] coresight-etm3x 3007d000.etm: ETM 3.5 initialized
[    1.493762] mmcblk0boot0: mmc0:0001 Q2J54A partition 1 2.00 MiB
[    1.499760] sgtl5000 0-000a: sgtl5000 revision 0x11
[    1.504860] mmcblk0boot1: mmc0:0001 Q2J54A partition 2 2.00 MiB
[    1.511942]  mmcblk0: p1 p2
[    1.541981] Netfilter messages via NETLINK v0.30.
[    1.546780] nfnl_acct: registering with nfnetlink.
[    1.551797] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[    1.558219] nf_tables: (c) 2007-2009 Patrick McHardy <kaber@trash.net>
[    1.565040] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.570866] NET: Registered protocol family 10
[    1.576278] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    1.581800] NET: Registered protocol family 17
[    1.586356] Bridge firewalling registered
[    1.590438] 8021q: 802.1Q VLAN Support v1.8
[    1.594687] Key type dns_resolver registered
[    1.605411] Registering SWP/SWPB emulation handler
[    1.610763] registered taskstats version 1
[    1.614903] Loading compiled-in X.509 certificates
[    1.625132] Loaded X.509 cert 'Build time autogenerated kernel key: 6d956b24a9f82fc8c248024afb292a82b1150742'
[    1.660838] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    1.665832] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 2
[    1.694240] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    1.700450] hub 2-0:1.0: USB hub found
[    1.704305] hub 2-0:1.0: 1 port detected
[    1.709633] imx_thermal 30000000.aips-bus:tempmon: Extended Commercial CPU temperature grade - max:105C critical:105C passive:95C
[    1.725887] asoc-simple-card sound-wm8978: wm8978-hifi <-> 308b0000.sai mapping ok
[    1.836511] input: gpio-keys as /devices/soc0/gpio-keys/input/input1
[    1.844993] rtc-ds1307 3-0068: setting system clock to 2021-01-19 11:18:07 UTC (1611055087)
[    1.871352] 3.3V: disabling
[    1.874259] ALSA device list:
[    1.877247]   #0: Wolfson WM8978
[    1.887768] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.896011] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.905299] devtmpfs: mounted
[    1.909361] Freeing unused kernel memory: 1024K
[    2.015194] systemd[1]: systemd 234 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ +LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 +IDN default-hierarchy=hybrid)
[    2.036388] systemd[1]: Detected architecture arm.
[    2.074896] systemd[1]: Set hostname to <colibri-imx7-emmc>.
[    2.298247] random: systemd: uninitialized urandom read (16 bytes read)
[    2.305308] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.344413] random: systemd: uninitialized urandom read (16 bytes read)
[    2.351110] systemd[1]: Reached target Host and Network Name Lookups.
[    2.384340] random: systemd: uninitialized urandom read (16 bytes read)
[    2.391195] systemd[1]: Listening on Journal Socket (/dev/log).
[    2.424633] systemd[1]: Listening on Journal Socket.
[    2.454768] systemd[1]: Listening on Network Service Netlink Socket.
[    2.494625] systemd[1]: Listening on udev Control Socket.
[    2.524524] systemd[1]: Listening on udev Kernel Socket.
[    2.985133] configfs: module verification failed: signature and/or required key missing - tainting kernel
[    3.317200] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.500195] systemd-journald[189]: Received request to flush runtime journal from PID 1
[    4.159052] CAN device driver interface
[    4.901369] random: crng init done
[    4.904818] random: 7 urandom warning(s) missed due to ratelimiting
[    4.959769] Bluetooth: Core ver 2.22
[    4.974207] NET: Registered protocol family 31
[    4.978748] Bluetooth: HCI device and connection manager initialized
[    4.996810] Bluetooth: HCI socket layer initialized
[    5.001805] Bluetooth: L2CAP socket layer initialized
[    5.017626] Bluetooth: SCO socket layer initialized
[    5.074682] using random self ethernet address
[    5.079167] using random host ethernet address
[    5.204250] mcp251x spi2.0: MCP251x didn't enter in conf mode after reset
[    5.211292] mcp251x spi2.0: Probe failed, err=16
[    5.216023] mcp251x: probe of spi2.0 failed with error -16
[    5.256292] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    5.334284] Micrel KSZ8041 30be0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=-1)
[    5.369738] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    5.462023] usb0: HOST MAC 00:14:2d:ff:ff:fe
[    5.472967] usb0: MAC 00:14:2d:ff:ff:ff
[    5.592919] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[    7.435102] fec 30be0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[    7.443070] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Whereas speaker-test causes following problem:

root@colibri-imx7-emmc:~# speaker-test

speaker-test 1.1.4

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib ../../../alsa-lib-1.1.4.1/src/pcm/pcm_direct.c:1271:(snd1_pcm_direct_initialize_slave) unable to install hw params
ALSA lib ../../../alsa-lib-1.1.4.1/src/pcm/pcm_dmix.c:1111:(snd_pcm_dmix_open) unable to initialize slave
Playback open error: -22,Invalid argument

Unfortunately it worked on imx6 (old post) but not on imx7

Do you also have a hint why I need to comment out some lines in basic device tree?

Hi @p_nies!

You need to comment out those lines to disable the pin assignments as GPIOs so they can be used by the codec. If using device tree overlays, you could also redefine that pinctrl node without those pins, that would be the most elegant way to do this.

I reviewed your overlay and made some changes to the i2c and sound nodes. Could you please change them to the following and give it a try?

/ {
    sound-wm8978 {
        compatible = "simple-audio-card";
        simple-audio-card,bitclock-master = <&dailink_master>;
        status="okay";
        simple-audio-card,format = "i2s";
        simple-audio-card,frame-master = <&dailink_master>;
        simple-audio-card,name = "Wolfson WM8978";
        simple-audio-card,routing =
            "LMICP", "Built-in Microphone",
            "RMICP", "Built-in Microphone",
            "L2", "Line-in Jack",
            "R2", "Line-in Jack",
            "LAUX", "Aux-in Jack",
            "RAUX", "Aux-in Jack",
            "Headphone Jack", "LHP",
            "Headphone Jack", "RHP";
        simple-audio-card,widgets =
            "Microphone", "Built-in Microphone",
            "Line", "Line-in Jack",
            "Line", "Aux-in Jack",
            "Headphone", "Headphone Jack",
            "Speaker", "Built-in Speaker";
		simple-audio-card,cpu {
			sound-dai = <&sai2>;
        };
        dailink_master,codec {
            sound-dai = <&wm8978 0>;
			clocks = <&clk IMX7D_AUDIO_MCLK_ROOT_CLK>;
        };

 
    };
};

&i2c3 {
    clock-frequency = <400000>;
    pinctrl-names = "default";
    status = "okay";
    pinctrl-0 = <&pinctrl_i2c3>;

    wm8978: wm8978@1a {
    compatible = "wlf,wm8978";
    #sound-dai-cells = <0>;
    clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
    reg = <0x1a>;
    };
};

Hi @gustavo.tx,

i’ve tested your device tree, unfortunately it failed with “no sound card found”. After changing it to following I’m getting rid of the error:

/ {
     sound-wm8978 {
         compatible = "simple-audio-card";
         status="okay";
         simple-audio-card,name = "Wolfson WM8978";
 
             simple-audio-card,widgets =
                 "Microphone", "Built-in Microphone",
                 "Line", "Line-in Jack",
                 "Line", "Aux-in Jack",
                 "Headphone", "Headphone Jack",
                 "Speaker", "Built-in Speaker";
             simple-audio-card,routing =
                 "LMICP", "Built-in Microphone",
                 "RMICP", "Built-in Microphone",
                 "L2", "Line-in Jack",
                 "R2", "Line-in Jack",
                 "LAUX", "Aux-in Jack",
                 "RAUX", "Aux-in Jack",
                 "Headphone Jack", "LHP",
                 "Headphone Jack", "RHP";
         simple-audio-card,format = "i2s";
         simple-audio-card,cpu {
               sound-dai = <&sai2 0>;
               system-clock-frequency = <3072000>;
               
                


         };
         simple-audio-card,codec {
             sound-dai = <&wm8978 0>;
            clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
            bitclock-master;
            frame-master;
         };
 
 
     };
 };
 
 &i2c3 {
     clock-frequency = <400000>;
     pinctrl-names = "default";
     status = "okay";
     pinctrl-0 = <&pinctrl_i2c3>;
 
     wm8978: wm8978@1a {
        compatible = "wlf,wm8978";
        #sound-dai-cells = <0>;
        clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
        reg = <0x1a>;
     };
 };

It’s now playing sound. Anyway I have to test the correct output tomorrow or on Monday. It would be great not to close this post until then :wink:

Can you also give me some info, why I need to set this clock?

Best regards

@p_nies,

Glad to know it’s now playing sound with your changes! I’ll wait for your feedback!

About the clock, you mean the clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; part?
I took that from the built-in codecs. You need to correctly assign the SoC clock to every peripheral so it’s enabled.

Hi @gustavo.tx ,

I managed to get some sound out of my module.
Therefore I added an extra line for MCLK from Colibri module.

Anyway it’s just mono. (also when using speaker test).

Do you have any idea why the output is just mono?

Here is my current device tree setup (working but just mono)

/ {
     sound-wm8978 {
        compatible = "simple-audio-card";
        status="okay";
        simple-audio-card,name = "Wolfson WM8978";
        simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&dailink1_master>;
		simple-audio-card,frame-master = <&dailink1_master>;
		simple-audio-card,cpu {
			sound-dai = <&sai2>;
		};
		dailink1_master: simple-audio-card,codec {
			sound-dai = <&wm8978>;
			clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
		};
     };
 };
 
 &i2c3 {
     clock-frequency = <1000000>;
     pinctrl-names = "default";
     status = "okay";
     pinctrl-0 = <&pinctrl_i2c3>;
 
     wm8978: wm8978@1a {
        compatible = "wlf,wm8978";
        #sound-dai-cells = <0>;
		pinctrl-names = "default";
        clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
        pinctrl-0 = <&pinctrl_sai2_mclk>;
        reg = <0x1a>;
     };
 };

 
 &sai2 {
	 fsl,mode = "i2s-slave";
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_sai2>;
     status = "okay";
 };

@p_nies,

Can you check the output with an utility such as alsamixer?
Also you may want to insert the routing and widgets entries to see all available outputs.

Is audio coming from just one of the channels (mono) or is the same audio coming from both channels (dual mono)? If it’s the former, which channel is the audio coming from?

@gustavo.tx

I’ve checked alsamixer / amixer already.
Headphone is unmuted (on both), PCM also.

When starting to play something with aplay or speaker-test I’ll also see an output (so all internal mixers are set correctly).

Anyway when checking the output with some kind of logic analyzer there is just data on one channel

.

Here is my current alsamixer setup:

Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
  Mono:
  Front Left: Playback 59 [94%] [2.00dB] [on]
  Front Right: Playback 59 [94%] [2.00dB] [on]
Simple mixer control 'Headphone Playback ZC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
  Mono:
  Front Left: Playback 39 [62%] [-18.00dB] [off]
  Front Right: Playback 39 [62%] [-18.00dB] [off]
Simple mixer control 'Speaker Playback ZC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'PCM',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 255
  Front Left: 243 [95%] [-6.00dB]
  Front Right: 243 [95%] [-6.00dB]
Simple mixer control 'Line',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'Aux Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 7
  Front Left: 0 [0%] [-99999.99dB]
  Front Right: 0 [0%] [-99999.99dB]
Simple mixer control 'Capture PGA ZC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'ADC',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 255
  Front Left: 255 [100%] [0.00dB]
  Front Right: 255 [100%] [0.00dB]
Simple mixer control 'ADC 128x Oversampling',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'ADC Companding',0
  Capabilities: enum
  Items: 'Off' 'NC' 'u-law' 'A-law'
  Item0: 'Off'
Simple mixer control 'ADC Inversion',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'ALC Capture Attack',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 10
  Mono: 2 [20%]
Simple mixer control 'ALC Capture Decay',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 10
  Mono: 3 [30%]
Simple mixer control 'ALC Capture Hold',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 10
  Mono: 0 [0%]
Simple mixer control 'ALC Capture Max Gain',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 7 [100%]
Simple mixer control 'ALC Capture Min Gain',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 0 [0%]
Simple mixer control 'ALC Capture Mode',0
  Capabilities: enum
  Items: 'ALC' 'Limiter'
  Item0: 'ALC'
Simple mixer control 'ALC Capture Noise Gate',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'ALC Capture Noise Gate Threshold',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 0 [0%]
Simple mixer control 'ALC Capture Target',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 15
  Mono: 11 [73%]
Simple mixer control 'ALC Enable',0
  Capabilities: enum
  Items: 'Off' 'Right' 'Left' 'Both'
  Item0: 'Off'
Simple mixer control 'DAC 128x Oversampling',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'DAC Companding',0
  Capabilities: enum
  Items: 'Off' 'NC' 'u-law' 'A-law'
  Item0: 'Off'
Simple mixer control 'DAC Inversion',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'DAC Playback Limiter',0
  Capabilities: volume volume-joined pswitch pswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 12
  Mono: 0 [0%] [0.00dB] Playback [off]
Simple mixer control 'DAC Playback Limiter Attack',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 15
  Mono: 2 [13%]
Simple mixer control 'DAC Playback Limiter Decay',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 15
  Mono: 3 [20%]
Simple mixer control 'DAC Playback Limiter Threshold',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 0 [0%]
Simple mixer control 'Digital Loopback',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'EQ1',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 1 [4%] [-11.00dB]
Simple mixer control 'EQ1 Cut Off',0
  Capabilities: enum
  Items: '80Hz' '105Hz' '135Hz' '175Hz'
  Item0: '105Hz'
Simple mixer control 'EQ2',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ2 Cut Off',0
  Capabilities: enum
  Items: '230Hz' '300Hz' '385Hz' '500Hz'
  Item0: '300Hz'
Simple mixer control 'EQ3',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ3 Cut Off',0
  Capabilities: enum
  Items: '650Hz' '850Hz' '1.1kHz' '1.4kHz'
  Item0: '850Hz'
Simple mixer control 'EQ4',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ4 Cut Off',0
  Capabilities: enum
  Items: '1.8kHz' '2.4kHz' '3.2kHz' '4.1kHz'
  Item0: '2.4kHz'
Simple mixer control 'EQ5',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ5 Cut Off',0
  Capabilities: enum
  Items: '5.3kHz' '6.9kHz' '9kHz' '11.7kHz'
  Item0: '6.9kHz'
Simple mixer control 'Equaliser EQ2 Bandwidth',0
  Capabilities: enum
  Items: 'Narrow' 'Wide'
  Item0: 'Narrow'
Simple mixer control 'Equaliser EQ3 Bandwidth',0
  Capabilities: enum
  Items: 'Narrow' 'Wide'
  Item0: 'Narrow'
Simple mixer control 'Equaliser EQ4 Bandwidth',0
  Capabilities: enum
  Items: 'Narrow' 'Wide'
  Item0: 'Narrow'
Simple mixer control 'Equaliser Function',0
  Capabilities: enum
  Items: 'Capture' 'Playback'
  Item0: 'Playback'
Simple mixer control 'High Pass Cut Off',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 0 [0%]
Simple mixer control 'High Pass Filter',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Input PGA',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 63
  Front Left: 16 [25%] [0.00dB]
  Front Right: 16 [25%] [0.00dB]
Simple mixer control 'L2/R2 Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 7
  Front Left: 0 [0%] [-99999.99dB]
  Front Right: 0 [0%] [-99999.99dB]
Simple mixer control 'Left Input Mixer L2',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Left Input Mixer MicN',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Left Input Mixer MicP',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Left Output Mixer Aux',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Left Output Mixer Line Bypass',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Left Output Mixer PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'PGA Boost (+20dB)',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Right Input Mixer MicN',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Right Input Mixer MicP',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Right Input Mixer R2',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Right Output Mixer Aux',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Right Output Mixer Line Bypass',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Right Output Mixer PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

@p_nies,

Can you check if the output being used is a stereo output? From what you’ve told me, it seems that is the case, right?

I don’t see any reason this wouldn’t work. Device tree looks fine and on the software side everything looks good. Is it possible that this is a carrier board issue? How are the audio traces being routed and how’s that being connected to a headphone?

@gustavo.tx

As you can see on the attached picture, there is only a signal when TXFS (Frame Sync) is on low, while there is no signal on TXFS high. This will cause the MONO Signal.

Anyway this signal is directly out of the Toradex Module. For my understanding the carrier board (also it could have a problem as well) could not emit any sound on one channel, because there is no data for this channel.

For testing i used aplay and “speaker-test -c 2” to get an output on both channel. The funny thing about it is.

One more thing:
When using arecord, i’ll get a signal on both fs (high and low) for recording
When using aplay/speaker-test, i’ll only get a signal on fs low but:

  • right channel: empty → signal data
  • left channel: signal → empty

It seems as if the signal for both channel will be put into one frame sync anyway it should be on both.

Best regards

@p_nies,

For testing i used aplay and “speaker-test -c 2” to get an output on both channel. The funny thing about it is.

Using this, the output was still mono, is that right?

The only thing I see different from other configurations is that your device tree is missing the routing and widgets sections, but I really don’t think that would be the issue:

simple-audio-card,widgets =
    "Microphone", "AMIC",
    "Headphone", "Headphone Jack",
    "Speaker", "Line Out Jack";
simple-audio-card,routing =
    "LMICN", "AMIC",
    "RMICN", "AMIC",
    "Headphone Jack", "LSPK",
    "Headphone Jack", "RSPK",
    "Line Out Jack", "LHP",
    "Line Out Jack", "RHP";

Can you show me how alsamixer displays the volume controls? This can be a screenshot.

Hi @gustavo.tx,
here is an image of my alsamixer:
[upload|X97vXGV5rhpbVVGCfS0LMY6gfCA=]

I’ve also attached an image of the logic analyzer again.
Now I’ve piped my arecord → aplay.
As you can see, the arecord is working as expected, the aplay not.
[upload|/nV7u2h+5N4+otKi+hJyexBagY8=]

For your information: I’ve also changed sai2 to master ( fsl,mode = “i2s-master”) but no efford.

Thanks for your help so far

Fortunately I’ve managed to get an audio-output on the device.
Unfortunately it’s not the way as it’s supposed to.

I’ve changed following line:

simple-audio-card,format = "i2s";

to

        simple-audio-card,format = "dsp_a";

I’ve found an PDF on nxp where different audio formats are explained.
It seems as if the sound card tries to output “DSP Mode with 50% WS” but I have no clue why?

Would be happy to solve this problem as well to know why I have to change the protocol.

Best regards