[alsa-devel] Using simple-audio-card with imx6sl-evk
Hi,
I am trying to get imx6sl-evk to work with simple-audio-card with the following changes:
arch/arm/boot/dts/imx6sl-evk.dts | 52 ++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-)
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts index fda4932..24b9849 100644 --- a/arch/arm/boot/dts/imx6sl-evk.dts +++ b/arch/arm/boot/dts/imx6sl-evk.dts @@ -10,6 +10,7 @@
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> +#include <dt-bindings/sound/fsl-imx-audmux.h> #include "imx6sl.dtsi"
/ { @@ -92,19 +93,25 @@ };
sound { - compatible = "fsl,imx6sl-evk-wm8962", "fsl,imx-audio-wm8962"; - model = "wm8962-audio"; - ssi-controller = <&ssi2>; - audio-codec = <&codec>; - audio-routing = + compatible = "simple-audio-card"; + simple-audio-card,name = "wm8962-audio"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&dailink_master>; + simple-audio-card,frame-master = <&dailink_master>; + simple-audio-card,widgets = + "Headphone", "Headphone Jack"; + simple-audio-card,routing = "Headphone Jack", "HPOUTL", - "Headphone Jack", "HPOUTR", - "Ext Spk", "SPKOUTL", - "Ext Spk", "SPKOUTR", - "AMIC", "MICBIAS", - "IN3R", "AMIC"; - mux-int-port = <2>; - mux-ext-port = <3>; + "Headphone Jack", "HPOUTR"; + + simple-audio-card,cpu { + sound-dai = <&ssi2>; + }; + + dailink_master: simple-audio-card,codec { + sound-dai = <&codec>; + }; }; };
@@ -112,6 +119,26 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_audmux3>; status = "okay"; + + ssi2 { + fsl,audmux-port = <1>; + fsl,port-config = < + (IMX_AUDMUX_V2_PTCR_SYN | + IMX_AUDMUX_V2_PTCR_TFSDIR | + IMX_AUDMUX_V2_PTCR_TFSEL(2) | + IMX_AUDMUX_V2_PTCR_TCLKDIR | + IMX_AUDMUX_V2_PTCR_TCSEL(2)) + IMX_AUDMUX_V2_PDCR_RXDSEL(2) + >; + }; + + audmuxpins3 { + fsl,audmux-port = <2>; + fsl,port-config = < + IMX_AUDMUX_V2_PTCR_SYN + IMX_AUDMUX_V2_PDCR_RXDSEL(1) + >; + }; };
&ecspi1 { @@ -255,6 +282,7 @@ compatible = "wlf,wm8962"; reg = <0x1a>; clocks = <&clks IMX6SL_CLK_EXTERN_AUDIO>; + #sound-dai-cells = <0>; DCVDD-supply = <&vgen3_reg>; DBVDD-supply = <®_aud3v>; AVDD-supply = <&vgen3_reg>;
Then I get the following probe error:
[ 2.030249] input: WM8962 Beep Generator as /devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1/1-001a/input/input1 [ 2.042388] wm8962 1-001a: simple-card: set_sysclk error [ 2.047805] asoc-simple-card sound: ASoC: failed to init 202c000.ssi-wm8962: -22 [ 2.055242] asoc-simple-card sound: ASoC: failed to instantiate card -22 [ 2.065117] asoc-simple-card: probe of sound failed with error -22
I compared how imx-wm8962 calls snd_soc_dai_set_sysclk and did the same on simple card (quick hack):
--- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -134,7 +134,7 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, }
if (set->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0); + ret = snd_soc_dai_set_sysclk(dai, 1, set->sysclk, 0); if (ret && ret != -ENOTSUPP) { dev_err(dai->dev, "simple-card: set_sysclk error\n"); goto err;
,and this allows the probe to succeed.
When I try to play I get:
root@freescale /home$ aplay clarinet.wav [ 16.424340] wm8962 1-001a: Unsupported sysclk ratio 680 Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
and the track is played with the wrong frequency and wrong sysclk ratio.
Any suggestions as to how to use simple-card on this board?
Thanks,
Fabio Estevam
On Thu, Mar 05, 2015 at 12:07:23AM -0300, Fabio Estevam wrote:
When I try to play I get:
root@freescale /home$ aplay clarinet.wav [ 16.424340] wm8962 1-001a: Unsupported sysclk ratio 680 Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
and the track is played with the wrong frequency and wrong sysclk ratio.
Any suggestions as to how to use simple-card on this board?
The problem is that simple-card doesn't understand anything with a more complex arrangement than a single dumb clock. Moving the clocks over to the clock API and then configuring them that way is probably the way forwards here.
participants (2)
-
Fabio Estevam
-
Mark Brown