diff options
author | aghuge <aghuge@nvidia.com> | 2012-12-04 17:06:27 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-12-20 15:03:42 -0800 |
commit | 7aeea222eb335388c784278045009bcf3a715001 (patch) | |
tree | 95f69dc4039cb97eba28fddca3266b54b9bbee75 /drivers/gpio | |
parent | c27103c60370a1a62336a7e47a5d225d2c136acc (diff) |
gpio: tegra: add tegra_is_gpio
Added tegra_is_gpio function to
return true if pin is configured as gpio
Bug 1172972
Signed-off-by: aghuge <aghuge@nvidia.com>
Reviewed-on: http://git-master/r/168285
(cherry picked from commit 312fc9fc203f77c2521a24991608511be0465695)
Change-Id: Ieac0af9a6ee000cbeb73e714395169799ae18e3b
Signed-off-by: aghuge <aghuge@nvidia.com>
Reviewed-on: http://git-master/r/172625
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 5c3d55e442e3..d2266541c6e0 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -145,6 +145,17 @@ static void tegra_gpio_enable(int gpio) tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1); } +int tegra_is_gpio(int gpio) +{ + if (gpio >= TEGRA_NR_GPIOS) { + pr_warn("%s : Invalid gpio ID - %d\n", __func__, gpio); + return 0; + } + return (tegra_gpio_readl(GPIO_CNF(gpio)) >> GPIO_BIT(gpio)) & 0x1; +} +EXPORT_SYMBOL(tegra_is_gpio); + + static void tegra_gpio_disable(int gpio) { if (gpio >= TEGRA_NR_GPIOS) { |