diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-06-01 14:25:14 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-06-07 10:39:44 +0300 |
commit | 85397f6bc4ff13a6bc5259facb8ebebb1986d666 (patch) | |
tree | 459762d6ff277aae8506efe330425230c6122c25 /drivers/gpu/drm/mgag200/mgag200_drv.h | |
parent | 73f54d5d968264148ef81941d9dc07e35025a120 (diff) | |
download | linux-85397f6bc4ff13a6bc5259facb8ebebb1986d666.tar.xz |
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_drv.h')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_drv.h | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index 5634fc003ca4..99a9446b7df5 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -218,18 +218,6 @@ struct mga_device { enum mga_type type; - union { - struct { - long ref_clk; - long pclk_min; - long pclk_max; - } g200; - struct { - /* SE model number stored in reg 0x1e24 */ - u32 unique_rev_id; - } g200se; - } model; - struct mgag200_pll pixpll; struct mga_i2c_chan i2c; struct drm_connector connector; @@ -241,6 +229,53 @@ static inline struct mga_device *to_mga_device(struct drm_device *dev) return container_of(dev, struct mga_device, base); } +struct mgag200_g200_device { + struct mga_device base; + + /* PLL constants */ + long ref_clk; + long pclk_min; + long pclk_max; +}; + +static inline struct mgag200_g200_device *to_mgag200_g200_device(struct drm_device *dev) +{ + return container_of(to_mga_device(dev), struct mgag200_g200_device, base); +} + +struct mgag200_g200se_device { + struct mga_device base; + + /* SE model number stored in reg 0x1e24 */ + u32 unique_rev_id; +}; + +static inline struct mgag200_g200se_device *to_mgag200_g200se_device(struct drm_device *dev) +{ + return container_of(to_mga_device(dev), struct mgag200_g200se_device, base); +} + + /* mgag200_drv.c */ +int mgag200_regs_init(struct mga_device *mdev); + + /* mgag200_<device type>.c */ +struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); +struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); +struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); +struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); +struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); +struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); +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 *mgag200_g200ew3_device_create(struct pci_dev *pdev, const struct drm_driver *drv, + enum mga_type type, unsigned long flags); + /* mgag200_mode.c */ int mgag200_modeset_init(struct mga_device *mdev); |