arm: tegra: laguna: add platform data for MAX98090
Shreshtha Sahu [Mon, 3 Feb 2014 12:32:09 +0000 (17:32 +0530)]
This patch adds platform data support for MAX98090
audio codec

Bug: 1377308

Change-Id: I3abdb71e254601a7e0056adaa4ccc6256c39688a
Signed-off-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-on: http://git-master/r/362914
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Vikram Fugro <vfugro@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-laguna-power.c

index ecd7f18..2904189 100644 (file)
@@ -60,6 +60,7 @@
 #include <linux/irqchip/tegra.h>
 #include <linux/pci-tegra.h>
 #include <linux/tegra-soc.h>
+#include <sound/max98090.h>
 #include <linux/tegra_fiq_debugger.h>
 #include <linux/platform_data/tegra_usb_modem_power.h>
 #include <linux/platform_data/tegra_ahci.h>
@@ -229,6 +230,55 @@ enum {
        LAGUNA_ERSS_MAX_I2C_1_3_ADDR_10,
 };
 
+static struct max98090_pdata laguna_max98090_pdata = {
+       /* Microphone Configuration */
+       .digmic_left_mode = 1,
+       .digmic_right_mode = 1,
+};
+
+static struct i2c_board_info laguna_i2c1_0_max98090_board_info[] = {
+       [LAGUNA_ERSS_MAX_I2C_1_0_ADDR_10] = {
+               I2C_BOARD_INFO("max98090", 0x10),
+               .platform_data  = &laguna_max98090_pdata,
+       },
+};
+static struct i2c_board_info laguna_i2c1_1_max98090_board_info[] = {
+       [LAGUNA_ERSS_MAX_I2C_1_1_ADDR_10] = {
+               I2C_BOARD_INFO("max98090", 0x10),
+               .platform_data  = &laguna_max98090_pdata,
+       },
+};
+static struct i2c_board_info laguna_i2c1_2_max98090_board_info[] = {
+       [LAGUNA_ERSS_MAX_I2C_1_2_ADDR_10] = {
+               I2C_BOARD_INFO("max98090", 0x10),
+               .platform_data  = &laguna_max98090_pdata,
+       },
+};
+static struct i2c_board_info laguna_i2c1_3_max98090_board_info[] = {
+       [LAGUNA_ERSS_MAX_I2C_1_3_ADDR_10] = {
+               I2C_BOARD_INFO("max98090", 0x10),
+               .platform_data  = &laguna_max98090_pdata,
+       },
+};
+
+static void laguna_register_max98090(void)
+{
+       laguna_max98090_pdata.irq = gpio_to_irq(TEGRA_GPIO_PH4);
+
+       i2c_register_board_info(PCA954x_I2C_BUS0,
+                       laguna_i2c1_0_max98090_board_info,
+                       ARRAY_SIZE(laguna_i2c1_0_max98090_board_info));
+       i2c_register_board_info(PCA954x_I2C_BUS1,
+                       laguna_i2c1_1_max98090_board_info,
+                       ARRAY_SIZE(laguna_i2c1_1_max98090_board_info));
+       i2c_register_board_info(PCA954x_I2C_BUS2,
+                       laguna_i2c1_2_max98090_board_info,
+                       ARRAY_SIZE(laguna_i2c1_2_max98090_board_info));
+       i2c_register_board_info(PCA954x_I2C_BUS3,
+                       laguna_i2c1_3_max98090_board_info,
+                       ARRAY_SIZE(laguna_i2c1_3_max98090_board_info));
+}
+
 static struct i2c_board_info __initdata i2c_keyboard_board_info = {
        I2C_BOARD_INFO("hid", 0x3B),
        .platform_data  = &i2c_keyboard_pdata,
@@ -327,11 +377,29 @@ static struct tegra_asoc_platform_data ardbeg_audio_pdata_rt5639 = {
        },
 };
 
+static struct tegra_asoc_platform_data laguna_audio_pdata_max98090 = {
+       .gpio_hp_det = TEGRA_GPIO_HP_DET,
+       .gpio_hp_mute = -1,
+       .edp_support            = true,
+       .edp_states             = {1080, 842, 0},
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 1,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+               .channels       = 2,
+               .bit_clk        = 1536000,
+       },
+};
+
 static void ardbeg_audio_init(void)
 {
        struct board_info board_info;
        tegra_get_board_info(&board_info);
 
+       if (board_info.board_id == BOARD_PM359)
+               laguna_register_max98090();
+
        if (board_info.board_id == BOARD_PM359 ||
                        board_info.board_id == BOARD_PM358 ||
                        board_info.board_id == BOARD_PM370 ||
@@ -361,6 +429,9 @@ static void ardbeg_audio_init(void)
 
        ardbeg_audio_pdata_rt5639.codec_name = "rt5639.0-001c";
        ardbeg_audio_pdata_rt5639.codec_dai_name = "rt5639-aif1";
+
+       laguna_audio_pdata_max98090.codec_name = "max98090.7-0010";
+       laguna_audio_pdata_max98090.codec_dai_name = "HiFi";
 }
 
 static struct platform_device ardbeg_audio_device_rt5639 = {
@@ -371,6 +442,14 @@ static struct platform_device ardbeg_audio_device_rt5639 = {
        },
 };
 
+static struct platform_device laguna_audio_device_max98090 = {
+       .name = "tegra-snd-max98090",
+       .id = 0,
+       .dev = {
+               .platform_data = &laguna_audio_pdata_max98090,
+       },
+};
+
 static void __init ardbeg_uart_init(void)
 {
 
@@ -1186,7 +1265,9 @@ static void __init tegra_ardbeg_late_init(void)
        ardbeg_audio_init();
        platform_add_devices(ardbeg_devices, ARRAY_SIZE(ardbeg_devices));
 
-       if (board_info.board_id != BOARD_PM359)
+       if (board_info.board_id == BOARD_PM359) /* Laguna ERS-S */
+               platform_device_register(&laguna_audio_device_max98090);
+       else
                platform_device_register(&ardbeg_audio_device_rt5639);
 
        //tegra_ram_console_debug_init();
index 6e98f7d..2d95cb6 100644 (file)
@@ -530,6 +530,7 @@ static struct regulator_consumer_supply fixed_reg_3v3_supply[] = {
        REGULATOR_SUPPLY("vdd_sys_cam_3v3", NULL),
        REGULATOR_SUPPLY("micvdd", "tegra-snd-rt5645.0"),
        REGULATOR_SUPPLY("micvdd", "tegra-snd-rt5639.0"),
+       REGULATOR_SUPPLY("spkvdd", "tegra-snd-max98090.0"),
        REGULATOR_SUPPLY("vdd_gps_3v3", NULL),
        REGULATOR_SUPPLY("vdd_nfc_3v3", NULL),
        REGULATOR_SUPPLY("vdd_3v3_sensor", NULL),
@@ -562,6 +563,7 @@ static struct regulator_consumer_supply fixed_reg_dcdc_1v8_supply[] = {
        REGULATOR_SUPPLY("dbvdd", "tegra-snd-rt5639.0"),
        REGULATOR_SUPPLY("dmicvdd", "tegra-snd-rt5639.0"),
        REGULATOR_SUPPLY("dmicvdd", "tegra-snd-rt5645.0"),
+       REGULATOR_SUPPLY("vdd_aud_dgtl", "tegra-snd-max98090.0"),
        REGULATOR_SUPPLY("vdd_1v8b_nfc", NULL),
        REGULATOR_SUPPLY("vdd_1v8_sensor", NULL),
        REGULATOR_SUPPLY("vdd_1v8_sdmmc", NULL),
@@ -584,6 +586,7 @@ static struct regulator_consumer_supply fixed_reg_dcdc_1v8_supply[] = {
 /* gated by TCA6416 GPIO EXP GPIO0 */
 static struct regulator_consumer_supply fixed_reg_dcdc_1v2_supply[] = {
        REGULATOR_SUPPLY("vdd_1v2_en", NULL),
+       REGULATOR_SUPPLY("avdd_aud", "tegra-snd-max98090.0"),
 };
 
 /* AMS GPIO2 */