Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) // Copyright 2010 Ben Dooks <ben-linux@fluff.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) // Support for wakeup mask interrupts on newer SoCs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "wakeup-mask.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void samsung_sync_wakemask(void __iomem *reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 			   const struct samsung_wakeup_mask *mask, int nr_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct irq_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	u32 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	val = __raw_readl(reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	for (; nr_mask > 0; nr_mask--, mask++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		if (mask->irq == NO_WAKEUP_IRQ) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 			val |= mask->bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		data = irq_get_irq_data(mask->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		/* bit of a liberty to read this directly from irq_data. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		if (irqd_is_wakeup_set(data))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 			val &= ~mask->bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 			val |= mask->bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	__raw_writel(val, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }