mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-01 22:18:04 +07:00
gpio/omap: cleanup _set_gpio_wakeup(), remove ifdefs
Make _set_gpio_wakeup() generic by removing ifdefs. Code for the various SoCs/bank-methods was already the same, except for the non-wakeup GPIO checking. But that flag is set on a per-SoC basis, so can be used for all SoCs. While here, use dev_err() and remove GPIO bank calculation assumption based on subtracting bank pointers. Signed-off-by: Kevin Hilman <khilman@ti.com>
This commit is contained in:
parent
7a6f8416e2
commit
f64ad1a0e2
@ -525,42 +525,24 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena
|
|||||||
*/
|
*/
|
||||||
static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
|
static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
|
||||||
{
|
{
|
||||||
unsigned long uninitialized_var(flags);
|
u32 gpio_bit = GPIO_BIT(bank, gpio);
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
switch (bank->method) {
|
if (bank->non_wakeup_gpios & gpio_bit) {
|
||||||
#ifdef CONFIG_ARCH_OMAP16XX
|
dev_err(bank->dev,
|
||||||
case METHOD_MPUIO:
|
"Unable to modify wakeup on non-wakeup GPIO%d\n", gpio);
|
||||||
case METHOD_GPIO_1610:
|
|
||||||
spin_lock_irqsave(&bank->lock, flags);
|
|
||||||
if (enable)
|
|
||||||
bank->suspend_wakeup |= (1 << gpio);
|
|
||||||
else
|
|
||||||
bank->suspend_wakeup &= ~(1 << gpio);
|
|
||||||
spin_unlock_irqrestore(&bank->lock, flags);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_ARCH_OMAP2PLUS
|
|
||||||
case METHOD_GPIO_24XX:
|
|
||||||
case METHOD_GPIO_44XX:
|
|
||||||
if (bank->non_wakeup_gpios & (1 << gpio)) {
|
|
||||||
printk(KERN_ERR "Unable to modify wakeup on "
|
|
||||||
"non-wakeup GPIO%d\n",
|
|
||||||
(bank - gpio_bank) * bank->width + gpio);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&bank->lock, flags);
|
spin_lock_irqsave(&bank->lock, flags);
|
||||||
if (enable)
|
if (enable)
|
||||||
bank->suspend_wakeup |= (1 << gpio);
|
bank->suspend_wakeup |= gpio_bit;
|
||||||
else
|
else
|
||||||
bank->suspend_wakeup &= ~(1 << gpio);
|
bank->suspend_wakeup &= ~gpio_bit;
|
||||||
|
|
||||||
spin_unlock_irqrestore(&bank->lock, flags);
|
spin_unlock_irqrestore(&bank->lock, flags);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
printk(KERN_ERR "Can't enable GPIO wakeup for method %i\n",
|
|
||||||
bank->method);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _reset_gpio(struct gpio_bank *bank, int gpio)
|
static void _reset_gpio(struct gpio_bank *bank, int gpio)
|
||||||
@ -579,7 +561,7 @@ static int gpio_wake_enable(struct irq_data *d, unsigned int enable)
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
bank = irq_data_get_irq_chip_data(d);
|
bank = irq_data_get_irq_chip_data(d);
|
||||||
retval = _set_gpio_wakeup(bank, GPIO_INDEX(bank, gpio), enable);
|
retval = _set_gpio_wakeup(bank, gpio, enable);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user