media: bcm2835-unicam: Fix bug in buffer swapping logic
authorNaushir Patuck <naush@raspberrypi.com>
Fri, 5 Mar 2021 15:40:45 +0000 (15:40 +0000)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:04:11 +0000 (16:04 +0000)
commitc929c3054c96397e812f20950f0b927a48c3fd49
tree28a62c00970ae8db77aea6dce05c74d30dd0e7e3
parenta74c92b93244468d7eb58f84b8ee18770bdd65d7
media: bcm2835-unicam: Fix bug in buffer swapping logic

If multiple sets of interrupts occur simultaneously, it may be unsafe
to swap buffers, as the hardware may already be re-using the current
buffers. In such cases, avoid swapping buffers, and wait for the next
opportunity at the Frame End interrupt to signal completion.

Additionally, check the packet compare status when watching for frame
end for buffers swaps, as this could also signify a frame end event.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
drivers/media/platform/bcm2835/bcm2835-unicam.c