arm: tegra: cardhu: add support for max98095
Ravindra Lokhande [Wed, 18 Jan 2012 14:15:35 +0000 (19:15 +0530)]
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>

Rebase-Id: R523511aa7816138c5bc9b273508c467433b1cb67

arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/board-cardhu.c

index 8249ef5..3fb2d83 100644 (file)
@@ -145,6 +145,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
 
index 1ed2a07..ab0305b 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/nfc/pn544.h>
 
 #include <sound/wm8903.h>
+#include <sound/max98095.h>
 #include <media/tegra_dtv.h>
 
 #include <mach/clk.h>
@@ -49,8 +50,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>
@@ -315,25 +316,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)
 {
@@ -349,7 +438,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);
 }
@@ -593,7 +684,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,
@@ -601,27 +692,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,
        },
 };
 
@@ -652,8 +759,9 @@ static struct platform_device *cardhu_devices[] __initdata = {
        &bluetooth_dit_device,
        &baseband_dit_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,