[alsa-devel] ASoC: pll/clkdiv issue with simple-card driver & WM8510/Atmel SSC

jukka.hynninen at vaisala.com jukka.hynninen at vaisala.com
Thu Sep 21 14:20:35 CEST 2017


Hi all,

We're looking into using the generic simple-card.c driver to glue together WM8510 codec driver and Atmel SSC platform driver without a specific machine code.

It turned out that the DTS configuration below fails to set the codec PLL and clkdiv values. In fact, wm8510_set_dai_pll() and wm8510_set_dai_clkdiv() get never called.

After adding following lines (omitting determination of myboard_* values) into wm8510_pcm_hw_params(), the audio starts working properly:

                           wm8510_set_dai_clkdiv(dai, WM8510_BCLKDIV, myboard_bclk_div);
                           wm8510_set_dai_pll(dai, 0, 0, 12000000, myboard_pll_out);
                           wm8510_set_dai_clkdiv(dai, WM8510_MCLKDIV, myboard_mclk_div);

What is actually the missing part? Did we forget to configure something in DTS?

Or is this a limitation of simple-card driver? If so, what would be the proper way to implement the missing features?

We're using Linux v4.14-rc1. The codec clock comes from a constantly running 12 MHz oscillator, and the codec is the clock and frame master.

DTS configuration is as follows:

	ahb {
		apb {
			ssc0: ssc at fff9c000 {
				#sound-dai-cells = <0>;
				status = "okay";
				dmas =	<&dma 1 AT91_DMA_CFG_PER_ID(5)>,
					<&dma 1 AT91_DMA_CFG_PER_ID(6)>;
				dma-names = "tx", "rx";
				pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
			};

			spi0: spi at fffa4000{
				status = "okay";
				cs-gpios = <&pioB 3 0>, <&pioA 28 0>, <0>, <0>;

				audio_codec: wm8510 at 1 {
					#sound-dai-cells = <0>;
					compatible = "wlf,wm8510";
					spi-max-frequency = <2000000>;
					reg = <1>;
				};
		};
	};

                           sound {
                                                      compatible = "simple-audio-card";
                                                      simple-audio-card,name = "wm8510_WID";
                                                      simple-audio-card,format = "i2s";
                                                      simple-audio-card,routing = "Mono Out", "MONOOUT";

                                                      simple-audio-card,codec {
                                                                                  sound-dai = <&audio_codec>;
                                                                                  system-clock-frequency = <12000000>;
                                                                                  bitclock-master;
                                                                                  frame-master;
                                                      };

                                                      simple-audio-card,cpu {
                                                                                  sound-dai = <&ssc0>;
                                                      };
                           };

-Jukka



More information about the Alsa-devel mailing list