Commit 41615d2f authored by WangHao's avatar WangHao Committed by Jiakun Shuai
Browse files

drm/phytium: Replace default efi fb0 with dc fb

phytium inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9REDQ


CVE: NA

------------------------------------------------------------

When enable efi fb, replace the original efi fb0 when loading the
dc driver.

Fixes: b80df10f ("DRM: Phytium display DRM driver")
Signed-off-by: default avatarWangHao <wanghao1851@phytium.com.cn>
Signed-off-by: default avatarYang Xun <yangxun@phytium.com.cn>
Signed-off-by: default avatarWang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: default avatarJiakun Shuai <shuaijiakun1288@phytium.com.cn>
parent b51533d4
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@

#include <linux/pci.h>
#include <drm/drm_drv.h>
#include <drm/drm_aperture.h>
#include <linux/dmaengine.h>
#include "phytium_display_drv.h"
#include "phytium_pci.h"
@@ -238,12 +239,30 @@ phytium_pci_private_fini(struct pci_dev *pdev, struct phytium_display_private *p
	devm_kfree(&pdev->dev, pci_priv);
}

static int phytium_remove_conflicting_framebuffers(struct pci_dev *pdev)
{
	resource_size_t base, size;

	base = pci_resource_start(pdev, 2);
	size = pci_resource_len(pdev, 2);

	return drm_aperture_remove_conflicting_framebuffers(base, size,
			&phytium_display_drm_driver);

}

static int phytium_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	struct phytium_display_private *priv = NULL;
	struct drm_device *dev = NULL;
	int ret = 0;

	ret = phytium_remove_conflicting_framebuffers(pdev);
	if (ret) {
		DRM_ERROR("failed to remove conflicting phytium framebuffers\n");
		return ret;
	}

	dev = drm_dev_alloc(&phytium_display_drm_driver, &pdev->dev);
	if (IS_ERR(dev)) {
		DRM_ERROR("failed to allocate drm_device\n");