diff options
author | Sumit Bhattacharya <sumitb@nvidia.com> | 2011-09-07 15:12:51 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:48:52 -0800 |
commit | 0e221d5510a9ffbf2c72fef54a3eca2ed7e3fead (patch) | |
tree | 3626374ae18f7f42d323a863eba65dcdbf33b364 | |
parent | efc301de4c4bacb4fa8d35e11ec0135879cdd883 (diff) |
ARM: tegra: Add enterprise audio support
Bug 862023
Change-Id: I0ba560f471088302d6197c564f02606a25f2a5db
Reviewed-on: http://git-master/r/51072
Tested-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Rebase-Id: Rfeed9cb02b08e8673c0b4784d2eedc672c3b4bfc
-rw-r--r-- | arch/arm/mach-tegra/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-pinmux.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.c | 125 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/tegra_max98088_pdata.h | 23 |
5 files changed, 157 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 2ea7f817d926..00c21565af6b 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -138,6 +138,7 @@ config MACH_CARDHU config MACH_TEGRA_ENTERPRISE bool "Enterprise board" depends on ARCH_TEGRA_3x_SOC + select MACH_HAS_SND_SOC_TEGRA_MAX98088 if SND_SOC help Support for NVIDIA Enterprise development platform diff --git a/arch/arm/mach-tegra/board-enterprise-pinmux.c b/arch/arm/mach-tegra/board-enterprise-pinmux.c index 0e3eaa9253f7..3d91cc76018b 100644 --- a/arch/arm/mach-tegra/board-enterprise-pinmux.c +++ b/arch/arm/mach-tegra/board-enterprise-pinmux.c @@ -400,6 +400,10 @@ static __initdata struct tegra_pingroup_config enterprise_unused_pinmux[] = { DEFAULT_PINMUX(SPI2_MISO, SPI2, PULL_DOWN, TRISTATE, OUTPUT), }; +static struct tegra_gpio_table gpio_table[] = { + { .gpio = TEGRA_GPIO_HP_DET, .enable = true }, +}; + struct pin_info_low_power_mode { char name[16]; int gpio_nr; @@ -515,6 +519,7 @@ int __init enterprise_pinmux_init(void) tegra_pinmux_config_table(enterprise_unused_pinmux, ARRAY_SIZE(enterprise_unused_pinmux)); + tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); enterprise_set_unused_pin_gpio(enterprise_unused_gpio_pins, ARRAY_SIZE(enterprise_unused_gpio_pins)); return 0; diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c index 19137b2350fc..310fd97629db 100644 --- a/arch/arm/mach-tegra/board-enterprise.c +++ b/arch/arm/mach-tegra/board-enterprise.c @@ -37,6 +37,8 @@ #include <linux/fsl_devices.h> #include <linux/i2c/atmel_mxt_ts.h> +#include <sound/max98088.h> + #include <mach/clk.h> #include <mach/iomap.h> #include <mach/irqs.h> @@ -46,6 +48,8 @@ #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <mach/usb_phy.h> +#include <mach/i2s.h> +#include <mach/tegra_max98088_pdata.h> #include "board.h" #include "clock.h" @@ -175,6 +179,7 @@ static __initdata struct tegra_clk_init_table enterprise_clk_init_table[] = { { "blink", "clk_32k", 32768, true}, { "pll_a", NULL, 564480000, false}, { "pll_a_out0", NULL, 11289600, false}, + { "i2s0", "pll_a_out0", 0, false}, { NULL, NULL, 0, 0}, }; @@ -224,6 +229,104 @@ static struct tegra_i2c_platform_data enterprise_i2c5_platform_data = { .arb_recovery = arb_lost_recovery, }; +/* Equalizer filter coefs generated from the MAXIM MAX98088 + * evkit software tool */ +static struct max98088_eq_cfg max98088_eq_cfg[] = { + { + .name = "FLAT", + .rate = 44100, + .band1 = {0x2000, 0xC002, 0x4000, 0x00E9, 0x0000}, + .band2 = {0x2000, 0xC00F, 0x4000, 0x02BC, 0x0000}, + .band3 = {0x2000, 0xC0A7, 0x4000, 0x0916, 0x0000}, + .band4 = {0x2000, 0xC5C2, 0x4000, 0x1A87, 0x0000}, + .band5 = {0x2000, 0xF6B0, 0x4000, 0x3F51, 0x0000}, + }, + { + .name = "LOWPASS1K", + .rate = 44100, + .band1 = {0x205D, 0xC001, 0x3FEF, 0x002E, 0x02E0}, + .band2 = {0x5B9A, 0xC093, 0x3AB2, 0x088B, 0x1981}, + .band3 = {0x0D22, 0xC170, 0x26EA, 0x0D79, 0x32CF}, + .band4 = {0x0894, 0xC612, 0x01B3, 0x1B34, 0x3FFA}, + .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7}, + }, + { /* BASS=-12dB, TREBLE=+9dB, Fc=5KHz */ + .name = "HIBOOST", + .rate = 44100, + .band1 = {0x0815, 0xC001, 0x3AA4, 0x0003, 0x19A2}, + .band2 = {0x0815, 0xC103, 0x092F, 0x0B55, 0x3F56}, + .band3 = {0x0E0A, 0xC306, 0x1E5C, 0x136E, 0x3856}, + .band4 = {0x2459, 0xF665, 0x0CAA, 0x3F46, 0x3EBB}, + .band5 = {0x5BBB, 0x3FFF, 0xCEB0, 0x0000, 0x28CA}, + }, + { /* BASS=12dB, TREBLE=+12dB */ + .name = "LOUD12DB", + .rate = 44100, + .band1 = {0x7FC1, 0xC001, 0x3EE8, 0x0020, 0x0BC7}, + .band2 = {0x51E9, 0xC016, 0x3C7C, 0x033F, 0x14E9}, + .band3 = {0x1745, 0xC12C, 0x1680, 0x0C2F, 0x3BE9}, + .band4 = {0x4536, 0xD7E2, 0x0ED4, 0x31DD, 0x3E42}, + .band5 = {0x7FEF, 0x3FFF, 0x0BAB, 0x0000, 0x3EED}, + }, + { + .name = "FLAT", + .rate = 16000, + .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000}, + .band2 = {0x2000, 0xC033, 0x4000, 0x0505, 0x0000}, + .band3 = {0x2000, 0xC268, 0x4000, 0x115F, 0x0000}, + .band4 = {0x2000, 0xDA62, 0x4000, 0x33C6, 0x0000}, + .band5 = {0x2000, 0x4000, 0x4000, 0x0000, 0x0000}, + }, + { + .name = "LOWPASS1K", + .rate = 16000, + .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000}, + .band2 = {0x5BE8, 0xC3E0, 0x3307, 0x15ED, 0x26A0}, + .band3 = {0x0F71, 0xD15A, 0x08B3, 0x2BD0, 0x3F67}, + .band4 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7}, + .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7}, + }, + { /* BASS=-12dB, TREBLE=+9dB, Fc=2KHz */ + .name = "HIBOOST", + .rate = 16000, + .band1 = {0x0815, 0xC001, 0x3BD2, 0x0009, 0x16BF}, + .band2 = {0x080E, 0xC17E, 0xF653, 0x0DBD, 0x3F43}, + .band3 = {0x0F80, 0xDF45, 0xEE33, 0x36FE, 0x3D79}, + .band4 = {0x590B, 0x3FF0, 0xE882, 0x02BD, 0x3B87}, + .band5 = {0x4C87, 0xF3D0, 0x063F, 0x3ED4, 0x3FB1}, + }, + { /* BASS=12dB, TREBLE=+12dB */ + .name = "LOUD12DB", + .rate = 16000, + .band1 = {0x7FC1, 0xC001, 0x3D07, 0x0058, 0x1344}, + .band2 = {0x2DA6, 0xC013, 0x3CF1, 0x02FF, 0x138B}, + .band3 = {0x18F1, 0xC08E, 0x244D, 0x0863, 0x34B5}, + .band4 = {0x2BE0, 0xF385, 0x04FD, 0x3EC5, 0x3FCE}, + .band5 = {0x7FEF, 0x4000, 0x0BAB, 0x0000, 0x3EED}, + }, +}; + + +static struct max98088_pdata enterprise_max98088_pdata = { + /* equalizer configuration */ + .eq_cfg = max98088_eq_cfg, + .eq_cfgcnt = ARRAY_SIZE(max98088_eq_cfg), + + /* microphone configuration */ + .digmic_left_mode = 1, + .digmic_right_mode = 1, + + /* receiver output configuration */ + .receiver_mode = 0, /* 0 = amplifier, 1 = line output */ +}; + + +static struct i2c_board_info __initdata max98088_board_info = { + I2C_BOARD_INFO("max98088", 0x10), + .platform_data = &enterprise_max98088_pdata, + .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_HP_DET), +}; + static void enterprise_i2c_init(void) { tegra_i2c_device1.dev.platform_data = &enterprise_i2c1_platform_data; @@ -237,6 +340,8 @@ static void enterprise_i2c_init(void) platform_device_register(&tegra_i2c_device3); platform_device_register(&tegra_i2c_device2); platform_device_register(&tegra_i2c_device1); + + i2c_register_board_info(0, &max98088_board_info, 1); } static struct platform_device *enterprise_uart_devices[] __initdata = { @@ -344,6 +449,22 @@ static struct platform_device tegra_camera = { .id = -1, }; +static struct tegra_max98088_platform_data enterprise_audio_pdata = { + .gpio_spkr_en = -1, + .gpio_hp_det = TEGRA_GPIO_HP_DET, + .gpio_hp_mute = -1, + .gpio_int_mic_en = -1, + .gpio_ext_mic_en = -1, +}; + +static struct platform_device enterprise_audio_device = { + .name = "tegra-snd-max98088", + .id = 0, + .dev = { + .platform_data = &enterprise_audio_pdata, + }, +}; + static struct platform_device *enterprise_devices[] __initdata = { &tegra_pmu_device, &tegra_rtc_device, @@ -357,6 +478,10 @@ static struct platform_device *enterprise_devices[] __initdata = { &tegra_wdt_device, &tegra_avp_device, &tegra_camera, + &tegra_ahub_device, + &tegra_i2s_device0, + &tegra_pcm_device, + &enterprise_audio_device, &tegra_spi_device4, #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE) &tegra_se_device, diff --git a/arch/arm/mach-tegra/board-enterprise.h b/arch/arm/mach-tegra/board-enterprise.h index 16454052aa6d..0dc82eb6c2ed 100644 --- a/arch/arm/mach-tegra/board-enterprise.h +++ b/arch/arm/mach-tegra/board-enterprise.h @@ -77,6 +77,9 @@ void __init enterprise_tsensor_init(void); #define CAM_FLASH_MAX_TORCH_AMP 7 #define CAM_FLASH_MAX_FLASH_AMP 7 +/* Audio-related GPIOs */ +#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW3 + #define BOARD_1205 (0x0C05) #define BOARD_E1197 (0x0B61) #define ENTERPRISE_FAB_A01 (0x01) diff --git a/arch/arm/mach-tegra/include/mach/tegra_max98088_pdata.h b/arch/arm/mach-tegra/include/mach/tegra_max98088_pdata.h new file mode 100644 index 000000000000..3b4c7b600639 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/tegra_max98088_pdata.h @@ -0,0 +1,23 @@ +/* + * arch/arm/mach-tegra/include/mach/tegra_max98088_pdata.h + * + * Copyright 2011 NVIDIA, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +struct tegra_max98088_platform_data { + int gpio_spkr_en; + int gpio_hp_det; + int gpio_hp_mute; + int gpio_int_mic_en; + int gpio_ext_mic_en; +}; |