From e69be33e228a11f1247e0538bb7f595bf49fb340 Mon Sep 17 00:00:00 2001 From: Chris Fries Date: Wed, 6 Oct 2010 23:57:42 -0500 Subject: [PATCH] [ARM]: tegra: stingray: Add Bluetooth Bypass switch for DAC2-DAP4 Split the old "init_das()" into two separate functions, one for DAC1->DAP1 and one for DAC2->DAP2/4. The DAC2 will now talk to either CPCAP CODEC or Bluetooth SCO. Signed-off-by: Iliyan Malchev --- arch/arm/mach-tegra/board-stingray.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-tegra/board-stingray.c b/arch/arm/mach-tegra/board-stingray.c index f7d107c66305..5f56ca511043 100644 --- a/arch/arm/mach-tegra/board-stingray.c +++ b/arch/arm/mach-tegra/board-stingray.c @@ -249,12 +249,14 @@ static struct cpcap_audio_state stingray_cpcap_audio_state = { }; /* CPCAP is i2s master; tegra_audio_pdata.master == false */ +static void init_dac2(bool bluetooth); static struct cpcap_audio_platform_data cpcap_audio_pdata = { .master = true, .regulator = "vaudio", .state = &stingray_cpcap_audio_state, .speaker_gpio = TEGRA_GPIO_PR3, .headset_gpio = -1, + .bluetooth_bypass = init_dac2, }; static struct platform_device cpcap_audio_device = { @@ -881,19 +883,28 @@ static inline void das_writel(unsigned long value, unsigned long offset) #define APB_MISC_DAS_DAP_CTRL_SEL_0 0xc00 #define APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0 0xc40 -static void init_das(void) +static void init_dac1(void) { bool master = tegra_audio_pdata.master; - /* DAC1 -> DAP1 */ das_writel((!master)<<31, APB_MISC_DAS_DAP_CTRL_SEL_0); das_writel(0, APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0); +} - master = tegra_audio2_pdata.master; - /* DAC2 -> DAP2 */ - das_writel((!master)<<31 | 1, APB_MISC_DAS_DAP_CTRL_SEL_0 + 4); - das_writel(1<<28 | 1<<24 | 1, - APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0 + 4); +static void init_dac2(bool bluetooth) +{ + bool master = tegra_audio2_pdata.master; + if (!bluetooth) { + /* DAC2 -> DAP2 for CPCAP CODEC */ + das_writel((!master)<<31 | 1, APB_MISC_DAS_DAP_CTRL_SEL_0 + 4); + das_writel(1<<28 | 1<<24 | 1, + APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0 + 4); + } else { + /* DAC2 -> DAP4 for Bluetooth Voice */ + das_writel((!master)<<31 | 19, APB_MISC_DAS_DAP_CTRL_SEL_0 + 4); + das_writel(3<<28 | 3<<24 | 3, + APB_MISC_DAS_DAC_INPUT_DATA_CLK_SEL_0 + 4); + } } static void __init tegra_stingray_init(void) @@ -988,7 +999,8 @@ static void __init tegra_stingray_init(void) tegra_serial_debug_init(TEGRA_UARTB_BASE, INT_UARTB, clk, INT_QUAD_RES_31, -1); - init_das(); + init_dac1(); + init_dac2(false); tegra_i2s_device1.dev.platform_data = &tegra_audio_pdata; tegra_i2s_device2.dev.platform_data = &tegra_audio2_pdata; cpcap_device_register(&cpcap_audio_device); -- 2.34.1