[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260120-ul-driver-i2c-j722s-v2-2-832097c6b64f@ti.com>
Date: Tue, 20 Jan 2026 16:13:47 +0530
From: Aniket Limaye <a-limaye@...com>
To: Vignesh Raghavendra <vigneshr@...com>, <u-kumar1@...com>, Nishanth Menon
<nm@...com>, Tero Kristo <kristo@...nel.org>, Santosh Shilimkar
<ssantosh@...nel.org>, Thomas Gleixner <tglx@...nel.org>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>
CC: <j-mcarthur@...com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>, Aniket Limaye
<a-limaye@...com>
Subject: [PATCH v2 2/2] irqchip/ti-sci-intr: Allow parsing interrupt-types
per-line
Some INTR router instances act as simple passthroughs that preserve the
source interrupt type unchanged at the output line, rather than converting
all interrupts to a fixed type.
When interrupt sources are not homogeneous with respect to trigger type,
the driver needs to read each source's interrupt type from DT and pass it
unchanged to its interrupt parent.
Add support for "ti,intr-trigger-type" = 15 (IRQ_TYPE_DEFAULT) to
indicate passthrough mode. When set to 15, parse interrupt type per-line
from the DT fwspec provided by the interrupt source. Else, use the
global setting for all interrupt lines.
Signed-off-by: Aniket Limaye <a-limaye@...com>
---
Changes in v2:
- Use correct Patch Subject prefix
- Reword Commit msg to better describe the patch
- Fix function argument alignment as per coding style
- Fix variable declaration ordering as per coding style
- Link to v1: https://lore.kernel.org/r/20260116-ul-driver-i2c-j722s-v1-2-c28e8ba38a9e@ti.com
---
drivers/irqchip/irq-ti-sci-intr.c | 49 ++++++++++++++++++++++++++++++---------
1 file changed, 38 insertions(+), 11 deletions(-)
diff --git a/drivers/irqchip/irq-ti-sci-intr.c b/drivers/irqchip/irq-ti-sci-intr.c
index 354613e74ad0..e0b06796c86e 100644
--- a/drivers/irqchip/irq-ti-sci-intr.c
+++ b/drivers/irqchip/irq-ti-sci-intr.c
@@ -61,11 +61,22 @@ static int ti_sci_intr_irq_domain_translate(struct irq_domain *domain,
{
struct ti_sci_intr_irq_domain *intr = domain->host_data;
- if (fwspec->param_count != 1)
- return -EINVAL;
- *hwirq = fwspec->param[0];
- *type = intr->type;
+ if (intr->type != IRQ_TYPE_DEFAULT) {
+ /* Global interrupt-type */
+ if (fwspec->param_count != 1)
+ return -EINVAL;
+
+ *hwirq = fwspec->param[0];
+ *type = intr->type;
+ } else {
+ /* Per-Line interrupt-type */
+ if (fwspec->param_count != 2)
+ return -EINVAL;
+
+ *hwirq = fwspec->param[0];
+ *type = fwspec->param[1];
+ }
return 0;
}
@@ -128,11 +139,12 @@ static void ti_sci_intr_irq_domain_free(struct irq_domain *domain,
* @domain: Pointer to the interrupt router IRQ domain
* @virq: Corresponding Linux virtual IRQ number
* @hwirq: Corresponding hwirq for the IRQ within this IRQ domain
+ * @hwirq_type: Corresponding hwirq trigger type for the IRQ within this IRQ domain
*
* Returns intr output irq if all went well else appropriate error pointer.
*/
static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,
- unsigned int virq, u32 hwirq)
+ unsigned int virq, u32 hwirq, u32 hwirq_type)
{
struct ti_sci_intr_irq_domain *intr = domain->host_data;
struct device_node *parent_node;
@@ -156,11 +168,26 @@ static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,
fwspec.param_count = 3;
fwspec.param[0] = 0; /* SPI */
fwspec.param[1] = p_hwirq - 32; /* SPI offset */
- fwspec.param[2] = intr->type;
+ fwspec.param[2] = hwirq_type;
} else {
/* Parent is Interrupt Router */
- fwspec.param_count = 1;
- fwspec.param[0] = p_hwirq;
+ u32 parent_trigger_type;
+
+ err = of_property_read_u32(parent_node, "ti,intr-trigger-type",
+ &parent_trigger_type);
+ if (err)
+ goto err_irqs;
+
+ if (parent_trigger_type != IRQ_TYPE_DEFAULT) {
+ /* Parent has global trigger type */
+ fwspec.param_count = 1;
+ fwspec.param[0] = p_hwirq;
+ } else {
+ /* Parent supports per-line trigger types */
+ fwspec.param_count = 2;
+ fwspec.param[0] = p_hwirq;
+ fwspec.param[1] = hwirq_type;
+ }
}
err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
@@ -196,15 +223,15 @@ static int ti_sci_intr_irq_domain_alloc(struct irq_domain *domain,
void *data)
{
struct irq_fwspec *fwspec = data;
+ unsigned int hwirq_type;
unsigned long hwirq;
- unsigned int flags;
int err, out_irq;
- err = ti_sci_intr_irq_domain_translate(domain, fwspec, &hwirq, &flags);
+ err = ti_sci_intr_irq_domain_translate(domain, fwspec, &hwirq, &hwirq_type);
if (err)
return err;
- out_irq = ti_sci_intr_alloc_parent_irq(domain, virq, hwirq);
+ out_irq = ti_sci_intr_alloc_parent_irq(domain, virq, hwirq, hwirq_type);
if (out_irq < 0)
return out_irq;
--
2.52.0
Powered by blists - more mailing lists