summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorBitan Biswas <bbiswas@nvidia.com>2011-11-15 14:39:02 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:50:16 -0800
commitd42e1fd52adbed786f13bd22dce41fee58146465 (patch)
treefb09283a2f4f41a2dd5f96a7267adcd22d6cf483 /drivers/gpio
parentc40df1b08359db110ef153d470e3e3da7a5ba575 (diff)
arm: tegra: power: lp0 wake enable modified
GPIO based lp0 wakeup needed to support search for its irq as well as GPIO bank irq in table. This is implemented in this change. lp0 wakeup irq enable using enable_irq_wake needs to be called in specific drivers. Additionally, in some cases wake irq needs to be updated in tegra wakeup table. bug 890309 bug 902114 Change-Id: I983318172ffb020f565763cfe2bb29018223dcd0 Reviewed-on: http://git-master/r/64395 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: Rffcadeee341a73f2ea6d62e31d507e9a8dce5a0e
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-tegra.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index b75ce0295ef6..94da36eadcf9 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -126,6 +126,19 @@ static void tegra_gpio_mask_write(u32 reg, int gpio, int value)
__raw_writel(val, reg);
}
+int tegra_gpio_get_bank_int_nr(int gpio)
+{
+ int bank;
+ int irq;
+ if (gpio >= TEGRA_NR_GPIOS) {
+ pr_warn("%s : Invalid gpio ID - %d\n", __func__, gpio);
+ return -EINVAL;
+ }
+ bank = gpio >> 5;
+ irq = tegra_gpio_banks[bank].irq;
+ return irq;
+}
+
void tegra_gpio_enable(int gpio)
{
if (gpio >= TEGRA_NR_GPIOS) {
@@ -167,7 +180,8 @@ static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset)
{
if ((__raw_readl(GPIO_OE(offset)) >> GPIO_BIT(offset)) & 0x1)
- return (__raw_readl(GPIO_OUT(offset)) >> GPIO_BIT(offset)) & 0x1;
+ return (__raw_readl(GPIO_OUT(offset)) >>
+ GPIO_BIT(offset)) & 0x1;
return (__raw_readl(GPIO_IN(offset)) >> GPIO_BIT(offset)) & 0x1;
}