Re: [PATCH v8 6/8] drm/etnaviv: add driver support for the PCI devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 2023/6/9 01:32, Bjorn Helgaas wrote:
On Wed, Jun 07, 2023 at 06:55:49PM +0800, Sui Jingfeng wrote:
From: Sui Jingfeng <suijingfeng@xxxxxxxxxxx>

This patch adds PCI driver support on top of what we already have. Take
the GC1000 in LS7A1000/LS2K1000 as the first instance of the PCI device
driver. There is only one GPU core for the GC1000 in the LS7A1000 and
LS2K1000. Therefore, component frameworks can be avoided.
+#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER
+#include "etnaviv_pci_drv.h"
+#endif
With trivial stubs for etnaviv_register_pci_driver() and
etnaviv_unregister_pci_driver(), I think you could get rid of all
these #ifdefs.

OK, then, I will try to add dummy implement at etnaviv_pci_drv.h,

Thanks.

+void etnaviv_drm_unbind(struct device *dev, bool component)
  {
  	struct etnaviv_drm_private *priv = etna_private_ptr;
  	struct drm_device *drm = priv->drm;
@@ -746,6 +750,12 @@ static int __init etnaviv_init(void)
  	if (ret != 0)
  		goto unregister_gpu_driver;
+#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER
+	ret = etnaviv_register_pci_driver();
+	if (ret != 0)
+		goto unregister_platform_driver;
+#endif
+
  	/*
  	 * If the DT contains at least one available GPU device, instantiate
  	 * the DRM platform device.
@@ -763,7 +773,7 @@ static int __init etnaviv_init(void)
  		break;
  	}
- return 0;
+	return ret;
unregister_platform_driver:
  	platform_driver_unregister(&etnaviv_platform_driver);
@@ -778,6 +788,10 @@ static void __exit etnaviv_exit(void)
  	etnaviv_destroy_platform_device(&etnaviv_platform_device);
  	platform_driver_unregister(&etnaviv_platform_driver);
  	platform_driver_unregister(&etnaviv_gpu_driver);
+
+#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER
+	etnaviv_unregister_pci_driver();
+#endif
+static const struct pci_device_id etnaviv_pci_id_lists[] = {
+	{PCI_VENDOR_ID_LOONGSON, 0x7a15, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{PCI_VENDOR_ID_LOONGSON, 0x7a05, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
PCI_VDEVICE()

This make it impossible to hook device-specific data in the future.

But currently there no device specific data associated with the 0x7a05 and 0x7a15,

so it's acceptable for now. Thanks.

Bjorn

--
Jingfeng




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux