gpio/omap: remove suspend/resume callbacks
[deliverable/linux.git] / drivers / gpio / gpio-omap.c
index 1adc2ec1e3835ae98e230b160b63264eb0afb3bc..c89c38869c0c8f381cf5f3c64c0c1e73de3b9dd0 100644 (file)
@@ -57,14 +57,10 @@ struct gpio_bank {
        u16 irq;
        int irq_base;
        struct irq_domain *domain;
-       u32 suspend_wakeup;
-       u32 saved_wakeup;
        u32 non_wakeup_gpios;
        u32 enabled_non_wakeup_gpios;
        struct gpio_regs context;
        u32 saved_datain;
-       u32 saved_fallingdetect;
-       u32 saved_risingdetect;
        u32 level_mask;
        u32 toggle_mask;
        spinlock_t lock;
@@ -516,11 +512,11 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
 
        spin_lock_irqsave(&bank->lock, flags);
        if (enable)
-               bank->suspend_wakeup |= gpio_bit;
+               bank->context.wake_en |= gpio_bit;
        else
-               bank->suspend_wakeup &= ~gpio_bit;
+               bank->context.wake_en &= ~gpio_bit;
 
-       __raw_writel(bank->suspend_wakeup, bank->base + bank->regs->wkup_en);
+       __raw_writel(bank->context.wake_en, bank->base + bank->regs->wkup_en);
        spin_unlock_irqrestore(&bank->lock, flags);
 
        return 0;
@@ -640,7 +636,6 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
        u32 isr;
        unsigned int gpio_irq, gpio_index;
        struct gpio_bank *bank;
-       u32 retrigger = 0;
        int unmasked = 0;
        struct irq_chip *chip = irq_desc_get_chip(desc);
 
@@ -677,8 +672,6 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
                        chained_irq_exit(chip, desc);
                }
 
-               isr |= retrigger;
-               retrigger = 0;
                if (!isr)
                        break;
 
@@ -789,8 +782,7 @@ static int omap_mpuio_suspend_noirq(struct device *dev)
        unsigned long           flags;
 
        spin_lock_irqsave(&bank->lock, flags);
-       bank->saved_wakeup = __raw_readl(mask_reg);
-       __raw_writel(0xffff & ~bank->suspend_wakeup, mask_reg);
+       __raw_writel(0xffff & ~bank->context.wake_en, mask_reg);
        spin_unlock_irqrestore(&bank->lock, flags);
 
        return 0;
@@ -805,7 +797,7 @@ static int omap_mpuio_resume_noirq(struct device *dev)
        unsigned long           flags;
 
        spin_lock_irqsave(&bank->lock, flags);
-       __raw_writel(bank->saved_wakeup, mask_reg);
+       __raw_writel(bank->context.wake_en, mask_reg);
        spin_unlock_irqrestore(&bank->lock, flags);
 
        return 0;
@@ -965,18 +957,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
        }
 
        _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv);
-       _gpio_rmw(base, bank->regs->irqstatus, l,
-                                       bank->regs->irqenable_inv == false);
-       _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->debounce_en != 0);
-       _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->ctrl != 0);
+       _gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv);
        if (bank->regs->debounce_en)
-               _gpio_rmw(base, bank->regs->debounce_en, 0, 1);
+               __raw_writel(0, base + bank->regs->debounce_en);
 
        /* Save OE default value (0xffffffff) in the context */
        bank->context.oe = __raw_readl(bank->base + bank->regs->direction);
         /* Initialize interface clk ungated, module enabled */
        if (bank->regs->ctrl)
-               _gpio_rmw(base, bank->regs->ctrl, 0, 1);
+               __raw_writel(0, base + bank->regs->ctrl);
 }
 
 static __devinit void
@@ -1155,54 +1144,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_ARCH_OMAP2PLUS
 
-#if defined(CONFIG_PM_SLEEP)
-static int omap_gpio_suspend(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct gpio_bank *bank = platform_get_drvdata(pdev);
-       void __iomem *base = bank->base;
-       void __iomem *wakeup_enable;
-       unsigned long flags;
-
-       if (!bank->mod_usage || !bank->loses_context)
-               return 0;
-
-       if (!bank->regs->wkup_en || !bank->suspend_wakeup)
-               return 0;
-
-       wakeup_enable = bank->base + bank->regs->wkup_en;
-
-       spin_lock_irqsave(&bank->lock, flags);
-       bank->saved_wakeup = __raw_readl(wakeup_enable);
-       _gpio_rmw(base, bank->regs->wkup_en, 0xffffffff, 0);
-       _gpio_rmw(base, bank->regs->wkup_en, bank->suspend_wakeup, 1);
-       spin_unlock_irqrestore(&bank->lock, flags);
-
-       return 0;
-}
-
-static int omap_gpio_resume(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct gpio_bank *bank = platform_get_drvdata(pdev);
-       void __iomem *base = bank->base;
-       unsigned long flags;
-
-       if (!bank->mod_usage || !bank->loses_context)
-               return 0;
-
-       if (!bank->regs->wkup_en || !bank->saved_wakeup)
-               return 0;
-
-       spin_lock_irqsave(&bank->lock, flags);
-       _gpio_rmw(base, bank->regs->wkup_en, 0xffffffff, 0);
-       _gpio_rmw(base, bank->regs->wkup_en, bank->saved_wakeup, 1);
-       spin_unlock_irqrestore(&bank->lock, flags);
-
-       return 0;
-}
-#endif /* CONFIG_PM_SLEEP */
-
 #if defined(CONFIG_PM_RUNTIME)
 static void omap_gpio_restore_context(struct gpio_bank *bank);
 
@@ -1247,11 +1188,9 @@ static int omap_gpio_runtime_suspend(struct device *dev)
         */
        bank->saved_datain = __raw_readl(bank->base +
                                                bank->regs->datain);
-       l1 = __raw_readl(bank->base + bank->regs->fallingdetect);
-       l2 = __raw_readl(bank->base + bank->regs->risingdetect);
+       l1 = bank->context.fallingdetect;
+       l2 = bank->context.risingdetect;
 
-       bank->saved_fallingdetect = l1;
-       bank->saved_risingdetect = l2;
        l1 &= ~bank->enabled_non_wakeup_gpios;
        l2 &= ~bank->enabled_non_wakeup_gpios;
 
@@ -1310,9 +1249,9 @@ static int omap_gpio_runtime_resume(struct device *dev)
                }
        }
 
-       __raw_writel(bank->saved_fallingdetect,
+       __raw_writel(bank->context.fallingdetect,
                        bank->base + bank->regs->fallingdetect);
-       __raw_writel(bank->saved_risingdetect,
+       __raw_writel(bank->context.risingdetect,
                        bank->base + bank->regs->risingdetect);
        l = __raw_readl(bank->base + bank->regs->datain);
 
@@ -1329,14 +1268,15 @@ static int omap_gpio_runtime_resume(struct device *dev)
         * No need to generate IRQs for the rising edge for gpio IRQs
         * configured with falling edge only; and vice versa.
         */
-       gen0 = l & bank->saved_fallingdetect;
+       gen0 = l & bank->context.fallingdetect;
        gen0 &= bank->saved_datain;
 
-       gen1 = l & bank->saved_risingdetect;
+       gen1 = l & bank->context.risingdetect;
        gen1 &= ~(bank->saved_datain);
 
        /* FIXME: Consider GPIO IRQs with level detections properly! */
-       gen = l & (~(bank->saved_fallingdetect) & ~(bank->saved_risingdetect));
+       gen = l & (~(bank->context.fallingdetect) &
+                                        ~(bank->context.risingdetect));
        /* Consider all GPIO IRQs needed to be updated */
        gen |= gen0 | gen1;
 
@@ -1432,14 +1372,11 @@ static void omap_gpio_restore_context(struct gpio_bank *bank)
 }
 #endif /* CONFIG_PM_RUNTIME */
 #else
-#define omap_gpio_suspend NULL
-#define omap_gpio_resume NULL
 #define omap_gpio_runtime_suspend NULL
 #define omap_gpio_runtime_resume NULL
 #endif
 
 static const struct dev_pm_ops gpio_pm_ops = {
-       SET_SYSTEM_SLEEP_PM_OPS(omap_gpio_suspend, omap_gpio_resume)
        SET_RUNTIME_PM_OPS(omap_gpio_runtime_suspend, omap_gpio_runtime_resume,
                                                                        NULL)
 };
This page took 0.027992 seconds and 5 git commands to generate.