diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-06-01 13:25:14 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-06-07 09:39:44 +0200 |
commit | 85397f6bc4ff13a6bc5259facb8ebebb1986d666 (patch) | |
tree | 459762d6ff277aae8506efe330425230c6122c25 /drivers/gpu/drm/mgag200/mgag200_g200er.c | |
parent | drm/mgag200: Remove special case for G200SE with <2 MiB (diff) | |
download | linux-85397f6bc4ff13a6bc5259facb8ebebb1986d666.tar.xz linux-85397f6bc4ff13a6bc5259facb8ebebb1986d666.zip |
drm/mgag200: Initialize each model in separate function
Add a separate initializer function for each model. Add separate
devic structures for G200 and G200SE, which require additional
information.
Also move G200's and G200SE's helpers for reading the BIOS and
version id into model-specific code.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601112522.5774-3-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200/mgag200_g200er.c')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_g200er.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_g200er.c b/drivers/gpu/drm/mgag200/mgag200_g200er.c new file mode 100644 index 000000000000..1c5e757ec016 --- /dev/null +++ b/drivers/gpu/drm/mgag200/mgag200_g200er.c @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/pci.h> + +#include <drm/drm_drv.h> + +#include "mgag200_drv.h" + +/* + * DRM device + */ + +struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags) +{ + struct mga_device *mdev; + struct drm_device *dev; + int ret; + + mdev = devm_drm_dev_alloc(&pdev->dev, drv, struct mga_device, base); + if (IS_ERR(mdev)) + return mdev; + dev = &mdev->base; + + pci_set_drvdata(pdev, dev); + + mdev->flags = flags; + mdev->type = type; + + ret = mgag200_regs_init(mdev); + if (ret) + return ERR_PTR(ret); + + ret = mgag200_mm_init(mdev); + if (ret) + return ERR_PTR(ret); + + ret = mgag200_modeset_init(mdev); + if (ret) + return ERR_PTR(ret); + + return mdev; +} |