Commit 3c1ed51a authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Thomas Zimmermann

drm/rockchip: remove existing generic drivers to take over the device

There are drivers that register framebuffer devices very early in the boot
process and make use of the existing framebuffer as setup by the firmware.

If one of those drivers has registered a fbdev, then the fallback fbdev of
the DRM driver won't be bound to the framebuffer console. To avoid that,
remove any existing generic driver and take over the graphics device.

By doing that, the fb mapped to the console is switched correctly from the
early fbdev to the one registered by the rockchip DRM driver:

    [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Tested-by: default avatarPeter Robinson <pbrobinson@gmail.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210516074833.451643-1-javierm@redhat.com
parent 162ba3bd
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/console.h> #include <linux/console.h>
#include <linux/iommu.h> #include <linux/iommu.h>
#include <drm/drm_aperture.h>
#include <drm/drm_drv.h> #include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
...@@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev) ...@@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev)
struct rockchip_drm_private *private; struct rockchip_drm_private *private;
int ret; int ret;
/* Remove existing drivers that may own the framebuffer memory. */
ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb");
if (ret) {
DRM_DEV_ERROR(dev,
"Failed to remove existing framebuffers - %d.\n",
ret);
return ret;
}
drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev); drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev);
if (IS_ERR(drm_dev)) if (IS_ERR(drm_dev))
return PTR_ERR(drm_dev); return PTR_ERR(drm_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment