ARM: tegra: integration of slave mode support.
Ankit Gupta [Fri, 13 Jul 2012 09:28:18 +0000 (14:28 +0530)]
Add configurability support for i2s parameters accross all board.

ARM: tegra: board: add i2s params
Add configurability support for i2s parameters accross all board
files.
Signed-off-by: Ankit Gupta <ankitgupta@nvidia.com>
Change-Id: If58788b5126280b7e1dc8c66e9c96d0e71229b5e
Reviewed-on: http://git-master/r/111476
(cherry-picked from commit cac52867b0a0cad3b3c5bf46f08b0b94d0be2e02)

ARM: tegra: include: add configurability support for i2s params.
Add several variables for i2s configuration in platform data
structure.
Signed-off-by: Ankit Gupta <ankitgupta@nvidia.com>
Change-Id: Iea3930f308954471f170513234c2c02a8559ef98
Reviewed-on: http://git-master/r/111473
(cherry picked from commit 35e749770f6046fc82860f1152db2f5f579b9508)

Conflicts:

arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-harmony.c

Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Change-Id: Id6fd683f11c8768b46b4b7b80dc3fc1239753ed5
Reviewed-on: http://git-master/r/123329
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-harmony.c
arch/arm/mach-tegra/board-kai.c
arch/arm/mach-tegra/board-ventana.c
arch/arm/mach-tegra/board-whistler.c
arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h

index 237dd5f..e2835e4 100644 (file)
@@ -2,6 +2,7 @@
  * arch/arm/mach-tegra/board-cardhu.c
  *
  * Copyright (c) 2011-2012, NVIDIA Corporation.  All rights reserved.
+ * Copyright (c) 2011-2012, NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -730,12 +731,25 @@ static struct platform_device tegra_rtc_device = {
        .num_resources = ARRAY_SIZE(tegra_rtc_resources),
 };
 
-static struct tegra_wm8903_platform_data cardhu_audio_wm8903_pdata = {
+static struct tegra_asoc_platform_data cardhu_audio_wm8903_pdata = {
        .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
        .gpio_hp_det            = TEGRA_GPIO_HP_DET,
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct tegra_asoc_platform_data cardhu_audio_max98095_pdata = {
@@ -744,6 +758,19 @@ static struct tegra_asoc_platform_data cardhu_audio_max98095_pdata = {
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct platform_device cardhu_audio_wm8903_device = {
@@ -769,14 +796,17 @@ static struct tegra_asoc_platform_data cardhu_audio_aic326x_pdata = {
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
        /*defaults for Verbier-Cardhu board with TI AIC326X codec*/
-       .audio_port_id          = {
-               [HIFI_CODEC] = 0,
-               [BASEBAND] = -1,
-               [BT_SCO] = 3,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
        },
-       .baseband_param         = {
-               .rate = -1,
-               .channels = -1,
+       .i2s_param[BT_SCO]      = {
+               .sample_size    = 16,
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
        },
 };
 
index 4ffb95a..8e68132 100644 (file)
@@ -487,8 +487,6 @@ static void __init enterprise_uart_init(void)
                                ARRAY_SIZE(enterprise_uart_devices));
 }
 
-
-
 static struct resource tegra_rtc_resources[] = {
        [0] = {
                .start = TEGRA_RTC_BASE,
@@ -520,16 +518,27 @@ static struct tegra_asoc_platform_data enterprise_audio_pdata = {
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
-       .debounce_time_hp = -1,
+       .debounce_time_hp       = -1,
        /*defaults for Enterprise board*/
-       .audio_port_id          = {
-               [HIFI_CODEC] = 0,
-               [BASEBAND] = 2,
-               [BT_SCO] = 3,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
        },
-       .baseband_param         = {
-               .rate = 8000,
-               .channels = 1,
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = 2,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+               .rate           = 8000,
+               .channels       = 1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
        },
 };
 
@@ -548,15 +557,25 @@ static struct tegra_asoc_platform_data enterprise_audio_aic326x_pdata = {
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
        /*defaults for Verbier-Enterprise (E1197) board with TI AIC326X codec*/
-       .audio_port_id          = {
-               [HIFI_CODEC] = 0,
-               [BASEBAND] = 2,
-               [BT_SCO] = 3,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = 2,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+               .rate           = 8000,
+               .channels       = 1,
        },
-       .baseband_param         = {
-               .rate = 8000,
-               .channels = 1,
-               .bit_format = TEGRA_DAIFMT_DSP_A,
+       .i2s_param[BT_SCO]      = {
+               .sample_size    = 16,
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
        },
 };
 
@@ -863,12 +882,12 @@ static void enterprise_audio_init(void)
        tegra_get_board_info(&board_info);
 
        if (board_info.board_id == BOARD_E1197)
-               enterprise_audio_pdata.audio_port_id[HIFI_CODEC] = 1;
+               enterprise_audio_pdata.i2s_param[HIFI_CODEC].audio_port_id = 1;
        else if (board_info.fab == BOARD_FAB_A04) {
-               enterprise_audio_pdata.audio_port_id[BASEBAND] = 4;
+               enterprise_audio_pdata.i2s_param[BASEBAND].audio_port_id = 4;
                platform_device_register(&tegra_i2s_device4);
        } else {
-               enterprise_audio_pdata.audio_port_id[BASEBAND] = 2;
+               enterprise_audio_pdata.i2s_param[BASEBAND].audio_port_id = 2;
                platform_device_register(&tegra_i2s_device2);
        }
 
index 6f71662..02448a0 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2010 Google, Inc.
  * Copyright (C) 2011 NVIDIA, Inc.
+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -44,7 +45,7 @@
 #include <asm/hardware/gic.h>
 #include <asm/setup.h>
 
-#include <mach/tegra_wm8903_pdata.h>
+#include <mach/tegra_asoc_pdata.h>
 #include <mach/iomap.h>
 #include <mach/irqs.h>
 #include <mach/sdhci.h>
@@ -225,12 +226,25 @@ static struct platform_device harmony_gpio_keys_device = {
        }
 };
 
-static struct tegra_wm8903_platform_data harmony_audio_pdata = {
+static struct tegra_asoc_platform_data harmony_audio_pdata = {
        .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
        .gpio_hp_det            = TEGRA_GPIO_HP_DET,
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
        .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct platform_device harmony_audio_device = {
index 333cfe5..25ba922 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-kai.c
  *
- * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -55,7 +55,7 @@
 #include <mach/io.h>
 #include <mach/io_dpd.h>
 #include <mach/i2s.h>
-#include <mach/tegra_rt5640_pdata.h>
+#include <mach/tegra_asoc_pdata.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/usb_phy.h>
@@ -581,12 +581,25 @@ static struct platform_device tegra_rtc_device = {
        .num_resources = ARRAY_SIZE(tegra_rtc_resources),
 };
 
-static struct tegra_rt5640_platform_data kai_audio_pdata = {
+static struct tegra_asoc_platform_data kai_audio_pdata = {
        .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
        .gpio_hp_det            = TEGRA_GPIO_HP_DET,
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
        .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
+               .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct platform_device kai_audio_device = {
index 00fc459..0d51570 100644 (file)
@@ -2,6 +2,7 @@
  * arch/arm/mach-tegra/board-ventana.c
  *
  * Copyright (c) 2010-2011 NVIDIA Corporation.
+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,7 +52,7 @@
 #include <mach/iomap.h>
 #include <mach/io.h>
 #include <mach/i2s.h>
-#include <mach/tegra_wm8903_pdata.h>
+#include <mach/tegra_asoc_pdata.h>
 
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
@@ -356,12 +357,25 @@ static struct platform_device tegra_camera = {
        .id = -1,
 };
 
-static struct tegra_wm8903_platform_data ventana_audio_pdata = {
+static struct tegra_asoc_platform_data ventana_audio_pdata = {
        .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
        .gpio_hp_det            = TEGRA_GPIO_HP_DET,
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
        .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct platform_device ventana_audio_device = {
index bc83df6..80ffeef 100644 (file)
@@ -360,12 +360,32 @@ static struct platform_device tegra_camera = {
 };
 
 static struct tegra_asoc_platform_data whistler_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,
-       .debounce_time_hp = 200,
+       .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,
+       .debounce_time_hp       = 200,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = 2,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+               .rate           = 8000,
+               .channels       = 1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .sample_size    = 16,
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct platform_device whistler_audio_aic326x_device = {
index fff2fcc..7aada69 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/include/mach/tegra_asoc_pdata.h
  *
- * Copyright 2012 NVIDIA, Inc.
+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
 #define        TEGRA_DAIFMT_RIGHT_J            3
 #define        TEGRA_DAIFMT_LEFT_J             4
 
-struct baseband_config {
+struct i2s_config {
+       int audio_port_id;
+       int is_i2s_master;
+       int i2s_mode;
+       int sample_size;
        int rate;
        int channels;
-       int bit_format;
-       int is_master;
 };
 
 struct tegra_asoc_platform_data {
+       const char *codec_name;
+       const char *codec_dai_name;
        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;
+       struct i2s_config i2s_param[NUM_I2S_DEVICES];
 };