pinctrl: tegra: set tristate =1 and input =0 for unused pins
Laxman Dewangan [Thu, 29 May 2014 12:24:41 +0000 (17:24 +0530)]
Set the tristate bit to 1 and e_input to 0 for unused pins
to set it on low power and avoid conflict with any other pins.

Bug 200033491

Change-Id: If83f6129dbf6c6fe28a7a7c596e5a3858a894914
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/416649
(cherry picked from commit 7e81b36f87cffdc5d473a39735877a1432ac3151)
Reviewed-on: http://git-master/r/498328
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>

drivers/pinctrl/pinctrl-tegra.c

index 77970f4..5f3a110 100644 (file)
@@ -58,6 +58,9 @@ struct tegra_pmx {
 
 static struct tegra_pmx *pmx;
 
+static int tegra_pinconf_group_set(struct pinctrl_dev *pctldev,
+                  unsigned group, unsigned long config);
+
 static inline u32 pmx_readl(struct tegra_pmx *pmx, u32 bank, u32 reg)
 {
        return readl(pmx->regs[bank] + reg);
@@ -370,6 +373,21 @@ static int tegra_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
        return 0;
 }
 
+static int tegra_pinconfig_froup_set(struct pinctrl_dev *pctldev,
+               unsigned group, unsigned long param, unsigned long arg)
+{
+       unsigned long config;
+       int ret;
+
+       config = TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, arg);
+       ret = tegra_pinconf_group_set(pctldev, group, config);
+       if (ret < 0)
+               dev_err(pctldev->dev,
+                       "Pinctrl group %u tristate config failed: %d\n",
+                       group, ret);
+       return ret;
+}
+
 static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned req_function,
                               unsigned group)
 {
@@ -379,6 +397,7 @@ static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned req_functi
        int i;
        u32 val;
        unsigned long flags;
+       int ret;
 
        g = &pmx->soc->groups[group];