Problem setting up a sound device on OSD3358-512M-BSMbased custom board.

Forums Reference, Evaluation, and Development Boards OSD3358-SM-RED Problem setting up a sound device on OSD3358-512M-BSMbased custom board.

Viewing 1 reply thread
  • Author
    Posts
    • #10841
      Ivan Ivanovivan.ivanov
      Participant

        Hi All 🙂

        I hope I’m posting this in the right section.
        So, I’m tasked to activate a number of peripheral devices on a custom SBC board based on OSD3358-512M-BSM. I did hit a huge roadblock with the audio device. It’s based on PCM1774RGPR chip. From what I’ve gathered looking into osd3358-bsm-refdesign.dts the default sound device for this platform is supposed to be tda19988, compatible with “nxp,tda998x”… The main difference between the two (I think) is that tda19988 provides the sound for the HDMI connection, while in my case pcm1774rgpr simply outputs into a 3.5mm jack.

        The pcm1774rgpr is connected to the same pins the default tda19988 is connected to, and they’re supposed to be configured at the same modes, so no difference there. However pcm1774rgpr also makes use of spi1 cs0 interface for volume control, balance control, equalizer etc.. I’m not sure if that matters for a proper u-boot configuration.(i.e. DTB)

        I’m running a custom built kernel. built from the official octavo systems kernel git-repo source. Using menuconfig I have activated whatever drivers/kenel modules related to pcm179x pcm177x audio dacs this kernel supports.

        So far I’ve tried to activate the device by either modifying the main dtb file (osd3358-bsm-refdesign.dts) or my adding a dtbo file into uEnv.txt

        ————————————————————————————-
        Modifications to osd3358-bsm-refdesign.dts:
        Changed the status of the “tda19988: tda19988” node to “disabled”

        Added a sub-node to mcasp0 node:

        &mcasp0
        {
        	pinctrl-names = "default";
        	pinctrl-0 = <&mcasp0_pins>;
        	status = "okay";
        
        	#address-cells = <1>;
        	#size-cells = <0>;
        	#sound-dai-cells = <0>;
        
        	op-mode = <0>; // MCASP_IIS_MODE +/
        	tdm-slots = <2>;
        	num-serializer = <4>;
        
        	serial-dir = < 2 1 0 0 >; // 1 TX 2 RX 0 unused +/
        
        	rx-num-evt = <32>;
        	tx-num-evt = <32>;
        
        	/* My addition ... */
        	pcm1792a: pcm1792a
        	{
        		compatible = "ti,pcm1792a", "ti,pcm1755";
        		status = "okay";
        
        		pinctrl-names = "default";
        		pinctrl-0 = <&mcasp0_pins>;
        
        		#sound-dai-cells = <0>;
        	};
        };
        
        

        And lastly, in the “sound/simple-audio-card,codec” I changed:

        simple-audio-card,codec
        {
        	sound-dai = <&pcm1792a>; /* Previously: &tda19988 */
        	#sound-dai-cells = <0>;
        };
        

        ————————————————————————–
        Custom dts file that I compile to dtbo… I named it sound-pcm1774-00A0.dts It is a modification of BB-HDMI-TDA998x-00A0.dts
        ——————– Contents ——————————————————

        #include <dt-bindings/board/am335x-bbw-bbb-base.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/pinctrl/am33xx.h> #include <dt-bindings/gpio/gpio.h> //#include <dt-bindings/osd335x-sm.dtsi>
        
        /dts-v1/;
        /plugin/;
        
        / {
        	compatible = "ti,beaglebone", "ti,beaglebone-black";
        
        	/* Identification */
        	part-number = "AUDIO-PCM1774";
        	version = "00A0";
        
        	/* state the resources this cape uses */
        	exclusive-use = "P9.25", /* mcasp0: mcasp0_ahclkx */
        			"P9.28", /* mcasp0: mcasp0_axr2 */
        			"P9.29", /* mcasp0: mcasp0_fsx */
        			"P9.31", /* mcasp0: mcasp0_aclkx */
        			"mcasp0",
        			"gpio1_27";
        
        	fragment@0
        	{
        		target-path="/";
        
        		__overlay__
        		{
        			clk_mcasp0_fixed: clk_mcasp0_fixed
        			{
        				#clock-cells = <0>;
        				compatible = "fixed-clock";
        				clock-frequency = <24576000>;
        			};
        
        			clk_mcasp0: clk_mcasp0
        			{
        				#clock-cells = <0>;
        				compatible = "gpio-gate-clock";
        				clocks = <&clk_mcasp0_fixed>;
        				enable-gpios = <&gpio1 27 0>; // BeagleBone Black Clk enable on GPIO1_27 +/
        			};
        
        			sound
        			{
        				compatible = "simple-audio-card";
        				simple-audio-card,name = "TI BeagleBone Black";
        				simple-audio-card,format = "i2s";
        				simple-audio-card,bitclock-master = <&dailink0_master>;
        				simple-audio-card,frame-master = <&dailink0_master>;
        
        				dailink0_master: simple-audio-card,cpu
        				{
        					sound-dai = <&mcasp0>;
        					clocks = <&clk_mcasp0>;
        				};
        
        				simple-audio-card,codec
        				{
        					sound-dai = <&pcm1774>;
        				};
        			};
        		};
        	};
        
        	fragment@1
        	{
        		target = <&am33xx_pinmux>;
        
        		__overlay__
        		{
        			mcasp0_pins: mcasp0_pins
        			{
        			pinctrl-single,pins = < AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) // mcasp0_ahcklx.mcasp0_ahclkx +/
        						AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) // mcasp0_ahclkr.mcasp0_axr2 +/
        						AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0) // mcasp0_fsx.mcasp0_fsx +/ 
        						AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) // mcasp0_aclkx.mcasp0_aclkx +/
        						AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) >; // gpmc_a11.GPIO1_27 +/
        			};
        		};
        	};
        
        	fragment@3
        	{
        		target = <&i2c0>;
        
        		__overlay__
        		{
        			#address-cells = <1>;
        			#size-cells = <0>;
        
        			pcm1774: pcm1774 /* that was the tda19988 node previously */
        			{
        				compatible = "ti,pcm1792a", "ti,pcm1755";
        				reg = <0x70>;
        
        				pinctrl-names = "default";
        				pinctrl-0 = <&mcasp0_pins>;
        
        				// Convert 24bit BGR to RGB, e.g. cross red and blue wiring +/
        				// video-ports = <0x234501>; +/
        
        				#sound-dai-cells = <0>;
        			};
        		};
        	};
        
        	fragment@4
        	{
        		target = <&mcasp0>;
        
        		__overlay__
        		{
        			#sound-dai-cells = <0>;
        			pinctrl-names = "default";
        			pinctrl-0 = <&mcasp0_pins>;
        			status = "okay";
        			op-mode = <0>; // MCASP_IIS_MODE +/
        			tdm-slots = <2>;
        			serial-dir = < 0 0 1 0 >;// 0: INACTIVE, 1: TX, 2: RX +/
        
        			tx-num-evt = <32>;
        			rx-num-evt = <32>;
        		};
        	};
        };
        

        —————————————————————–

        Whether I used the modified osd3358-bsm-refdesign.dts or the original osd3358-bsm-refdesign.dts with the sound-pcm1774-00A0.dtbo the result is the same and it’s as follows:

        After the device boots there is on ‘sound’ or ‘sound0’ device file in /dev/

        $ ls -l /proc/asound/
        
        total 0
        dr-xr-xr-x 4 root root 0 Oct 7 05:03 .
        dr-xr-xr-x 103 root root 0 Jan 1 1970 ..
        -r--r--r-- 1 root root 0 Oct 7 07:38 cards
        -r--r--r-- 1 root root 0 Oct 7 07:38 devices
        -r--r--r-- 1 root root 0 Oct 7 07:38 modules
        dr-xr-xr-x 2 root root 0 Oct 7 07:38 oss
        -r--r--r-- 1 root root 0 Oct 7 07:38 pcm
        dr-xr-xr-x 2 root root 0 Oct 7 07:38 seq
        -r--r--r-- 1 root root 0 Oct 7 07:38 timers
        -r--r--r-- 1 root root 0 Oct 7 07:38 version

        There’s supposed to be a file or dir named ‘card0’ if there was an active sound card

        $cat /proc/asound/cards
        --- no soundcards ---
        
        $lsmod | grep snd
        snd_soc_simple_card 7959 0
        snd_soc_simple_card_utils 6408 1 snd_soc_simple_card
        snd_soc_davinci_mcasp 21479 0
        snd_soc_omap 4317 1 snd_soc_davinci_mcasp
        snd_soc_edma 1546 1 snd_soc_davinci_mcasp
        snd_soc_core 198874 5 snd_soc_davinci_mcasp,snd_soc_edma,snd_soc_simple_card_utils,snd_soc_omap,snd_soc_simple_card
        snd_pcm_dmaengine 6214 2 snd_soc_omap,snd_soc_core
        snd_pcm 105795 4 snd_soc_davinci_mcasp,snd_pcm_dmaengine,snd_soc_omap,snd_soc_core
        snd_timer 24435 1 snd_pcm
        snd 74655 3 snd_timer,snd_soc_core,snd_pcm
        soundcore 8860 1 snd
        

        As you can see all related kernel modules are loaded successfully.

        #dmesg | grep snd
        [ 19.483795] Registering platform device 'snd-soc-dummy'. Parent at platform
        [ 19.483827] device: 'snd-soc-dummy': device_add
        [ 19.483880] bus: 'platform': add device snd-soc-dummy
        [ 19.484034] PM: Adding info for platform:snd-soc-dummy
        [ 19.484445] bus: 'platform': add driver snd-soc-dummy
        [ 19.484647] bus: 'platform': driver_probe_device: matched device snd-soc-dummy with driver snd-soc-dummy
        [ 19.484672] bus: 'platform': really_probe: probing driver snd-soc-dummy with device snd-soc-dummy
        [ 19.484716] snd-soc-dummy snd-soc-dummy: no default pinctrl state
        [ 19.484773] devices_kset: Moving snd-soc-dummy to end of list
        [ 19.484826] driver: 'snd-soc-dummy': driver_bound: bound to device 'snd-soc-dummy'
        [ 19.581553] bus: 'platform': really_probe: bound device snd-soc-dummy to driver snd-soc-dummy
        
        #dmesg | grep sound
        [ 0.562812] device: 'sound': device_add
        [ 0.562872] bus: 'platform': add device sound
        [ 0.563026] PM: Adding info for platform:sound
        [ 18.195451] device class 'sound': registering
        [ 28.079827] bus: 'platform': driver_probe_device: matched device sound with driver asoc-simple-card
        [ 28.079855] bus: 'platform': really_probe: probing driver asoc-simple-card with device sound
        [ 28.079902] asoc-simple-card sound: no pinctrl handle
        [ 28.079953] devices_kset: Moving sound to end of list
        [ 28.080131] platform sound: Driver asoc-simple-card requests probe deferral
        [ 28.080146] platform sound: Added to deferred list
        [ 31.471492] PM: Moving platform:sound to end of list
        [ 31.471509] platform sound: Retrying from deferred list
        [ 31.472073] bus: 'platform': driver_probe_device: matched device sound with driver asoc-simple-card
        [ 31.472092] bus: 'platform': really_probe: probing driver asoc-simple-card with device sound
        [ 31.472121] asoc-simple-card sound: no pinctrl handle
        [ 31.472168] devices_kset: Moving sound to end of list
        [ 31.472327] platform sound: Driver asoc-simple-card requests probe deferral
        [ 31.472342] platform sound: Added to deferred list
        

        Sorry for the long post and I would greatly appreciate any help on the matter I’m really stuck with this thing.

        Thanks alot in dvance 🙂

      • #10901
        Neeraj Dantu
        Moderator

          Ivan,

          Looks like the codec can be used with either I2C or SPI control interface. Have you instantiated the proper control interface in the device tree? See https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/sound/pcm179x.txt and https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/sound/pcm1789.txt.

          Best,

          Neeraj

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.
      chatsimple