Skip to content

Commit

Permalink
drm/sun4i: backend: Add comment explaining why registers are cleared
Browse files Browse the repository at this point in the history
Many of the backend's layer configuration registers have undefined
default values. This poses a risk as we use regmap_update_bits in
some places, and don't overwrite the whole register.

At probe/bind time we explicitly clear all the control registers
by writing 0 to them. This patch adds a more detailed explanation
on why we're doing this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-5-wens@csie.org
  • Loading branch information
Chen-Yu Tsai authored and Maxime Ripard committed Oct 16, 2017
1 parent cff2192 commit 936598d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/gpu/drm/sun4i/sun4i_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,14 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,

list_add_tail(&backend->engine.list, &drv->engine_list);

/* Reset the registers */
/*
* Many of the backend's layer configuration registers have
* undefined default values. This poses a risk as we use
* regmap_update_bits in some places, and don't overwrite
* the whole register.
*
* Clear the registers here to have something predictable.
*/
for (i = 0x800; i < 0x1000; i += 4)
regmap_write(backend->engine.regs, i, 0);

Expand Down

0 comments on commit 936598d

Please sign in to comment.