Skip to content

Commit 4dc7071

Browse files
author
Marc Zyngier
committed
irqchip/qcom-pdc: Kill non-wakeup irqdomain
A careful look at the way the PDC driver works shows that: - all interrupts are in the same space - all interrupts are treated the same And yet the driver creates two domains based on whether the interrupt gets mapped directly or from the pinctrl code, which is obviously a waste of resources. Kill the non-wakeup domain and unify all the interrupt handling. Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220224101226.88373-3-maz@kernel.org
1 parent 8d4c998 commit 4dc7071

1 file changed

Lines changed: 10 additions & 74 deletions

File tree

drivers/irqchip/qcom-pdc.c

Lines changed: 10 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/slab.h>
2222
#include <linux/types.h>
2323

24-
#define PDC_MAX_IRQS 168
2524
#define PDC_MAX_GPIO_IRQS 256
2625

2726
#define CLEAR_INTR(reg, intr) (reg & ~(1 << intr))
@@ -224,51 +223,6 @@ static int qcom_pdc_alloc(struct irq_domain *domain, unsigned int virq,
224223
unsigned int type;
225224
int ret;
226225

227-
ret = qcom_pdc_translate(domain, fwspec, &hwirq, &type);
228-
if (ret)
229-
return ret;
230-
231-
ret = irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
232-
&qcom_pdc_gic_chip, NULL);
233-
if (ret)
234-
return ret;
235-
236-
region = get_pin_region(hwirq);
237-
if (!region)
238-
return irq_domain_disconnect_hierarchy(domain->parent, virq);
239-
240-
if (type & IRQ_TYPE_EDGE_BOTH)
241-
type = IRQ_TYPE_EDGE_RISING;
242-
243-
if (type & IRQ_TYPE_LEVEL_MASK)
244-
type = IRQ_TYPE_LEVEL_HIGH;
245-
246-
parent_fwspec.fwnode = domain->parent->fwnode;
247-
parent_fwspec.param_count = 3;
248-
parent_fwspec.param[0] = 0;
249-
parent_fwspec.param[1] = pin_to_hwirq(region, hwirq);
250-
parent_fwspec.param[2] = type;
251-
252-
return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,
253-
&parent_fwspec);
254-
}
255-
256-
static const struct irq_domain_ops qcom_pdc_ops = {
257-
.translate = qcom_pdc_translate,
258-
.alloc = qcom_pdc_alloc,
259-
.free = irq_domain_free_irqs_common,
260-
};
261-
262-
static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq,
263-
unsigned int nr_irqs, void *data)
264-
{
265-
struct irq_fwspec *fwspec = data;
266-
struct irq_fwspec parent_fwspec;
267-
struct pdc_pin_region *region;
268-
irq_hw_number_t hwirq;
269-
unsigned int type;
270-
int ret;
271-
272226
ret = qcom_pdc_translate(domain, fwspec, &hwirq, &type);
273227
if (ret)
274228
return ret;
@@ -301,16 +255,9 @@ static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq,
301255
&parent_fwspec);
302256
}
303257

304-
static int qcom_pdc_gpio_domain_select(struct irq_domain *d,
305-
struct irq_fwspec *fwspec,
306-
enum irq_domain_bus_token bus_token)
307-
{
308-
return bus_token == DOMAIN_BUS_WAKEUP;
309-
}
310-
311-
static const struct irq_domain_ops qcom_pdc_gpio_ops = {
312-
.select = qcom_pdc_gpio_domain_select,
313-
.alloc = qcom_pdc_gpio_alloc,
258+
static const struct irq_domain_ops qcom_pdc_ops = {
259+
.translate = qcom_pdc_translate,
260+
.alloc = qcom_pdc_alloc,
314261
.free = irq_domain_free_irqs_common,
315262
};
316263

@@ -361,7 +308,7 @@ static int pdc_setup_pin_mapping(struct device_node *np)
361308

362309
static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
363310
{
364-
struct irq_domain *parent_domain, *pdc_domain, *pdc_gpio_domain;
311+
struct irq_domain *parent_domain, *pdc_domain;
365312
int ret;
366313

367314
pdc_base = of_iomap(node, 0);
@@ -383,32 +330,21 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
383330
goto fail;
384331
}
385332

386-
pdc_domain = irq_domain_create_hierarchy(parent_domain, 0, PDC_MAX_IRQS,
387-
of_fwnode_handle(node),
388-
&qcom_pdc_ops, NULL);
389-
if (!pdc_domain) {
390-
pr_err("%pOF: GIC domain add failed\n", node);
391-
ret = -ENOMEM;
392-
goto fail;
393-
}
394-
395-
pdc_gpio_domain = irq_domain_create_hierarchy(parent_domain,
333+
pdc_domain = irq_domain_create_hierarchy(parent_domain,
396334
IRQ_DOMAIN_FLAG_QCOM_PDC_WAKEUP,
397335
PDC_MAX_GPIO_IRQS,
398336
of_fwnode_handle(node),
399-
&qcom_pdc_gpio_ops, NULL);
400-
if (!pdc_gpio_domain) {
401-
pr_err("%pOF: PDC domain add failed for GPIO domain\n", node);
337+
&qcom_pdc_ops, NULL);
338+
if (!pdc_domain) {
339+
pr_err("%pOF: PDC domain add failed\n", node);
402340
ret = -ENOMEM;
403-
goto remove;
341+
goto fail;
404342
}
405343

406-
irq_domain_update_bus_token(pdc_gpio_domain, DOMAIN_BUS_WAKEUP);
344+
irq_domain_update_bus_token(pdc_domain, DOMAIN_BUS_WAKEUP);
407345

408346
return 0;
409347

410-
remove:
411-
irq_domain_remove(pdc_domain);
412348
fail:
413349
kfree(pdc_region);
414350
iounmap(pdc_base);

0 commit comments

Comments
 (0)