diff options
author | Alan Tull <alan.tull@freescale.com> | 2011-05-18 16:32:35 -0500 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-01-09 20:08:43 +0800 |
commit | 78534a1bbe94c1bc5796e7018c63ff170232e79d (patch) | |
tree | dedc9db5da181e9dafa1b6aaba2849bbff066b69 /arch/arm/mach-mx5 | |
parent | fd99ee21358e8c41f7dfda488e8bd5afd1445a45 (diff) |
ENGR00139461-1 mxc alsa soc spdif driver
S/PDIF tx and rx using ASoC layer.
Signed-off-by: Alan Tull <alan.tull@freescale.com>
Diffstat (limited to 'arch/arm/mach-mx5')
-rwxr-xr-x | arch/arm/mach-mx5/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-mx51_3ds.c | 20 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx51_babbage.c | 19 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_ard.c | 18 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_evk.c | 16 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_loco.c | 19 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_smd.c | 22 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/clock.c | 4 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/devices-imx51.h | 8 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/devices-imx53.h | 7 |
10 files changed, 132 insertions, 3 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index ff27eb4bc245..513e1b8017b7 100755 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig @@ -40,6 +40,7 @@ config SOC_IMX51 select IMX_HAVE_PLATFORM_IMX_DVFS select IMX_HAVE_PLATFORM_IMX_SSI select IMX_HAVE_PLATFORM_IMX_IIM + select IMX_HAVE_PLATFORM_IMX_SPDIF config SOC_IMX53 bool @@ -59,6 +60,7 @@ config SOC_IMX53 select IMX_HAVE_PLATFORM_IMX_SSI select IMX_HAVE_PLATFORM_IMX_IIM select IMX_HAVE_PLATFORM_LDB + select IMX_HAVE_PLATFORM_IMX_SPDIF if ARCH_MX50_SUPPORTED #comment "i.MX50 machines:" diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c index 63dfbeafbc1e..c279555bf2d7 100644 --- a/arch/arm/mach-mx5/board-mx51_3ds.c +++ b/arch/arm/mach-mx5/board-mx51_3ds.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2008-2011 Freescale Semiconductor, Inc. All Rights Reserved. * Copyright (C) 2010 Jason Wang <jason77.wang@gmail.com> * * The code contained herein is licensed under the GNU General Public @@ -68,6 +68,8 @@ static iomux_v3_cfg_t mx51_3ds_pads[] = { MX51_PAD_NANDF_RB3__ECSPI2_MISO, MX51_PAD_NANDF_D15__ECSPI2_MOSI, MX51_PAD_NANDF_D12__GPIO3_28, + + MX51_PAD_GPIO1_7__SPDIF_OUT, }; /* Serial ports */ @@ -130,6 +132,15 @@ static struct spi_board_info mx51_3ds_spi_nor_device[] = { .platform_data = NULL,}, }; +static struct mxc_spdif_platform_data mxc_spdif_data = { + .spdif_tx = 1, + .spdif_rx = 0, + .spdif_clk_44100 = 0, /* spdif_ext_clk source for 44.1KHz */ + .spdif_clk_48000 = 7, /* audio osc source */ + .spdif_clkid = 0, + .spdif_clk = NULL, /* spdif bus clk */ +}; + /* * Board specific initialization. */ @@ -142,6 +153,9 @@ static void __init mx51_3ds_init(void) imx51_add_imx_uart(1, &uart_pdata); imx51_add_imx_uart(2, &uart_pdata); + mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk"); + clk_put(mxc_spdif_data.spdif_core_clk); + imx51_add_ecspi(1, &mx51_3ds_ecspi2_pdata); spi_register_board_info(mx51_3ds_spi_nor_device, ARRAY_SIZE(mx51_3ds_spi_nor_device)); @@ -153,6 +167,10 @@ static void __init mx51_3ds_init(void) imx51_add_sdhci_esdhc_imx(0, NULL); imx51_add_imx_keypad(&mx51_3ds_map_data); imx51_add_imx2_wdt(0, NULL); + + imx51_add_spdif(&mxc_spdif_data); + imx51_add_spdif_dai(); + imx51_add_spdif_audio_device(); } static void __init mx51_3ds_timer_init(void) diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c index bb3467bf24d5..b260b2c8b3c4 100755 --- a/arch/arm/mach-mx5/board-mx51_babbage.c +++ b/arch/arm/mach-mx5/board-mx51_babbage.c @@ -11,6 +11,7 @@ */ #include <linux/init.h> +#include <linux/clk.h> #include <linux/platform_device.h> #include <linux/i2c.h> #include <linux/gpio.h> @@ -217,6 +218,8 @@ static iomux_v3_cfg_t mx51babbage_pads[] = { MX51_PAD_AUD3_BB_RXD__AUD3_RXD, MX51_PAD_AUD3_BB_CK__AUD3_TXC, MX51_PAD_AUD3_BB_FS__AUD3_TXFS, + + MX51_PAD_OWIRE_LINE__SPDIF_OUT, }; /* Serial ports */ @@ -630,6 +633,15 @@ static struct platform_device bbg_audio_device = { .name = "imx-sgtl5000", }; +static struct mxc_spdif_platform_data mxc_spdif_data = { + .spdif_tx = 1, + .spdif_rx = 0, + .spdif_clk_44100 = 0, /* spdif_ext_clk source for 44.1KHz */ + .spdif_clk_48000 = 7, /* audio osc source */ + .spdif_clkid = 0, + .spdif_clk = NULL, /* spdif bus clk */ +}; + /* * Board specific initialization. */ @@ -642,6 +654,9 @@ static void __init mx51_babbage_init(void) mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, ARRAY_SIZE(mx51babbage_pads)); + mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk"); + clk_put(mxc_spdif_data.spdif_core_clk); + imx51_add_imx_uart(0, &uart_pdata); imx51_add_imx_uart(1, &uart_pdata); imx51_add_imx_uart(2, &uart_pdata); @@ -666,6 +681,10 @@ static void __init mx51_babbage_init(void) imx51_add_imx_i2c(0, &babbage_i2c_data); imx51_add_imx_i2c(1, &babbage_i2c_data); + imx51_add_spdif(&mxc_spdif_data); + imx51_add_spdif_dai(); + imx51_add_spdif_audio_device(); + mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); mxc_register_device(&mxc_pm_device, &babbage_pm_data); i2c_register_board_info(1, mxc_i2c1_board_info, diff --git a/arch/arm/mach-mx5/board-mx53_ard.c b/arch/arm/mach-mx5/board-mx53_ard.c index d728de1123b0..101c11fcea24 100755 --- a/arch/arm/mach-mx5/board-mx53_ard.c +++ b/arch/arm/mach-mx5/board-mx53_ard.c @@ -123,6 +123,9 @@ static iomux_v3_cfg_t mx53_ard_pads[] = { /* TOUCH_INT_B */ MX53_PAD_GPIO_17__GPIO7_12, + + /* MAINBRD_SPDIF_IN */ + MX53_PAD_KEY_COL3__SPDIF_IN1, }; /* Config CS1 settings for ethernet controller */ @@ -211,6 +214,15 @@ static struct i2c_board_info mxc_i2c2_board_info[] __initdata = { }, }; +static struct mxc_spdif_platform_data mxc_spdif_data = { + .spdif_tx = 0, + .spdif_rx = 1, + .spdif_clk_44100 = 0, /* Souce from CKIH1 for 44.1K */ + .spdif_clk_48000 = 7, /* Source from CKIH2 for 48k and 32k */ + .spdif_clkid = 0, + .spdif_clk = NULL, /* spdif bus clk */ +}; + static inline void mx53_ard_init_uart(void) { imx53_add_imx_uart(0, NULL); @@ -229,6 +241,8 @@ static void __init mx53_ard_board_init(void) { mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads, ARRAY_SIZE(mx53_ard_pads)); + mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk"); + clk_put(mxc_spdif_data.spdif_core_clk); mx53_ard_init_uart(); imx53_add_srtc(); imx53_add_imx2_wdt(0, NULL); @@ -241,6 +255,10 @@ static void __init mx53_ard_board_init(void) imx53_add_imx_i2c(1, &mx53_ard_i2c1_data); imx53_add_imx_i2c(2, &mx53_ard_i2c2_data); + imx53_add_spdif(&mxc_spdif_data); + imx53_add_spdif_dai(); + imx53_add_spdif_audio_device(); + i2c_register_board_info(1, mxc_i2c1_board_info, ARRAY_SIZE(mxc_i2c1_board_info)); i2c_register_board_info(2, mxc_i2c2_board_info, diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c index 300d56e75c2c..42319341f9eb 100755 --- a/arch/arm/mach-mx5/board-mx53_evk.c +++ b/arch/arm/mach-mx5/board-mx53_evk.c @@ -720,10 +720,22 @@ static void __init mx53_evk_io_init(void) } } +static struct mxc_spdif_platform_data mxc_spdif_data = { + .spdif_tx = 1, + .spdif_rx = 0, + .spdif_clk_44100 = 0, /* Souce from CKIH1 for 44.1K */ + .spdif_clk_48000 = 7, /* Source from CKIH2 for 48k and 32k */ + .spdif_clkid = 0, + .spdif_clk = NULL, /* spdif bus clk */ +}; + static void __init mx53_evk_board_init(void) { mx53_evk_io_init(); + mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk"); + clk_put(mxc_spdif_data.spdif_core_clk); + mx53_evk_init_uart(); imx53_add_srtc(); mx53_evk_fec_reset(); @@ -756,6 +768,10 @@ static void __init mx53_evk_board_init(void) imx53_add_ecspi(0, &mx53_evk_spi_data); imx53_add_imx2_wdt(0, NULL); + imx53_add_spdif(&mxc_spdif_data); + imx53_add_spdif_dai(); + imx53_add_spdif_audio_device(); + /* this call required to release SCC RAM partition held by ROM * during boot, even if SCC2 driver is not part of the image */ diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 82aec683c593..a10a3d0c8535 100755 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c @@ -717,6 +717,18 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, } } +static struct mxc_spdif_platform_data mxc_spdif_data = { + .spdif_tx = 1, + .spdif_rx = 0, + .spdif_clk_44100 = -1, /* No source for 44.1K */ + /* Source from CCM spdif_clk (24M) for 48k and 32k + * It's not accurate: for 48Khz it is actually 46875Hz (2.3% off) + */ + .spdif_clk_48000 = 1, + .spdif_clkid = 0, + .spdif_clk = NULL, /* spdif bus clk */ +}; + static void __init mx53_loco_board_init(void) { mx53_loco_io_init(); @@ -725,6 +737,9 @@ static void __init mx53_loco_board_init(void) mx53_loco_fec_reset(); imx53_add_fec(&mx53_loco_fec_data); + mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk"); + clk_put(mxc_spdif_data.spdif_core_clk); + mxc_register_device(&mxc_pm_device, &loco_pm_data); imx53_add_ipuv3(&ipu_data); @@ -762,6 +777,10 @@ static void __init mx53_loco_board_init(void) mxc_register_device(&loco_audio_device, &loco_audio_data); imx53_add_imx_ssi(1, &loco_ssi_pdata); + imx53_add_spdif(&mxc_spdif_data); + imx53_add_spdif_dai(); + imx53_add_spdif_audio_device(); + /*GPU*/ if (mx53_revision() >= IMX_CHIP_REVISION_2_0) gpu_data.z160_revision = 1; diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c index f60c92eba54d..afb8db647341 100755 --- a/arch/arm/mach-mx5/board-mx53_smd.c +++ b/arch/arm/mach-mx5/board-mx53_smd.c @@ -216,6 +216,8 @@ static iomux_v3_cfg_t mx53_smd_pads[] = { MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK, MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1, MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0, + + MX53_PAD_GPIO_17__SPDIF_OUT1, }; #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) @@ -718,11 +720,27 @@ static struct fsl_mxc_ldb_platform_data ldb_data = { .boot_enable = MXC_LDBDI1, }; +static struct mxc_spdif_platform_data mxc_spdif_data = { + .spdif_tx = 1, + .spdif_rx = 0, + .spdif_clk_44100 = 0, /* Souce from CKIH1 for 44.1K */ + /* Source from CCM spdif_clk (24M) for 48k and 32k + * It's not accurate + */ + .spdif_clk_48000 = 1, + .spdif_clkid = 0, + .spdif_clk = NULL, /* spdif bus clk */ +}; + static void __init mx53_smd_board_init(void) { ipu_data.csi_clk[0] = clk_get(NULL, "ssi_ext1_clk"); mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads, ARRAY_SIZE(mx53_smd_pads)); + + mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk"); + clk_put(mxc_spdif_data.spdif_core_clk); + mx53_smd_init_uart(); mx53_smd_fec_reset(); mxc_register_device(&mxc_pm_device, &smd_pm_data); @@ -780,6 +798,10 @@ static void __init mx53_smd_board_init(void) mxc_register_device(&imx_bt_rfkill, &imx_bt_rfkill_data); imx53_add_imx_ssi(1, &smd_ssi_pdata); + imx53_add_spdif(&mxc_spdif_data); + imx53_add_spdif_dai(); + imx53_add_spdif_audio_device(); + /* this call required to release SCC RAM partition held by ROM * during boot, even if SCC2 driver is not part of the image */ diff --git a/arch/arm/mach-mx5/clock.c b/arch/arm/mach-mx5/clock.c index e728e650169c..4ffe416fc816 100755 --- a/arch/arm/mach-mx5/clock.c +++ b/arch/arm/mach-mx5/clock.c @@ -4504,7 +4504,7 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK(NULL, "emi_intr_clk.0", emi_intr_clk[0]), _REGISTER_CLOCK(NULL, "emi_intr_clk.1", emi_intr_clk[1]), _REGISTER_CLOCK(NULL, "spdif_xtal_clk", spdif_xtal_clk), - _REGISTER_CLOCK("mxc_alsa_spdif.0", NULL, spdif0_clk[0]), + _REGISTER_CLOCK("mxc_spdif.0", NULL, spdif0_clk[0]), _REGISTER_CLOCK("mxc_vpu.0", NULL, vpu_clk[0]), _REGISTER_CLOCK(NULL, "lpsr_clk", lpsr_clk), _REGISTER_CLOCK("mxc_rtc.0", NULL, rtc_clk), @@ -4524,7 +4524,7 @@ static struct clk_lookup lookups[] = { static struct clk_lookup mx51_lookups[] = { _REGISTER_CLOCK("mxc_i2c_hs.3", NULL, hsi2c_serial_clk), _REGISTER_CLOCK("mxc_sim.0", NULL, sim_clk[0]), - _REGISTER_CLOCK("mxc_alsa_spdif.0", NULL, spdif1_clk[0]), + _REGISTER_CLOCK("mxc_spdif.0", NULL, spdif1_clk[0]), _REGISTER_CLOCK(NULL, "mipi_hsp_clk", mipi_hsp_clk), _REGISTER_CLOCK(NULL, "ddr_hf_clk", ddr_hf_clk), _REGISTER_CLOCK("imx51-ecspi.0", NULL, cspi1_clk[0]), diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index bbd12bc54f5f..952ca7b3faa4 100755 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h @@ -89,3 +89,11 @@ extern const struct imx_tve_data imx51_tve_data __initconst; #define imx51_add_v4l2_capture(id) \ platform_device_register_resndata(NULL, "mxc_v4l2_capture",\ id, NULL, 0, NULL, 0); + +extern const struct imx_spdif_data imx51_imx_spdif_data __initconst; +#define imx51_add_spdif(pdata) imx_add_spdif(&imx51_imx_spdif_data, pdata) + +extern const struct imx_spdif_dai_data imx51_spdif_dai_data __initconst; +#define imx51_add_spdif_dai() imx_add_spdif_dai(&imx51_spdif_dai_data) + +#define imx51_add_spdif_audio_device(pdata) imx_add_spdif_audio_device() diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h index 3a6ac442142b..0311af3fef39 100755 --- a/arch/arm/mach-mx5/devices-imx53.h +++ b/arch/arm/mach-mx5/devices-imx53.h @@ -93,3 +93,10 @@ extern const struct imx_mxc_scc2_data imx53_mxc_scc2_data __initconst; #define imx53_add_mxc_scc2() \ imx_add_mxc_scc2(&imx53_mxc_scc2_data) +extern const struct imx_spdif_data imx53_imx_spdif_data __initconst; +#define imx53_add_spdif(pdata) imx_add_spdif(&imx53_imx_spdif_data, pdata) + +extern const struct imx_spdif_dai_data imx53_spdif_dai_data __initconst; +#define imx53_add_spdif_dai() imx_add_spdif_dai(&imx53_spdif_dai_data) + +#define imx53_add_spdif_audio_device(pdata) imx_add_spdif_audio_device() |