arm: tegra: cardhu: setting pin GMI_CS1_N to gpio-input mode.
Laxman Dewangan [Mon, 28 Feb 2011 09:30:37 +0000 (14:30 +0530)]
Setting pin GMI_CS1_N to gpio input mode to avoid signal driving
conflict between charger status and AP.

bug 797053

Original-Change-Id: I0890966d489459c62462f476da99b7c502da723b
Reviewed-on: http://git-master/r/21097
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Ramachandrudu Kandhala <rkandhala@nvidia.com>
Original-Change-Id: I38f9c21dd9ff3ce688957a9466b02d92910d5f18

Rebase-Id: R79903828792e59f11bc807d29f192fd7fe4534ae

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

index 4ed5d3a..4c35cd7 100644 (file)
@@ -17,6 +17,9 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <mach/pinmux.h>
+#include "board.h"
+#include "board-cardhu.h"
+#include "gpio-names.h"
 
 #define DEFAULT_DRIVE(_name)                                   \
        {                                                       \
@@ -398,9 +401,39 @@ static __initdata struct tegra_pingroup_config cardhu_pinmux[] = {
        VI_PINMUX(VI_VSYNC,        RSVD1,           NORMAL,    NORMAL,     INPUT,  DISABLE, DISABLE),
 };
 
-void __init cardhu_pinmux_init(void)
+int __init cardhu_pinmux_init(void)
 {
        tegra_pinmux_config_table(cardhu_pinmux, ARRAY_SIZE(cardhu_pinmux));
        tegra_drive_pinmux_config_table(cardhu_drive_pinmux,
                                        ARRAY_SIZE(cardhu_drive_pinmux));
+       return 0;
+}
+
+/* Initialize the pins to desired state as per power/asic/system-eng
+ * recomendation */
+int __init cardhu_pins_state_init(void)
+{
+       int ret;
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
+       if (board_info.board_id == BOARD_E1291) {
+
+               /* Set GMI_CS1_N Signal in GPIO Input Mode*/
+               ret = gpio_request(TEGRA_GPIO_PJ2, "GMI_CS1_N");
+               if (ret < 0) {
+                       pr_err("%s() Error in gpio_request() for gpio %d\n",
+                                       __func__, TEGRA_GPIO_PJ2);
+                       return ret;
+               }
+               ret = gpio_direction_input(TEGRA_GPIO_PJ2);
+               if (ret < 0) {
+                       pr_err("%s() Error in setting gpio %d to input\n",
+                               __func__, TEGRA_GPIO_PJ2);
+                       gpio_free(TEGRA_GPIO_PJ2);
+                       return ret;
+               }
+               tegra_gpio_enable(TEGRA_GPIO_PJ2);
+       }
+       return 0;
 }
index f19ac23..62c57d9 100644 (file)
@@ -393,6 +393,7 @@ static void __init tegra_cardhu_init(void)
        cardhu_bt_rfkill();
        cardhu_sata_init();
        audio_wired_jack_init();
+       cardhu_pins_state_init();
 }
 
 static void __init tegra_cardhu_reserve(void)
index ba10392..a03f34b 100644 (file)
@@ -117,5 +117,6 @@ int cardhu_kbc_init(void);
 int cardhu_scroll_init(void);
 int cardhu_keys_init(void);
 int cardhu_gpio_switch_regulator_init(void);
+int cardhu_pins_state_init(void);
 
 #endif