]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/irq_sim.h
regulator: ab8500: Remove AB8505 USB regulator
[mirror_ubuntu-bionic-kernel.git] / include / linux / irq_sim.h
CommitLineData
b19af510
BG
1#ifndef _LINUX_IRQ_SIM_H
2#define _LINUX_IRQ_SIM_H
3/*
4 * Copyright (C) 2017 Bartosz Golaszewski <brgl@bgdev.pl>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/irq_work.h>
44e72c7e 13#include <linux/device.h>
b19af510
BG
14
15/*
16 * Provides a framework for allocating simulated interrupts which can be
17 * requested like normal irqs and enqueued from process context.
18 */
19
20struct irq_sim_work_ctx {
21 struct irq_work work;
22 int irq;
23};
24
25struct irq_sim_irq_ctx {
26 int irqnum;
27 bool enabled;
28};
29
30struct irq_sim {
31 struct irq_sim_work_ctx work_ctx;
32 int irq_base;
33 unsigned int irq_count;
34 struct irq_sim_irq_ctx *irqs;
35};
36
37int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs);
44e72c7e
BG
38int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
39 unsigned int num_irqs);
b19af510
BG
40void irq_sim_fini(struct irq_sim *sim);
41void irq_sim_fire(struct irq_sim *sim, unsigned int offset);
42int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset);
43
44#endif /* _LINUX_IRQ_SIM_H */