From: Kiran Gunda <kgunda@codeaurora.org>
To: Kiran Gunda <kgunda@codeaurora.org>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Abhijeet Dharmapurikar <adharmap@codeaurora.org>,
linux-kernel@vger.kernel.org
Cc: Timur Tabi <timur@codeaurora.org>,
linux-arm-msm@vger.kernel.org, adharmap@quicinc.com,
aghayal@qti.qualcomm.com
Subject: [PATCH 06/11] spmi: pmic-arb: fix missing interrupts
Date: Wed, 10 May 2017 19:55:36 +0530 [thread overview]
Message-ID: <1494426343-6431-6-git-send-email-kgunda@codeaurora.org> (raw)
In-Reply-To: <1494426343-6431-1-git-send-email-kgunda@codeaurora.org>
From: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
irq_enable is called when the device resumes. Note that the
irq_enable is called regardless of whether the interrupt was
marked enabled/disabled in the descriptor or whether it was
masked/unmasked at the controller while resuming.
The current driver unconditionally clears the interrupt in its
irq_enable callback. This is dangerous as any interrupts that
happen right before the resume could be missed.
Remove the irq_enable callback and use mask/unmask instead.
Also remove struct pmic_arb_irq_spec as it serves no real purpose.
It is used only in the translate function and the code is much
cleaner without it.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
---
drivers/spmi/spmi-pmic-arb.c | 29 +++--------------------------
1 file changed, 3 insertions(+), 26 deletions(-)
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 0a5728c..bc03737 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -588,17 +588,6 @@ static void qpnpint_irq_unmask(struct irq_data *d)
qpnpint_spmi_write(d, QPNPINT_REG_EN_CLR, &data, 1);
}
-static void qpnpint_irq_enable(struct irq_data *d)
-{
- u8 irq = d->hwirq >> 8;
- u8 data;
-
- qpnpint_irq_unmask(d);
-
- data = BIT(irq);
- qpnpint_spmi_write(d, QPNPINT_REG_LATCHED_CLR, &data, 1);
-}
-
static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type)
{
struct spmi_pmic_arb_qpnpint_type type;
@@ -647,7 +636,6 @@ static int qpnpint_get_irqchip_state(struct irq_data *d,
static struct irq_chip pmic_arb_irqchip = {
.name = "pmic_arb",
- .irq_enable = qpnpint_irq_enable,
.irq_ack = qpnpint_irq_ack,
.irq_mask = qpnpint_irq_mask,
.irq_unmask = qpnpint_irq_unmask,
@@ -657,12 +645,6 @@ static int qpnpint_get_irqchip_state(struct irq_data *d,
| IRQCHIP_SKIP_SET_WAKE,
};
-struct spmi_pmic_arb_irq_spec {
- unsigned slave:4;
- unsigned per:8;
- unsigned irq:3;
-};
-
static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
struct device_node *controller,
const u32 *intspec,
@@ -671,7 +653,6 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
unsigned int *out_type)
{
struct spmi_pmic_arb *pa = d->host_data;
- struct spmi_pmic_arb_irq_spec spec;
int rc;
u8 apid;
@@ -686,10 +667,6 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
if (intspec[0] > 0xF || intspec[1] > 0xFF || intspec[2] > 0x7)
return -EINVAL;
- spec.slave = intspec[0];
- spec.per = intspec[1];
- spec.irq = intspec[2];
-
rc = pa->ver_ops->ppid_to_apid(pa, intspec[0],
(intspec[1] << 8), &apid);
if (rc < 0) {
@@ -705,9 +682,9 @@ static int qpnpint_irq_domain_dt_translate(struct irq_domain *d,
if (apid < pa->min_apid)
pa->min_apid = apid;
- *out_hwirq = spec.slave << 24
- | spec.per << 16
- | spec.irq << 8
+ *out_hwirq = (intspec[0] & 0xF) << 24
+ | (intspec[1] & 0xFF) << 16
+ | (intspec[2] & 0x7) << 8
| apid;
*out_type = intspec[3] & IRQ_TYPE_SENSE_MASK;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2017-05-10 14:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 14:25 [PATCH 01/11] spmi: pmic_arb: block access of invalid read and writes Kiran Gunda
2017-05-10 14:25 ` [PATCH 02/11] spmi: pmic-arb: rename spmi_pmic_arb_dev to spmi_pmic_arb Kiran Gunda
2017-05-10 14:25 ` [PATCH 03/11] spmi: pmic-arb: fix inconsistent use of apid and chan Kiran Gunda
2017-05-10 14:25 ` [PATCH 04/11] spmi: pmic-arb: optimize table lookups Kiran Gunda
2017-05-10 14:25 ` [PATCH 05/11] spmi: pmic-arb: cleanup unrequested irqs Kiran Gunda
2017-05-10 14:25 ` Kiran Gunda [this message]
2017-05-10 14:25 ` [PATCH 07/11] spmi: pmic-arb: clear the latched status of the interrupt Kiran Gunda
2017-05-10 14:25 ` [PATCH 08/11] spmi: pmic_arb: use appropriate flow handler Kiran Gunda
2017-05-10 14:25 ` [PATCH 09/11] spmi: pmic-arb: check apid enabled before calling the handler Kiran Gunda
2017-05-10 14:25 ` [PATCH 10/11] spmi: pmic_arb: add support for PMIC bus arbiter v3 Kiran Gunda
2017-05-10 14:25 ` [PATCH 11/11] spmi: spmi-pmic-arb: enable the SPMI interrupt as a wakeup source Kiran Gunda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494426343-6431-6-git-send-email-kgunda@codeaurora.org \
--to=kgunda@codeaurora.org \
--cc=adharmap@codeaurora.org \
--cc=adharmap@quicinc.com \
--cc=aghayal@qti.qualcomm.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=timur@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).