drm/sun4i: remove simplefb at probe
If simplefb was setup by our bootloader and enabled in the DT, we will have
a first framebuffer loaded in our system.
However, as soon as our DRM driver will load, it will reset the controller,
initialise it and, if the framebuffer emulation is enabled, register a
second framebuffer device.
This is obviously pretty bad, since the first framebuffer will be some kind
of a black hole, with memory still reserved that we can write to safely,
but not displayed anywhere.
Make sure we remove that framebuffer when we probe so we don't end up in
that situation.
Fixes: 9026e0d122
("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
This commit is contained in:
Родитель
0de6e914a0
Коммит
3d6bd9065b
|
@ -125,6 +125,22 @@ static struct drm_driver sun4i_drv_driver = {
|
|||
.disable_vblank = sun4i_drv_disable_vblank,
|
||||
};
|
||||
|
||||
static void sun4i_remove_framebuffers(void)
|
||||
{
|
||||
struct apertures_struct *ap;
|
||||
|
||||
ap = alloc_apertures(1);
|
||||
if (!ap)
|
||||
return;
|
||||
|
||||
/* The framebuffer can be located anywhere in RAM */
|
||||
ap->ranges[0].base = 0;
|
||||
ap->ranges[0].size = ~0;
|
||||
|
||||
remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false);
|
||||
kfree(ap);
|
||||
}
|
||||
|
||||
static int sun4i_drv_bind(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm;
|
||||
|
@ -172,6 +188,9 @@ static int sun4i_drv_bind(struct device *dev)
|
|||
}
|
||||
drm->irq_enabled = true;
|
||||
|
||||
/* Remove early framebuffers (ie. simplefb) */
|
||||
sun4i_remove_framebuffers();
|
||||
|
||||
/* Create our framebuffer */
|
||||
drv->fbdev = sun4i_framebuffer_init(drm);
|
||||
if (IS_ERR(drv->fbdev)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче