arm: tegra: p1852: Fixes for I2S master mode
Nitin Pai [Tue, 10 Jul 2012 13:31:34 +0000 (18:31 +0530)]
Change the Drive strength of DAP1 for I2S to operate in both
master and slave mode.
Changed the Pull Up/Down mechanism for I2S4 to operate in master/slave
mode.

Bug 1009249

Signed-off-by: Nitin Pai <npai@nvidia.com>
Reviewed-on: http://git-master/r/114587
(cherry picked from commit 29ec5dfb81b823880f393bece5daf5396ef77629)
Change-Id: I24a252370b993150a553c9f81fb44e6d8f86589a
Reviewed-on: http://git-master/r/118251
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/board-p1852-pinmux.c
arch/arm/mach-tegra/board-p1852.c
arch/arm/mach-tegra/board-p1852.h

index 21f310b..bb28e27 100644 (file)
@@ -119,13 +119,8 @@ static __initdata struct tegra_drive_pingroup_config p1852_drive_pinmux[] = {
        SET_DRIVE(GMH,  DISABLE, ENABLE, DIV_1, 0,  12, SLOWEST, SLOWEST),
 
        /* I2S/TDM */
-#ifdef CONFIG_TEGRA_MODS
        SET_DRIVE(DAP1, ENABLE, ENABLE, DIV_1, 20,  20, SLOWEST, SLOWEST),
        SET_DRIVE(DAP3, ENABLE, ENABLE, DIV_1, 20,  20, SLOWEST, SLOWEST),
-#else
-       SET_DRIVE(DAP1, ENABLE, ENABLE, DIV_1, 3,  3, SLOWEST, SLOWEST),
-       SET_DRIVE(DAP3, ENABLE, ENABLE, DIV_1, 3,  3, SLOWEST, SLOWEST),
-#endif
 
        /* SPI */
        SET_DRIVE(UAD,          DISABLE, ENABLE, DIV_1, 4, 1, SLOWEST, SLOWEST),
@@ -184,6 +179,9 @@ static __initdata struct tegra_drive_pingroup_config p1852_drive_pinmux[] = {
        }
 
 
+static __initdata struct tegra_pingroup_config p1852_pinmux_i2s4_master[] = {
+       DEFAULT_PINMUX(SDMMC4_CLK,    NAND,   PULL_UP,    NORMAL, INPUT),
+};
 
 static __initdata struct tegra_pingroup_config p1852_pinmux_common[] = {
        /* SDMMC1 pinmux */
@@ -291,10 +289,10 @@ static __initdata struct tegra_pingroup_config p1852_pinmux_common[] = {
        DEFAULT_PINMUX(DAP3_SCLK,       I2S2,           NORMAL,         NORMAL,         INPUT),
 
        /* DAP3 */
-       LVPAD_PINMUX(SDMMC4_DAT4,       I2S4,           NORMAL,         NORMAL,         INPUT,  DISABLE,        DISABLE),
-       LVPAD_PINMUX(SDMMC4_DAT5,       I2S4,           NORMAL,         NORMAL,         INPUT,  DISABLE,        DISABLE),
-       LVPAD_PINMUX(SDMMC4_DAT6,       I2S4,           NORMAL,         NORMAL,         INPUT,  DISABLE,        DISABLE),
-       LVPAD_PINMUX(SDMMC4_DAT7,       I2S4,           NORMAL,         NORMAL,         INPUT,  DISABLE,        DISABLE),
+       DEFAULT_PINMUX(SDMMC4_DAT4,     I2S4,           NORMAL,         NORMAL,         INPUT),
+       DEFAULT_PINMUX(SDMMC4_DAT5,     I2S4,           NORMAL,         NORMAL,         INPUT),
+       DEFAULT_PINMUX(SDMMC4_DAT6,     I2S4,           NORMAL,         NORMAL,         INPUT),
+       DEFAULT_PINMUX(SDMMC4_DAT7,     I2S4,           NORMAL,         NORMAL,         INPUT),
 
        /* NOR pinmux */
        DEFAULT_PINMUX(GMI_AD0,         GMI,            NORMAL,         NORMAL,         INPUT),
@@ -427,7 +425,7 @@ static __initdata struct tegra_pingroup_config p1852_pinmux_common[] = {
        DEFAULT_PINMUX(GPIO_PV2,        RSVD1,  NORMAL, NORMAL, INPUT),
        DEFAULT_PINMUX(GPIO_PV3,        RSVD1,  NORMAL, NORMAL, INPUT),
        DEFAULT_PINMUX(SDMMC3_DAT7,     SDMMC3, NORMAL, NORMAL, INPUT),
-       LVPAD_PINMUX(SDMMC4_CLK,        NAND,   NORMAL, NORMAL, INPUT,  DISABLE,        DISABLE),
+       DEFAULT_PINMUX(SDMMC4_CLK,      NAND,   NORMAL, NORMAL, INPUT),
        DEFAULT_PINMUX(SDMMC3_CMD,      SDMMC3, NORMAL, NORMAL, INPUT),
        DEFAULT_PINMUX(SDMMC3_DAT3,     RSVD0,  NORMAL, NORMAL, INPUT),
        DEFAULT_PINMUX(VI_D1,           RSVD1,  NORMAL, NORMAL, INPUT),
@@ -445,6 +443,12 @@ int __init p1852_pinmux_init(void)
        return 0;
 }
 
+int p1852_pinmux_set_i2s4_master(void)
+{
+       tegra_pinmux_config_table(p1852_pinmux_i2s4_master,
+                                       ARRAY_SIZE(p1852_pinmux_i2s4_master));
+       return 0;
+}
 #define GPIO_INIT_PIN_MODE(_gpio, _is_input, _value)   \
        {                                       \
                .gpio_nr        = _gpio,        \
index b0a593f..e9cf144 100644 (file)
@@ -198,7 +198,6 @@ static void __init p1852_uart_init(void)
        platform_add_devices(p1852_uart_devices,
                                ARRAY_SIZE(p1852_uart_devices));
 }
-
 #if defined(CONFIG_TEGRA_P1852_TDM)
 static struct tegra_p1852_platform_data p1852_audio_tdm_pdata = {
        .codec_info[0] = {
@@ -241,6 +240,7 @@ static struct tegra_p1852_platform_data p1852_audio_i2s_pdata = {
                .name = "tegra-i2s-1",
                .pcm_driver = "tegra-pcm-audio",
                .i2s_format = format_i2s,
+               /* Defines whether the Audio codec chip is master or slave */
                .master = 1,
        },
        .codec_info[1] = {
@@ -250,6 +250,7 @@ static struct tegra_p1852_platform_data p1852_audio_i2s_pdata = {
                .name = "tegra-i2s-2",
                .pcm_driver = "tegra-pcm-audio",
                .i2s_format = format_i2s,
+               /* Defines whether the Audio codec chip is master or slave */
                .master = 0,
        },
 };
@@ -277,6 +278,8 @@ static struct platform_device tegra_snd_p1852 = {
 
 static void p1852_i2s_audio_init(void)
 {
+       struct tegra_p1852_platform_data *pdata;
+
        platform_device_register(&tegra_pcm_device);
        platform_device_register(&tegra_tdm_pcm_device);
        platform_device_register(&generic_codec_1);
@@ -285,6 +288,11 @@ static void p1852_i2s_audio_init(void)
        platform_device_register(&tegra_i2s_device4);
        platform_device_register(&tegra_ahub_device);
        platform_device_register(&tegra_snd_p1852);
+
+       /* Change pinmux of I2S4 for master mode */
+       pdata = tegra_snd_p1852.dev.platform_data;
+       if (!pdata->codec_info[1].master)
+               p1852_pinmux_set_i2s4_master();
 }
 
 
index 529bd38..7de6a6b 100644 (file)
 
 int p1852_sdhci_init(void);
 int p1852_pinmux_init(void);
+int p1852_pinmux_set_i2s4_master(void);
 int p1852_panel_init(void);
 int p1852_gpio_init(void);
 int p1852_pins_state_init(void);