External audio codec for BB AI via I2S interface

461 views
Skip to first unread message

Joseph

unread,
Feb 19, 2020, 2:41:19 PM2/19/20
to BeagleBoard
Hello, 
   I have a problem to run external WM8960 audio codec via i2s (audio interface). Codec works as master (it has own external oscillator), BB AI as slave. Programming of WM8960 registers via I2C works well. The connectors BB AI P9.19 and P9.20 are used for it. I program WM8960 via series of i2cset 18th commands:

i2cset -y 3 0x1a 0x1e  0x00  # R15 reset
i2cset -y 3 0x1a 0x0e  0x4f  # R7 audio interface: Master mode, 32 bit, DSP mode
.....
i2cset -y 3 0x1a 0x0a  0x00  # R5 ADC & DAC Control (CTR1): disable DAC soft mute (DACMU=0)

   The interface I2S - MCASP1 is used via BB AI connectors P9.28 (data in), P9.29 (fs), P9.30 (data out), P9.31 (clock). Valid signals appears on codec outputs (tested by an oscilloscope): frame (fs 48kHz), clock (clock 3.072MHz) and data out, after above set of i2cset commands. External digital bypass (data out -> data in) also works well (i.e. analog signal from input is transmitted to output of the codec). 
   The problem is that "aplay -l" does not show "Simple sound card" at mcasp1:
----------
debian@beaglebone:/var/lib/cloud9$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: H58040000encode [HDMI 58040000.encoder], device 0: HDMI 58040000.encoder snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
debian@beaglebone:/var/lib/cloud9$
----------
It seems that "Simple sound card" driver is not loaded and/or configured correctly (?).
Any ideas what is wrong in configuration?
Below some others details are included. 
   Best wishes
   Joseph

Additional information:
---------------
I checked that in /proc/config.gz the "simple sound card" is enabled in Kernel:
-----------------------
#
# Automatically generated file; DO NOT EDIT.

# Linux/arm 4.14.108 Kernel Configuration
....
# CONFIG_SND_SOC_NAU8824 is not set
CONFIG_SND_SOC_TPA6130A2=m
CONFIG_SND_SIMPLE_CARD_UTILS=y
CONFIG_SND_SIMPLE_CARD=y
# CONFIG_SND_SIMPLE_SCU_CARD is not set 
....
-----------------------
The configuration of pins is the following:
-----------------------
debian@beaglebone:/var/lib/cloud9$ show-pins
Caution: Uses peripheral names from <https://goo.gl/jiazTL>. See README there for details.
P9.19a   16 fast rx  up   7 i²c 3 scl        i2c@4807a000 (i2c4)
P9.20a   17 fast rx  up   7 i²c 3 sda        i2c@4807a000 (i2c4)
P8.35b   57 fast rx      14 gpio 2.00
P8.33b   58 fast rx      14 gpio 2.01
P9.21a   60 fast rx down 14 gpio 2.03
P8.12    67 fast rx down 14 gpio 2.10
P8.11    68 fast rx down 14 gpio 2.11
P9.15    69 fast rx down 14 gpio 2.12
P9.26b   81 fast rx      14 gpio 2.24
P8.34b   89 fast rx      14 gpio 3.00
P8.36b   90 fast rx      14 gpio 3.01
P8.15a   92 fast rx down 14 gpio 3.03
P9.20b   94 fast rx  up  14 gpio 3.05        i2c@4807a000 (i2c4)
P9.19b   95 fast rx  up  14 gpio 3.06        i2c@4807a000 (i2c4)
P9.41b   96 fast rx      14 gpio 3.07
P8.18    98 fast rx down 14 gpio 3.09
P8.19    99 fast rx down 14 gpio 3.10
P8.13   100 fast rx down 14 gpio 3.11
P8.14   102 fast rx down 14 gpio 3.13
P9.42b  103 fast rx      14 gpio 3.14
P9.27a  104 fast rx down 14 gpio 3.15
P9.14   107 fast    down 10 pwm 2 A          pwm@48442200 (ehrpwm2)
P9.16   108 fast    down 10 pwm 2 B          pwm@48442200 (ehrpwm2)
P8.15b  109 fast rx      14 gpio 3.27
P8.26   110 fast rx down 14 gpio 3.28
P8.16   111 fast rx down 14 gpio 3.29
P8.28a  114 fast rx down 14 gpio 3.19
P8.30a  115 fast rx down 14 gpio 3.20
P8.29a  117 fast rx down 14 gpio 3.22
P8.27a  118 fast rx down 14 gpio 3.23
P8.45a  119 fast rx down 14 gpio 7.00
P8.46a  120 fast rx down 14 gpio 7.01
P8.43   121 fast rx down 14 gpio 7.02
P8.44   122 fast rx down 14 gpio 7.03
P8.41   123 fast rx down 14 gpio 7.04
P8.42   124 fast rx down 14 gpio 7.05
P8.39   125 fast rx down 14 gpio 7.06
P8.40   126 fast rx down 14 gpio 7.07
P8.37a  127 fast rx down 14 gpio 7.08
P8.38a  128 fast rx down 14 gpio 7.09
P8.36a  129 fast rx down 14 gpio 7.10
P8.34a  130 fast rx down 14 gpio 7.11
P8.35a  131 fast rx down 14 gpio 7.12
P8.33a  132 fast rx down 14 gpio 7.13
P8.31a  133 fast rx down 14 gpio 7.14
P8.32a  134 fast rx down 14 gpio 7.15
P8.45b  135 fast rx      14 gpio 7.16
P9.11b  136 fast rx      14 gpio 7.17
P8.17   137 fast rx down 14 gpio 7.18
P8.27b  138 fast rx      14 gpio 7.19
P8.28b  139 fast rx      14 gpio 7.20
P8.29b  140 fast rx      14 gpio 7.21
P8.30b  141 fast rx      14 gpio 7.22
P8.46b  142 fast rx      14 gpio 7.23
P9.13b ?160 fast    down 15 unused          
P9.26a  162 fast rx  up  14 gpio 5.14
P9.24   163 fast rx  up  14 gpio 5.15
P9.25   165 fast rx down 14 gpio 5.17
P8.09   166 fast rx down 14 gpio 5.18
P9.22a  167 fast rx down 14 gpio 5.19
P9.41a  168 fast rx down 14 gpio 5.20
P9.31b  169 fast rx       0 mcasp 0 tx clk   mcasp@48460000 (mcasp1_pins)
P9.29b  170 fast rx       0 mcasp 0 tx fs    mcasp@48460000 (mcasp1_pins)
P9.12   171 fast rx down 14 gpio 4.00
P9.27b  172 fast rx      14 gpio 4.01
P9.18b  173 fast rx      14 gpio 4.02
P9.17b  174 fast rx      14 gpio 4.03
P9.31a  181 fast rx      14 gpio 4.10        mcasp@48460000 (mcasp1_pins)
P9.29a  182 fast rx      14 gpio 4.11        mcasp@48460000 (mcasp1_pins)
P9.30   183 fast          0 mcasp 0 d10      mcasp@48460000 (mcasp1_pins)
P9.28   184 fast rx       0 mcasp 0 d11      mcasp@48460000 (mcasp1_pins)
P9.42a  185 fast rx down 14 gpio 3.18
P8.10   186 fast rx down 14 gpio 5.04
P8.07   187 fast rx down 14 gpio 5.05
P8.08   188 fast rx down 14 gpio 5.06
P9.11a  203 fast rx down 15 unused          
P9.13a  204 fast rx down 15 unused          
P8.38b  205 fast rx down 15 unused          
P8.37b  206 fast rx down 15 unused          
P8.31b  207 fast rx down 15 unused          
P8.32b  208 fast rx down 15 unused          
P8.21   223 fast rx  up  14 gpio 5.29
P8.20   224 fast rx  up  14 gpio 5.30
P8.25   225 fast rx  up  14 gpio 5.31
P8.24   226 fast rx  up  14 gpio 6.00
P8.05   227 fast rx  up  14 gpio 6.01
P8.06   228 fast rx  up  14 gpio 6.02
P8.23   229 fast rx  up  14 gpio 0.22
P8.22   230 fast rx  up  14 gpio 0.23
P8.03   231 fast rx  up  14 gpio 0.24
P8.04   232 fast rx  up  14 gpio 0.25
P9.23   237 fast rx  up  14 gpio 6.11
P9.22b  240 fast rx      14 gpio 6.14
P9.21b  241 fast rx      14 gpio 6.15
P9.18a  242 fast rx down 14 gpio 6.16
P9.17a  243 fast rx down 14 gpio 6.17
debian@beaglebone:/var/lib/cloud9$
-------------------------
The command dmesg reports only 3 lines connected with sound and ALSA:

[    1.540953] ALSA device list:
[    1.540958]   #0: HDMI 58040000.encoder
[    0.573034] Advanced Linux Sound Architecture Driver Initialized.

i.e.:
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.108-ti-r124 (root@x1-am57xx-beagle-x15-2gb) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 SMP PREEMPT Sat Nov 9 05:05:41 UTC 2019
[    0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: BeagleBoard.org BeagleBone AI
[    0.000000] Memory policy: Data cache writealloc
………
[    0.572959] FPGA manager framework
[    0.573034] Advanced Linux Sound Architecture Driver Initialized.
[    0.573457] NetLabel: Initializing
………
[    1.540525] vtt_fixed: supplied by smps3
[    1.540953] ALSA device list:
[    1.540958]   #0: HDMI 58040000.encoder
[    1.543599] Freeing unused kernel memory: 1024K
……..
----------------------------

#include "am5729-beagleboneai.dts"  
// make it easy to determine which dtb you're currently running on  
// (via /proc/device-tree/chosen/)  
/ {  
 chosen {  
  base_dtb = "am5729-beagleboneai-custom.dts";  
  base_dtb_timestamp = __TIMESTAMP__;  
 };  
};  
// eventually these should be available in a header  
#define P9_14  (0x3400 + 4 * 107)  
#define P9_16  (0x3400 + 4 * 108)  
#define P9_19a (0x3400 + 4 * 16)  
#define P9_19b (0x3400 + 4 * 95)  
#define P9_20a (0x3400 + 4 * 17)  
#define P9_20b (0x3400 + 4 * 94)  
#define P9_28  (0x3400 + 4 * 184)
#define P9_29a (0x3400 + 4 * 182)
#define P9_29b (0x3400 + 4 * 170)
#define P9_30  (0x3400 + 4 * 183)
#define P9_31a (0x3400 + 4 * 181)
#define P9_31b (0x3400 + 4 * 169)

/{
sound {compatible = "simple-audio-card";
        simple-audio-card,format = "dsp_a";
        simple-audio-card,name = "wm8960-soundcard";
        simple-audio-card,bitclock-master = <&sndcodec>;
        simple-audio-card,frame-master = <&sndcodec>;
        simple-audio-card,convert-rate = <48000>;
        status = "okay";
        simple-audio-card,widgets =
               "Microphone", "Mic Jack",
                "Line", "Line In",
                "Line", "Line Out",
                "Speaker", "Speaker",
                "Headphone", "Headphone Jack";
        simple-audio-card,routing =
                "Headphone Jack", "HP_L",
                "Headphone Jack", "HP_R",
                "Speaker", "SPK_LP",
                "Speaker", "SPK_LN",
                "LINPUT1", "Mic Jack",
                "LINPUT3", "Mic Jack",
                "RINPUT1", "Mic Jack",
                "RINPUT2", "Mic Jack";
        simple-audio-card,cpu {
                sound-dai = <&mcasp1>;
        };
        sndcodec: simple-audio-card,codec {
                sound-dai = <&wm8960>;
                  system-clock-frequency = <3072000>;
                };
};
};

// enable i2c-3 on P9.19 (scl) + P9.20 (sda)  
&i2c4 {  
 status = "okay";  
 clock-frequency = <400000>;  
 pinctrl-names = "default";  
 pinctrl-0 = <&i2c4_pins>;  

 wm8960: wm8960@1a { 
 #sound-dai-cells = <0>; 
 compatible = "wlf,wm8960"; 
 reg = <0x1a>;
};
};
&mcasp1 {
    #sound-dai-cells = <0>;
    status = "okay";
    pinctrl-names = "default";  
    pinctrl-0 = <&mcasp1_pins>;  
    op-mode = <0>;    /* MCASP_IIS_MODE */
    tdm-slots = <2>;
    /* 16 serializers */
    serial-dir = <    /* 0: INACTIVE, 1: TX, 2: RX */
        0 0 0 0
        0 0 0 0
        0 0 1 2       /* axr10 - TX, axr11 – RX */
        0 0 0 0 >;

    tx-num-evt = <32>;
    rx-num-evt = <32>;
};  
&dra7_pmx_core {  
 i2c4_pins: i2c4 {  
  pinctrl-single,pins = <  
   DRA7XX_CORE_IOPAD( P9_19a, PIN_INPUT_PULLUP | MUX_MODE7  )  // scl  
   DRA7XX_CORE_IOPAD( P9_19b, PIN_INPUT_PULLUP | MUX_MODE14 )  // (shared pin)  
   DRA7XX_CORE_IOPAD( P9_20a, PIN_INPUT_PULLUP | MUX_MODE7  )  // sda  
   DRA7XX_CORE_IOPAD( P9_20b, PIN_INPUT_PULLUP | MUX_MODE14 )  // (shared pin)  
  >;  
 };
  mcasp1_pins: mcasp1_pins {
  pinctrl-single,pins = <
   DRA7XX_CORE_IOPAD(P9_28, PIN_INPUT | MUX_MODE0) /* mcasp1_axr11.mcasp1_axr11 */
   DRA7XX_CORE_IOPAD(P9_29b, PIN_INPUT | MUX_MODE0) /* mcasp1_fsx.mcasp1_fsx */
   DRA7XX_CORE_IOPAD(P9_30, PIN_OUTPUT | MUX_MODE0) /* mcasp1_axr10.mcasp1_axr10 */
   DRA7XX_CORE_IOPAD(P9_31b, PIN_INPUT | MUX_MODE0) /* mcasp1_aclkx.mcasp1_aclkx */ 
   DRA7XX_CORE_IOPAD(P9_29a, PIN_INPUT | MUX_MODE14)
   DRA7XX_CORE_IOPAD(P9_31a, PIN_INPUT | MUX_MODE14)
  >;
 };  
};  
// enable pwm-2 on P9.14 (out-A) + P9.16 (out-B)  
&epwmss2 {  
 status = "okay";  
};  
&ehrpwm2 {  
 status = "okay";  
 pinctrl-names = "default";  
 pinctrl-0 = <&ehrpwm2_pins>;  
};  
&dra7_pmx_core {  
 ehrpwm2_pins: ehrpwm2 {  
  pinctrl-single,pins = <  
   DRA7XX_CORE_IOPAD( P9_14, PIN_OUTPUT_PULLDOWN | MUX_MODE10 )  // out A  
   DRA7XX_CORE_IOPAD( P9_16, PIN_OUTPUT_PULLDOWN | MUX_MODE10 )  // out B  
  >;  
 };  
};  
  
// Here's the obnoxious part: since u-boot doesn't have same pin defaults yet, all pins not  
// explicitly setup above should be overridden here.  This will eventually no longer be needed.  
&cape_pins_default {  
 pinctrl-single,pins = <  
  DRA7XX_CORE_IOPAD( 0x372C, PIN_INPUT_PULLDOWN | MUX_MODE15 ) // P9.11a (no gpio)  
  DRA7XX_CORE_IOPAD( 0x3620, PIN_INPUT          | MUX_MODE14 ) // P9.11b  
  DRA7XX_CORE_IOPAD( 0x36AC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.12  
  DRA7XX_CORE_IOPAD( 0x3730, PIN_INPUT_PULLDOWN | MUX_MODE15 ) // P9.13  (no gpio)  
 // DRA7XX_CORE_IOPAD( 0x35AC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.14  
  DRA7XX_CORE_IOPAD( 0x3514, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.15  
 // DRA7XX_CORE_IOPAD( 0x35B0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.16  
  DRA7XX_CORE_IOPAD( 0x37CC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.17a  
  DRA7XX_CORE_IOPAD( 0x36B8, PIN_INPUT          | MUX_MODE14 ) // P9.17b  
  DRA7XX_CORE_IOPAD( 0x37C8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.18a  
  DRA7XX_CORE_IOPAD( 0x36B4, PIN_INPUT          | MUX_MODE14 ) // P9.18b  
 // DRA7XX_CORE_IOPAD( 0x3440, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P9.19a  
 // DRA7XX_CORE_IOPAD( 0x357C, PIN_INPUT          | MUX_MODE14 ) // P9.19b  
 // DRA7XX_CORE_IOPAD( 0x3444, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P9.20a  
 // DRA7XX_CORE_IOPAD( 0x3578, PIN_INPUT          | MUX_MODE14 ) // P9.20b  
  DRA7XX_CORE_IOPAD( 0x34F0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.21a  
  DRA7XX_CORE_IOPAD( 0x37C4, PIN_INPUT          | MUX_MODE14 ) // P9.21b  
  DRA7XX_CORE_IOPAD( 0x369C, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.22a  
  DRA7XX_CORE_IOPAD( 0x37C0, PIN_INPUT          | MUX_MODE14 ) // P9.22b  
  DRA7XX_CORE_IOPAD( 0x37B4, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P9.23  
  DRA7XX_CORE_IOPAD( 0x368C, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P9.24  
  DRA7XX_CORE_IOPAD( 0x3694, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.25  
  DRA7XX_CORE_IOPAD( 0x3688, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P9.26a  
  DRA7XX_CORE_IOPAD( 0x3544, PIN_INPUT          | MUX_MODE14 ) // P9.26b  
  DRA7XX_CORE_IOPAD( 0x35A0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.27a  
  DRA7XX_CORE_IOPAD( 0x36B0, PIN_INPUT          | MUX_MODE14 ) // P9.27b  
 // DRA7XX_CORE_IOPAD( 0x36E0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.28  
 // DRA7XX_CORE_IOPAD( 0x36D8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.29a  
 // DRA7XX_CORE_IOPAD( 0x36A8, PIN_INPUT          | MUX_MODE14 ) // P9.29b  
 // DRA7XX_CORE_IOPAD( 0x36DC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.30  
 // DRA7XX_CORE_IOPAD( 0x36D4, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.31a  
 // DRA7XX_CORE_IOPAD( 0x36A4, PIN_INPUT          | MUX_MODE14 ) // P9.31b  
  DRA7XX_CORE_IOPAD( 0x36A0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.41a  
  DRA7XX_CORE_IOPAD( 0x3580, PIN_INPUT          | MUX_MODE14 ) // P9.41b  
  DRA7XX_CORE_IOPAD( 0x36E4, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P9.42a  
  DRA7XX_CORE_IOPAD( 0x359C, PIN_INPUT          | MUX_MODE14 ) // P9.42b  
  DRA7XX_CORE_IOPAD( 0x379C, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.3  
  DRA7XX_CORE_IOPAD( 0x37A0, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.4  
  DRA7XX_CORE_IOPAD( 0x378C, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.5  
  DRA7XX_CORE_IOPAD( 0x3790, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.6  
  DRA7XX_CORE_IOPAD( 0x36EC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.7  
  DRA7XX_CORE_IOPAD( 0x36F0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.8  
  DRA7XX_CORE_IOPAD( 0x3698, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.9  
  DRA7XX_CORE_IOPAD( 0x36E8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.10  
  DRA7XX_CORE_IOPAD( 0x3510, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.11  
  DRA7XX_CORE_IOPAD( 0x350C, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.12  
  DRA7XX_CORE_IOPAD( 0x3590, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.13  
  DRA7XX_CORE_IOPAD( 0x3598, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.14  
  DRA7XX_CORE_IOPAD( 0x3570, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.15a  
  DRA7XX_CORE_IOPAD( 0x35B4, PIN_INPUT          | MUX_MODE14 ) // P8.15b  
  DRA7XX_CORE_IOPAD( 0x35BC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.16  
  DRA7XX_CORE_IOPAD( 0x3624, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.17  
  DRA7XX_CORE_IOPAD( 0x3588, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.18  
  DRA7XX_CORE_IOPAD( 0x358C, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.19  
  DRA7XX_CORE_IOPAD( 0x3780, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.20  
  DRA7XX_CORE_IOPAD( 0x377C, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.21  
  DRA7XX_CORE_IOPAD( 0x3798, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.22  
  DRA7XX_CORE_IOPAD( 0x3794, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.23  
  DRA7XX_CORE_IOPAD( 0x3788, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.24  
  DRA7XX_CORE_IOPAD( 0x3784, PIN_INPUT_PULLUP   | MUX_MODE14 ) // P8.25  
  DRA7XX_CORE_IOPAD( 0x35B8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.26  
  DRA7XX_CORE_IOPAD( 0x35D8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.27a  
  DRA7XX_CORE_IOPAD( 0x3628, PIN_INPUT          | MUX_MODE14 ) // P8.27b  
  DRA7XX_CORE_IOPAD( 0x35C8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.28a  
  DRA7XX_CORE_IOPAD( 0x362C, PIN_INPUT          | MUX_MODE14 ) // P8.28b  
  DRA7XX_CORE_IOPAD( 0x35D4, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.29a  
  DRA7XX_CORE_IOPAD( 0x3630, PIN_INPUT          | MUX_MODE14 ) // P8.29b  
  DRA7XX_CORE_IOPAD( 0x35CC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.30a  
  DRA7XX_CORE_IOPAD( 0x3634, PIN_INPUT          | MUX_MODE14 ) // P8.30b  
  DRA7XX_CORE_IOPAD( 0x3614, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.31a  
  DRA7XX_CORE_IOPAD( 0x373C, PIN_INPUT_PULLDOWN | MUX_MODE15 ) // P8.31b (no gpio)  
  DRA7XX_CORE_IOPAD( 0x3618, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.32a  
  DRA7XX_CORE_IOPAD( 0x3740, PIN_INPUT_PULLDOWN | MUX_MODE15 ) // P8.32b (no gpio)  
  DRA7XX_CORE_IOPAD( 0x3610, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.33a  
  DRA7XX_CORE_IOPAD( 0x34E8, PIN_INPUT          | MUX_MODE14 ) // P8.33b  
  DRA7XX_CORE_IOPAD( 0x3608, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.34a  
  DRA7XX_CORE_IOPAD( 0x3564, PIN_INPUT          | MUX_MODE14 ) // P8.34b  
  DRA7XX_CORE_IOPAD( 0x360C, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.35a  
  DRA7XX_CORE_IOPAD( 0x34E4, PIN_INPUT          | MUX_MODE14 ) // P8.35b  
  DRA7XX_CORE_IOPAD( 0x3604, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.36a  
  DRA7XX_CORE_IOPAD( 0x3568, PIN_INPUT          | MUX_MODE14 ) // P8.36b  
  DRA7XX_CORE_IOPAD( 0x35FC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.37a  
  DRA7XX_CORE_IOPAD( 0x3738, PIN_INPUT_PULLDOWN | MUX_MODE15 ) // P8.37b (no gpio)  
  DRA7XX_CORE_IOPAD( 0x3600, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.38a  
  DRA7XX_CORE_IOPAD( 0x3734, PIN_INPUT_PULLDOWN | MUX_MODE15 ) // P8.38b (no gpio)  
  DRA7XX_CORE_IOPAD( 0x35F4, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.39  
  DRA7XX_CORE_IOPAD( 0x35F8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.40  
  DRA7XX_CORE_IOPAD( 0x35EC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.41  
  DRA7XX_CORE_IOPAD( 0x35F0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.42  
  DRA7XX_CORE_IOPAD( 0x35E4, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.43  
  DRA7XX_CORE_IOPAD( 0x35E8, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.44  
  DRA7XX_CORE_IOPAD( 0x35DC, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.45a  
  DRA7XX_CORE_IOPAD( 0x361C, PIN_INPUT          | MUX_MODE14 ) // P8.45b  
  DRA7XX_CORE_IOPAD( 0x35E0, PIN_INPUT_PULLDOWN | MUX_MODE14 ) // P8.46a  
  DRA7XX_CORE_IOPAD( 0x3638, PIN_INPUT          | MUX_MODE14 ) // P8.46b  
 >;  
};  

Joseph

unread,
Mar 3, 2020, 5:38:56 AM3/3/20
to BeagleBoard
Hello,
   Now the codec and driver work well (certainly the configuration can be optimized). Below is the corrected part of the dts file and other information.
   All the best
Joseph

-------------
Corrected part of the dts file:
/{
sound {compatible = "simple-audio-card";
        simple-audio-card,format = "dsp_a";
        simple-audio-card,name = "wm8960-soundcard";
        simple-audio-card,bitclock-master = <&sndcodec>;
        simple-audio-card,frame-master = <&sndcodec>;
        simple-audio-card,convert-rate = <48000>;
        simple-audio-card,mclk-fs = <512>;
        status = "okay";
        simple-audio-card,widgets =
                "Line", "Line In",
                "Headphone", "Headphone Jack";
        simple-audio-card,routing =
                "Headphone Jack", "HP_L",
                "Headphone Jack", "HP_R",
                "LINPUT2", "Line In",
                "RINPUT2", "Line In";
        simple-audio-card,cpu {
                sound-dai = <&mcasp1>;
        };
        sndcodec: simple-audio-card,codec {
                  sound-dai = <&wm8960>;
        };
};
};

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

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

&mcasp1 {
    #sound-dai-cells = <0>;
    status = "okay";
    pinctrl-names = "default";  
    pinctrl-0 = <&mcasp1_pins>;  
    op-mode = <0>;    /* MCASP_IIS_MODE */
    tdm-slots = <2>;
    /* 16 serializers */
    serial-dir = <    /* 0: INACTIVE, 1: TX, 2: RX */
        0 0 0 0
        0 0 0 0
        0 0 1 2       /* axr10 - TX, axr11 – RX */
        0 0 0 0 >;
    tx-num-evt = <1>;
    rx-num-evt = <1>;
};
--------------------
debian@beaglebone:/var/lib/cloud9$ dmesg | grep -i sound                                                                                                                
[    0.576402] Advanced Linux Sound Architecture Driver Initialized.
[   49.744107] asoc-simple-card sound: wm8960-hifi <-> 48460000.mcasp mapping ok
--------------------
debian@beaglebone:/var/lib/cloud9$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: H58040000encode [HDMI 58040000.encoder], device 0: HDMI 58040000.encoder snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: wm8960soundcard [wm8960-soundcard], device 0: davinci-mcasp.0-wm8960-hifi wm8960-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
--------------------
alsamixer was used to configure the codec parameters and then the following commands were succesfully tested: aplay, arecord, speaker-test, alsaloop. Also commands "i2cset -f -y 3 0x1a 0xuu 0xvv" (where uu and vv are hexadecimal values) can be used to directly set up some codec registers.
--------------------
Reply all
Reply to author
Forward
0 new messages