]> git.karo-electronics.de Git - karo-tx-linux.git/commit
MLK-10227 video: mxsfb: Correct interrupt handling
authorLiu Ying <Ying.Liu@freescale.com>
Thu, 5 Feb 2015 07:08:24 +0000 (15:08 +0800)
committerLiu Ying <Ying.Liu@freescale.com>
Mon, 9 Feb 2015 06:19:26 +0000 (14:19 +0800)
commitfea9f69322cc8753591fe2ff5ad7cc95ba0c589c
tree45d067e61c3395507086c67d79d461f7e876c79c
parent563ccb37969aaf5093747e67159802b1664775f4
MLK-10227 video: mxsfb: Correct interrupt handling

We've got a race condition bewteen the interrupt handler mxsfb_irq_handler()
and the function mxsfb_wait_for_vsync() on the flag host->wait4vsync.
If a CUR_FRAME_DONE interrupt comes and we just finish setting host->wait4vsync
to be 1 in mxsfb_wait_for_vsync() before we go to the interrupt handler, we are
likely to see the VSYNC_EDGE interrupt status bit asserted in the interrupt
handler for the CUR_FRAME_DONE interrupt, disable the not yet enabled VSYNC_EDGE
interrupt and finally clear host->wait4vsync.
Then, we go back to mxsfb_wait_for_vsync() and enable the VSYNC_EDGE interrupt
with host->wait4vsync=0.  This may leave the VSYNC_EDGE interrupt enabled all
the time and never get a chance to be disabled in the interrupt handler.
So, we are deemed to hang up because the uncleared VSYNC_EDGE interrupt status
bit will cause the CPU to be trapped forever, according to SoC designer's words.
This patch corrects the interrupt handling to handle only the interrupts which
are acknowledged by checking both the interrupt enablement bits and the status
bits but not the status bits only.  This may avoid any bogus interrupt from
being handled.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit 24e1e55076b624f9dc93c1f23e14dd024bdff1c7)
drivers/video/mxsfb.c