We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

DTS fixed-clock and devm_clk_get



  • I am working on getting an SGTL5000 codec working with an Omega2s. I have the driver compiling and inserted into the kernel but I can't get devm_clk_get to find the clocks. Here's the particular block from sgtl5000.c

    	sgtl5000->mclk = devm_clk_get(&client->dev, NULL);
    	if (IS_ERR(sgtl5000->mclk)) {
    		ret = PTR_ERR(sgtl5000->mclk);
    		dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
    		/* Defer the probe to see if the clk will be provided later */
    		if (ret == -ENOENT)
    			ret = -EPROBE_DEFER;
    		goto disable_regs;
    	}
    
    	ret = clk_prepare_enable(sgtl5000->mclk);
    	if (ret) {
    		dev_err(&client->dev, "Error enabling clock %d\n", ret);
    		goto disable_regs;
    	}
    
    

    And the accompanying output from dmesg:
    [ 1199.266056] sgtl5000 0-000a: Failed to get mclock: -2

    Here are the modifications I made to OMEGA2.dtsi, I know they are being loaded because my pinmux is being updated properly and I have used dtc to make sure the blob is correct.

    {
     	/*... other definitions omitted for brevity ... */
    	refclk: refclk@0 {
    		#clock-cells = <0>;
    		compatible = "fixed-clock";
    		clock-frequency = <12000000>; // 12 MHz
    	};
    );
    
    &i2c {
    	status = "okay";
    
    	sgtl5000: sgtl5000@a {
    		#sound-dai-cells = <0>;
    		compatible = "fsl,sgtl5000";
    		reg = <0xa>;
    		clocks = <&refclk>;
    	};
    };
    

    Is there something else I have to do to make fixed-clock work? I looked through kernel_makeconfig but didn't see anything obvious.



  • Looks like the fixed-clock driver is provided by CONFIG_COMMON_CLK which isn't available in the mt76x8 config. I'll try to figure out another solution.



  • I spent some time implementing refclk in my platform driver, but then I found that sound/soc/ralink/ralink-i2s.c seems to have all that done already. So it seems like my ultimate solution is just to comment out everything having to do with clocks and hardcode the expected 12 MHz frequency.



Looks like your connection to Community was lost, please wait while we try to reconnect.