Unverified Commit a797cbe4 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!9039 [OLK-5.10] drm/phytium: Replace default efi fb0 with dc fb

Merge Pull Request from: @liyuting 
 
bugzilla: #IA51DT 
When enable efi fb, replace the original efi fb0 when loading the phytium dc driver. 
 
Link:https://gitee.com/openeuler/kernel/pulls/9039

 

Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents aa4e0464 a6f23857
Loading
Loading
Loading
Loading
+23 −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_fb_helper.h>
#include <linux/dmaengine.h>
#include "phytium_display_drv.h"
#include "phytium_pci.h"
@@ -238,12 +239,34 @@ phytium_pci_private_fini(struct pci_dev *pdev, struct phytium_display_private *p
	devm_kfree(&pdev->dev, pci_priv);
}

static int phytium_kick_out_firmware_fb(struct pci_dev *pdev)
{
	struct apertures_struct *ap;

	ap = alloc_apertures(1);
	if (!ap)
		return -ENOMEM;

	ap->ranges[0].base = pci_resource_start(pdev, 2);
	ap->ranges[0].size = pci_resource_len(pdev, 2);

	drm_fb_helper_remove_conflicting_framebuffers(ap, "phytiumdrmfb",
			false);
	kfree(ap);

	return 0;
}

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_kick_out_firmware_fb(pdev);
	if (ret)
		DRM_ERROR("failed to remove conflicting framebuffers\n");

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