1 // SPDX-License-Identifier: GPL-2.0-only 2 3 #include <linux/pci.h> 4 5 #include <drm/drm_drv.h> 6 7 #include "mgag200_drv.h" 8 9 /* 10 * DRM device 11 */ 12 13 static const struct mgag200_device_info mgag200_g200eh_device_info = 14 MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false, 1, 0, false); 15 16 struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, 17 enum mga_type type) 18 { 19 struct mga_device *mdev; 20 struct drm_device *dev; 21 resource_size_t vram_available; 22 int ret; 23 24 mdev = devm_drm_dev_alloc(&pdev->dev, drv, struct mga_device, base); 25 if (IS_ERR(mdev)) 26 return mdev; 27 dev = &mdev->base; 28 29 pci_set_drvdata(pdev, dev); 30 31 ret = mgag200_init_pci_options(pdev, 0x00000120, 0x0000b000); 32 if (ret) 33 return ERR_PTR(ret); 34 35 ret = mgag200_device_preinit(mdev); 36 if (ret) 37 return ERR_PTR(ret); 38 39 ret = mgag200_device_init(mdev, type, &mgag200_g200eh_device_info); 40 if (ret) 41 return ERR_PTR(ret); 42 43 vram_available = mgag200_device_probe_vram(mdev); 44 45 ret = mgag200_modeset_init(mdev, vram_available); 46 if (ret) 47 return ERR_PTR(ret); 48 49 return mdev; 50 } 51