IMX6(android6.0.1 kernel 4.1.15) + CS4344 codec

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

IMX6(android6.0.1 kernel 4.1.15) + CS4344 codec

1,145 Views
unameping
Contributor I

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 ?

Labels (3)
0 Kudos
5 Replies

1,014 Views
igorpadykov
NXP Employee
NXP Employee

Hi unameping

for finding optimal SSI, AUDMUX settings may be useful baremetal SDK

"1.1.0_iMX6_Platform_SDK.zip" found on

SMP Enable in IMX6 

Pay attention to Chapter 5 Configuring the AUDMUX Driver iMX6_Firmware_Guide.pdf

included in package.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,014 Views
unameping
Contributor I

Hi igorpadykov,

Thank you very much for your reply.

My codec is   connect to ssi1 and the ext_port is AUD5

pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDL_PAD_SD2_DAT0__AUD4_RXD 0x130b0
MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x130b0
MX6QDL_PAD_SD2_DAT2__AUD4_TXD 0x110b0
MX6QDL_PAD_SD2_DAT3__AUD4_TXC 0x130b0
>;
};

int_port = 1;

ext_port = 5;

imx_audmux_config(1,5)  //this is right ?

0 Kudos

1,014 Views
unameping
Contributor I

the ext_port is AUD4 

int_port = 1;

ext_port = 4;

imx_audmux_config(1,4)  //this is right ?

0 Kudos

1,014 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos

1,014 Views
unameping
Contributor I

HI,igorpadykov ,

can cpu ssi1 output bclk and lclk,how to set it?

0 Kudos