drm/phytium: Bugfix enable efi fb for ps23xx when using pe2201 bmc card

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

Reviewed-by: Jiakun Shuai<shuaijiakun1288@phytium.com.cn>
Signed-off-by: Xu Yan <xuyan1481@phytium.com.cn>
Signed-off-by: WangHao <wanghao1851@phytium.com.cn>
This commit is contained in:
xuyan 2024-06-26 14:24:19 +08:00
parent 4c42a59bb6
commit c328a15761
1 changed files with 23 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <drm/drm_drv.h> #include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include "phytium_display_drv.h" #include "phytium_display_drv.h"
#include "phytium_pci.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); 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) static int phytium_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
struct phytium_display_private *priv = NULL; struct phytium_display_private *priv = NULL;
struct drm_device *dev = NULL; struct drm_device *dev = NULL;
int ret = 0; 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); dev = drm_dev_alloc(&phytium_display_drm_driver, &pdev->dev);
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
DRM_ERROR("failed to allocate drm_device\n"); DRM_ERROR("failed to allocate drm_device\n");