All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback
@ 2017-08-23 12:46 Kiran Gunda
  2017-08-24 12:15 ` Shawn Guo
  2017-08-30 21:03 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Kiran Gunda @ 2017-08-23 12:46 UTC (permalink / raw)
  To: gregkh, sboyd, Kiran Gunda, Abhijeet Dharmapurikar,
	David Collins, linux-kernel
  Cc: shawnguo, linux-arm-msm, linux-arm-msm-owner

Check the irq ownership in the irq_request_resources callback
instead of checking it during the irq mapping. This can prevent
installing the flow handler for the interrupt that is not owned by the EE
and allow the irq translation during the gpio driver probe.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
---
V2:
Fixed commit message.

V1:
This patch depends on the below patch series. Please take this patch
along with this series.
 drivers/spmi/spmi-pmic-arb.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index ca9bdd3..360b821 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -666,6 +666,24 @@ static int qpnpint_get_irqchip_state(struct irq_data *d,
 	return 0;
 }
 
+static int qpnpint_irq_request_resources(struct irq_data *d)
+{
+	struct spmi_pmic_arb *pmic_arb = irq_data_get_irq_chip_data(d);
+	u16 periph = hwirq_to_per(d->hwirq);
+	u16 apid = hwirq_to_apid(d->hwirq);
+	u16 sid = hwirq_to_sid(d->hwirq);
+	u16 irq = hwirq_to_irq(d->hwirq);
+
+	if (pmic_arb->apid_data[apid].irq_ee != pmic_arb->ee) {
+		dev_err(&pmic_arb->spmic->dev, "failed to xlate sid = %#x, periph = %#x, irq = %u: ee=%u but owner=%u\n",
+			sid, periph, irq, pmic_arb->ee,
+			pmic_arb->apid_data[apid].irq_ee);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static struct irq_chip pmic_arb_irqchip = {
 	.name		= "pmic_arb",
 	.irq_ack	= qpnpint_irq_ack,
@@ -674,6 +692,7 @@ static int qpnpint_get_irqchip_state(struct irq_data *d,
 	.irq_set_type	= qpnpint_irq_set_type,
 	.irq_set_wake	= qpnpint_irq_set_wake,
 	.irq_get_irqchip_state	= qpnpint_get_irqchip_state,
+	.irq_request_resources = qpnpint_irq_request_resources,
 	.flags		= IRQCHIP_MASK_ON_SUSPEND,
 };
 
@@ -707,13 +726,6 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
 	}
 
 	apid = rc;
-	if (pmic_arb->apid_data[apid].irq_ee != pmic_arb->ee) {
-		dev_err(&pmic_arb->spmic->dev, "failed to xlate sid = %#x, periph = %#x, irq = %u: ee=%u but owner=%u\n",
-			intspec[0], intspec[1], intspec[2], pmic_arb->ee,
-			pmic_arb->apid_data[apid].irq_ee);
-		return -ENODEV;
-	}
-
 	/* Keep track of {max,min}_apid for bounding search during interrupt */
 	if (apid > pmic_arb->max_apid)
 		pmic_arb->max_apid = apid;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback
  2017-08-23 12:46 [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback Kiran Gunda
@ 2017-08-24 12:15 ` Shawn Guo
  2017-08-30 21:03 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2017-08-24 12:15 UTC (permalink / raw)
  To: Kiran Gunda
  Cc: gregkh, sboyd, Abhijeet Dharmapurikar, David Collins,
	linux-kernel, linux-arm-msm, linux-arm-msm-owner

On Wed, Aug 23, 2017 at 06:16:26PM +0530, Kiran Gunda wrote:
> Check the irq ownership in the irq_request_resources callback
> instead of checking it during the irq mapping. This can prevent
> installing the flow handler for the interrupt that is not owned by the EE
> and allow the irq translation during the gpio driver probe.
> 
> Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>

It fixes qcom-spmi-gpio driver probe failure introduced by the series
below.

[PATCH V2 00/12]: spmi: pmic-arb: Support for HW v5 and other fixes

FWIW, Tested-by: Shawn Guo <shawnguo@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback
  2017-08-23 12:46 [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback Kiran Gunda
  2017-08-24 12:15 ` Shawn Guo
@ 2017-08-30 21:03 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2017-08-30 21:03 UTC (permalink / raw)
  To: Kiran Gunda
  Cc: gregkh, Abhijeet Dharmapurikar, David Collins, linux-kernel,
	shawnguo, linux-arm-msm, linux-arm-msm-owner

On 08/23, Kiran Gunda wrote:
> Check the irq ownership in the irq_request_resources callback
> instead of checking it during the irq mapping. This can prevent
> installing the flow handler for the interrupt that is not owned by the EE
> and allow the irq translation during the gpio driver probe.
> 
> Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-30 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 12:46 [PATCH V2] spmi: pmic-arb: Move the ownership check to irq_chip callback Kiran Gunda
2017-08-24 12:15 ` Shawn Guo
2017-08-30 21:03 ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.