xref: /linux/include/linux/irq_sim.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1b5c5f395SBartosz Golaszewski /* SPDX-License-Identifier: GPL-2.0+ */
2b5c5f395SBartosz Golaszewski /*
3b5c5f395SBartosz Golaszewski  * Copyright (C) 2017-2018 Bartosz Golaszewski <brgl@bgdev.pl>
4337cbeb2SBartosz Golaszewski  * Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
5b5c5f395SBartosz Golaszewski  */
6b5c5f395SBartosz Golaszewski 
7b19af510SBartosz Golaszewski #ifndef _LINUX_IRQ_SIM_H
8b19af510SBartosz Golaszewski #define _LINUX_IRQ_SIM_H
9b19af510SBartosz Golaszewski 
1044e72c7eSBartosz Golaszewski #include <linux/device.h>
11337cbeb2SBartosz Golaszewski #include <linux/fwnode.h>
12337cbeb2SBartosz Golaszewski #include <linux/irqdomain.h>
13b19af510SBartosz Golaszewski 
14b19af510SBartosz Golaszewski /*
15b19af510SBartosz Golaszewski  * Provides a framework for allocating simulated interrupts which can be
16b19af510SBartosz Golaszewski  * requested like normal irqs and enqueued from process context.
17b19af510SBartosz Golaszewski  */
18b19af510SBartosz Golaszewski 
19*011f5837SBartosz Golaszewski struct irq_sim_ops {
20*011f5837SBartosz Golaszewski 	int (*irq_sim_irq_requested)(struct irq_domain *domain,
21*011f5837SBartosz Golaszewski 				     irq_hw_number_t hwirq, void *data);
22*011f5837SBartosz Golaszewski 	void (*irq_sim_irq_released)(struct irq_domain *domain,
23*011f5837SBartosz Golaszewski 				     irq_hw_number_t hwirq, void *data);
24*011f5837SBartosz Golaszewski };
25*011f5837SBartosz Golaszewski 
26337cbeb2SBartosz Golaszewski struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
2744e72c7eSBartosz Golaszewski 					 unsigned int num_irqs);
28337cbeb2SBartosz Golaszewski struct irq_domain *devm_irq_domain_create_sim(struct device *dev,
29337cbeb2SBartosz Golaszewski 					      struct fwnode_handle *fwnode,
30337cbeb2SBartosz Golaszewski 					      unsigned int num_irqs);
31*011f5837SBartosz Golaszewski struct irq_domain *irq_domain_create_sim_full(struct fwnode_handle *fwnode,
32*011f5837SBartosz Golaszewski 					      unsigned int num_irqs,
33*011f5837SBartosz Golaszewski 					      const struct irq_sim_ops *ops,
34*011f5837SBartosz Golaszewski 					      void *data);
35*011f5837SBartosz Golaszewski struct irq_domain *
36*011f5837SBartosz Golaszewski devm_irq_domain_create_sim_full(struct device *dev,
37*011f5837SBartosz Golaszewski 				struct fwnode_handle *fwnode,
38*011f5837SBartosz Golaszewski 				unsigned int num_irqs,
39*011f5837SBartosz Golaszewski 				const struct irq_sim_ops *ops,
40*011f5837SBartosz Golaszewski 				void *data);
41337cbeb2SBartosz Golaszewski void irq_domain_remove_sim(struct irq_domain *domain);
42b19af510SBartosz Golaszewski 
43b19af510SBartosz Golaszewski #endif /* _LINUX_IRQ_SIM_H */
44