]> git.baikalelectronics.ru Git - kernel.git/commit
drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled
authorJyri Sarha <jsarha@ti.com>
Wed, 1 Mar 2017 08:30:28 +0000 (10:30 +0200)
committerJyri Sarha <jsarha@ti.com>
Tue, 14 Mar 2017 12:28:58 +0000 (14:28 +0200)
commit5594f513e9e0e8fbcaa22213e7c4ccd63b60c6bd
treedac90042217220bc75df42a2788d2312d3744b14
parent0590064ddd0a4c30d05464ebe302f6b684d7cb50
drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled

Touching HW while clocks are off is a serious error and for instance
breaks suspend functionality. After this patch tilcdc_crtc_update_fb()
always updates the primary plane's framebuffer pointer, increases fb's
reference count and stores vblank event. tilcdc_crtc_update_fb() only
writes the fb's DMA address to HW if the crtc is enabled, as
tilcdc_crtc_enable() takes care of writing the address on enable.

This patch also refactors the tilcdc_crtc_update_fb() a bit. Number of
subsequent small changes had made it almost unreadable. There should
be no other functional changes but checking the CRTC's enable
state. However, the locking goes a bit differently and some of the
redundant checks have been removed in this new version.

The enable_lock should be enough to protect the access to
tilcdc_crtc->enabled. The irq_lock protects the access to last_vblank
and next_fb. The check for vrefresh and last_vblank being valid is
redundant, as the vrefresh should be always valid if the CRTC is
enabled and now last_vblank should be too, because it is initialized
to current time when CRTC raster is enabled. If for some reason the
values are not correctly initialized the division by zero warning is
quite appropriate.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/tilcdc/tilcdc_crtc.c