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.

TLV320ADC5140: Interfacing TLV320ADC5140 evk board to Renesas-RZG2H Hihope Board using Linux I2S

Part Number: TLV320ADC5140


Hi Ti Teams,
We are interfacing the ti tlv320adc5140 evk board to renesas rzg2h hihope board.

I have Codec TLV320ADC5140 EVK board, where I can access I2C and I2S lines, I2C is working.

please find the below Audio codec connection details.

RZ/G2H CPU Pin AG34 {SSI_SCK78} is connected to TLV320ADC5140 pin BCLK.

RZ/G2H CPU Pin AG33 {SSI_WS78} is connected to TLV320ADC5140 pin FSYNC.

RZ/G2H CPU Pin AG30 {SSI_SDATA7} is connected to TLV320ADC5140 pin DOUT1.

 Below is  the dtsi configuration  entries we . We enable the tlv321adcx140.c in the kernel driver

We made below dtsi enties for TLV320adc5140 board in hihope-comman.dtsi file
      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 */
        };

snd_rzg2h: sound {

        compatible = "simple-audio-card";
        simple-audio-card,name = "Renesas Rzg2h";
        #sound-dai-cells = <0>;
        simple-audio-card,dai-link@0 {
                format = "i2s";
                bitclock-master = <&sound0_master>;
                frame-master = <&sound0_master>;
                sound0_master: cpu{
                        sound-dai = <&rcar_sound>;
                        clocks = <&clk_mcasp0>;
                        dai-tdm-slot-num = <4>;
                        dai-tdm-slot-width = <32>;
                        dai-tdm-slot-tx-mask = <1 1 1 1>;
                        dai-tdm-slot-rx-mask = <1 1 1 1>;
                };
                codec {
                        sound-dai = <&tlv320adc5140>;
                };
        };
};
   sound_card {
        compatible = "audio-graph-card";
        label = "rcar-sound";
        dais = <&rsnd_port2>;
    };
&i2c0 {
        pinctrl-0 = <&i2c0_pins>;
        pinctrl-names = "default";
        status = "okay";
        clock-frequency = <100000>;
        #address-cells = <1>;
        #size-cells = <0>;
        pinctrl-0 = <&i2c0_pins>;
        pinctrl-names = "default";
        status = "okay";
        clock-frequency = <100000>;
        tlv320adc5140: tlv320adc5140@4c {
                compatible = "ti,tlv320adc5140";
                #sound-dai-cells = <0>;
                reg = <0x4c>;
                /* Digital Mics */
                ti,use-internal-areg; /*Regulator with AVDD at 3.3V.  If not defined then the internal regulator is enabled */
                ti,mic-bias-source = <0>; /* 0 - Mic bias is set to VREF */
                ti,pdm-edge-select = <1 1 1 1>;
                ti,gpio-config = <0 0>;
                ti,gpi-config = <4 5 6 7>;
                ti,gpo-config-1 = <4 1>;
                ti,gpo-config-2 = <4 1>;
                ti,gpo-config-3 = <4 1>;
                ti,gpo-config-4 = <4 1>;
                ti,slot-mapping = <0 1 2 3>;
                ti,asi-tx-driver = <0>;
                reset-gpios = <&gpio6 11 GPIO_ACTIVE_HIGH>;
        };
        port@0 {
                tlv320adc5140_endpoint: endpoint {
                        remote-endpoint = <&rsnd_endpoint2>;
                };
        };
      sound_pins2: sound {
                groups = "ssi78_ctrl", "ssi7_data";/* G6_17, G6_18, G6_19*/
                function = "ssi";
        };
};
&rcar_sound {
        pinctrl-0 = < &sound_pins2>;
        pinctrl-names = "default";
        status = "okay";
        /* Single DAI */
        #sound-dai-cells = <0>;
        /* audio_clkout */
        #clock-cells = <0>;
        clock-frequency = <24576000>;
        ports {
                rsnd_port2: port {
                        rsnd_endpoint2: endpoint {
                                remote-endpoint = <&tlv320adc5140_endpoint>;
                                dai-format = "i2s";
                                bitclock-master = <&rsnd_endpoint2>;
                                frame-master = <&rsnd_endpoint2>;
                                /* [CAPTURE] */
                                capture = <&ssi7>;
                        };
                };
        };
};
hihope-common.dtsi is the dtsi file we  use for our board, .
We are getting i2c detection and having issue with driver initialization.
Please find the attached Image file which show the dmesgs.
Could you please guide us what are we missing here.
 
Thanks and regards,
Nagaraja
// SPDX-License-Identifier: GPL-2.0
/*
 * Device Tree Source for the HiHope RZ/G2H Rev.4.0 and
 * HiHope RZ/G2[MN] Rev.[2.0/3.0/4.0] main board common parts
 *
 * Copyright (C) 2019 Renesas Electronics Corp.
 */

#include <dt-bindings/gpio/gpio.h>

/ {
	aliases {
		serial0 = &scif2;                 //GP5_11 GP5_10 serial debug port
		serial1 = &hscif0;                //GP5_13 GP5_14 
		serial2 = &hscif1;                //GP5_5 GP5_6
		serial3 = &scif0;                 //GP5_1 GP5_2
                serial5 = &scif5;                 //GP5_19 GP5_21
	};

	chosen {
		bootargs = "ignore_loglevel";
		stdout-path = "serial0:115200n8";
	};

	hdmi0-out {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi0_con: endpoint {
				remote-endpoint = <&rcar_dw_hdmi0_out>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		led1 {
			gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
		};

		led2 {
			gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>;
		};

		led3 {
			gpios = <&gpio0  0 GPIO_ACTIVE_HIGH>;
		};

		led4 {
			gpios = <&gpio6 11 GPIO_ACTIVE_HIGH>;
		};
	};

	reg_1p8v: regulator0 {
		compatible = "regulator-fixed";
		regulator-name = "fixed-1.8V";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_3p3v: regulator1 {
		compatible = "regulator-fixed";
		regulator-name = "fixed-3.3V";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		regulator-always-on;
	};

	sound_card: sound {
		compatible = "audio-graph-card";

		label = "rcar-sound";

		dais = <&rsnd_port0	/* HDMI Audio */
			&rsnd_port1>;	/* External PCM5102A Codec */
	};

	vbus0_usb2: regulator-vbus0-usb2 {
		compatible = "regulator-fixed";

		regulator-name = "USB20_VBUS0";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;

		gpio = <&gpio6 16 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	vccq_sdhi0: regulator-vccq-sdhi0 {
		compatible = "regulator-gpio";

		regulator-name = "SDHI0 VccQ";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;

		gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>;
		gpios-states = <1>;
		states = <3300000 1
			  1800000 0>;
	};

	x302_clk: x302-clock {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <33000000>;
	};

	x304_clk: x304-clock {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <25000000>;
	};

	vspm_if {
		compatible = "renesas,vspm_if";
	};

	pcm5102a: pcm5102a {
		compatible = "ti,pcm5102a";
		#sound-dai-cells = <0>;

		port {
			pcm5102a_endpoint: endpoint {
				remote-endpoint = <&rsnd_endpoint1>;
			};
		};
	};
};

&audio_clk_a {
	clock-frequency = <22579200>;
};

&du {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&extal_clk {
	clock-frequency = <16666666>;
};

&extalr_clk {
	clock-frequency = <32768>;
};

&gpio6 {
	usb1-reset {
		gpio-hog;
		gpios = <10 GPIO_ACTIVE_LOW>;
		output-low;
		line-name = "usb1-reset";
	};
};

&hdmi0 {
	status = "okay";

	ports {
		port@1 {
			reg = <1>;
			rcar_dw_hdmi0_out: endpoint {
				remote-endpoint = <&hdmi0_con>;
			};
		};
		port@2 {
			reg = <2>;
			dw_hdmi0_snd_in: endpoint {
				remote-endpoint = <&rsnd_endpoint>;
			};
		};
	};
};
&hscif0 {
	pinctrl-0 = <&hscif0_pins>;
	pinctrl-names = "default";

	uart-has-rtscts;
	status = "okay";
};
#if 0
&scif1 {
	pinctrl-0 = <&scif1_pins>;
	pinctrl-names = "default";

	status = "okay";
};

#endif 
&scif0 {
	pinctrl-0 = <&scif0_pins>;
	pinctrl-names = "default";

	status = "okay";
};

&hscif1 {
	pinctrl-0 = <&hscif1_pins>;
	pinctrl-names = "default";

	uart-has-rtscts;
	status = "okay";
};

&scif5 {
	pinctrl-0 = <&scif5_pins>;
	pinctrl-names = "default";

	status = "okay";
};

&hsusb {
	dr_mode = "otg";
	status = "okay";
};

&i2c4 {
	clock-frequency = <400000>;
	status = "okay";

	versaclock5: clock-generator@6a {
		compatible = "idt,5p49v5923";
		reg = <0x6a>;
		#clock-cells = <1>;
		clocks = <&x304_clk>;
		clock-names = "xin";
	};
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&pcie_bus_clk {
	clock-frequency = <100000000>;
};

&pfc {
	pinctrl-0 = <&scif_clk_pins>;
	pinctrl-names = "default";

	hscif0_pins: hscif0 {
		groups = "hscif0_data", "hscif0_ctrl";
		function = "hscif0";
	};
	scif1_pins: scif1 {
		groups = "scif1_data_a";
		function = "scif1";
	};

	scif2_pins: scif2 {
		groups = "scif2_data_a";
		function = "scif2";
	};

	scif_clk_pins: scif_clk {
		groups = "scif_clk_a";
		function = "scif_clk";
	};

	hscif1_pins: hscif1 {
		groups = "hscif1_data_a", "hscif1_ctrl_a";
		function = "hscif1";
	};

	scif0_pins: scif0 {
		groups = "scif0_data";
		function = "scif0";
	};

	scif5_pins: scif5 {
		groups = "scif5_data_a";
		function = "scif5";
	};

	sdhi0_pins: sd0 {
		groups = "sdhi0_data4", "sdhi0_ctrl";
		function = "sdhi0";
		power-source = <3300>;
	};

	sdhi0_pins_uhs: sd0_uhs {
		groups = "sdhi0_data4", "sdhi0_ctrl";
		function = "sdhi0";
		power-source = <1800>;
	};

	sdhi2_pins: sd2 {
		groups = "sdhi2_data4", "sdhi2_ctrl";
		function = "sdhi2";
		power-source = <1800>;
	};

	sdhi3_pins: sd3 {
		groups = "sdhi3_data8", "sdhi3_ctrl", "sdhi3_ds";
		function = "sdhi3";
		power-source = <1800>;
	};

	sound_clk_pins: sound_clk {
		groups = "audio_clk_a_a";
		function = "audio_clk";
	};

	sound_pins: sound {
		groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
		function = "ssi";
	};

	usb0_pins: usb0 {
		groups = "usb0";
		function = "usb0";
	};

	usb1_pins: usb1 {
		mux {
			groups = "usb1";
			function = "usb1";
		};

		ovc {
			pins = "GP_6_27";
			bias-pull-up;
		};

		pwen {
			pins = "GP_6_26";
		};
	};

	usb30_pins: usb30 {
		groups = "usb30";
		function = "usb30";
	};
};

&rcar_sound {
	pinctrl-0 = <&sound_clk_pins &sound_pins>;
	pinctrl-names = "default";

	status = "okay";

	/* Single DAI */
	#sound-dai-cells = <0>;

	ports {
		rsnd_port0: port@0 {
			rsnd_endpoint: endpoint {
				remote-endpoint = <&dw_hdmi0_snd_in>;


				dai-format = "i2s";
				bitclock-master = <&rsnd_endpoint>;
				frame-master = <&rsnd_endpoint>;

				playback = <&ssi2>;
			};
		};

		rsnd_port1: port@1 {
			rsnd_endpoint1: endpoint {
				remote-endpoint = <&pcm5102a_endpoint>;

				dai-format = "i2s";
				bitclock-master = <&rsnd_endpoint1>;
				frame-master = <&rsnd_endpoint1>;

				playback = <&ssi1 &src1 &dvc0>;
			};
		};
	};
};

&ssi1 {
	shared-pin;
};

&rwdt {
	timeout-sec = <60>;
	status = "okay";
};

&scif2 {
	pinctrl-0 = <&scif2_pins>;
	pinctrl-names = "default";

	status = "okay";
};

&scif_clk {
	clock-frequency = <14745600>;
};

&sdhi0 {
	pinctrl-0 = <&sdhi0_pins>;
	pinctrl-1 = <&sdhi0_pins_uhs>;
	pinctrl-names = "default", "state_uhs";

	vmmc-supply = <&reg_3p3v>;
	vqmmc-supply = <&vccq_sdhi0>;
	cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
	bus-width = <4>;
	sd-uhs-sdr50;
	sd-uhs-sdr104;
	status = "okay";
};

&sdhi2 {
	status = "okay";
	pinctrl-0 = <&sdhi2_pins>;
	pinctrl-names = "default";

	vmmc-supply = <&wlan_en_reg>;
	bus-width = <4>;
	non-removable;
	cap-power-off-card;
	keep-power-in-suspend;

	#address-cells = <1>;
	#size-cells = <0>;
	wlcore: wlcore@2 {
		compatible = "ti,wl1837";
		reg = <2>;
		interrupt-parent = <&gpio2>;
		interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
	};
};

&sdhi3 {
	pinctrl-0 = <&sdhi3_pins>;
	pinctrl-1 = <&sdhi3_pins>;
	pinctrl-names = "default", "state_uhs";

	vmmc-supply = <&reg_3p3v>;
	vqmmc-supply = <&reg_1p8v>;
	bus-width = <8>;
	mmc-hs200-1_8v;
	mmc-hs400-1_8v;
	non-removable;
	fixed-emmc-driver-type = <1>;
	status = "okay";
};

&usb_extal_clk {
	clock-frequency = <50000000>;
};

&usb2_phy0 {
	pinctrl-0 = <&usb0_pins>;
	pinctrl-names = "default";

	vbus-supply = <&vbus0_usb2>;
	status = "okay";
};

&usb2_phy1 {
	pinctrl-0 = <&usb1_pins>;
	pinctrl-names = "default";

	status = "okay";
};

&usb3_peri0 {
	phys = <&usb3_phy0>;
	phy-names = "usb";

	companion = <&xhci0>;

	status = "okay";
};

&usb3_phy0 {
	status = "okay";
};

&usb3s0_clk {
	clock-frequency = <100000000>;
};

&xhci0 {
	pinctrl-0 = <&usb30_pins>;
	pinctrl-names = "default";

	status = "okay";
};

&cmt0 {
	status = "okay";
};

&cmt1 {
	status = "okay";
};

&tmu0 {
	status = "okay";
};

&tmu1 {
	status = "okay";
};

&tmu2 {
	status = "okay";
};

&tmu3 {
	status = "okay";
};

&tmu4 {
	status = "okay";
};