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()
33 static int devm_request_result(struct device *dev, int rc, unsigned int irq, in devm_request_result() argument
41 irq, handler, thread_fn, devname ? : ""); in devm_request_result()
44 static int __devm_request_threaded_irq(struct device *dev, unsigned int irq, in __devm_request_threaded_irq() argument
56 return -ENOMEM; in __devm_request_threaded_irq()
61 rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname, in __devm_request_threaded_irq()
68 dr->irq = irq; in __devm_request_threaded_irq()
69 dr->dev_id = dev_id; in __devm_request_threaded_irq()
76 * devm_request_threaded_irq - allocate an interrupt line for a managed device with error logging
77 * @dev: Device to request interrupt for
78 * @irq: Interrupt line to allocate
83 * @devname: An ascii name for the claiming device, dev_name(dev) if NULL
95 * information (device name, interrupt number, handler functions and
100 int devm_request_threaded_irq(struct device *dev, unsigned int irq, in devm_request_threaded_irq() argument
105 int rc = __devm_request_threaded_irq(dev, irq, handler, thread_fn, in devm_request_threaded_irq()
108 return devm_request_result(dev, rc, irq, handler, thread_fn, devname); in devm_request_threaded_irq()
112 static int __devm_request_any_context_irq(struct device *dev, unsigned int irq, in __devm_request_any_context_irq() argument
123 return -ENOMEM; in __devm_request_any_context_irq()
128 rc = request_any_context_irq(irq, handler, irqflags, devname, dev_id); in __devm_request_any_context_irq()
134 dr->irq = irq; in __devm_request_any_context_irq()
135 dr->dev_id = dev_id; in __devm_request_any_context_irq()
142 * devm_request_any_context_irq - allocate an interrupt line for a managed device with error logging
143 * @dev: Device to request interrupt for
144 * @irq: Interrupt line to allocate
147 * @devname: An ascii name for the claiming device, dev_name(dev) if NULL
159 * information (device name, interrupt number, handler functions and
165 int devm_request_any_context_irq(struct device *dev, unsigned int irq, in devm_request_any_context_irq() argument
169 int rc = __devm_request_any_context_irq(dev, irq, handler, irqflags, in devm_request_any_context_irq()
172 return devm_request_result(dev, rc, irq, handler, NULL, devname); in devm_request_any_context_irq()
177 * devm_free_irq - free an interrupt
178 * @dev: device to free interrupt for
179 * @irq: Interrupt line to free
180 * @dev_id: Device identity to free
187 void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id) in devm_free_irq() argument
189 struct irq_devres match_data = { irq, dev_id }; in devm_free_irq()
201 static void devm_irq_desc_release(struct device *dev, void *res) in devm_irq_desc_release()
205 irq_free_descs(this->from, this->cnt); in devm_irq_desc_release()
209 * __devm_irq_alloc_descs - Allocate and initialize a range of irq descriptors
210 * for a managed device
211 * @dev: Device to allocate the descriptors for
212 * @irq: Allocate for specific irq number if irq >= 0
213 * @from: Start the search from this irq number
215 * @node: Preferred node on which the irq descriptor should be allocated
218 * which hints where the irq descriptors should be allocated
221 * Returns the first irq number or error code.
225 int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from, in __devm_irq_alloc_descs() argument
234 return -ENOMEM; in __devm_irq_alloc_descs()
236 base = __irq_alloc_descs(irq, from, cnt, node, owner, affinity); in __devm_irq_alloc_descs()
242 dr->from = base; in __devm_irq_alloc_descs()
243 dr->cnt = cnt; in __devm_irq_alloc_descs()
252 * devm_irq_alloc_generic_chip - Allocate and initialize a generic chip
253 * for a managed device
254 * @dev: Device to allocate the generic chip for
255 * @name: Name of the irq chip
265 devm_irq_alloc_generic_chip(struct device *dev, const char *name, int num_ct, in devm_irq_alloc_generic_chip()
287 static void devm_irq_remove_generic_chip(struct device *dev, void *res) in devm_irq_remove_generic_chip()
291 irq_remove_generic_chip(this->gc, this->msk, this->clr, this->set); in devm_irq_remove_generic_chip()
295 * devm_irq_setup_generic_chip - Setup a range of interrupts with a generic
296 * chip for a managed device
298 * @dev: Device to setup the generic chip for
299 * @gc: Generic irq chip holding all data
300 * @msk: Bitmask holding the irqs to initialize relative to gc->irq_base
305 * Set up max. 32 interrupts starting from gc->irq_base. Note, this
309 int devm_irq_setup_generic_chip(struct device *dev, struct irq_chip_generic *gc, in devm_irq_setup_generic_chip()
318 return -ENOMEM; in devm_irq_setup_generic_chip()
322 dr->gc = gc; in devm_irq_setup_generic_chip()
323 dr->msk = msk; in devm_irq_setup_generic_chip()
324 dr->clr = clr; in devm_irq_setup_generic_chip()
325 dr->set = set; in devm_irq_setup_generic_chip()
334 static void devm_irq_domain_remove(struct device *dev, void *res) in devm_irq_domain_remove()
342 * devm_irq_domain_instantiate() - Instantiate a new irq domain data for a
343 * managed device.
344 * @dev: Device to instantiate the domain for
348 * Return: A pointer to the instantiated irq domain or an ERR_PTR value.
350 struct irq_domain *devm_irq_domain_instantiate(struct device *dev, in devm_irq_domain_instantiate()
358 return ERR_PTR(-ENOMEM); in devm_irq_domain_instantiate()