Hi ct3paul@163.com
We use i.mx6q sabrelite board as an example, main changes in Linux kernel (rel_imx_3.0.35_4.1.0):
arch/arm/mach-mx6board-mx6q_sabrelite.c
static iomux_v3_cfg_t mx6q_sabrelite_pads[] = {
....
/* AUDMUX */
MX6Q_PAD_KEY_COL1__AUDMUX_AUD5_TXFS,
MX6Q_PAD_KEY_ROW0__AUDMUX_AUD5_TXD,
MX6Q_PAD_KEY_ROW1__AUDMUX_AUD5_RXD,
MX6Q_PAD_KEY_COL0__AUDMUX_AUD5_TXC,
MX6Q_PAD_NANDF_CS2__CCM_CLKO2, /* --> TLV320AIC23B MCLK */
/* I2C1, TLV320AIC23B */
MX6Q_PAD_CSI0_DAT8__I2C1_SDA,
MX6Q_PAD_CSI0_DAT9__I2C1_SCL,
....
}
....
static struct mxc_audio_platform_data mx6_sabrelite_audio_data;
static int mx6_sabrelite_sgtl5000_init(void)
{
struct clk *clko2;
struct clk *new_parent;
int rate;
clko2 = clk_get(NULL, "clko2_clk");
if (IS_ERR(clko2)) {
pr_err("can't get CLKO2 clock.\n");
return PTR_ERR(clko2);
}
new_parent = clk_get(NULL, "osc_clk");
if (!IS_ERR(new_parent)) {
clk_set_parent(clko2, new_parent);
clk_put(new_parent);
}
/* MCLK = 12 MHz */
rate = clk_round_rate(clko2, 12000000);
mx6_sabrelite_audio_data.sysclk = rate;
clk_set_rate(clko2, rate);
clk_enable(clko2);
return 0;
}
static struct imx_ssi_platform_data mx6_sabrelite_ssi_pdata = {
.flags = IMX_SSI_DMA | IMX_SSI_SYN,
};
static struct imx_ssi_platform_data mx6_sabrelite_ssi_pdata = {
.flags = IMX_SSI_DMA | IMX_SSI_SYN,
};
static struct mxc_audio_platform_data mx6_sabrelite_audio_data = {
.ssi_num = 1,
.src_port = 2,
.ext_port = 5,
.init = mx6_sabrelite_sgtl5000_init,
.hp_gpio = -1,
};
static struct platform_device mx6_sabrelite_audio_device = {
.name = "imx-sgtl5000",
};
static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
{
I2C_BOARD_INFO("tlv320aic23", 0x1a),
},
};
------------------------------------------------------------------------
sound/soc/imx/Kconfig
config SND_SOC_IMX_SGTL5000
tristate "SoC Audio support for i.MX boards with sgtl5000"
depends on I2C && (MACH_MX35_3DS || MACH_MX51_BABBAGE \
|| MACH_MX6Q_SABRELITE || MACH_MX6Q_ARM2)
select SND_SOC_TLV320AIC23
select SND_MXC_SOC_MX2
help
Say Y if you want to add support for SoC audio on an i.MX board with
a sgtl5000 codec.
------------------------------------------------------------------------
sound/soc/imx/imx-sgtl5000.c
see attachment for machine layer code
------------------------------------------------------------------------
connection of the codec:
i.mx6q <--> tlv320aic23b(pin)
AUD5_TXFS LRCIN(5), LRCOUT(7)
AUD5_TXD DIN(4)
AUD5_RXD DOUT(6)
AUD5_TXC BCLK(3)
CCM_CLKO2 XTI(25)
I2C1_SDA SDIN(23)
I2C1_SCL SCLK(24)
Alexander