diff options
author | Ravindra Lokhande <rlokhande@nvidia.com> | 2012-01-18 19:45:35 +0530 |
---|---|---|
committer | Lokesh Pathak <lpathak@nvidia.com> | 2012-03-01 03:09:00 -0800 |
commit | 15dc3c059437332373ae90ca438f313c5a4d369b (patch) | |
tree | b00bd27ebb6e0dc442e3f400150cdc5ce182256f /arch/arm/mach-tegra | |
parent | 1579d6096c14765e8f1dce2a0ac1a732db944d0b (diff) |
arm: tegra: cardhu: add support for max98095
add support for maxim 98095 audio codec
Change-Id: I112130341363e18986158cd94a981a60a80fb0d0
Reviewed-on: http://git-master/r/75956
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/85485
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r-- | arch/arm/mach-tegra/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu.c | 164 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h | 36 |
3 files changed, 173 insertions, 28 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 124c5f5c1c53..30d1a105bb18 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -144,6 +144,7 @@ config MACH_CARDHU depends on ARCH_TEGRA_3x_SOC select MACH_HAS_SND_SOC_TEGRA_WM8903 if SND_SOC select MACH_HAS_SND_SOC_TEGRA_TLV320AIC326X if SND_SOC + select MACH_HAS_SND_SOC_TEGRA_MAX98095 if SND_SOC help Support for NVIDIA Cardhu development platform diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c index 8834c3e3c9d8..763e66ae3fe6 100644 --- a/arch/arm/mach-tegra/board-cardhu.c +++ b/arch/arm/mach-tegra/board-cardhu.c @@ -41,6 +41,7 @@ #include <linux/nfc/pn544.h> #include <sound/wm8903.h> +#include <sound/max98095.h> #include <media/tegra_dtv.h> #include <mach/clk.h> @@ -50,8 +51,8 @@ #include <mach/iomap.h> #include <mach/io.h> #include <mach/i2s.h> +#include <mach/tegra_asoc_pdata.h> #include <mach/tegra_wm8903_pdata.h> -#include <mach/tegra_aic326x_pdata.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <mach/usb_phy.h> @@ -284,25 +285,113 @@ static struct wm8903_platform_data cardhu_wm8903_pdata = { }, }; -static struct wm8903_platform_data cardhu_aic3262_pdata = { - .irq_active_low = 0, - .micdet_cfg = 0, - .micdet_delay = 100, -}; - -static struct i2c_board_info __initdata cardhu_board_info[] = { +/* Equalizer filter coefs generated from the MAXIM MAX98095 + * evkit software tool */ +static struct max98095_eq_cfg max98095_eq_cfg[] = { { - I2C_BOARD_INFO("wm8903", 0x1a), - .platform_data = &cardhu_wm8903_pdata, - .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), + .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}, }, { - I2C_BOARD_INFO("aic3262-codec", 0x18), - .platform_data=&cardhu_aic3262_pdata, - .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), + .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 max98095_pdata cardhu_max98095_pdata = { + /* equalizer configuration */ + .eq_cfg = max98095_eq_cfg, + .eq_cfgcnt = ARRAY_SIZE(max98095_eq_cfg), + + /* Biquad filter response configuration */ + .bq_cfg = NULL, + .bq_cfgcnt = 0, + + /* microphone configuration */ + .digmic_left_mode = 1, + .digmic_right_mode = 1, +}; + +static struct i2c_board_info __initdata cardhu_codec_wm8903_info = { + I2C_BOARD_INFO("wm8903", 0x1a), + .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), + .platform_data = &cardhu_wm8903_pdata, +}; + +static struct i2c_board_info __initdata cardhu_codec_aic326x_info = { + I2C_BOARD_INFO("aic3262-codec", 0x18), + .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), }; +static struct i2c_board_info __initdata cardhu_codec_max98095_info = { + I2C_BOARD_INFO("max98095", 0x10), + .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), + .platform_data = &cardhu_max98095_pdata, +}; static void cardhu_i2c_init(void) { @@ -318,7 +407,9 @@ static void cardhu_i2c_init(void) platform_device_register(&tegra_i2c_device2); platform_device_register(&tegra_i2c_device1); - i2c_register_board_info(4, cardhu_board_info, ARRAY_SIZE(cardhu_board_info)); + i2c_register_board_info(4, &cardhu_codec_wm8903_info, 1); + i2c_register_board_info(4, &cardhu_codec_max98095_info, 1); + i2c_register_board_info(4, &cardhu_codec_aic326x_info, 1); i2c_register_board_info(2, cardhu_i2c_bus3_board_info, 1); } @@ -562,7 +653,7 @@ static struct platform_device tegra_rtc_device = { .num_resources = ARRAY_SIZE(tegra_rtc_resources), }; -static struct tegra_wm8903_platform_data cardhu_audio_pdata = { +static struct tegra_wm8903_platform_data cardhu_audio_wm8903_pdata = { .gpio_spkr_en = TEGRA_GPIO_SPKR_EN, .gpio_hp_det = TEGRA_GPIO_HP_DET, .gpio_hp_mute = -1, @@ -570,27 +661,43 @@ static struct tegra_wm8903_platform_data cardhu_audio_pdata = { .gpio_ext_mic_en = -1, }; -static struct platform_device cardhu_audio_device = { +static struct tegra_asoc_platform_data cardhu_audio_max98095_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 cardhu_audio_wm8903_device = { .name = "tegra-snd-wm8903", .id = 0, .dev = { - .platform_data = &cardhu_audio_pdata, + .platform_data = &cardhu_audio_wm8903_pdata, }, }; -static struct tegra_aic326x_platform_data cardhu_aic326x_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 cardhu_audio_max98095_device = { + .name = "tegra-snd-max98095", + .id = 0, + .dev = { + .platform_data = &cardhu_audio_max98095_pdata, + }, +}; + +static struct tegra_asoc_platform_data cardhu_audio_aic326x_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 cardhu_aic326x_audio_device = { +static struct platform_device cardhu_audio_aic326x_device = { .name = "tegra-snd-aic326x", .id = 0, .dev = { - .platform_data = &cardhu_aic326x_audio_pdata, + .platform_data = &cardhu_audio_aic326x_pdata, }, }; @@ -622,8 +729,9 @@ static struct platform_device *cardhu_devices[] __initdata = { &baseband_dit_device, &cardhu_bcm4329_rfkill_device, &tegra_pcm_device, - &cardhu_audio_device, - &cardhu_aic326x_audio_device, + &cardhu_audio_wm8903_device, + &cardhu_audio_max98095_device, + &cardhu_audio_aic326x_device, &tegra_hda_device, #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES) &tegra_aes_device, diff --git a/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h b/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h new file mode 100644 index 000000000000..34eb2f4fc372 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h @@ -0,0 +1,36 @@ +/* + * arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h + * + * Copyright 2012 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. + * + */ + +#define HIFI_CODEC 0 +#define BASEBAND 1 +#define BT_SCO 2 +#define NUM_I2S_DEVICES 3 + +struct baseband_config { + int rate; + int channels; +}; + +struct tegra_asoc_platform_data { + int gpio_spkr_en; + int gpio_hp_det; + int gpio_hp_mute; + int gpio_int_mic_en; + int gpio_ext_mic_en; + unsigned int debounce_time_hp; + int audio_port_id[NUM_I2S_DEVICES]; + struct baseband_config baseband_param; +}; |