staging: mrst: overlay: Use double buffering for overlay registers and add suspend/resume hooks
The existing suspend/resume code that fiddles with the OVADD registers
simply does not work. Replace it with something sensible.
Allocate two pages for the registers and ping-pong between them. This
allows update_plane() to do its thing without waiting for the previous
update to complete. The previous update, if not completed, will simply
be overwritten by a new update.
If the hardware is powered down when update_plane() is called we can
simply skip programming OVADD, and instead wait for the reusme hook
to do it next time the hardware is woken up. It's also theoretically
possible that the hardware gets woken up just after we've pointed the
driver to the new register page, in which case we can simply skip
programming OVADD in update_plane(), since we know the resume hook
already did it for us.
There is a slight concern whether the hardware fetches the register
contents from memory in an atomic fashion wrt. the OVADD register
writes. That is, if the hardware can still be fetching the registers
from the old page after OVADD is pointed to the new page, there
might be trouble. So far I did not observe any ill effects. The
hardware really lacks any kind of sensible status + atomic flip
registers, so if it turns out there are problems we may need to
poll the pipe scanline counter to avoid updating OVADD too close
to the time when the hardware fetches the registers from memory.
But so far that doesn't seem necessary.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>