This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62P: TLV320ADC3101

Part Number: AM62P
Other Parts Discussed in Thread: TLV320ADC3101,

I'm using a AM62p5 processor and a TLV320ADC3101 as my audio in.

I have this configuration on my sound node

	codec_audio: sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "Lohr-Full-Audio";
		simple-audio-card,mclk-fs = <512>;
		status = "okay";

		simple-audio-card,dai-link@0 {
			format = "i2s";
			bitclock-master = <&mcasp_cpu>;
			frame-master = <&mcasp_cpu>;

			mcasp_cpu: cpu {
				sound-dai = <&mcasp2 0>;
				system-clock-direction-out;
				dai-tdm-slot-num = <2>;
				dai-tdm-slot-width = <32>;
			};

			codec_3: codec@0 {
				sound-dai = <&audio_adc1>;
				clocks = <&audio_refclk0>;
				clock-names = "mclk";
				simple-audio-card,prefix = "ADC1";
				assigned-clock-rates = <24576000>; 
			};
		};
};

this configuration on my mcasp2 node.

&mcasp2 {
	pinctrl-names = "default";
    pinctrl-0 = <&mcasp_audio_in_out_pins_default>;

	op-mode = <0>;          /* Modo I2S */
    tdm-slots = <2>;        /* Stereo */

	serial-dir = <0 0 0 2 0>;

	tx-num-evt = <32>;
	rx-num-evt = <32>;

    status = "okay";

	#sound-dai-cells = <0>;

    clocks = <&k3_clks 192 0>, <&k3_clks 192 27>; 
	clock-names = "fck", "mcasp_aux_clk";

    assigned-clocks = <&k3_clks 192 0>, <&k3_clks 192 27>;
    assigned-clock-parents = <0>, <&k3_clks 192 30>;
    assigned-clock-rates = <0>, <24576000>;

	auxclk-fs-ratio = <512>;
	fck-master;

};


and this configuration on my I2C node

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

	audio_adc1: adc1@19 {
		compatible = "ti,tlv320adc3101";
		reg = <0x19>;
		pinctrl-0 = <&main_rst_adc1_pins_default>;
		pinctrl-names = "default";
		reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;
		
		#sound-dai-cells = <0>;
		clocks = <&k3_clks 192 30>;
		mclk-fs = <512>;
		clock-names = "mclk";

		assigned-clocks = <&k3_clks 192 30>;
    	assigned-clock-rates = <24576000>;

        status = "okay";

        gpio-controller;
        #gpio-cells = <2>;

        ti,dmdin-gpio1 = <0>;
        ti,micbias1-vg = <0>;
    };
};

But when I try to acquire sound using this command

root@am62p-lohr:~# arecord -D hw:0,0 -d 2 -f S16_LE -r 48000 -c 2 /tmp/test.wav

I got this error.

Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
arecord: pcm_read:2272: read error: Input/output error

is there anything wrong on my configuration?

Best regards.

  • Hi Sergio,

    Could you share the pinmux controls as well. I assume there is a conflict with aux clk and refclk as MCLK to ADC.

    Best Regards

    Suren

  • Hi Suren

    Here the mcasp pinmux

    mcasp_audio_in_out_pins_default: mcasp-audio-in-out-default-pins {
    pinctrl-single,pins = <
    AM62PX_IOPAD(0x0170, PIN_INPUT, 2) /* (A21) RGMII2_TD1.MCASP2_ACLKR */
    AM62PX_IOPAD(0x0178, PIN_OUTPUT, 2) /* (A19) RGMII2_TD3.MCASP2_ACLKX */
    AM62PX_IOPAD(0x0188, PIN_INPUT, 2) /* (E16) RGMII2_RD1.MCASP2_AFSR */
    AM62PX_IOPAD(0x0174, PIN_OUTPUT, 2) /* (D17) RGMII2_TD2.MCASP2_AFSX */
    AM62PX_IOPAD(0x018c, PIN_OUTPUT, 2) /* (E17) RGMII2_RD2.MCASP2_AXR0 */
    AM62PX_IOPAD(0x0180, PIN_OUTPUT, 2) /* (D19) RGMII2_RXC.MCASP2_AXR1 */
    AM62PX_IOPAD(0x0184, PIN_OUTPUT, 2) /* (E19) RGMII2_RD0.MCASP2_AXR2 */
    AM62PX_IOPAD(0x017c, PIN_INPUT, 2) /* (F19) RGMII2_RX_CTL.MCASP2_AXR3 */
    AM62PX_IOPAD(0x0164, PIN_INPUT, 2) /* (A20) RGMII2_TX_CTL.MCASP2_AXR4 */
    >;
    };

    Best Regards

  • Hi Sergio,

    Lets discuss it tomorrow.

    Best Regards

    Suren

  • Hi Sergio,

    I have routed your query to our Audio forum. Please expect a response soon. Ping me back in a day or two, if you don't have a response.

    Best Regards

    Suren

  • Hi Sergio,

    Are you able to do aplay and it is just arecord that has this issue? Or is it both? Can you check your amixer settings to verify that you have a connection on the DAPM_ROUTE path between the input pin used and the ADC. If you can send me the asound.state file, and an i2c register dump of the codec, I can help verify how it is set up before you attempt the record.

    Best,
    Mir

  • Hi Mir,

    I can use aplay, but one source at a time, if I run "aplay -v -D hw:0,1 -c 8 -r 48000 /storage/Enya-May-It-Be.wav" in one terminal and in other i try to run "aplay -v -D hw:0,0 -c 8 -r 48000 /storage/Enya-May-It-Be.wav" i got resource busy error. My goal is to run diferent sources at same time in all my codecs.

    My arecord didn't work.  I used alsamixer -c 0 and I didn't find this DAPM_ROUTE.

    here is my /var/lib/alsa/asound.state content

    # Dummy file, do not delete
    


    here is my i2cdump

    root@am62p-lohr:~# i2cdump -y -f 2 0x19
    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: 04 00 01 17 01 17 7d d3 7f ff 00 00 00 00 7f ff    ?.????}??.....?.
    10: 00 00 00 00 00 00 00 00 7f ff 00 00 00 00 00 00    ........?.......
    20: 00 00 7f ff 00 00 00 00 00 00 00 00 7f ff 00 00    ..?.........?...
    30: 00 00 00 00 00 00 7f ff 00 00 00 00 00 00 00 00    ......?.........
    40: 00 00 00 00 00 00 00 00 7f ff 00 00 00 00 7f ff    ........?.....?.
    50: 00 00 00 00 00 00 00 00 7f ff 00 00 00 00 00 00    ........?.......
    60: 00 00 7f ff 00 00 00 00 00 00 00 00 7f ff 00 00    ..?.........?...
    70: 00 00 00 00 00 00 7f ff 00 00 00 00 00 00 00 00    ......?.........
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    

    Regards, 

    Sergio

  • Hi Mir,

    I don't know if it helps but my hardware connection is this.



    I just put the Mcasp and clocks pins.

    Att.

  • Is there any update ?

  • Hi  

    • Sorry for the delay in response. Request you to share the kernel logs when the issue is reproduce to see if there is any error message thrown in the kernel logs.
    • The IO error are usually associated with the audio data/dma - I doubt that it is related to codec. Since we will be using multiple instances with unique widget names sound-name-prefix and i2c bus and address based dai name. 

    Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2272: read error: Input/output error

     

  • Hi Niranjan,

    here is my logs, i've put some debugs on davinci-mcasp driver.

    root@am62p-lohr:~# speaker-test -D plughw:0,0 -c 6 -r 48000 -twav
    
    speaker-test 1.2.11
    
    Playback device is plughw:0,0
    Stream parameters are 48000Hz, S16_LE, 6 channels
    WAV file(s)
    Rate set to 48000Hz (requested 48000Hz)
    Buffer size range from 64 to 43690
    Period size range from 32 to 5461
    Periods = 4
    was set period_size = 5461
    was set buffer_size = 21844
     0 - Front Left
     4 - Center
     1 - Front Right
     3 - Rear Right
     2 - Rear Left
     5 - LFE
    [  143.684609] davinci-mcasp 2b20000.audio-controller: startup: Opening Playback stream
    [  143.684633] davinci-mcasp 2b20000.audio-controller: startup: Max channels constrained to 6 (Serializers: 3, TDM Slots: 2)
    [  143.685892] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=24576000 Hz, dir=OUT
    [  143.685916] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [  143.686160] davinci-mcasp 2b20000.audio-controller: hw_params: Starting setup for 48000Hz, 2 channels, format 0x2
    [  143.686172] davinci-mcasp 2b20000.audio-controller: hw_params: Detected word_length = 16
    [  143.686179] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Raw fmt mask 0x1001
    [  143.686184] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Format -> I2S
    [  143.686191] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: McASP is Provider (BCLK/FS Master)
    [  143.686200] davinci-mcasp 2b20000.audio-controller: hw_params: Calculating BCLK (rate:48000 * sbits:16 * slots:2) = 1536000 Hz
    [  143.686208] davinci-mcasp 2b20000.audio-controller: calc_clk_div: sysclk=24576000, target_bclk=1536000
    [  143.686214] davinci-mcasp 2b20000.audio-controller: calc_clk_div: Final BCLK div=16, error=0 PPM
    [  143.686221] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting BCLK divider to 16 (reg value: 15, explicit: 0)
    [  143.686230] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting MCLK (AUXCLK) divider to 1 (reg value: 0)
    [  143.686237] davinci-mcasp 2b20000.audio-controller: hw_param TX: channels=2, period_words=24000, slots=2
    [  143.686244] davinci-mcasp 2b20000.audio-controller: hw_param: needed serializers = 1
    [  143.686250] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR0 as TX
    [  143.686261] davinci-mcasp 2b20000.audio-controller: hw_param: FIFO active! NUMDMA=1, NUMEVT=32, DMA maxburst=32
    [  143.686267] davinci-mcasp 2b20000.audio-controller: hw_params: Entering I2S mode setup
    [  143.686272] davinci-mcasp 2b20000.audio-controller: i2s_hw_param TX: channels=2, total_slots=2
    [  143.686278] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: TDM mask calculated = 0x3 (serializers needed: 1)
    [  143.686285] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: Configuring TX TDM=0x3, FSXMOD=2 slots
    [  143.686292] davinci-mcasp 2b20000.audio-controller: config_ch_size: sample_width=16, slot_width=16, mask=0xffff
    [  143.686298] davinci-mcasp 2b20000.audio-controller: config_ch_size: Format I2S/LEFT_J -> TX rotate=4, RX rotate=0
    [  143.686305] davinci-mcasp 2b20000.audio-controller: config_ch_size: Setting TX/RX SSZ=0x7 (fmt field)
    [  143.686311] davinci-mcasp 2b20000.audio-controller: hw_params: Setup completed successfully
    [  143.699323] davinci-mcasp 2b20000.audio-controller: McASP TX: Starting playback...
    [  143.699342] davinci-mcasp 2b20000.audio-controller: McASP TX: Enabling FIFO
    [  143.699348] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x200 to reg 0xa0
    [  143.699356] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  143.699361] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x100 to reg 0xa0
    [  143.699368] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  143.699374] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x400 to reg 0xa0
    [  143.699380] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  143.699387] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x800 to reg 0xa0
    [  143.699393] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  143.699398] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x1000 to reg 0xa0
    [  143.699404] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  152.637321] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=0 Hz, dir=OUT
    [  152.637349] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [  156.178155] davinci-mcasp 2b20000.audio-controller: startup: Opening Playback stream
    [  156.178180] davinci-mcasp 2b20000.audio-controller: startup: Max channels constrained to 6 (Serializers: 3, TDM Slots: 2)
    [  156.179539] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=24576000 Hz, dir=OUT
    [  156.179560] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [  156.179581] davinci-mcasp 2b20000.audio-controller: hw_params: Starting setup for 48000Hz, 6 channels, format 0x2
    [  156.179589] davinci-mcasp 2b20000.audio-controller: hw_params: Detected word_length = 16
    [  156.179595] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Raw fmt mask 0x1001
    [  156.179600] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Format -> I2S
    [  156.179607] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: McASP is Provider (BCLK/FS Master)
    [  156.179617] davinci-mcasp 2b20000.audio-controller: hw_params: Calculating BCLK (rate:48000 * sbits:16 * slots:2) = 1536000 Hz
    [  156.179625] davinci-mcasp 2b20000.audio-controller: calc_clk_div: sysclk=24576000, target_bclk=1536000
    [  156.179631] davinci-mcasp 2b20000.audio-controller: calc_clk_div: Final BCLK div=16, error=0 PPM
    [  156.179637] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting BCLK divider to 16 (reg value: 15, explicit: 0)
    [  156.179645] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting MCLK (AUXCLK) divider to 1 (reg value: 0)
    [  156.179652] davinci-mcasp 2b20000.audio-controller: hw_param TX: channels=6, period_words=32766, slots=2
    [  156.179659] davinci-mcasp 2b20000.audio-controller: hw_param: needed serializers = 3
    [  156.179665] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR0 as TX
    [  156.179671] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR1 as TX
    [  156.179676] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR2 as TX
    [  156.179684] davinci-mcasp 2b20000.audio-controller: hw_param: FIFO active! NUMDMA=3, NUMEVT=6, DMA maxburst=6
    [  156.179690] davinci-mcasp 2b20000.audio-controller: hw_params: Entering I2S mode setup
    [  156.179695] davinci-mcasp 2b20000.audio-controller: i2s_hw_param TX: channels=6, total_slots=2
    [  156.179701] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: TDM mask calculated = 0x3 (serializers needed: 3)
    [  156.179707] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: Configuring TX TDM=0x3, FSXMOD=2 slots
    [  156.179715] davinci-mcasp 2b20000.audio-controller: config_ch_size: sample_width=16, slot_width=16, mask=0xffff
    [  156.179721] davinci-mcasp 2b20000.audio-controller: config_ch_size: Format I2S/LEFT_J -> TX rotate=4, RX rotate=0
    [  156.179727] davinci-mcasp 2b20000.audio-controller: config_ch_size: Setting TX/RX SSZ=0x7 (fmt field)
    [  156.179734] davinci-mcasp 2b20000.audio-controller: hw_params: Setup completed successfully
    [  156.189471] davinci-mcasp 2b20000.audio-controller: McASP TX: Starting playback...
    [  156.189491] davinci-mcasp 2b20000.audio-controller: McASP TX: Enabling FIFO
    [  156.189497] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x200 to reg 0xa0
    [  156.189504] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  156.189510] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x100 to reg 0xa0
    [  156.189516] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  156.189523] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x400 to reg 0xa0
    [  156.189529] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  156.189535] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x800 to reg 0xa0
    [  156.189542] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  156.189547] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x1000 to reg 0xa0
    [  156.189553] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [  165.934490] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=0 Hz, dir=OUT
    [  165.934517] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    


    and here is a extract of my device tree

    /{
    
    	// Pino GPIO0_22 - MAIN 17V@5A POWER SUPPLY
    	//-----------------------------------------------------------------------------------------------------
    	en_pwr_17v: en-pwr-17v {
    		compatible = "regulator-fixed";
    		regulator-name = "en_pwr_17v_en";
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_17v_power_en_pins_default>;
    		regulator-min-microvolt = <3300000>;
    		regulator-max-microvolt = <3300000>;
    		regulator-boot-on;
    		regulator-always-on;
    		enable-active-high;
    		gpio = <&main_gpio0 22 GPIO_ACTIVE_HIGH>;
    	};
    
    	clk_nvp6324_fixed: nvp6324-xclk {
    		compatible = "fixed-clock";
    		#clock-cells = <0>;
    		clock-frequency = <27000000>;
    	};
    
        // Config do backlight do LCD
        backlight: backlight {
            compatible = "pwm-backlight";
            pinctrl-names = "default";
            pinctrl-0 = <&backlight_pins_default>;
            brightness-levels = <94 94 94 95 95 96 96 96 97 97 98 98 98 99 99 99 100 100 100 101
    							101 101 102 102 102 103 103 103 104 104 104 105 105 105 106 106 106
    							107 107 107 108 108 108 109 109 109 110 110 110 111 111 111 112 112
    							112 113 113 113 114 114 114 115 115 115 116 116 116 117 117 117 118
    							118 118 119 119 119 120 120 120 121 121 122 122 122 123 123 124 124
    							124 125 125 126 126 126 127 127 128 128 128 129 129 130 130 130 131
    							131 132 132 132 133 133 134 134 134 135 135 136 136 136 137 137 138
    							138 138 139 139 140 140 140 141 141 142 142 142 143 143 144 144 144
    							145 145 146 146 146 147 147 148 148 148 149 149 150 150 151 151 152
    							152 153 153 154 154 154 155 155 155 156 156 157 157 157 158 158 158
    							158 159 159 160 160 160 161 161 161 162 162 162 163 163 163 164 164
    							165 165 166 166 167 167 168 168 169 169 169 170 170 171 171 171 172
    							172 172 173 173 173 174 174 175 175 175 176 176 177 177 178 178 179
    							179 180 180 181 181 182 182 183 183 184 184 185 185 186 186 187 187
    							188 188 189 189 190 190 191 191 192 192 193 193 194 194	>;
            default-brightness-level = <100>;
            enable-gpios = <&main_gpio0 6 GPIO_ACTIVE_HIGH>; //STB_TFT_DISP
    		post-pwm-on-delay-ms = <100>;
    		pwm-off-delay-ms = <100>;
            pwms = <&epwm2 0 62500 0>;
            status = "okay";
        };
    
    	lcd {
    		compatible = "lincolntech,lcd185-101ct";
    		backlight = <&backlight>;
    		status = "okay";
    
    		/*
    		* Note that the OLDI TX 0 transmits the odd set of pixels
    		* while the OLDI TX 1 transmits the even set. This is a
    		* fixed configuration in the IP integration and is not
    		* changeable. The properties, "dual-lvds-odd-pixels" and
    		* "dual-lvds-even-pixels" have been used to merely
    		* identify if a Dual Link configuration is required.
    		* But swapping them will cause an error in the dss driver.
    		*/
    		port@0 {
    			lcd_in0: endpoint {
    				remote-endpoint = <&oldi_0_out>;
    			};
    		};
    	};
    
    	codec_audio: sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "Lohr-Audio";
    		status = "okay";
    		simple-audio-card,mclk-fs = <512>;
    
    		simple-audio-card,format = "i2s";
    
    		simple-audio-card,widgets =
    			"Speaker", "External Speaker";
    
    		clocks = <&audio_refclk0>;
    		clock-names = "mclk";
    
     		simple-audio-card,dai-link@0 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai>;
                frame-master = <&cpu_dai>;
    
    			cpu_dai: cpu {
                    sound-dai = <&mcasp2>;
                    system-clock-direction-out;
                };
    
    			codec {
                    sound-dai = <&tas5731>, <&audio1>, <&audio2>;
    
                    clocks = <&audio_refclk0>, <&audio_refclk0> , <&audio_refclk0>;
    
     			};
    		};
    
    	};
    };
    
    &mcasp2 {
        status = "okay";
        #sound-dai-cells = <0>;
    
        pinctrl-names = "default";
        pinctrl-0 = <&mcasp_audio_in_out_pins_default>;
    
        op-mode = <0>;          /* Modo I2S */
        tdm-slots = <2>;        /* Stereo */
    	slot-width = <32>;
    
        serial-dir = <1 1 1 0 0>;
    
    	tx-num-evt = <32>;
    	rx-num-evt = <32>;
    
    	clocks = <&k3_clks 192 0>, <&audio_refclk0>;
    	clock-names = "fck", "ahclkx";
    
    	assigned-clocks = <&k3_clks 192 0>, <&k3_clks 192 44>;
    
    	assigned-clock-parents = <&audio_refclk0>, <&audio_refclk0>;
    
    	assigned-clock-rates = <24560000>, <24560000>;
    
    };
    
    &oldi0_dss0 {
    	status = "okay";
    };
    
    &oldi0_dss0_ports {
    	status = "okay";
    	
    	#address-cells = <1>;
        #size-cells = <0>;
    	port@0 {
    		#size-cells = <0>;
    	
    		reg = <0>;
    		oldi_0_in: endpoint {
    			#address-cells = <1>;
                #size-cells = <0>;
    			remote-endpoint = <&dpi0_out0>;
    		};
    	};
    
    	port@1 {
    		reg = <1>;
    		oldi_0_out: endpoint {
    			remote-endpoint = <&lcd_in0>;
    		};
    	};
    };
    
    &dss0_ports {
    	/* VP1: LVDS Output (OLDI TX 0) */
    	
    	port@0 {
    	
    		reg = <0>;
    		dpi0_out0: endpoint {
    			remote-endpoint = <&oldi_0_in>;
    		};
    	};
    };
    
    &dss0 {
    	status = "okay";
    };
    
    // Touch_Screen / MFI -----------------------------------------------------------------
    &main_i2c0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>;
    	clock-frequency = <400000>;
    
    	touchscreen_ga657x@5d{
    		status = "okay";
    		label = "touchscreen";
    		compatible = "goodix,ga657x";
    		reg = <0x5d>;
    
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_int_tft_tch_pins_default>, <&main_rst_tft_touch_pins_default>;
    
    		interrupt-parent = <&main_gpio0>;
    		irq-gpios = <&main_gpio0 4 GPIO_ACTIVE_LOW>;
    
    		reset-gpios = <&main_gpio0 3 GPIO_ACTIVE_HIGH>;
    
    		irq-flags = <2>;
    
    		touchscreen-max-id = <11>;
    		touchscreen-size-x = <1280>;
    		touchscreen-size-y = <720>;
    
    		touchscreen-max-w = <512>;
    		touchscreen-max-p = <512>;
    		touchscreen-key-map = <172>, <158>; /*KEY_HOMEPAGE=172, KEY_BACK=158, KEY_MENU=139*/
    		goodix,slide-wakeup = <0>;
    		goodix,type-a-report = <0>;
    		goodix,driver-send-cfg = <0>;
    		goodix,resume-in-workqueue = <0>;
    		goodix,swap-x2y = <0>;
    		goodix,esd-protect = <1>;
    		goodix,auto-update = <0>;
    		goodix,auto-update-cfg = <0>;
    		goodix,power-off-sleep = <0>;
    		goodix,pen-suppress-finger = <0>;
    
    		goodix,cfg-group0 = [ 53 D0 02 00 05 05 F5 D5 21 48 2D 0F 5A 41 0E 05 00 00 32 32 20 00 05 14 14 1A 14 8B 2B 00 ];
    
    		vdd_ana-supply  = <&vcc_3v3_sys>;
    		vcc_i2c-supply  = <&vcc_3v3_sys>;
    
    	};
    
    	apple_mfi343s00177@10{
    		status = "okay";
    		label = "mfi_auth_chip";
    		reg = <0x10>;
            compatible = "i2c-device";
    	};
    
    	audio1: audio1@18 {
    		// TLV320DAC3203IRGE (ADC/DAC)
    		#sound-dai-cells = <0>;
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_dac1_pins_default>;
    
    		compatible = "ti,tlv320aic32x4";
            reg = <0x18>;
    	    status = "okay";
    
    		sound-name-prefix = "AIC1";
    		iov-supply = <&vcc_3v3_sys>;
    		ldoin-supply = <&vcc_3v3_sys>;
    
    		reset-gpios = <&main_gpio0 45 GPIO_ACTIVE_HIGH>;
    		clocks = <&k3_clks 192 30>;
    		clock-names = "mclk";
    
    		aic32x4-gpio-func = <0xff 0xff 0xff 0xff 0x08>;
    
    		gpio-controller;
    		#gpio-cells = <2>;
    	};
    };
    
    &main_i2c1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c1_pins_default>;
    	clock-frequency = <400000>;
    
    	audio2: audio2@18 {
    		// TLV320DAC3203IRGE (MIC/DAC)
    		#sound-dai-cells = <0>;
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_dac2_pins_default>;
    		compatible = "ti,tlv320aic32x4";
            reg = <0x18>;
    		status = "okay";
    
    		sound-name-prefix = "AIC1";
    		iov-supply = <&vcc_3v3_sys>;
    		ldoin-supply = <&vcc_3v3_sys>;
    
    		reset-gpios = <&main_gpio0 46 GPIO_ACTIVE_HIGH>;
    		clocks = <&k3_clks 192 30>;
    		clock-names = "mclk";
    
    		aic32x4-gpio-func = <0xff 0xff 0xff 0xff 0x08>;
    
    		gpio-controller;
    		#gpio-cells = <2>;
    	};
    
    	audio_adc1: adc1@32 {
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_adc1_pins_default>;
            compatible = "ti,tlv320adc3101";
            reg = <0x32>;
            status = "okay";
    
            reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;
    		clocks = <&k3_clks 192 30>;
    
    		sound-name-prefix = "ADC1";
    
            ti,dmdin-gpio1 = <0>;
            ti,dmclk-gpio2 = <0>;
    
            ti,micbias1-vg = <0>;
    
            gpio-controller;
            #gpio-cells = <2>;
            #sound-dai-cells = <0>;
        };
    
    	audio_adc2: adc2@36 {
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_adc2_pins_default>;
            compatible = "ti,tlv320adc3101";
            reg = <0x36>;
            status = "okay";
    
            reset-gpios = <&main_gpio0 48 GPIO_ACTIVE_HIGH>;
    		clocks = <&k3_clks 192 30>;
    
    		sound-name-prefix = "ADC2";
    
            ti,dmdin-gpio1 = <0>;
            ti,dmclk-gpio2 = <0>;
    
            ti,micbias1-vg = <0>;
    
            gpio-controller;
            #gpio-cells = <2>;
            #sound-dai-cells = <0>;
        };
    
    };
    
    &main_i2c2 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c2_pins_default>;
    	clock-frequency = <400000>;
    
    	nvp6324: camera@33 {
    
    		pinctrl-names = "default";
    		pinctrl-0 = <&irq_video_pins_default>, <&mpu_rst_video_pins_default>;
    
    		compatible = "nextchip,nvp6324_mipi";
    		reg = <0x33>;
    		mode = <4>;
    		clocks = <&clk_nvp6324_fixed>;
    		clock-names = "capture_mclk";
    		mclk = <&clk_nvp6324_fixed>;
    		mclk_source = <0>;
    		pwm-gpios = <&main_gpio0 36 GPIO_ACTIVE_LOW>;
    
    		ports {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			port@0 {
    				reg = <0>;
    				csi2_cam0: endpoint {
    					remote-endpoint = <&csi2rx0_in_sensor>;
    					link-frequencies = /bits/ 64 <480000000>;
    					clock-lanes = <0>;
    					data-lanes = <1 2 3 4>;
    				};
    			};
    		};
    
    	};
    
    	tas5731: audio-codec@1a {
    		compatible = "ti,tas5717";
    		reg = <0x1a>;
    
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_amp_rst_pins_default>,
    					<&main_amp_pwr_down_pins_default>;
    
    		#sound-dai-cells = <0>;
    		reset-gpios = <&main_gpio0 15 GPIO_ACTIVE_HIGH>;
    		pdn-gpios = <&main_gpio0 16 GPIO_ACTIVE_HIGH>;
    
    
    		clocks = <&k3_clks 157 16>;
    		clock-names = "mclk";
    
    		assigned-clocks = <&k3_clks 157 16>;
    		assigned-clock-rates = <24576000>;
    
    		AVDD-supply  = <&vcc_3v3_sys>;
    		DVDD-supply  = <&vcc_3v3_sys>;
    		PVDD_AB-supply = <&en_pwr_17v>;
    		PVDD_CD-supply = <&en_pwr_17v>;
    	};
    };
    
    &k3_clks {
    	assigned-clocks = <&k3_clks 157 16>;
    	status = "okay";
    };
    
    &cdns_csi2rx0 {
    	ports {
    		#address-cells = <1>;
    		#size-cells = <0>;
    
    		csi0_port0: port@0 {
    			reg = <0>;
    			status = "okay";
    
    			csi2rx0_in_sensor: endpoint@0 {
    				remote-endpoint = <&csi2_cam0>;
    				bus-type = <4>; /* CSI2 DPHY. */
    				clock-lanes = <0>;
    				data-lanes = <1 2 3 4>;
    			};
    		};
    	};
    };
    
    &audio_refclk0 {
    	#clock-cells = <0>;
    
    	pinctrl-names = "default";
        pinctrl-0 = <&audio_ext_refclk_pins_default>;
    
    	clocks = <&k3_clks 157 0>;
    	assigned-clocks = <&k3_clks 157 0>;
    	assigned-clock-parents = <&k3_clks 157 16>;
    
    	assigned-clock-rates = <24576000>;
    
    	#clock-cells = <0>;
    
        status = "okay";
    };
    
    &main_gpio0 {
    	status = "okay";
    	pinctrl-names = "default";
    
    	pinctrl-0 = <&main_rst_tft_display_pins_default>, <&main_en_pwr_cam_pins_default>;
    
        rst-tft-disp-hog {
            gpio-hog;
            gpios = <5 GPIO_ACTIVE_HIGH>;
            output-low;
            line-name = "rst_tft_disp";
        };
    
    };
    
    &main_pmx0{
    	
    	pinctrl-names = "default";
    	pinctrl-0 = <&myepwm0_pins_default>;
    
    	// RST_TFT_TCH
    	main_rst_tft_touch_pins_default: main-rst-tft-touch-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x000c, PIN_INPUT, 7) /* (L25) CN1/19 - PINO20 OSPI0_D0.GPIO0_3 - RST_TFT_TCH*/
    			>;
    	};
    
    	// INT_TFT_TCH
    	main_int_tft_tch_pins_default: main-int-tft-tch-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0010, PIN_INPUT, 7) /* (N24) OSPI0_D1.GPIO0_4 */
    			>;
    	};
    
    	main_amp_rst_pins_default: main-amp-rst-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x003c, PIN_INPUT, 7) /* (U22) GPMC0_AD0.GPIO0_15 */
    			>;
    	};
    
    	main_amp_pwr_down_pins_default: main-amp-pwr-down-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0040, PIN_INPUT, 7) /* (U21) GPMC0_AD1.GPIO0_16 */
    			>;
    	};
    
    	// RESET_DAC1
    	main_rst_dac1_pins_default: main-rst-dac1-default-pins {
    		pinctrl-single,pins = <
    				AM62PX_IOPAD(0x00b8, PIN_INPUT, 7) /* (AE24) VOUT0_DATA0.GPIO0_45 */
    			>;
    	};
    
    	// RESET_DAC2
    	main_rst_dac2_pins_default: main-rst-dac2-default-pins {
    		pinctrl-single,pins = <
    				AM62PX_IOPAD(0x00bc, PIN_INPUT, 7) /* (W23) VOUT0_DATA1.GPIO0_46 */
    			>;
    	};
    
    	// RESET_ADC1
    	main_rst_adc1_pins_default: main-rst-adc1-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x00c0, PIN_INPUT, 7) /* (AA23) VOUT0_DATA2.GPIO0_47 */
    			>;
    	};
    
    	// RESET_ADC2
    	main_rst_adc2_pins_default: main-rst-adc2-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x00c4, PIN_INPUT, 7) /* (Y23) VOUT0_DATA3.GPIO0_48 */
    		>;
    	};
    
    	//Rádio??
    	mcasp2_pins_default: mcasp2-default-pins { 
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01b0, PIN_INPUT, 0) /* (G20) MCASP0_ACLKR */
    			AM62PX_IOPAD(0x01ac, PIN_INPUT, 0) /* (G23) MCASP0_AFSR */
    			AM62PX_IOPAD(0x019c, PIN_INPUT, 0) /* (E24) MCASP0_AXR1 */
    		>;
    	};
    	
    	// TLV320ADC3101IRGER
    	mcasp_audio_in_out_pins_default: mcasp-audio-in-out-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0170, PIN_INPUT, 2) /* (A21) RGMII2_TD1.MCASP2_ACLKR */
    			AM62PX_IOPAD(0x0178, PIN_OUTPUT, 2) /* (A19) RGMII2_TD3.MCASP2_ACLKX */
    			AM62PX_IOPAD(0x0188, PIN_INPUT, 2) /* (E16) RGMII2_RD1.MCASP2_AFSR */
    			AM62PX_IOPAD(0x0174, PIN_OUTPUT, 2) /* (D17) RGMII2_TD2.MCASP2_AFSX */
    			AM62PX_IOPAD(0x018c, PIN_OUTPUT, 2) /* (E17) RGMII2_RD2.MCASP2_AXR0 */
    			AM62PX_IOPAD(0x0180, PIN_INPUT, 2) /* (D19) RGMII2_RXC.MCASP2_AXR1 */
    			AM62PX_IOPAD(0x0184, PIN_INPUT, 2) /* (E19) RGMII2_RD0.MCASP2_AXR2 */
    			AM62PX_IOPAD(0x017c, PIN_INPUT, 2) /* (F19) RGMII2_RX_CTL.MCASP2_AXR3 */
    			AM62PX_IOPAD(0x0164, PIN_INPUT, 2) /* (A20) RGMII2_TX_CTL.MCASP2_AXR4 */
    		>;
    	};
    
    	backlight_pins_default: bl-pins-default {
    		pinctrl-single,pins = <
    			/* AM62PX_IOPAD(0x0014, PIN_INPUT, 7) */ /* (N25) CN1/19 - PINO22 - OSPI0_D2.GPIO0_5 - RST_TFT_DISP*/
    			AM62PX_IOPAD(0x0018, PIN_INPUT, 7) /* (M24) CN1/19 - PINO23 - OSPI0_D3.GPIO0_6 - STB_TFT_DISP*/
    			AM62PX_IOPAD(0x0124, PIN_OUTPUT, 4) /* (J25) CN1/19 - PINO14 - MMC2_SDCD.EHRPWM2_A - PWM_BCKL_TFT */
    		>;
    	};
    
    	main_rst_tft_display_pins_default: main-rst-tft-display-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0014, PIN_INPUT, 7) /* (N25) CN1/19 - PINO22 - OSPI0_D2.GPIO0_5 - RST_TFT_DISP*/
    		>;
    	};
    
    	myepwm0_pins_default: myepwm0-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x01b4, PIN_OUTPUT, 2) /* (D20) SPI0_CS0.EHRPWM0_A */
    		>;
    	};
    
    	main_17v_power_en_pins_default: main-17v-power-en-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0058, PIN_OUTPUT, 7) /* (W25) GPMC0_AD7.GPIO0_22 */
    		>;
    	};
    
    	main_en_pwr_cam_pins_default: main-en-pwr-cam-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x016c, PIN_INPUT, 7) /* (B19) RGMII2_TD0.GPIO0_89 */
    		>;
    	};
    
    	irq_video_pins_default: irq-video-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x00a8, PIN_INPUT, 7) /* (T23) GPMC0_CSn0.GPIO0_41 */
    		>;
    	};
    
    	mpu_rst_video_pins_default: mpu-rst-video-default-pins {
    		pinctrl-single,pins = <
    			AM62PX_IOPAD(0x0094, PIN_INPUT, 7) /* (T24) GPMC0_BE1n.GPIO0_36 MPU_RST_VIDEO /  RESET_VIDEO_1V8 / RESET_VIDEO */
    		>;
    	};
    
    };
    
    &main_gpio1 {
    	status = "okay";
    };
    
    &ecap0{
    	status = "okay";
    };
    
    &epwm0{
    	status = "okay";
    };
    
    &epwm1{
    	status = "okay";
    	
    };
    
    &epwm2{
    	status = "okay";
    };



    Att.

  • Hi    Did you reproduce the "Resource Busy error" when these logs were captured ? I could not see any error logs.

    Request you to share the kernel logs for the issue case if not. 

  • hi, this error was occurring because i was using mcasp2 instance in multiple dai-link, now i've changed it to this topology

    	codec_audio: sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "Audio";
    		status = "okay";
    		simple-audio-card,mclk-fs = <512>;
    
    		simple-audio-card,format = "i2s";
    
    		simple-audio-card,widgets =
    			"Speaker", "External Speaker";
    
    		clocks = <&audio_refclk0>;
    		clock-names = "mclk";
    
     		simple-audio-card,dai-link@0 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai>;
                frame-master = <&cpu_dai>;
    
    			cpu_dai: cpu {
                    sound-dai = <&mcasp2>;
                    system-clock-direction-out;
                };
    
    			codec {
                    sound-dai = <&tas5731>, <&audio1>, <&audio2>;
    
                    clocks = <&audio_refclk0>, <&audio_refclk0> , <&audio_refclk0>;
    
     			};
    		};
    
    	};


    my older version was something like this.

    	codec_audio: sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "Lohr-Audio";
    		status = "okay";
    		simple-audio-card,mclk-fs = <512>;
    
    		simple-audio-card,format = "i2s";
    
    		simple-audio-card,widgets =
    			"Speaker", "External Speaker";
    
    		clocks = <&audio_refclk0>;
    		clock-names = "mclk";
    
     		simple-audio-card,dai-link@0 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai>;
                frame-master = <&cpu_dai>;
    
    			cpu_dai: cpu {
                    sound-dai = <&mcasp2>;
                    system-clock-direction-out;
                };
    
    			codec {
                    sound-dai = <&tas5731>;
    
                    clocks = <&audio_refclk0>;
    
     			};
    		};
    		
    		simple-audio-card,dai-link@1 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai1>;
                frame-master = <&cpu_dai1>;
    
    			cpu_dai1: cpu {
                    sound-dai = <&mcasp2>;
                    system-clock-direction-out;
                };
    
    			codec {
                    sound-dai =<&audio1>;
    
                    clocks = <&audio_refclk0>;
    
     			};
    		};
    
    	};

    Att.

  • Are you saying that the issue is solved after making the changes to the DTS file and can we consider the issue as closed ?

  • No, i can't reproduce multiple sources at the same time yet, but the problem resource busy didn't appear anymore.

    Att.

  • ok, please let us know when the issue is reproduced with kernel logs.

  • I've three components connected to my MCASP2, but when i run aplay -l it only appear tas571.

    root@am62p-lohr:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: LohrAudio [Lohr-Audio], device 0: 2b20000.audio-controller-tas571x-hifi tas571x-hifi-0 [2b20000.audio-controller-tas571x-hifi tas571x-hifi-0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    root@am62p-lohr:~# aplay -L
    null
    Discard all samples (playback) or generate zero samples (capture)
    pulse
    PulseAudio Sound Server
    sysdefault:CARD=LohrAudio
    Lohr-Audio, 2b20000.audio-controller-tas571x-hifi tas571x-hifi-0
    Default Audio Device

    root@am62p-lohr:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: LohrAudio [Lohr-Audio], device 0: 2b20000.audio-controller-tas571x-hifi tas571x-hifi-0 [2b20000.audio-controller-tas571x-hifi tas571x-hifi-0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    root@am62p-lohr:~# speaker-test -D plughw:0,0 -c 6 -r 48000 -twav

    speaker-test 1.2.11

    Playback device is plughw:0,0
    Stream parameters are 48000Hz, S16_LE, 6 channels
    WAV file(s)
    Rate set to 48000Hz (requested 48000Hz)
    Buffer size range from 64 to 43690
    Period size range from 32 to 5461
    Periods = 4
    was set period_size = 5461
    was set buffer_size = 21844
    0 - Front Left
    4 - Center
    1 - Front Right
    3 - Rear Right
    2 - Rear Left
    5 - LFE
    Time per period = 8.257195
    0 - Front Left
    4 - Center
    1 - Front Right
    3 - Rear Right
    ^CTransfer failed: Bad address
    [ 9401.646519] davinci-mcasp 2b20000.audio-controller: startup: Opening Playback stream
    [ 9401.646543] davinci-mcasp 2b20000.audio-controller: startup: Max channels constrained to 6 (Serializers: 3, TDM Slots: 2)
    [ 9401.647740] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=24576000 Hz, dir=OUT
    [ 9401.647762] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [ 9401.647783] davinci-mcasp 2b20000.audio-controller: hw_params: Starting setup for 48000Hz, 6 channels, format 0x2
    [ 9401.647791] davinci-mcasp 2b20000.audio-controller: hw_params: Detected word_length = 16
    [ 9401.647796] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Raw fmt mask 0x1001
    [ 9401.647802] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Format -> I2S
    [ 9401.647808] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: McASP is Provider (BCLK/FS Master)
    [ 9401.647817] davinci-mcasp 2b20000.audio-controller: hw_params: Calculating BCLK (rate:48000 * sbits:16 * slots:2) = 1536000 Hz
    [ 9401.647825] davinci-mcasp 2b20000.audio-controller: calc_clk_div: sysclk=24576000, target_bclk=1536000
    [ 9401.647832] davinci-mcasp 2b20000.audio-controller: calc_clk_div: Final BCLK div=16, error=0 PPM
    [ 9401.647839] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting BCLK divider to 16 (reg value: 15, explicit: 0)
    [ 9401.647847] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting MCLK (AUXCLK) divider to 1 (reg value: 0)
    [ 9401.647854] davinci-mcasp 2b20000.audio-controller: hw_param TX: channels=6, period_words=32766, slots=2
    [ 9401.647860] davinci-mcasp 2b20000.audio-controller: hw_param: needed serializers = 3
    [ 9401.647867] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR0 as TX
    [ 9401.647873] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR1 as TX
    [ 9401.647878] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR2 as TX
    [ 9401.647886] davinci-mcasp 2b20000.audio-controller: hw_param: FIFO active! NUMDMA=3, NUMEVT=6, DMA maxburst=6
    [ 9401.647893] davinci-mcasp 2b20000.audio-controller: hw_params: Entering I2S mode setup
    [ 9401.647897] davinci-mcasp 2b20000.audio-controller: i2s_hw_param TX: channels=6, total_slots=2
    [ 9401.647903] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: TDM mask calculated = 0x3 (serializers needed: 3)
    [ 9401.647909] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: Configuring TX TDM=0x3, FSXMOD=2 slots
    [ 9401.647916] davinci-mcasp 2b20000.audio-controller: config_ch_size: sample_width=16, slot_width=16, mask=0xffff
    [ 9401.647923] davinci-mcasp 2b20000.audio-controller: config_ch_size: Format I2S/LEFT_J -> TX rotate=4, RX rotate=0
    [ 9401.647929] davinci-mcasp 2b20000.audio-controller: config_ch_size: Setting TX/RX SSZ=0x7 (fmt field)
    [ 9401.647936] davinci-mcasp 2b20000.audio-controller: hw_params: Setup completed successfully
    [ 9401.653134] davinci-mcasp 2b20000.audio-controller: McASP TX: Starting playback...
    [ 9401.653154] davinci-mcasp 2b20000.audio-controller: McASP TX: Enabling FIFO
    [ 9401.653161] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x200 to reg 0xa0
    [ 9401.653168] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9401.653174] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x100 to reg 0xa0
    [ 9401.653180] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9401.653187] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x400 to reg 0xa0
    [ 9401.653193] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9401.653200] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x800 to reg 0xa0
    [ 9401.653206] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9401.653211] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x1000 to reg 0xa0
    [ 9401.653217] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9414.530433] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=0 Hz, dir=OUT
    [ 9414.530461] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)

    In one terminal I ran 
    root@am62p-lohr:~# speaker-test -D plughw:0,0 -c 2 -r 48000 -twav

    speaker-test 1.2.11

    Playback device is plughw:0,0
    Stream parameters are 48000Hz, S16_LE, 2 channels
    WAV file(s)
    Rate set to 48000Hz (requested 48000Hz)
    Buffer size range from 64 to 131072
    Period size range from 32 to 16384
    Periods = 4
    was set period_size = 12000
    was set buffer_size = 48000
     0 - Front Left
     1 - Front Right

    and in the second terminal i ran 

    root@am62p-lohr:~# speaker-test -D plughw:0,2 -c 2 -r 48000 -twav

    speaker-test 1.2.11

    Playback device is plughw:0,2
    Stream parameters are 48000Hz, S16_LE, 2 channels
    WAV file(s)
    Playback open error: -2,No such file or directory
    [ 9640.913741] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=0 Hz, dir=OUT
    [ 9640.913771] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [ 9641.865008] davinci-mcasp 2b20000.audio-controller: startup: Opening Playback stream
    [ 9641.865032] davinci-mcasp 2b20000.audio-controller: startup: Max channels constrained to 6 (Serializers: 3, TDM Slots: 2)
    [ 9641.866351] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=24576000 Hz, dir=OUT
    [ 9641.866376] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [ 9641.866397] davinci-mcasp 2b20000.audio-controller: hw_params: Starting setup for 48000Hz, 2 channels, format 0x2
    [ 9641.866405] davinci-mcasp 2b20000.audio-controller: hw_params: Detected word_length = 16
    [ 9641.866410] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Raw fmt mask 0x1001
    [ 9641.866416] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Format -> I2S
    [ 9641.866423] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: McASP is Provider (BCLK/FS Master)
    [ 9641.866432] davinci-mcasp 2b20000.audio-controller: hw_params: Calculating BCLK (rate:48000 * sbits:16 * slots:2) = 1536000 Hz
    [ 9641.866440] davinci-mcasp 2b20000.audio-controller: calc_clk_div: sysclk=24576000, target_bclk=1536000
    [ 9641.866446] davinci-mcasp 2b20000.audio-controller: calc_clk_div: Final BCLK div=16, error=0 PPM
    [ 9641.866453] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting BCLK divider to 16 (reg value: 15, explicit: 0)
    [ 9641.866461] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting MCLK (AUXCLK) divider to 1 (reg value: 0)
    [ 9641.866467] davinci-mcasp 2b20000.audio-controller: hw_param TX: channels=2, period_words=24000, slots=2
    [ 9641.866474] davinci-mcasp 2b20000.audio-controller: hw_param: needed serializers = 1
    [ 9641.866481] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR0 as TX
    [ 9641.866491] davinci-mcasp 2b20000.audio-controller: hw_param: FIFO active! NUMDMA=1, NUMEVT=32, DMA maxburst=32
    [ 9641.866498] davinci-mcasp 2b20000.audio-controller: hw_params: Entering I2S mode setup
    [ 9641.866503] davinci-mcasp 2b20000.audio-controller: i2s_hw_param TX: channels=2, total_slots=2
    [ 9641.866509] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: TDM mask calculated = 0x3 (serializers needed: 1)
    [ 9641.866516] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: Configuring TX TDM=0x3, FSXMOD=2 slots
    [ 9641.866523] davinci-mcasp 2b20000.audio-controller: config_ch_size: sample_width=16, slot_width=16, mask=0xffff
    [ 9641.866529] davinci-mcasp 2b20000.audio-controller: config_ch_size: Format I2S/LEFT_J -> TX rotate=4, RX rotate=0
    [ 9641.866535] davinci-mcasp 2b20000.audio-controller: config_ch_size: Setting TX/RX SSZ=0x7 (fmt field)
    [ 9641.866542] davinci-mcasp 2b20000.audio-controller: hw_params: Setup completed successfully
    [ 9641.874448] davinci-mcasp 2b20000.audio-controller: McASP TX: Starting playback...
    [ 9641.874468] davinci-mcasp 2b20000.audio-controller: McASP TX: Enabling FIFO
    [ 9641.874474] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x200 to reg 0xa0
    [ 9641.874481] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9641.874486] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x100 to reg 0xa0
    [ 9641.874492] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9641.874499] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x400 to reg 0xa0
    [ 9641.874506] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9641.874511] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x800 to reg 0xa0
    [ 9641.874517] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9641.874523] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x1000 to reg 0xa0
    [ 9641.874529] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 9642.971122] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=0 Hz, dir=OUT
    [ 9642.971148] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)


  • Hi Sergio,

    Please have the playback and record use-cases verified with multichannel approach and let us know if you are stuck. 

    Best Regards

    Suren

  • Hi Suren,

    I'm trying to make work playback and record but I think I'm having clock issues, could you review my clock configuration?

    /{
    
    	codec_audio: sound {
    		compatible = "simple-audio-card";
    		simple-audio-card,name = "Lohr-Audio";
    		status = "okay";
    		simple-audio-card,mclk-fs = <512>;
    
    		simple-audio-card,format = "i2s";
    
    		simple-audio-card,widgets =
    			"Headphone", "Headphone Jack",
    			"Speaker", "External Speaker",
    			"Speaker", "Left Speaker",
    			"Speaker", "Right Speaker",
    			"Line", "Line In Left",
            	"Line", "Line In Right";
    
    		simple-audio-card,routing =
    			/* Codec 1 (AIC1) - Conectando aos fones */
    			"Headphone Jack", "AIC1 HPL",
    			"Headphone Jack", "AIC1 HPR",
    
    			/* Codec 2 (AIC2) - Conectando ao Speaker Externo */
    			"External Speaker", "AIC2 HPL",
    			"External Speaker", "AIC2 HPR",
    
    			/* TAS5731 - Amplificador Principal */
    			"Left Speaker", "OUT_A",
    			"Left Speaker", "OUT_B",
    			"Right Speaker", "OUT_C",
    			"Right Speaker", "OUT_D";
    
    		clocks = <&audio_refclk0>;
    
    		clock-names = "mclk";
    
     		simple-audio-card,dai-link@0 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai>;
    			frame-master = <&cpu_dai>;
    
    			cpu_dai: cpu {
    				sound-dai = <&mcasp2>;
    				system-clock-direction-out;
    			};
    
    			codec@0 {
    				sound-dai = <&tas5731>;
    				sound-name-prefix = "TAS_0";				
    				clocks = <&audio_refclk0>;
    
     			};
    		};
    
    		simple-audio-card,dai-link@1 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai1>;
    			frame-master = <&cpu_dai1>;
    
    			cpu_dai1: cpu {
    				sound-dai = <&mcasp2>;
    				system-clock-direction-out;
    			};
    
    			codec@1 {
    				sound-dai =<&audio1>;
    				sound-name-prefix = "AIC1";
    				clocks = <&audio_refclk0>;
     			};
    		};
    
    		simple-audio-card,dai-link@2 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai2>;
    			frame-master = <&cpu_dai2>;
    
    			cpu_dai2: cpu {
    				sound-dai = <&mcasp2>;
    				system-clock-direction-out;
    			};
    
    			codec@2 {
    				sound-dai =<&audio2>;
    				sound-name-prefix = "AIC2";
    				clocks = <&audio_refclk0>;
     			};
    		};
    
    		simple-audio-card,dai-link@3 {
     			format = "i2s";
    			bitclock-master = <&cpu_dai3>;
    			frame-master = <&cpu_dai3>;
    
    			cpu_dai3: cpu {
    				sound-dai = <&mcasp2>;
    			};
    
    			codec@3 {
    				sound-dai =<&audio_adc1>;
    				sound-name-prefix = "ADC1";
    				clocks = <&audio_refclk0>;
     			};
    		};
    
    	};
    };
    
    &mcasp2 {
        status = "okay";
        #sound-dai-cells = <0>;
    
        pinctrl-names = "default";
        pinctrl-0 = <&mcasp_audio_in_out_pins_default>;
    
        op-mode = <0>;          /* Modo I2S */
        tdm-slots = <2>;        /* Stereo */
    	tdm-slots-rx = <6>;
    	slot-width = <16>;
    
        serial-dir = <1 1 1 2 0>;
    
    	tx-num-evt = <32>;
    	rx-num-evt = <32>;
    
    	assigned-clocks = <&k3_clks 192 0>, <&k3_clks 192 27>;
    	assigned-clock-parents = <&k3_clks 192 1>, <&k3_clks 192 1>; 
    	assigned-clock-rates = <24576000>, <24576000>;
    	
    };
    
    &main_i2c0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c0_pins_default>;
    	clock-frequency = <400000>;
    	audio1: audio1@18 {
    		// TLV320DAC3203IRGE (ADC/DAC)
    		#sound-dai-cells = <0>;
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_dac1_pins_default>;
    
    		compatible = "ti,tlv320aic32x4";
            reg = <0x18>;
    	    status = "okay";
    
    		sound-name-prefix = "AIC1";
    		iov-supply = <&vcc_3v3_sys>;
    		ldoin-supply = <&vcc_3v3_sys>;
    
    		reset-gpios = <&main_gpio0 45 GPIO_ACTIVE_LOW>;
    
    		clocks = <&k3_clks 157 6>;
    		clock-names = "mclk";
    
    		assigned-clocks = <&k3_clks 157 6>;
    		assigned-clock-rates = <24576000>;
    
    		aic32x4-gpio-func = <0xff 0xff 0xff 0xff 0x08>;
    
    		gpio-controller;
    		#gpio-cells = <2>;
    	};
    };
    
    
    &main_i2c1 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c1_pins_default>;
    	clock-frequency = <400000>;
    
    	audio_adc1: adc1@19 {
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_adc1_pins_default>;
            compatible = "ti,tlv320adc3101";
            reg = <0x19>;
            status = "okay";
    
            reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;
    		clocks = <&k3_clks 192 30>;
    
    		sound-name-prefix = "ADC1";
    
            ti,dmdin-gpio1 = <0>;
            ti,dmclk-gpio2 = <0>;
    
            ti,micbias1-vg = <0>;
    
            gpio-controller;
            #gpio-cells = <2>;
            #sound-dai-cells = <0>;
        };
        
    };
    
    &main_i2c2 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_i2c2_pins_default>;
    	clock-frequency = <400000>;
    
    	tas5731: audio-codec@1a {
    		compatible = "ti,tas5717";
    		reg = <0x1a>;
    
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_amp_rst_pins_default>,
    					<&main_amp_pwr_down_pins_default>;
    
    		#sound-dai-cells = <0>;
    		reset-gpios = <&main_gpio0 15 GPIO_ACTIVE_HIGH>;
    		pdn-gpios = <&main_gpio0 16 GPIO_ACTIVE_HIGH>;
    
    
    		clocks = <&k3_clks 157 6>;
    		clock-names = "mclk";
    
    		assigned-clocks = <&k3_clks 157 6>;
    		assigned-clock-rates = <24576000>;
    
    		AVDD-supply  = <&vcc_3v3_sys>;
    		DVDD-supply  = <&vcc_3v3_sys>;
    		PVDD_AB-supply = <&en_pwr_17v>;
    		PVDD_CD-supply = <&en_pwr_17v>;
    	};
    };
    
    &k3_clks {
    	assigned-clocks = <&k3_clks 157 6>;
    	status = "okay";
    };
    
    &audio_refclk0 {
    	#clock-cells = <0>;
    
    	pinctrl-names = "default";
        pinctrl-0 = <&audio_ext_refclk_pins_default>;
    
    	clocks = <&k3_clks 157 0>;
    	assigned-clocks = <&k3_clks 157 0>;
    	assigned-clock-parents = <&k3_clks 157 6>;
    
    	assigned-clock-rates = <24576000>;
    
    	#clock-cells = <0>;
    
        status = "okay";
    };
    


    Best Regards,

  • Hi,

    Can you share your intended clocks and which direction it comes from? I am not sure about the syntax here but I can help you see if it is possible and what i2c would be needed to configure. Then we can verify with the driver files/a reg dump which registers are being set. 

    Best,
    Mir

  • Hi Sergio,

    AUDIO_EXT_REFCLK is being generated by MCASP2 AHCLKX correct? Why is your DTS pointing to MCASP0_AHCLKX?

    	assigned-clocks = <&k3_clks 157 0>;
    	assigned-clock-parents = <&k3_clks 157 6>;

    Shouldn't  this be <&k3_clks 157, 8> instead of <&k3_clks157,6>

      They are using MCASP as master and generating the clocks from AUX_CLK. 

    Best Regards

    Suren

  • I was also asking like what frequencies, I see there is a rate of "24576000" mentioned, I assume this is an MCLK? What would the BCLK and WCLK desired be, and is the ADC generating those or the MCU? Thanks for helping with the syntax - I am really not sure about how the clocks are defined in the dts like this for this system.

  • Hi,
    I'm using AUDIO_EXT_REFCLK0 generated by the MPU as my MCKL, and i want a master clock of 24576000.

    My desired BCLK is 1.5MHz and my desired WCLK is 48Khz.

    Best regards.

  • Hi Sergio,

    Are you still having issues with the clocks? 

    Best Regards

    Suren

  • Hi suren,

    I've changed my mcasp node to this

    &mcasp2 {
    status = "okay";
    #sound-dai-cells = <0>;

    pinctrl-names = "default";
    pinctrl-0 = <&mcasp_audio_in_out_pins_default>;

    op-mode = <0>; /* Modo I2S */
    tdm-slots = <2>; /* Stereo */
    tdm-slots-rx = <6>;
    slot-width = <32>;

    serial-dir = <1 1 1 2 0>;

    tx-num-evt = <32>;
    rx-num-evt = <32>;

    clocks = <&k3_clks 192 0>, <&k3_clks 192 30>;
    clock-names = "fck", "ahclkx";

    assigned-clocks = <&k3_clks 192 27>;
    assigned-clock-parents = <&k3_clks 192 30>;
    assigned-clock-rates = <24576000>;

    mclk-fs = <512>;

    };

    Now it's working my TAS, but on my TLV320DAC3203IRGE I'm hearing a continuous hiss only. My node is configured as bellow.

    audio1: audio1@18 {
    // TLV320DAC3203IRGE (ADC/DAC)
    #sound-dai-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&main_rst_dac1_pins_default>;

    compatible = "ti,tlv320aic32x4";
    reg = <0x18>;
    status = "okay";

    sound-name-prefix = "AIC1";
    iov-supply = <&vcc_3v3_sys>;
    ldoin-supply = <&vcc_3v3_sys>;

    reset-gpios = <&main_gpio0 45 GPIO_ACTIVE_HIGH>;

    clocks = <&audio_refclk0>;
    clock-names = "mclk";

    aic32x4-gpio-func = <0xff 0xff 0xff 0xff 0x08>;

    gpio-controller;
    #gpio-cells = <2>;
    };



    Best regards.

  • Hi Sergio.

    Did you have the ADC working in standalone without the DACs/Amplifier with the help from Audio team?

    Best Regards

    Suren

  • Hi Suren.

    I've did as you mentioned and let only my mic input on the device tree.

    I got this error when i tried to record

     root@am62p:/storage# arecord -D hw:0,0 -f S32_LE -r 48000 -c 2 -V stereo /storage/test.wav
    Recording WAVE '/storage/test.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
    +00%|00%+ arecord: pcm_read:2272: read error: Input/output error

    My mcasp2 node is shown bellow

    &mcasp2 {
    status = "okay";
    #sound-dai-cells = <0>;

    pinctrl-names = "default";
    pinctrl-0 = <&mcasp_audio_in_out_pins_default>;

    op-mode = <0>; /* Modo I2S */
    tdm-slots = <2>; /* Stereo */
    tdm-slots-rx = <6>;
    slot-width = <32>;

    serial-dir = <0 0 0 2 0>;

    tx-num-evt = <32>;
    rx-num-evt = <32>;

    clocks = <&k3_clks 192 0>, <&k3_clks 192 30>;
    clock-names = "fck", "ahclkx";

    assigned-clocks = <&k3_clks 192 27>;
    assigned-clock-parents = <&k3_clks 192 30>;

    assigned-clock-rates = <24576000>;

    mclk-fs = <512>;

    };


    Att.

  • Hi Sergio,

    Did the Audio team help configure/program the ADC before?

    If you don't get to hear back tomorrow, ping me and we can talk.

    Best Regards

    Suren

  • Can you share a register dump (i2cdump) of the ADC? And what clocks you are measuring on the MCLK/BCLK/WCLK during these tests.

    Best,
    Mir

  • TLV320ADC3101IRGER 

    root@am62p-lohr:~# i2cdump -f -y 2 0x19
    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: 04 00 01 17 01 17 7d d3 7f ff 00 00 00 00 7f ff    ?.????}??.....?.
    10: 00 00 00 00 00 00 00 00 7f ff 00 00 00 00 00 00    ........?.......
    20: 00 00 7f ff 00 00 00 00 00 00 00 00 7f ff 00 00    ..?.........?...
    30: 00 00 00 00 00 00 7f ff 00 00 00 00 00 00 00 00    ......?.........
    40: 00 00 00 00 00 00 00 00 7f ff 00 00 00 00 7f ff    ........?.....?.
    50: 00 00 00 00 00 00 00 00 7f ff 00 00 00 00 00 00    ........?.......
    60: 00 00 7f ff 00 00 00 00 00 00 00 00 7f ff 00 00    ..?.........?...
    70: 00 00 00 00 00 00 7f ff 00 00 00 00 00 00 00 00    ......?.........
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................


    when I run arecord -D hw:0,3 -r 48000 -f S16_LE -c 2 -d 15 /storage/teste.wav, I got this output 

    Recording WAVE '/storage/teste.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2272: read error: Input/output error

    bclk = 1,66MHz
    wclk = high level during 680ms
    mclk = 24,30MHz

  • Hi,

    This is a dump of page 4, which is just coefficients. Can you do a dump of page 0? To do this, write 0x00 to register 0x00 and then do the i2cdump. If you are not getting any clock on WCLK, this is what is causing the issue for you - there is a mismatch between what is generating the WCLK (is it the codec generating it from BCLK/MCLK or do you expect the MCU to generate WCLK?). It may be a clock divider issue as well. If you can send page 0 I can see what your clock dividers are. Please make sure the dump is during record/playback if you can.

    Best,
    Mir

  • Hi,

    root@am62p-lohr:~# sleep 2 && i2cdump -f -y 2 0x19
    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: 00 00 20 00 03 11 03 13 88 00 00 00 00 00 00 00    .. .?????.......
    10: 00 00 07 02 80 80 04 00 00 00 01 00 00 02 08 00    ..?????...?..??.
    20: 00 10 00 00 00 00 02 00 00 00 00 00 00 00 00 00    .?....?.........
    30: 00 00 00 00 00 12 02 02 00 00 00 44 00 01 00 00    .....???...D.?..
    40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    50: 00 00 88 00 00 00 00 00 7f 00 00 00 00 00 00 00    ..?.....?.......
    60: 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    


    here is my dump


  • Hi Sergio,

    Mir is out of office today and can return to this thread next week.

    Best,

    Garret

  • Hi Sergio,

    I went through your dump today. The clock dividers look like you should be using an MCLK of 24.576MHz for a WCLK of 48kHz (sample rate of 48k). Are you expecting the MCU to generate all the clocks for you or do you expect to just generate MCLK and the ADC will generate the BCLK and WCLK required for its operation? The current script is expecting slave mode (the BCLK and WCLK are also provided). However all the dividers in the clock tree were powered down, which we typically only see when the device is not in operation. I understand you were having an issue getting it to start in the first place, so maybe it is an issue with the MCU having a pull down on a clock or not properly turning them on?

    # PAGE 0 NOW
    02 20
    04 03 #plL_clkin=mclk, codec_clkin=pll_clk
    05 11 #P=1, R=1 (default)
    06 03 #J = 3
    07 13 #D MSB=0x13
    08 88 #D LSB=0x88 for total of 0x1388=5000 so J.D = 3.5
    12 07 #nadc powered down,=7
    13 02 #madc powered down,=2
    14 80 #aosr = 128
    15 80 #iadc=128*2
    16 04 #default decimation
    1a 01 #clkout div powered down, =1
    1b 00 #i2s, 16 bit, slave mode
    1d 02 #bdiv_clkin=adc_clk (default)
    1e 08 #bclk ndiv=8, powered down
    21 10 #default, pasi wclk output=internally generated adc_fs clk
    26 02 #default, both channels enabled
    35 12 #default, dout=primary dout
    36 02 
    37 02 
    3b 44 #def
    3d 01 #prb_r1 (default)
    52 88 #default - ladc+radc channels muted
    58 7f #default agc gains
    60 7f #default agc gains
    
    
    # expect 48k and bclk of 24.3MHz (24.576MHz??) otherwise it would be 47.46kHz
    
    

    Let me know about this.

    Best,
    Mir

  • Hi Mir,

    I'm expecting that MPU generate al the clocks on MCASP2.

    My currently &mcasp2 node is shown bellow

    &mcasp2 {
        status = "okay";
        #sound-dai-cells = <0>;
    
        pinctrl-names = "default";
        pinctrl-0 = <&mcasp_audio_in_out_pins_default>;
    
        op-mode = <0>;          /* Modo I2S */
        tdm-slots = <2>;        /* Stereo */
    	tdm-slots-rx = <6>;
    	slot-width = <32>;
    	//slot-width = <16>;
    
        serial-dir = <1 1 1 2 0>;
    
    	tx-num-evt = <32>;
    	rx-num-evt = <32>;
    
    	clocks = <&k3_clks 192 0>, <&k3_clks 192 30>;
    	clock-names = "fck", "ahclkx";
    
    	assigned-clocks = <&k3_clks 192 27>;
    	assigned-clock-parents = <&k3_clks 192 30>;
    
    	assigned-clock-rates = <24576000>;
    
    	mclk-fs = <512>;
    
    };
    


    and my ADC node is shown bellow

    	audio_adc1: adc1@19 {
    
    		#sound-dai-cells = <0>;
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_rst_adc1_pins_default>;
    		compatible = "ti,tlv320adc3101";
    		reg = <0x19>;
    		status = "okay";
    
    		reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;
    		//clocks = <&k3_clks 192 30>;
    		clocks = <&k3_clks 157 16>;
    		clock-names = "mclk";
    
    		sound-name-prefix = "ADC1";
    
    		ti,dmdin-gpio1 = <0>;
    		ti,dmclk-gpio2 = <0>;
    
    		ti,micbias1-vg = <0>;
    
    		gpio-controller;
    		#gpio-cells = <2>;
        };



    Att.

  • Hi,

    I do not know much about DTS specific configurations. However is it ok that the clocks are the same as the clock-parent in the mcasp2 node? Then there is another reference to a different clock in the adc "clocks" entry. 

    The dump you had sent me is not during operation. Were you ever able to have the device record or playback? Or was WCLK never being generated and it errors before it attempts to do the playback/record? 
    Did you verify that the pin is not being pulled high by your DTS config? I see in the reset-gpios line you have gpio 47 ACTIVE_HIGH? 

    Best,
    Mir

  • Hi,
    In mcasp2 I was able to playback but never was able to record, I think my clocks are wrong but I do not know much about clock configuration.

    My reset is correct we choose to have ACTIVE_HIGH.

    Best,

    Sergio

  • Ok.  and  can you help more with the DTS configuration for the ADC side. If the playback is working, it should be the same clocks for both ADC and DAC, so there may be some missing component on the DTS.

    Best,
    Mir

  • Hi Sergio,

     are you still facing the IO error ? Could you please share the kernel logs for this. As I mentioned earlier, I suspect that the IO error related issue is mostly related to DMA and not codec related. 

    McASP: 

    Based on the documentation, I think we have to use "ti,async-mode" when the Tx and Rx have different formats.  please confirm. This might be related to IO error. 

    Codec: Regarding the codec configurations (not related to IO error but are important )

    1. ti,micbias1-vg = <0>; // micbias disabled. Are you not using micbias from the chip ? 

    2. Your reset GPIO  should be  reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_LOW>;

    In driver,

    gpiod_set_value_cansleep(adc3xxx->rst_pin, 1); // Set to logical 1 =>  the GPIO subsystem drives the pin physically LOW (reset start)
    usleep_range(2000, 100000);
    gpiod_set_value_cansleep(adc3xxx->rst_pin, 0); // Set to logical 0 => GPIO subsystem driver then pin physically high (reset end )

    From data sheet, the RESET(with overhead bar) pin must be driven low for at least 10 ns

    Please check if the changes help. thanks 

  • Hi Niranjan

    When I ran this command "arecord -D hw:0,3 -f S16_LE -c 2 -r 44100 -v /tmp/test.wav" i get this output

    root@am62p-lohr:~# arecord -D hw:0,3 -f S16_LE -c 2 -r 44100 -v /tmp/test.wav
    arecord: set_params:1456: Unable to install hw params:
    ACCESS:  RW_INTERLEAVED
    FORMAT:  S16_LE
    SUBFORMAT:  STD
    SAMPLE_BITS: 16
    FRAME_BITS: 32
    CHANNELS: 2
    RATE: 44100
    PERIOD_TIME: (125011 125012)
    PERIOD_SIZE: 5513
    PERIOD_BYTES: 22052
    PERIODS: 4
    BUFFER_TIME: (500045 500046)
    BUFFER_SIZE: 22052
    BUFFER_BYTES: 88208
    TICK_TIME: 0
    [  422.111814] tlv320adc3xxx-codec 2-0019: ASoC: error at snd_soc_dai_hw_params on tlv320adc3xxx-hifi: -22
    [  422.124739]  2b20000.audio-controller-tlv320adc3xxx-hifi: ASoC: error at __soc_pcm_hw_params on 2b20000.audio-controller-tlv320adc3xxx-hifi: -22



    1. My micbias pins are not connected.
    2. We changed reset-gpio to HIGH because we have a inverter circuit connected to the reset pin, but we've changed the driver code too

    	/* Reset codec chip */
    	dev_info(dev, "Executando sequencia de reset de hardware...\n");
    	//gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
    	gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    	usleep_range(2000, 100000); /* Requirement: > 10 ns (datasheet p13) */
    	//gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    	gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
    


    I will check this "ti,async-mode", thank you.

    Att.

  • looks like the error is returned from hw_params in driver ? Could you please try SR 48k if you're using mclk as 24576000 Hz.

    Looks like 44.1k with this mclk is not supported in the driver as it is using lookup table. 

    elixir.bootlin.com/.../tlv320adc3xxx.c

  • Here are the results with 48000.

    root@am62p-lohr:~# arecord -D hw:0,3 -f S16_LE -c 2 -r 48000 -v /tmp/test.wav
    Hardware PCM card 0 'Lohr-Audio' device 3 subdevice 0
    Its setup is:
      stream       : CAPTURE
      access       : RW_INTERLEAVED
      format       : S16_LE
      subformat    : STD
      channels     : 2
      rate         : 48000
      exact rate   : 48000 (48000/1)
      msbits       : 16
      buffer_size  : 24000
      period_size  : 6000
      period_time  : 125000
      tstamp_mode  : ENABLE
      tstamp_type  : MONOTONIC
      period_step  : 1
      avail_min    : 6000
      period_event : 0
      start_threshold  : 1
      stop_threshold   : 24000
      silence_threshold: 0
      silence_size : 0
      boundary     : 6755399441055744000
      appl_ptr     : 0
      hw_ptr       : 0
    Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2272: read error: Input/output error
    
    [ 1923.353658] tlv320adc3xxx-codec 2-0019: ASoC: error at soc_component_write_no_lock on tlv320adc3xxx-codec.2-0019 for register: [0x00000005] -121
    [ 1923.366814] tlv320adc3xxx-codec 2-0019: ASoC: error at soc_component_write_no_lock on tlv320adc3xxx-codec.2-0019 for register: [0x00000006] -121
    [ 1923.380123] tlv320adc3xxx-codec 2-0019: ASoC: error at soc_component_write_no_lock on tlv320adc3xxx-codec.2-0019 for register: [0x00000008] -121
    [ 1923.393240] tlv320adc3xxx-codec 2-0019: ASoC: error at soc_component_write_no_lock on tlv320adc3xxx-codec.2-0019 for register: [0x00000007] -121
    [ 1923.406373] tlv320adc3xxx-codec 2-0019: ASoC: error at soc_component_write_no_lock on tlv320adc3xxx-codec.2-0019 for register: [0x00000004] -121
    [ 1923.419566] tlv320adc3xxx-codec 2-0019: ASoC: error at snd_soc_component_update_bits on tlv320adc3xxx-codec.2-0019 for register: [0x00000012] -121
    [ 1923.432862] tlv320adc3xxx-codec 2-0019: ASoC: error at snd_soc_component_update_bits on tlv320adc3xxx-codec.2-0019 for register: [0x00000013] -121
    [ 1923.446179] tlv320adc3xxx-codec 2-0019: ASoC: error at snd_soc_component_update_bits on tlv320adc3xxx-codec.2-0019 for register: [0x0000001e] -121
    
    


    att.

  • ok, now the previous error is gone and these errors look like are i2c error thrown while configuring the divisors for clocks in hw_params. Some i2c related issue, please check if the i2cdump is still working for the device.

  • here is the I2cdump

    ~# i2cdump -f -y 2 0x19
    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: 00 00 20 00 03 11 03 13 88 00 00 00 00 00 00 00    .. .?????.......
    10: 00 00 07 02 80 80 04 00 00 00 01 00 00 02 08 00    ..?????...?..??.
    20: 00 10 00 00 00 00 02 00 00 00 00 00 00 00 00 00    .?....?.........
    30: 00 00 00 00 00 12 02 02 00 00 00 44 00 01 00 00    .....???...D.?..
    40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    50: 00 00 88 00 00 00 00 00 7f 00 00 00 00 00 00 00    ..?.....?.......
    60: 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    

  • Could you please try keeping any one of the changes for the reset and try once again ?

    option1: reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_LOW>;

    or 

    option2: driver changes to handle reset

  • Option 1 reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_LOW>;  and driver unchanged

    ~# i2cdump -f -y 2 0x19
    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
    
    

    Option2: driver changes to handle reset and reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_LOW>; 

    //gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
    gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    usleep_range(2000, 100000); /* Requirement: > 10 ns (datasheet p13) */
    //gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);


    root@am62p-lohr:~# i2cdump -f -y 2 0x19
    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: 00 00 20 00 00 11 04 00 00 00 00 00 00 00 00 00    .. ..??.........
    10: 00 00 01 01 80 80 04 00 00 00 01 00 00 02 01 00    ..?????...?..??.
    20: 00 10 00 00 00 00 02 00 00 00 00 00 00 00 00 00    .?....?.........
    30: 00 00 00 00 00 12 02 02 00 00 00 44 00 01 00 00    .....???...D.?..
    40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    50: 00 00 88 00 00 00 00 00 7f 00 00 00 00 00 00 00    ..?.....?.......
    60: 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    

    ~# arecord -D hw:0,3 -f S16_LE -c 2 -r 48000 -v /tmp/test.wav
    arecord: main:850: audio open error: No such file or directory


    Option3:  driver changes to handle reset and reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;

    //gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
    gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    usleep_range(2000, 100000); /* Requirement: > 10 ns (datasheet p13) */
    //gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);

     

    root@am62p-lohr:~# i2cdump -f -y 2 0x19
    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
    


    Option4:  driver unchanged reset-gpios = <&main_gpio0 47 GPIO_ACTIVE_HIGH>;

    gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);
    //gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    usleep_range(2000, 100000); /* Requirement: > 10 ns (datasheet p13) */
    gpiod_set_value_cansleep(adc3xxx->rst_pin, 0);
    //gpiod_set_value_cansleep(adc3xxx->rst_pin, 1);


    root@am62p-lohr:~# i2cdump -f -y 2 0x19
    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: 00 00 20 00 00 11 04 00 00 00 00 00 00 00 00 00    .. ..??.........
    10: 00 00 01 01 80 80 04 00 00 00 01 00 00 02 01 00    ..?????...?..??.
    20: 00 10 00 00 00 00 02 00 00 00 00 00 00 00 00 00    .?....?.........
    30: 00 00 00 00 00 12 02 02 00 00 00 44 00 01 00 00    .....???...D.?..
    40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    50: 00 00 88 00 00 00 00 00 7f 00 00 00 00 00 00 00    ..?.....?.......
    60: 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    

    root@am62p-lohr:~# arecord -D hw:0,3 -f S16_LE -c 2 -r 48000 -v /tmp/test.wav
    Hardware PCM card 0 'Lohr-Audio' device 3 subdevice 0
    Its setup is:
      stream       : CAPTURE
      access       : RW_INTERLEAVED
      format       : S16_LE
      subformat    : STD
      channels     : 2
      rate         : 48000
      exact rate   : 48000 (48000/1)
      msbits       : 16
      buffer_size  : 24000
      period_size  : 6000
      period_time  : 125000
      tstamp_mode  : ENABLE
      tstamp_type  : MONOTONIC
      period_step  : 1
      avail_min    : 6000
      period_event : 0
      start_threshold  : 1
      stop_threshold   : 24000
      silence_threshold: 0
      silence_size : 0
      boundary     : 6755399441055744000
      appl_ptr     : 0
      hw_ptr       : 0
    Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2272: read error: Input/output error

    Att.

  • Option1: fails - looks to me like it is expected 

    Option2: sound card registration failed ? Not sure what is going on here. 

    Option3: fails - looks to me like it is expected

    Option4: Is the kernel error still i2c error or something else ? please share the kernel logs for this IO error 

  • option4 logs

    root@am62p-lohr:~# arecord -D hw:0,3 -f S16_LE -c 2 -r 48000 -v /tmp/test.wav
    Hardware PCM card 0 'Lohr-Audio' device 3 subdevice 0
    Its setup is:
    stream : CAPTURE
    access : RW_INTERLEAVED
    format : S16_LE
    subformat : STD
    channels : 2
    rate : 48000
    exact rate : 48000 (48000/1)
    msbits : 16
    buffer_size : 24000
    period_size : 6000
    period_time : 125000
    tstamp_mode : ENABLE
    tstamp_type : MONOTONIC
    period_step : 1
    avail_min : 6000
    period_event : 0
    start_threshold : 1
    stop_threshold : 24000
    silence_threshold: 0
    silence_size : 0
    boundary : 6755399441055744000
    appl_ptr : 0
    hw_ptr : 0
    Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2272: read error: Input/output error
    [ 110.895608] davinci-mcasp 2b20000.audio-controller: startup: Opening Capture stream
    [ 110.895633] davinci-mcasp 2b20000.audio-controller: startup: Max channels constrained to 2 (Serializers: 1, TDM Slots: 2)
    [ 110.896233] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=24576000 Hz, dir=OUT
    [ 110.896240] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)
    [ 110.898979] davinci-mcasp 2b20000.audio-controller: hw_params: Starting setup for 48000Hz, 2 channels, format 0x2
    [ 110.898988] davinci-mcasp 2b20000.audio-controller: hw_params: Detected word_length = 16
    [ 110.898994] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Raw fmt mask 0x1001
    [ 110.899000] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: Format -> I2S
    [ 110.899006] davinci-mcasp 2b20000.audio-controller: mcasp_set_dai_fmt: McASP is Provider (BCLK/FS Master)
    [ 110.899015] davinci-mcasp 2b20000.audio-controller: hw_params: Calculating BCLK (rate:48000 * sbits:16 * slots:2) = 1536000 Hz
    [ 110.899022] davinci-mcasp 2b20000.audio-controller: calc_clk_div: sysclk=24576000, target_bclk=1536000
    [ 110.899029] davinci-mcasp 2b20000.audio-controller: calc_clk_div: Final BCLK div=16, error=0 PPM
    [ 110.899035] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting BCLK divider to 16 (reg value: 15, explicit: 0)
    [ 110.899043] davinci-mcasp 2b20000.audio-controller: set_clkdiv: Setting MCLK (AUXCLK) divider to 1 (reg value: 0)
    [ 110.899049] davinci-mcasp 2b20000.audio-controller: hw_param RX: channels=2, period_words=12000, slots=2
    [ 110.899056] davinci-mcasp 2b20000.audio-controller: hw_param: needed serializers = 1
    [ 110.899065] davinci-mcasp 2b20000.audio-controller: hw_param: Configuring AXR3 as RX
    [ 110.899072] davinci-mcasp 2b20000.audio-controller: hw_param: FIFO active! NUMDMA=1, NUMEVT=32, DMA maxburst=32
    [ 110.899127] davinci-mcasp 2b20000.audio-controller: hw_params: Entering I2S mode setup
    [ 110.899196] davinci-mcasp 2b20000.audio-controller: i2s_hw_param RX: channels=2, total_slots=2
    [ 110.899204] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: TDM mask calculated = 0x3 (serializers needed: 1)
    [ 110.899210] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: Configuring RX TDM=0x3, FSRMOD=2 slots
    [ 110.899217] davinci-mcasp 2b20000.audio-controller: i2s_hw_param: Synchronous mode - forcing TX FSXMOD to 2
    [ 110.899223] davinci-mcasp 2b20000.audio-controller: config_ch_size: sample_width=16, slot_width=16, mask=0xffff
    [ 110.899229] davinci-mcasp 2b20000.audio-controller: config_ch_size: Format I2S/LEFT_J -> TX rotate=4, RX rotate=0
    [ 110.899236] davinci-mcasp 2b20000.audio-controller: config_ch_size: Setting TX/RX SSZ=0x7 (fmt field)
    [ 110.899242] davinci-mcasp 2b20000.audio-controller: hw_params: Setup completed successfully
    [ 110.916283] davinci-mcasp 2b20000.audio-controller: McASP RX: Starting reception...
    [ 110.916306] davinci-mcasp 2b20000.audio-controller: McASP RX: Enabling FIFO (base 0x1000)
    [ 110.916314] davinci-mcasp 2b20000.audio-controller: McASP RX: Releasing clock resets
    [ 110.916319] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x2 to reg 0x60
    [ 110.916326] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916332] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x1 to reg 0x60
    [ 110.916338] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916344] davinci-mcasp 2b20000.audio-controller: McASP RX: Synchronous mode - starting TX clocks for RX
    [ 110.916349] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x200 to reg 0xa0
    [ 110.916356] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916361] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x100 to reg 0xa0
    [ 110.916367] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916374] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x4 to reg 0x60
    [ 110.916380] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916385] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x8 to reg 0x60
    [ 110.916391] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916396] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x10 to reg 0x60
    [ 110.916402] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 110.916408] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL: Writing 0x1000 to reg 0xa0
    [ 110.916414] davinci-mcasp 2b20000.audio-controller: McASP GBLCTL synchronized after 0 iterations
    [ 111.633971] davinci-mcasp 2b20000.audio-controller: set_sysclk: id=0, freq=0 Hz, dir=OUT
    [ 111.633996] davinci-mcasp 2b20000.audio-controller: set_sysclk: Configuring HCLK as Output (AUXCLK -> Pin)

  •  Hi   I recommend to keep option 4 and continue debugging.

     request you to check IO related error

  • Hi Sergio, Niranjan,

    I am going to schedule a call for Monday morning (9:00AM Dallas Time) to resolve this quickly. The playback with this setup seems to be functional, its only record is having issues. 

    Best Regards

    Suren

  • Perfect.

    Best regards