New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 794818 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Task



Sign in to add a comment

EC: Handling of shared interrupt between TCPC and PPC.

Project Member Reported by aaboagye@chromium.org, Dec 14 2017

Issue description

There's a board that for each port, it has its interrupt lines for its TCPC and Type-C Power Path Controller (PPC) shared. That is both parts can assert the same interrupt line that goes to a single GPIO input. Additionally, these parts may both assert it at the same time.

Currently, the implementation I have is to service the TCPC interrupt first as normal and then go service the PPC. The PPC interrupt handling is done in the HOOKS task context via a deferred function.

The problem is that when servicing the PPC interrupt, the TCPC may reassert the interrupt line. This results in the interrupt line never de-asserting and since the interrupt is edge sensitive as opposed to level sensitive, we miss future interrupts for that port.

Right now, I'm re-calling the shared ISR if the interrupt line remains asserted in an attempt to "drain" them.[0]

shawnn@ was wondering if maybe it made sense to check the PPC interrupt status from the PDCMD task via pd_exchange_status(). However, there's a tradeoff that we would be slightly slower to service our TCPCs in some cases.

vpalatin@, what do you think?

[0]: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/807634/10
 

Comment 1 by sha...@chromium.org, Dec 14 2017

It looks bad on the surface because the lack of GPIOs on one board seems to be dictating our system design for all boards. But, I could see us implementing this in the PDCMD task even if we didn't have GPIO constraints, the code is cleaner than using a deferred task.

Comment 2 by vpalatin@google.com, Dec 14 2017

Apart from the hardware limitation being a terrible idea,
normally on a theoretical point of view, shared interrupt lines need to be level-triggered rather than edge-triggered to work properly (and in the linux kernel world we would service them from a 'threaded irq handler' effectively disabling the interrupt request until a lower priority kernel thread has done the I2C accesses to read the statuses for each user)
As noted by Aseda in the CL, level-triggered currently doesn't work (likely because you have to disable irq until the I2C status read+clear happens)
For TCPC, the Alert# line is designed to work with a level-sensitive host no issue there.

Overall, there are 2 parts in the design issue:
a. if we keep it edge-triggered, it seems we will still need to do Aseda trick (ie re-call the ISR if the line is still asserted), and this seems somewhat difficult to fully avoid small race conditions around this.
b. we need to decide where to check the status of both (shared) user of the interrupt line.
  Shawnn proposal looks the more robust.
Owner: aaboagye@chromium.org
Status: Assigned (was: Unconfirmed)

Sign in to add a comment