mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
011f583781
Currently users of the interrupt simulator don't have any way of being notified about interrupts from the simulated domain being requested or released. This causes a problem for one of the users - the GPIO simulator - which is unable to lock the pins as interrupts. Define a structure containing callbacks to be executed on various irq_sim-related events (for now: irq request and release) and provide an extended function for creating simulated interrupt domains that takes it and a pointer to custom user data (to be passed to said callbacks) as arguments. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20240624093934.17089-2-brgl@bgdev.pl Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Copyright (C) 2017-2018 Bartosz Golaszewski <brgl@bgdev.pl>
|
|
* Copyright (C) 2020 Bartosz Golaszewski <bgolaszewski@baylibre.com>
|
|
*/
|
|
|
|
#ifndef _LINUX_IRQ_SIM_H
|
|
#define _LINUX_IRQ_SIM_H
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/fwnode.h>
|
|
#include <linux/irqdomain.h>
|
|
|
|
/*
|
|
* Provides a framework for allocating simulated interrupts which can be
|
|
* requested like normal irqs and enqueued from process context.
|
|
*/
|
|
|
|
struct irq_sim_ops {
|
|
int (*irq_sim_irq_requested)(struct irq_domain *domain,
|
|
irq_hw_number_t hwirq, void *data);
|
|
void (*irq_sim_irq_released)(struct irq_domain *domain,
|
|
irq_hw_number_t hwirq, void *data);
|
|
};
|
|
|
|
struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
|
|
unsigned int num_irqs);
|
|
struct irq_domain *devm_irq_domain_create_sim(struct device *dev,
|
|
struct fwnode_handle *fwnode,
|
|
unsigned int num_irqs);
|
|
struct irq_domain *irq_domain_create_sim_full(struct fwnode_handle *fwnode,
|
|
unsigned int num_irqs,
|
|
const struct irq_sim_ops *ops,
|
|
void *data);
|
|
struct irq_domain *
|
|
devm_irq_domain_create_sim_full(struct device *dev,
|
|
struct fwnode_handle *fwnode,
|
|
unsigned int num_irqs,
|
|
const struct irq_sim_ops *ops,
|
|
void *data);
|
|
void irq_domain_remove_sim(struct irq_domain *domain);
|
|
|
|
#endif /* _LINUX_IRQ_SIM_H */
|