diff options
author | Vinod G <vinodg@nvidia.com> | 2011-05-02 15:17:19 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-05-13 18:38:17 -0700 |
commit | 0e3f21cb8aaae12171a908426a9c3487dce4da18 (patch) | |
tree | fdb02c6e5aa4ad9da9f09ffb70ed7f5c2bddef72 /arch | |
parent | 64e1800300d6394363e6509cfdf4edc7f766c9e6 (diff) |
arm: tegra: Exposing more i2s port for Baseband.
Exposed the baseband i2s port for cardhu.
Added separate audio init function.
Change-Id: I9ff38f101c5540ad6e2365ed93a8c88373164ea3
Reviewed-on: http://git-master/r/30087
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Tested-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/audio_switch.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.c | 46 | ||||
-rw-r--r-- | arch/arm/mach-tegra/devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/tegra_i2s.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/spdif.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra2_i2s.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra3_i2s.c | 14 |
8 files changed, 103 insertions, 82 deletions
diff --git a/arch/arm/mach-tegra/audio_switch.c b/arch/arm/mach-tegra/audio_switch.c index 761db91a5d6e..77429c07b6c0 100644 --- a/arch/arm/mach-tegra/audio_switch.c +++ b/arch/arm/mach-tegra/audio_switch.c @@ -751,16 +751,9 @@ int audio_apbif_set_acif(int ifc, int fifo_mode, struct audio_cif *cifInfo) if (fifo_mode == AUDIO_TX_MODE) { audio_switch_set_acif((unsigned int)ch->virt_base + APBIF_AUDIOCIF_TX0_CTRL_0, cifInfo); - - /* FIXME: packed mode as default */ - //apbif_set_pack_mode(ifc, AUDIO_TX_MODE, AUDIO_FIFO_PACK_16); - } else { audio_switch_set_acif((unsigned int)ch->virt_base + APBIF_AUDIOCIF_RX0_CTRL_0, cifInfo); - - /* FIXME: packed mode as default */ - //apbif_set_pack_mode(ifc, AUDIO_RX_MODE, AUDIO_FIFO_PACK_16); } return 0; } diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c index 606b309f6daf..68428916e710 100644 --- a/arch/arm/mach-tegra/board-cardhu.c +++ b/arch/arm/mach-tegra/board-cardhu.c @@ -222,9 +222,6 @@ static __initdata struct tegra_clk_init_table cardhu_clk_init_table[] = { { "blink", "clk_32k", 32768, true}, { "pll_a", NULL, 56448000, false}, { "pll_a_out0", NULL, 11289600, false}, - { "i2s1", "pll_a_out0", 11289600, false}, - { "i2s2", "pll_a_out0", 11289600, false}, - { "i2s3", "pll_a_out0", 11289600, false}, { "d_audio","pll_a_out0", 11289600, false}, { NULL, NULL, 0, 0}, }; @@ -309,7 +306,6 @@ static struct tegra_audio_platform_data tegra_i2s_pdata[] = { .dma_on = true, /* use dma by default */ .i2s_master_clk = 44100, .dev_clk_rate = 11289600, - .dap_clk = "extern1", .mode = AUDIO_FRAME_FORMAT_I2S, .fifo_fmt = AUDIO_FIFO_PACK_16, .bit_size = AUDIO_BIT_SIZE_16, @@ -327,6 +323,17 @@ static struct tegra_audio_platform_data tegra_i2s_pdata[] = { .i2s_bus_width = 32, .dsp_bus_width = 16, }, + [2] = { + .i2s_master = true, + .dma_on = true, /* use dma by default */ + .i2s_master_clk = 8000, + .dev_clk_rate = 1024000, + .mode = AUDIO_FRAME_FORMAT_DSP, + .fifo_fmt = AUDIO_FIFO_NOP, + .bit_size = AUDIO_BIT_SIZE_16, + .i2s_bus_width = 32, + .dsp_bus_width = 16, + }, }; static struct tegra_audio_platform_data tegra_spdif_pdata = { @@ -343,6 +350,25 @@ struct wired_jack_conf audio_wr_jack_conf = { .spkr_amp_reg = "avdd_amp" }; +static void cardhu_audio_init(void) +{ +#if defined(CONFIG_SND_HDA_TEGRA) + platform_device_register(&tegra_hda_device); +#endif + + tegra_i2s_device1.dev.platform_data = &tegra_i2s_pdata[0]; + platform_device_register(&tegra_i2s_device1); + + tegra_i2s_device2.dev.platform_data = &tegra_i2s_pdata[1]; + platform_device_register(&tegra_i2s_device2); + + tegra_i2s_device3.dev.platform_data = &tegra_i2s_pdata[2]; + platform_device_register(&tegra_i2s_device3); + + tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata; + platform_device_register(&tegra_spdif_device); +} + static void cardhu_i2c_init(void) { tegra_i2c_device1.dev.platform_data = &cardhu_i2c1_platform_data; @@ -401,16 +427,10 @@ static struct platform_device *cardhu_devices[] __initdata = { &tegra_udc_device, &androidusb_device, &tegra_usb_fsg_device, -#if defined(CONFIG_SND_HDA_TEGRA) - &tegra_hda_device, -#endif #if defined(CONFIG_TEGRA_IOVMM_SMMU) &tegra_smmu_device, #endif &tegra_wdt_device, - &tegra_i2s_device1, - &tegra_i2s_device3, - &tegra_spdif_device, &tegra_avp_device, &tegra_camera, &tegra_spi_device4, @@ -569,10 +589,8 @@ static void __init tegra_cardhu_init(void) cardhu_usb_init(); snprintf(serial, sizeof(serial), "%llx", tegra_chip_uid()); andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL); - tegra_i2s_device1.dev.platform_data = &tegra_i2s_pdata[0]; - tegra_i2s_device3.dev.platform_data = &tegra_i2s_pdata[1]; - tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata; platform_add_devices(cardhu_devices, ARRAY_SIZE(cardhu_devices)); + cardhu_audio_init(); cardhu_sdhci_init(); cardhu_regulator_init(); cardhu_gpio_switch_regulator_init(); diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c index f9662807e8cb..0018fdfda00f 100644 --- a/arch/arm/mach-tegra/board-enterprise.c +++ b/arch/arm/mach-tegra/board-enterprise.c @@ -164,9 +164,6 @@ static __initdata struct tegra_clk_init_table enterprise_clk_init_table[] = { { "blink", "clk_32k", 32768, true}, { "pll_a", NULL, 56448000, false}, { "pll_a_out0", NULL, 11289600, false}, - { "i2s1", "pll_a_out0", 11289600, false}, - { "i2s2", "pll_a_out0", 11289600, false}, - { "i2s3", "pll_a_out0", 11289600, false}, { "d_audio","pll_a_out0", 11289600, false}, { NULL, NULL, 0, 0}, }; @@ -251,7 +248,6 @@ static struct tegra_audio_platform_data tegra_i2s_pdata[] = { .dma_on = true, /* use dma by default */ .i2s_master_clk = 44100, .dev_clk_rate = 11289600, - .dap_clk = "extern1", .mode = AUDIO_FRAME_FORMAT_I2S, .fifo_fmt = AUDIO_FIFO_PACK_16, .bit_size = AUDIO_BIT_SIZE_16, @@ -269,13 +265,24 @@ static struct tegra_audio_platform_data tegra_i2s_pdata[] = { .i2s_bus_width = 32, .dsp_bus_width = 16, }, + [2] = { + .i2s_master = true, + .dma_on = true, /* use dma by default */ + .i2s_master_clk = 8000, + .dev_clk_rate = 1024000, + .mode = AUDIO_FRAME_FORMAT_DSP, + .fifo_fmt = AUDIO_FIFO_NOP, + .bit_size = AUDIO_BIT_SIZE_16, + .i2s_bus_width = 32, + .dsp_bus_width = 16, + }, }; static struct tegra_audio_platform_data tegra_spdif_pdata = { .dma_on = true, /* use dma by default */ .dev_clk_rate = 5644800, .mode = SPDIF_BIT_MODE_MODE16BIT, - .fifo_fmt = 0, + .fifo_fmt = AUDIO_FIFO_PACK_16, }; struct wired_jack_conf audio_wr_jack_conf = { @@ -284,6 +291,25 @@ struct wired_jack_conf audio_wr_jack_conf = { .en_mic_int = TEGRA_GPIO_PX0, }; +static void enterprise_audio_init(void) +{ +#if defined(CONFIG_SND_HDA_TEGRA) + platform_device_register(&tegra_hda_device); +#endif + + tegra_i2s_device1.dev.platform_data = &tegra_i2s_pdata[0]; + platform_device_register(&tegra_i2s_device1); + + tegra_i2s_device2.dev.platform_data = &tegra_i2s_pdata[1]; + platform_device_register(&tegra_i2s_device2); + + tegra_i2s_device3.dev.platform_data = &tegra_i2s_pdata[2]; + platform_device_register(&tegra_i2s_device3); + + tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata; + platform_device_register(&tegra_spdif_device); +} + static void enterprise_i2c_init(void) { tegra_i2c_device1.dev.platform_data = &enterprise_i2c1_platform_data; @@ -338,16 +364,10 @@ static struct platform_device *enterprise_devices[] __initdata = { &pmu_device, &tegra_rtc_device, &tegra_udc_device, -#if defined(CONFIG_SND_HDA_TEGRA) - &tegra_hda_device, -#endif #if defined(CONFIG_TEGRA_IOVMM_SMMU) &tegra_smmu_device, #endif &tegra_wdt_device, - &tegra_i2s_device1, - &tegra_i2s_device3, - &tegra_spdif_device, &tegra_avp_device, &tegra_camera, &tegra_spi_device4, @@ -478,10 +498,8 @@ static void __init tegra_enterprise_init(void) enterprise_i2c_init(); snprintf(serial, sizeof(serial), "%llx", tegra_chip_uid()); andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL); - tegra_i2s_device1.dev.platform_data = &tegra_i2s_pdata[0]; - tegra_i2s_device3.dev.platform_data = &tegra_i2s_pdata[1]; - tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata; platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices)); + enterprise_audio_init(); enterprise_sdhci_init(); enterprise_regulator_init(); touch_init(); diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c index 1f8b9455ac02..bd4af0dcc348 100644 --- a/arch/arm/mach-tegra/devices.c +++ b/arch/arm/mach-tegra/devices.c @@ -675,19 +675,22 @@ static struct resource audio_resource[] = { }; struct platform_device tegra_i2s_device1 = { - .name = "audio", + .name = "i2s", .id = 1, .resource = audio_resource, .num_resources = ARRAY_SIZE(audio_resource), }; +struct platform_device tegra_i2s_device2 = { + .name = "i2s", + .id = 2, +}; + struct platform_device tegra_i2s_device3 = { - .name = "audio", + .name = "i2s", .id = 3, }; -/* FIXME : Temporarly adding - find the right solution */ - static struct resource spdif_resource[] = { [0] = { .start = TEGRA_DMA_REQ_SEL_APBIF_CH3, diff --git a/arch/arm/mach-tegra/include/mach/tegra_i2s.h b/arch/arm/mach-tegra/include/mach/tegra_i2s.h index 25cb32731103..99497a4e4b3f 100644 --- a/arch/arm/mach-tegra/include/mach/tegra_i2s.h +++ b/arch/arm/mach-tegra/include/mach/tegra_i2s.h @@ -98,6 +98,7 @@ int i2s_set_channels(int ifc, int channels); int i2s_clock_disable(int ifc); int i2s_clock_enable(int ifc); int i2s_close(int ifc); +int i2s_clock_set_parent(int ifc, int parent); int i2s_clock_rate(int ifc, int rate); #endif /* __ARCH_ARM_MACH_TEGRA_I2S_H */ diff --git a/arch/arm/mach-tegra/spdif.c b/arch/arm/mach-tegra/spdif.c index df2600cb556c..972ca2bc8e06 100644 --- a/arch/arm/mach-tegra/spdif.c +++ b/arch/arm/mach-tegra/spdif.c @@ -573,50 +573,6 @@ void spdif_restore_regs(unsigned long base) spdif_writel(base, regs->spdif_usr_sta_rx_a_0, SPDIF_USR_STA_RX_A_0); spdif_writel(base, regs->spdif_usr_dat_tx_a_0, SPDIF_USR_DAT_TX_A_0); } - -void spdif_get_all_regs(unsigned long base, struct spdif_regs_cache* regs) -{ - regs->spdif_ctrl_0 = spdif_readl(base, SPDIF_CTRL_0); - regs->spdif_status_0 = spdif_readl(base, SPDIF_STATUS_0); - regs->spdif_strobe_ctrl_0 = spdif_readl(base, SPDIF_STROBE_CTRL_0); - regs->spdif_data_fifo_scr_0 = spdif_readl(base, SPDIF_DATA_FIFO_CSR_0); - regs->spdif_ch_sta_rx_a_0 = spdif_readl(base, SPDIF_CH_STA_RX_A_0); - regs->spdif_ch_sta_rx_b_0 = spdif_readl(base, SPDIF_CH_STA_RX_B_0); - regs->spdif_ch_sta_rx_c_0 = spdif_readl(base, SPDIF_CH_STA_RX_C_0); - regs->spdif_ch_sta_rx_d_0 = spdif_readl(base, SPDIF_CH_STA_RX_D_0); - regs->spdif_ch_sta_rx_e_0 = spdif_readl(base, SPDIF_CH_STA_RX_E_0); - regs->spdif_ch_sta_rx_f_0 = spdif_readl(base, SPDIF_CH_STA_RX_F_0); - regs->spdif_ch_sta_tx_a_0 = spdif_readl(base, SPDIF_CH_STA_TX_A_0); - regs->spdif_ch_sta_tx_b_0 = spdif_readl(base, SPDIF_CH_STA_TX_B_0); - regs->spdif_ch_sta_tx_c_0 = spdif_readl(base, SPDIF_CH_STA_TX_C_0); - regs->spdif_ch_sta_tx_d_0 = spdif_readl(base, SPDIF_CH_STA_TX_D_0); - regs->spdif_ch_sta_tx_e_0 = spdif_readl(base, SPDIF_CH_STA_TX_E_0); - regs->spdif_ch_sta_tx_f_0 = spdif_readl(base, SPDIF_CH_STA_TX_F_0); - regs->spdif_usr_sta_rx_a_0 = spdif_readl(base, SPDIF_USR_STA_RX_A_0); - regs->spdif_usr_dat_tx_a_0 = spdif_readl(base, SPDIF_USR_DAT_TX_A_0); -} - -void spdif_set_all_regs(unsigned long base, struct spdif_regs_cache* regs) -{ - spdif_writel(base, regs->spdif_ctrl_0, SPDIF_CTRL_0); - spdif_writel(base, regs->spdif_status_0, SPDIF_STATUS_0); - spdif_writel(base, regs->spdif_strobe_ctrl_0, SPDIF_STROBE_CTRL_0); - spdif_writel(base, regs->spdif_data_fifo_scr_0, SPDIF_DATA_FIFO_CSR_0); - spdif_writel(base, regs->spdif_ch_sta_rx_a_0, SPDIF_CH_STA_RX_A_0); - spdif_writel(base, regs->spdif_ch_sta_rx_b_0, SPDIF_CH_STA_RX_B_0); - spdif_writel(base, regs->spdif_ch_sta_rx_c_0, SPDIF_CH_STA_RX_C_0); - spdif_writel(base, regs->spdif_ch_sta_rx_d_0, SPDIF_CH_STA_RX_D_0); - spdif_writel(base, regs->spdif_ch_sta_rx_e_0, SPDIF_CH_STA_RX_E_0); - spdif_writel(base, regs->spdif_ch_sta_rx_f_0, SPDIF_CH_STA_RX_F_0); - spdif_writel(base, regs->spdif_ch_sta_tx_a_0, SPDIF_CH_STA_TX_A_0); - spdif_writel(base, regs->spdif_ch_sta_tx_b_0, SPDIF_CH_STA_TX_B_0); - spdif_writel(base, regs->spdif_ch_sta_tx_c_0, SPDIF_CH_STA_TX_C_0); - spdif_writel(base, regs->spdif_ch_sta_tx_d_0, SPDIF_CH_STA_TX_D_0); - spdif_writel(base, regs->spdif_ch_sta_tx_e_0, SPDIF_CH_STA_TX_E_0); - spdif_writel(base, regs->spdif_ch_sta_tx_f_0, SPDIF_CH_STA_TX_F_0); - spdif_writel(base, regs->spdif_usr_sta_rx_a_0, SPDIF_USR_STA_RX_A_0); - spdif_writel(base, regs->spdif_usr_dat_tx_a_0, SPDIF_USR_DAT_TX_A_0); -} #else static int spdif_get_apbif_channel(int fifo_mode) @@ -730,6 +686,9 @@ int spdif_set_acif(int fifo_mode, struct audio_cif *cifInfo) audio_switch_set_acif(spinfo->base + SPDIF_AUDIOCIF_RXDATA_CTRL_0, tx_audio_cif); + apbif_set_pack_mode(spdif_get_apbif_channel(fifo_mode), + fifo_mode, AUDIO_FIFO_PACK_16); + audio_apbif_set_acif(spdif_get_apbif_channel(fifo_mode), fifo_mode, tx_audio_cif); diff --git a/arch/arm/mach-tegra/tegra2_i2s.c b/arch/arm/mach-tegra/tegra2_i2s.c index ba593203d8ab..c10e366369f5 100644 --- a/arch/arm/mach-tegra/tegra2_i2s.c +++ b/arch/arm/mach-tegra/tegra2_i2s.c @@ -666,6 +666,9 @@ int i2s_init(int ifc, struct tegra_i2s_property* pi2sprop) if (i2s_open(ifc)) return err; + i2s_clock_rate(ifc, pi2sprop->clk_rate); + i2s_clock_set_parent(ifc, 0); + err = i2s_clock_enable(ifc); if (err) { @@ -730,6 +733,18 @@ int i2s_clock_disable(int ifc) return 0; } +int i2s_clock_set_parent(int ifc, int parent) +{ + /* Fix set the parent properly */ + struct clk *pll_a_out0_clk = clk_get_sys(NULL, "pll_a_out0"); + struct i2s_controller_info *info = &i2s_cont_info[ifc]; + + if (info->i2sprop.i2s_clk) + clk_set_parent(info->i2sprop.i2s_clk, pll_a_out0_clk); + + return 0; +} + int i2s_clock_rate(int ifc, int rate) { struct i2s_controller_info *info = &i2s_cont_info[ifc]; diff --git a/arch/arm/mach-tegra/tegra3_i2s.c b/arch/arm/mach-tegra/tegra3_i2s.c index 68c52ccadf5b..c565f9a4d198 100644 --- a/arch/arm/mach-tegra/tegra3_i2s.c +++ b/arch/arm/mach-tegra/tegra3_i2s.c @@ -859,6 +859,8 @@ int i2s_init(int ifc, struct tegra_i2s_property* pi2sprop) } i2s_clock_rate(ifc, pi2sprop->clk_rate); + i2s_clock_set_parent(ifc, 0); + err = i2s_clock_enable(ifc); if (err) { @@ -956,6 +958,18 @@ int i2s_clock_disable(int ifc) return 0; } +int i2s_clock_set_parent(int ifc, int parent) +{ + /* Fix set the parent properly */ + struct clk *pll_a_out0_clk = clk_get_sys(NULL, "pll_a_out0"); + struct i2s_controller_info *info = &i2s_cont_info[ifc]; + + if (info->i2sprop.i2s_clk) + clk_set_parent(info->i2sprop.i2s_clk, pll_a_out0_clk); + + return 0; +} + int i2s_clock_rate(int ifc, int rate) { struct i2s_controller_info *info = &i2s_cont_info[ifc]; |