cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157 I2C/I2S MCLK rate is 0. MAX9860

Makandra
Associate II

Hello.

 

I am struggling to get my codec to work. I am using MAX9860 codec.

The MAX9860 driver fails during probing, since the MCLK rate is registered as 0.

I get the following error:

[ 15.465445] max9860 1-0020: Bad mclk 0Hz (needs 10MHz - 60MHz)
[ 15.481832] max9860: probe of 1-0020 failed with error -22

 

This is the piece of the driver that causes the error:

/*
	 * mclk has to be in the 10MHz to 60MHz range.
	 * psclk is used to scale mclk into pclk so that
	 * pclk is in the 10MHz to 20MHz range.
	 */
	max9860->mclk_handle = clk_get(dev, "MCLK");

	if (IS_ERR(max9860->mclk_handle)) {
		ret = PTR_ERR(max9860->mclk_handle);
		dev_err_probe(dev, ret, "Failed to get MCLK\n");
		goto err_regulator;
	}

	mclk_rate = clk_get_rate(max9860->mclk_handle);
	clk_put(max9860->mclk_handle);

	if (mclk_rate > 60000000 || mclk_rate < 10000000) {
		dev_err(dev, "Bad mclk %luHz (needs 10MHz - 60MHz)\n",
			mclk_rate);
		ret = -EINVAL;
		goto err_regulator;
	}

 

This is my dts:

/ {
	sound {
		compatible = "audio-graph-card";
		label = "max9860-hifi";
		
		routing =
			"Playback", "MCLK",
			"Capture", "MCLK";

		dais = <&i2s1_port>;
		status = "okay";
	};
};


&i2c1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c1_pins_mx>;
	pinctrl-1 = <&i2c1_sleep_pins_mx>;
	status = "okay";
	
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	clock-frequency = <100000>;
	/delete-property/ dmas;
	/delete-property/ dma-names;
	
	max9860: max9860@20 {
		compatible = "maxim,max9860";
		reg = <0x20>;

		AVDD-supply = <&v1v8>;
		DVDD-supply = <&v1v8>;
		DVDDIO-supply = <&v3v3>;

		clocks = <&i2s1>;
		clock-names = "MCLK";
		
		codec_port: port {
            codec_endpoint: endpoint {
                remote-endpoint = <&i2s1_endpoint>;
            };
        };
	};
	
};

&i2s1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2s1_pins_mx &i2s1_pins_z_mx>;
	pinctrl-1 = <&i2s1_sleep_pins_mx &i2s1_sleep_pins_z_mx>;
	status = "okay";
	
	clocks = <&rcc SPI1>, <&rcc SPI1_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
	clock-names = "pclk", "i2sclk", "x8k", "x11k";
	#sound-dai-cells = <1>;
	
	#clock-cells = <0>; /* Set I2S1 as master clock provider */
		
	i2s1_port: port {
	
		#address-cells = <1>;
        #size-cells = <0>;
	
		i2s1_endpoint: endpoint {
			remote-endpoint = <&codec_endpoint>;
			format = "i2s";
			mclk-fs = <256>;
		};
	};

};

 

The clock seems to be properly created, but its rate is 0.

root@stm32mp15-xx:~# cat /sys/kernel/debug/clk/clk_summary | grep mclk
spi1_mclk 0 0 0 0 0 0 50000 ? deviceless no_connection_id

 

Does anyone know where to look next? Is it most likely a device-tree issue or is it a compatibility issue between ST i2s and the codec driver?

0 REPLIES 0