staging: mrst: overlay: Use double buffering for overlay registers and add suspend...
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 21 Dec 2011 00:01:37 +0000 (02:01 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:11 +0000 (12:29 +0300)
commit9fc09439dc9b023cf792f752deb696edb1bc3969
tree3bb671f7026815133be0eaf0b0383d593feef3fc
parentbf3d59ddd490a4953c439b15c9acf7e965376261
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>
drivers/staging/mrst/drv/mdfld_overlay.c
drivers/staging/mrst/drv/psb_intel_drv.h
drivers/staging/mrst/drv/psb_powermgmt.c