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()
154 static void devm_irq_desc_release(struct device *dev, void *res) in devm_irq_desc_release()
158 irq_free_descs(this->from, this->cnt); in devm_irq_desc_release()
162 * __devm_irq_alloc_descs - Allocate and initialize a range of irq descriptors
163 * for a managed device
164 * @dev: Device to allocate the descriptors for
165 * @irq: Allocate for specific irq number if irq >= 0
166 * @from: Start the search from this irq number
168 * @node: Preferred node on which the irq descriptor should be allocated
171 * which hints where the irq descriptors should be allocated
174 * Returns the first irq number or error code.
178 int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from, in __devm_irq_alloc_descs() argument
187 return -ENOMEM; in __devm_irq_alloc_descs()
189 base = __irq_alloc_descs(irq, from, cnt, node, owner, affinity); in __devm_irq_alloc_descs()
195 dr->from = base; in __devm_irq_alloc_descs()
196 dr->cnt = cnt; in __devm_irq_alloc_descs()
205 * devm_irq_alloc_generic_chip - Allocate and initialize a generic chip
206 * for a managed device
207 * @dev: Device to allocate the generic chip for
208 * @name: Name of the irq chip
218 devm_irq_alloc_generic_chip(struct device *dev, const char *name, int num_ct, in devm_irq_alloc_generic_chip()
240 static void devm_irq_remove_generic_chip(struct device *dev, void *res) in devm_irq_remove_generic_chip()
244 irq_remove_generic_chip(this->gc, this->msk, this->clr, this->set); in devm_irq_remove_generic_chip()
248 * devm_irq_setup_generic_chip - Setup a range of interrupts with a generic
249 * chip for a managed device
251 * @dev: Device to setup the generic chip for
252 * @gc: Generic irq chip holding all data
253 * @msk: Bitmask holding the irqs to initialize relative to gc->irq_base
258 * Set up max. 32 interrupts starting from gc->irq_base. Note, this
262 int devm_irq_setup_generic_chip(struct device *dev, struct irq_chip_generic *gc, in devm_irq_setup_generic_chip()
271 return -ENOMEM; in devm_irq_setup_generic_chip()
275 dr->gc = gc; in devm_irq_setup_generic_chip()
276 dr->msk = msk; in devm_irq_setup_generic_chip()
277 dr->clr = clr; in devm_irq_setup_generic_chip()
278 dr->set = set; in devm_irq_setup_generic_chip()
287 static void devm_irq_domain_remove(struct device *dev, void *res) in devm_irq_domain_remove()
295 * devm_irq_domain_instantiate() - Instantiate a new irq domain data for a
296 * managed device.
297 * @dev: Device to instantiate the domain for
301 * Return: A pointer to the instantiated irq domain or an ERR_PTR value.
303 struct irq_domain *devm_irq_domain_instantiate(struct device *dev, in devm_irq_domain_instantiate()
311 return ERR_PTR(-ENOMEM); in devm_irq_domain_instantiate()