Hi,
since previous idea fails (at least without any hints or answers), I try with different approach.
I would like to add support to sgtl5000. Since it is support with kernell. : (from menuconfig)
CONFIG_SND_SOC_IMX_SGTL5000: │
│ │
│ Say Y if you want to add support for SoC audio on an i.MX board with │
│ a sgtl5000 codec. │
│ │
│ Symbol: SND_SOC_IMX_SGTL5000 [=y] │
│ Type : tristate │
│ Prompt: SoC Audio support for i.MX boards with sgtl5000 │
│ Defined at sound/soc/imx/Kconfig:53 │
│ Depends on: SOUND [=y] && !M68K && SND [=y] && SND_SOC [=y] && SND_IMX_SOC [=y] && I2C [=y] && (MACH_MX35_3DS [=n] || \ │
│ MACH_MX51_BABBAGE [=n] || MACH_MX6Q_SABRELITE [=n] || MACH_MX6Q_ARM2 [=y]) │
│ Location: │
│ -> Device Drivers │
│ -> Sound card support (SOUND [=y]) │
│ -> Advanced Linux Sound Architecture (SND [=y]) │
│ -> ALSA for SoC audio support (SND_SOC [=y]) │
│ -> SoC Audio for Freescale i.MX CPUs (SND_IMX_SOC [=y]) │
│ Selects: SND_SOC_SGTL5000 [=y] && SND_MXC_SOC_MX2 [=y]
So I am enable it and sgtl5000 drivers are building same as imx-sgtl5000.
I also add support in board.c file:
static int sgtl5000_clk_enable(int enable)
{
pr_err("enable clk: %d", enable);
if (enable)
clk_enable(extern_audio_root);
else
clk_disable(extern_audio_root);
return 0;
}
static struct imx_ssi_platform_data stgl5000_pdata = {
.flags = IMX_SSI_DMA | IMX_SSI_SYN,
};
static struct mxc_audio_platform_data stgl5000_data;
static int sab_sgtl5000_init(void)
{
struct clk *clko;
int rate;
printk("----sab_sgtl5000_init\n");
clko = clk_get(NULL, "clko_clk");
if (IS_ERR(clko))
pr_err("can't get CLKO clock.\n");
extern_audio_root = clk_get(NULL, "extern_audio_clk");
if (IS_ERR(extern_audio_root))
pr_err("can't get extern_audio_root clock.\n");
//clk_set_parent(extern_audio_root, clko);
extern_audio_root=clko;
rate = clk_round_rate(clko, 24000000);
stgl5000_data.sysclk = rate;
clk_set_rate(clko, rate);
clk_enable(clko);
printk("----enable clko_clk.\n");
return 0;
}
static struct platform_device stgl5000_device = {
.name = "imx-sgtl5000",
};
static struct mxc_audio_platform_data stgl5000_data = {
.ssi_num = 1,
.src_port = 2,
.ext_port = 3,
.hp_gpio = -1,
.mic_gpio = -1,
.init = sab_sgtl5000_init,
.clock_enable = sgtl5000_clk_enable,
};
and during boot I change from probing wm8962 to sgtl5000.
static int __init imx6q_init_audio(void)
{
/* platform_device_register(&sabresd_vwm8962_reg_devices);
mxc_register_device(&mx6_sabresd_audio_wm8962_device,
&wm8962_data);
imx6q_add_imx_ssi(1, &mx6_sabresd_ssi_pdata);*/
mxc_register_device(&stgl5000_device,
&stgl5000_data);
imx6q_add_imx_ssi(1, &stgl5000_pdata);
return 0;
}
So I have enable sgtl5000 during boot. It;s initiating (checked by adding printk in imx-sgtl5000.c init function), but it is not registered as a sound card...
Linux :~# cat /proc/asound/cards
--- no soundcards ---
Linux :~# aplay -l
aplay: device_list:268: no soundcards found...
and dmesg part:
wm8962 1-001a: Device is not a WM8962, ID 0 != 6243
wm8962 1-001a: asoc: failed to probe CODEC wm8962.1-001a: -22
asoc: failed to instantiate card wm8962-audio: -22
sgtl5000 imx-init
----sab_sgtl5000_init
----enable clko_clk.
init_ret: 0
init_ret2: 0
imx_3stack asoc driver
Initialize HDMI-audio failed. Load HDMI-video first!
ALSA device list:
No soundcards found.