Skip to content

Commit

Permalink
spmi-pmic-arb: add support to dispatch interrupt based on IRQ status
Browse files Browse the repository at this point in the history
Current implementation of SPMI arbiter dispatches interrupt based on
the Arbiter's accumulator status, in some cases the accumulator status
may remain zero and the interrupt remains un-handled.  Add logic to
dispatch interrupts based Arbiter's IRQ status if the accumulator
status is zero.

Bug: 63899519
Test: Booted and ran modified code on walleye and taimen without any
apparent issues.  Problem being addressed has no reliable repro method
and occurs very infrequently, so efficacy will be monitored via
population data.

Change-Id: I5e8c1b75be2d727c6f74d14afb7a5a32603bda58
Signed-off-by: Ashay Jaiswal <[email protected]>
  • Loading branch information
Ashay Jaiswal authored and krossmo committed Dec 7, 2017
1 parent 3d4bd7e commit e9ef7d6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions drivers/spmi/spmi-pmic-arb.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,16 @@ static bool __pmic_arb_chained_irq(struct spmi_pmic_arb *pa, bool show)
int last = pa->max_apid >> 5;
u32 status, enable;
int i, id, apid;
/* status based dispatch */
bool acc_valid = false;
u32 irq_status = 0;

for (i = first; i <= last; ++i) {
status = readl_relaxed(pa->acc_status +
pa->ver_ops->owner_acc_status(pa->ee, i));
if (status)
acc_valid = true;

while (status) {
id = ffs(status) - 1;
status &= ~BIT(id);
Expand All @@ -597,6 +603,28 @@ static bool __pmic_arb_chained_irq(struct spmi_pmic_arb *pa, bool show)
periph_interrupt(pa, apid, show);
}
}

/* ACC_STATUS is empty but IRQ fired check IRQ_STATUS */
if (!acc_valid) {
for (i = pa->min_apid; i <= pa->max_apid; i++) {
/* skip if APPS is not irq owner */
if (pa->apid_data[i].irq_owner != pa->ee)
continue;

irq_status = readl_relaxed(pa->intr +
pa->ver_ops->irq_status(i));
if (irq_status) {
enable = readl_relaxed(pa->intr +
pa->ver_ops->acc_enable(i));
if (enable & SPMI_PIC_ACC_ENABLE_BIT) {
dev_dbg(&pa->spmic->dev,
"Dispatching IRQ for apid=%d status=%x\n",
i, irq_status);
periph_interrupt(pa, i, show);
}
}
}
}
return true;
}

Expand Down

0 comments on commit e9ef7d6

Please sign in to comment.