AnsweredAssumed Answered

IMX6(android6.0.1 kernel 4.1.15) + CS4344 codec

Question asked by unameping on May 14, 2020
Latest reply on May 15, 2020 by igorpadykov

Dear all:

              My codec is cs4344,imx6 is master,i use driver imx-si476x.c and tinyplay 1k there is no error,but bclk and lclk is  not output .

the code is:

 

&ssi1 {
fsl,mode = "i2s-master";
status = "okay";
};

 

imx-si476x.c :

static int imx_audmux_config(int slave, int master)
{
unsigned int ptcr, pdcr;
slave = slave - 1;
master = master - 1;

ptcr = IMX_AUDMUX_V2_PTCR_SYN |
IMX_AUDMUX_V2_PTCR_TFSDIR |
IMX_AUDMUX_V2_PTCR_TFSEL(slave) |
IMX_AUDMUX_V2_PTCR_TCLKDIR |
IMX_AUDMUX_V2_PTCR_TCSEL(slave);
pdcr = IMX_AUDMUX_V2_PDCR_RXDSEL(slave);
imx_audmux_v2_configure_port(master, ptcr, pdcr);

/*
* According to RM, RCLKDIR and SYN should not be changed at same time.
* So separate to two step for configuring this port.
*/
ptcr |= IMX_AUDMUX_V2_PTCR_RFSDIR |
IMX_AUDMUX_V2_PTCR_RFSEL(slave) |
IMX_AUDMUX_V2_PTCR_RCLKDIR |
IMX_AUDMUX_V2_PTCR_RCSEL(slave);
imx_audmux_v2_configure_port(master, ptcr, pdcr);

ptcr = IMX_AUDMUX_V2_PTCR_SYN;
pdcr = IMX_AUDMUX_V2_PDCR_RXDSEL(master);
imx_audmux_v2_configure_port(slave, ptcr, pdcr);

return 0;
}

static int imx_si476x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
u32 channels = params_channels(params);
u32 rate = params_rate(params);
u32 bclk = rate * channels * 32;
int ret = 0;

/* set cpu DAI configuration */
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
if (ret) {
dev_err(cpu_dai->dev, "failed to set dai fmt\n");
return ret;
}

ret = snd_soc_dai_set_tdm_slot(cpu_dai,
channels == 1 ? 1 : 0x3,
channels == 1 ? 1 : 0x3,
2, 32);
if (ret) {
dev_err(cpu_dai->dev, "failed to set dai tdm slot\n");
return ret;
}

ret = snd_soc_dai_set_sysclk(cpu_dai, 0, bclk, SND_SOC_CLOCK_OUT);
if (ret)
dev_err(cpu_dai->dev, "failed to set sysclk\n");

return ret;
}

 

when i using tinyplay 1k.wav file

There is no data output and no bclk no lclk but the mclk is well.

what can i do for this ?

 

Outcomes