Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright 2010 Ben Dooks <ben-linux@fluff.org>
0004 //
0005 // Support for wakeup mask interrupts on newer SoCs
0006 
0007 #include <linux/kernel.h>
0008 #include <linux/spinlock.h>
0009 #include <linux/device.h>
0010 #include <linux/types.h>
0011 #include <linux/irq.h>
0012 #include <linux/io.h>
0013 
0014 #include "wakeup-mask.h"
0015 #include "pm.h"
0016 
0017 void samsung_sync_wakemask(void __iomem *reg,
0018                const struct samsung_wakeup_mask *mask, int nr_mask)
0019 {
0020     struct irq_data *data;
0021     u32 val;
0022 
0023     val = __raw_readl(reg);
0024 
0025     for (; nr_mask > 0; nr_mask--, mask++) {
0026         if (mask->irq == NO_WAKEUP_IRQ) {
0027             val |= mask->bit;
0028             continue;
0029         }
0030 
0031         data = irq_get_irq_data(mask->irq);
0032 
0033         /* bit of a liberty to read this directly from irq_data. */
0034         if (irqd_is_wakeup_set(data))
0035             val &= ~mask->bit;
0036         else
0037             val |= mask->bit;
0038     }
0039 
0040     printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
0041     __raw_writel(val, reg);
0042 }