Commit f5285a2e authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

pm8xxx-adc: fix missing interrupts



There exists situations when an adc conversion is requested very
early in the resume sequence. These requests fail to complete
because of missing interrupts and eventually cause lockups.

When an interrupt is enabled during system resume the kernel rejects
enabling these interrupts. This keeps the interrupt disabled and causes
missed interrupt. Get around this problem by not needing to enable the
interrupt. IOW, do not call disable_irq and enable_irq, only request
the irq which leaves it in enabled state.

There is a bug in the pmic where if an interrupt is masked/unmasked
it clears the pending status. This causes a nonwakeup interrupt to
be missed as it is unmasked while resuming. Mostly this is okay but
if a adc request is made early in the suspend, it causes it to miss
interrupts. Make the adc interrupt a wakeup interrupt.

The driver initializes its completion only at probe time. This may cause
incorrect end of conversions with out of sync (spurious) interrupts.
Update the code to init a completion just before issuing a conversion.

Another issue was observed where the interrupt's unmask_irq was delayed,
causing another cpu to initiate the next conversion as soon as complete was
called. This lead to a situation where the interrupt for the next request
was triggered and the unmask happened later. Call complete within a
workqueue which guarantees that unmask would have completed and
it is safe to start the next conversion.

CRs-Fixed: 350768
Change-Id: I4c619c9c274a0cfd6a3e04b2b71ec885968d7375
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent c62852fc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment