Lines Matching +full:irq +full:- +full:device

1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/device.h>
7 #include <linux/irq.h>
12 * Device resource management aware IRQ request/free implementation.
15 unsigned int irq; member
19 static void devm_irq_release(struct device *dev, void *res) in devm_irq_release()
23 free_irq(this->irq, this->dev_id); in devm_irq_release()
26 static int devm_irq_match(struct device *dev, void *res, void *data) in devm_irq_match()
30 return this->irq == match->irq && this->dev_id == match->dev_id; in devm_irq_match()
34 * devm_request_threaded_irq - allocate an interrupt line for a managed device
35 * @dev: device to request interrupt for
36 * @irq: Interrupt line to allocate
37 * @handler: Function to be called when the IRQ occurs
41 * @devname: An ascii name for the claiming device, dev_name(dev) if NULL
49 * If an IRQ allocated with this function needs to be freed
52 int devm_request_threaded_irq(struct device *dev, unsigned int irq, in devm_request_threaded_irq() argument
63 return -ENOMEM; in devm_request_threaded_irq()
68 rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname, in devm_request_threaded_irq()
75 dr->irq = irq; in devm_request_threaded_irq()
76 dr->dev_id = dev_id; in devm_request_threaded_irq()
84 * devm_request_any_context_irq - allocate an interrupt line for a managed device
85 * @dev: device to request interrupt for
86 * @irq: Interrupt line to allocate
87 * @handler: Function to be called when the IRQ occurs
89 * @devname: An ascii name for the claiming device, dev_name(dev) if NULL
97 * If an IRQ allocated with this function needs to be freed
100 int devm_request_any_context_irq(struct device *dev, unsigned int irq, in devm_request_any_context_irq() argument
110 return -ENOMEM; in devm_request_any_context_irq()
115 rc = request_any_context_irq(irq, handler, irqflags, devname, dev_id); in devm_request_any_context_irq()
121 dr->irq = irq; in devm_request_any_context_irq()
122 dr->dev_id = dev_id; in devm_request_any_context_irq()
130 * devm_free_irq - free an interrupt
131 * @dev: device to free interrupt for
132 * @irq: Interrupt line to free
133 * @dev_id: Device identity to free
140 void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id) in devm_free_irq() argument
142 struct irq_devres match_data = { irq, dev_id }; in devm_free_irq()
146 free_irq(irq, dev_id); in devm_free_irq()
155 static void devm_irq_desc_release(struct device *dev, void *res) in devm_irq_desc_release()
159 irq_free_descs(this->from, this->cnt); in devm_irq_desc_release()
163 * __devm_irq_alloc_descs - Allocate and initialize a range of irq descriptors
164 * for a managed device
165 * @dev: Device to allocate the descriptors for
166 * @irq: Allocate for specific irq number if irq >= 0
167 * @from: Start the search from this irq number
169 * @node: Preferred node on which the irq descriptor should be allocated
172 * which hints where the irq descriptors should be allocated
175 * Returns the first irq number or error code.
179 int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from, in __devm_irq_alloc_descs() argument
188 return -ENOMEM; in __devm_irq_alloc_descs()
190 base = __irq_alloc_descs(irq, from, cnt, node, owner, affinity); in __devm_irq_alloc_descs()
196 dr->from = base; in __devm_irq_alloc_descs()
197 dr->cnt = cnt; in __devm_irq_alloc_descs()
206 * devm_irq_alloc_generic_chip - Allocate and initialize a generic chip
207 * for a managed device
208 * @dev: Device to allocate the generic chip for
209 * @name: Name of the irq chip
219 devm_irq_alloc_generic_chip(struct device *dev, const char *name, int num_ct, in devm_irq_alloc_generic_chip()
241 static void devm_irq_remove_generic_chip(struct device *dev, void *res) in devm_irq_remove_generic_chip()
245 irq_remove_generic_chip(this->gc, this->msk, this->clr, this->set); in devm_irq_remove_generic_chip()
249 * devm_irq_setup_generic_chip - Setup a range of interrupts with a generic
250 * chip for a managed device
252 * @dev: Device to setup the generic chip for
253 * @gc: Generic irq chip holding all data
254 * @msk: Bitmask holding the irqs to initialize relative to gc->irq_base
259 * Set up max. 32 interrupts starting from gc->irq_base. Note, this
263 int devm_irq_setup_generic_chip(struct device *dev, struct irq_chip_generic *gc, in devm_irq_setup_generic_chip()
272 return -ENOMEM; in devm_irq_setup_generic_chip()
276 dr->gc = gc; in devm_irq_setup_generic_chip()
277 dr->msk = msk; in devm_irq_setup_generic_chip()
278 dr->clr = clr; in devm_irq_setup_generic_chip()
279 dr->set = set; in devm_irq_setup_generic_chip()
288 static void devm_irq_domain_remove(struct device *dev, void *res) in devm_irq_domain_remove()
296 * devm_irq_domain_instantiate() - Instantiate a new irq domain data for a
297 * managed device.
298 * @dev: Device to instantiate the domain for
302 * Return: A pointer to the instantiated irq domain or an ERR_PTR value.
304 struct irq_domain *devm_irq_domain_instantiate(struct device *dev, in devm_irq_domain_instantiate()
312 return ERR_PTR(-ENOMEM); in devm_irq_domain_instantiate()