diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-06-08 11:12:16 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-06-08 11:12:16 -0400 |
commit | c226feb013ce81a18512fb4827bf7c2352d8b470 (patch) | |
tree | 4415ebda1c24f68bd7b88641f64097111eb359e0 /drivers/gpio | |
parent | 32919a28cc8470b1526f77b2f12cca8841b9ac62 (diff) | |
parent | 85ec7b970553369e0c956fab1d7a6022f2a99369 (diff) |
Merge branch 'for_3.0/gpio-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm into gpio/merge
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 6c51191da567..01f74a8459d9 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -432,7 +432,6 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
432 | { | 432 | { |
433 | void __iomem *base = bank->base; | 433 | void __iomem *base = bank->base; |
434 | u32 gpio_bit = 1 << gpio; | 434 | u32 gpio_bit = 1 << gpio; |
435 | u32 val; | ||
436 | 435 | ||
437 | if (cpu_is_omap44xx()) { | 436 | if (cpu_is_omap44xx()) { |
438 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, | 437 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, |
@@ -455,15 +454,8 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
455 | } | 454 | } |
456 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { | 455 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { |
457 | if (cpu_is_omap44xx()) { | 456 | if (cpu_is_omap44xx()) { |
458 | if (trigger != 0) | 457 | MOD_REG_BIT(OMAP4_GPIO_IRQWAKEN0, gpio_bit, |
459 | __raw_writel(1 << gpio, bank->base+ | 458 | trigger != 0); |
460 | OMAP4_GPIO_IRQWAKEN0); | ||
461 | else { | ||
462 | val = __raw_readl(bank->base + | ||
463 | OMAP4_GPIO_IRQWAKEN0); | ||
464 | __raw_writel(val & (~(1 << gpio)), bank->base + | ||
465 | OMAP4_GPIO_IRQWAKEN0); | ||
466 | } | ||
467 | } else { | 459 | } else { |
468 | /* | 460 | /* |
469 | * GPIO wakeup request can only be generated on edge | 461 | * GPIO wakeup request can only be generated on edge |
@@ -1134,8 +1126,11 @@ static void gpio_irq_shutdown(struct irq_data *d) | |||
1134 | { | 1126 | { |
1135 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1127 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1136 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1128 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1129 | unsigned long flags; | ||
1137 | 1130 | ||
1131 | spin_lock_irqsave(&bank->lock, flags); | ||
1138 | _reset_gpio(bank, gpio); | 1132 | _reset_gpio(bank, gpio); |
1133 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1139 | } | 1134 | } |
1140 | 1135 | ||
1141 | static void gpio_ack_irq(struct irq_data *d) | 1136 | static void gpio_ack_irq(struct irq_data *d) |
@@ -1150,9 +1145,12 @@ static void gpio_mask_irq(struct irq_data *d) | |||
1150 | { | 1145 | { |
1151 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1146 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1152 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1147 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1148 | unsigned long flags; | ||
1153 | 1149 | ||
1150 | spin_lock_irqsave(&bank->lock, flags); | ||
1154 | _set_gpio_irqenable(bank, gpio, 0); | 1151 | _set_gpio_irqenable(bank, gpio, 0); |
1155 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | 1152 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); |
1153 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1156 | } | 1154 | } |
1157 | 1155 | ||
1158 | static void gpio_unmask_irq(struct irq_data *d) | 1156 | static void gpio_unmask_irq(struct irq_data *d) |
@@ -1161,7 +1159,9 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
1161 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1159 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1162 | unsigned int irq_mask = 1 << get_gpio_index(gpio); | 1160 | unsigned int irq_mask = 1 << get_gpio_index(gpio); |
1163 | u32 trigger = irqd_get_trigger_type(d); | 1161 | u32 trigger = irqd_get_trigger_type(d); |
1162 | unsigned long flags; | ||
1164 | 1163 | ||
1164 | spin_lock_irqsave(&bank->lock, flags); | ||
1165 | if (trigger) | 1165 | if (trigger) |
1166 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); | 1166 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); |
1167 | 1167 | ||
@@ -1173,6 +1173,7 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
1173 | } | 1173 | } |
1174 | 1174 | ||
1175 | _set_gpio_irqenable(bank, gpio, 1); | 1175 | _set_gpio_irqenable(bank, gpio, 1); |
1176 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1176 | } | 1177 | } |
1177 | 1178 | ||
1178 | static struct irq_chip gpio_irq_chip = { | 1179 | static struct irq_chip gpio_irq_chip = { |
@@ -1524,7 +1525,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id) | |||
1524 | } | 1525 | } |
1525 | } | 1526 | } |
1526 | 1527 | ||
1527 | static void __init omap_gpio_chip_init(struct gpio_bank *bank) | 1528 | static void __devinit omap_gpio_chip_init(struct gpio_bank *bank) |
1528 | { | 1529 | { |
1529 | int j; | 1530 | int j; |
1530 | static int gpio; | 1531 | static int gpio; |