Merge tag 'nfsd-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
[linux-2.6-block.git] / include / linux / irq_sim.h
CommitLineData
b5c5f395 1/* SPDX-License-Identifier: GPL-2.0+ */
b19af510 2/*
b5c5f395 3 * Copyright (C) 2017-2018 Bartosz Golaszewski <brgl@bgdev.pl>
337cbeb2 4 * Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
b19af510
BG
5 */
6
b5c5f395
BG
7#ifndef _LINUX_IRQ_SIM_H
8#define _LINUX_IRQ_SIM_H
9
44e72c7e 10#include <linux/device.h>
337cbeb2
BG
11#include <linux/fwnode.h>
12#include <linux/irqdomain.h>
b19af510
BG
13
14/*
15 * Provides a framework for allocating simulated interrupts which can be
16 * requested like normal irqs and enqueued from process context.
17 */
18
011f5837
BG
19struct irq_sim_ops {
20 int (*irq_sim_irq_requested)(struct irq_domain *domain,
21 irq_hw_number_t hwirq, void *data);
22 void (*irq_sim_irq_released)(struct irq_domain *domain,
23 irq_hw_number_t hwirq, void *data);
24};
25
337cbeb2
BG
26struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
27 unsigned int num_irqs);
28struct irq_domain *devm_irq_domain_create_sim(struct device *dev,
29 struct fwnode_handle *fwnode,
30 unsigned int num_irqs);
011f5837
BG
31struct irq_domain *irq_domain_create_sim_full(struct fwnode_handle *fwnode,
32 unsigned int num_irqs,
33 const struct irq_sim_ops *ops,
34 void *data);
35struct irq_domain *
36devm_irq_domain_create_sim_full(struct device *dev,
37 struct fwnode_handle *fwnode,
38 unsigned int num_irqs,
39 const struct irq_sim_ops *ops,
40 void *data);
337cbeb2 41void irq_domain_remove_sim(struct irq_domain *domain);
b19af510
BG
42
43#endif /* _LINUX_IRQ_SIM_H */