Imx6q ssi i2s_master cannot generate bclk和LRCK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Imx6q ssi i2s_master cannot generate bclk和LRCK

419 Views
Wangyi
Contributor I

Hello,ALL:

For now ,in i.MX6Q,we are developing a codec driver with ssi as i2s_master codec as i2s_slave.We also use a external mclk with frequency of 18.432Mhz.Unfortunately,we cannot get any BLCK and LRCK. As below,we post some of our configuraion and source code.Can you tell me where our problem is or give us  some standard configuration of i2s_master,we will appricate your advice! Thank you!

codec: fm1288@60 {
compatible = "fortemedia,fm1288";
reg = <0x60>;
clocks = <&clks IMX6QDL_CLK_CKO>;
clock-names = "mclk";
VDD-supply = <&reg_audio>;
// wlf,shared-lrclk;
};

pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0
MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
>;
};

sound {
compatible = "fsl,imx6q-sabresd-fm1288",
"fsl,imx-audio-fm1288";
model = "fm1288-audio";
pinctrl-0 = <&pingctrl_fm1288>;
cpu-dai = <&ssi3>;
audio-codec = <&codec>;
asrc-controller = <&asrc>;
pa-shutdown-gpio = <&gpio5 8 1>;
hook-ctr-gpio = <&gpio5 9 0>;
hand-set-gpio = <&gpio5 12 0>;
mux-int-port = <7>;
mux-ext-port = <3>;

)

ssi3: ssi@02030000 {
#sound-dai-cells = <0>;
compatible = "fsl,imx6q-ssi",
"fsl,imx51-ssi";
reg = <0x02030000 0x4000>;
interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_SSI3_IPG>,
<&clks IMX6QDL_CLK_SSI3>;
clock-names = "ipg", "baud";
dmas = <&sdma 45 22 0>,
<&sdma 46 22 0>;
dma-names = "rx", "tx";
fsl,fifo-depth = <15>;
status = "disabled";
};

 

dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
SND_SOC_DAIFMT_CBS_CFS;

/* set cpu DAI configuration */
ret = snd_soc_dai_set_fmt(cpu_dai, dai_format);
if (ret) {
printk("failed to set cpu dai fmt: %d\n", ret);
return ret;
}
/* set i.MX active slot mask */
snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, 32);

ret = snd_soc_dai_set_tdm_slot(cpu_dai,
channels == 1 ? 0xfffffffe : 0xfffffffc,
channels == 1 ? 0xfffffffe : 0xfffffffc,
2, 32);
if (ret) {
printk("failed to set dai tdm slot \n");
return ret;
}

unsigned int bclk = 0;

bclk = rate * 32 * 2;

snd_soc_dai_set_sysclk(cpu_dai, 0, bclk, SND_SOC_CLOCK_OUT);

 

ret = of_property_read_u32(np, "mux-int-port", &int_port);
if (ret) {
dev_err(&pdev->dev, "mux-int-port missing or invalid\n");
goto fail;
}
ret = of_property_read_u32(np, "mux-ext-port", &ext_port);
if (ret) {
dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");
goto fail;
}


/*
* The port numbering in the hardware manual starts at 1, while
* the audmux API expects it starts at 0.
*/
int_port--;
ext_port--;
ret = imx_audmux_v2_configure_port(int_port,
IMX_AUDMUX_V2_PTCR_SYN |
IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
IMX_AUDMUX_V2_PTCR_TFSDIR |
IMX_AUDMUX_V2_PTCR_TCLKDIR,
IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));
if (ret) {
dev_err(&pdev->dev, "audmux internal port setup failed\n");
goto fail;
}
ret = imx_audmux_v2_configure_port(ext_port,
IMX_AUDMUX_V2_PTCR_SYN,
IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
if (ret) {
dev_err(&pdev->dev, "audmux external port setup failed\n");
goto fail;
}

 

 

 

0 Kudos
1 Reply

408 Views
igorpadykov
NXP Employee
NXP Employee

Hi yi

 

correct ssi clock configuration can be found checking sect.61.8.4 SSI Clocking

i.MX 6Dual/6Quad Applications Processor Reference Manual

and using baremetal ssi example :

https://github.com/RT-Thread/rt-thread/blob/master/bsp/imx6sx/iMX6_Platform_SDK/sdk/drivers/audio/sr...

 

Best regards
igor

0 Kudos