diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-07-28 15:41:00 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-07-29 17:01:47 +0300 |
commit | 877507bb954e7d0a4f2d3ba9957127a83c03e447 (patch) | |
tree | befbafd7ec19cbd8692de0289103f9b4605a47b0 /drivers/gpu/drm/mgag200/mgag200_mode.c | |
parent | 8aeeb3144fe27b2b8aa30db262de2f654f2edb9a (diff) | |
download | linux-877507bb954e7d0a4f2d3ba9957127a83c03e447.tar.xz |
drm/mgag200: Provide per-device callbacks for PIXPLLC
Move the PIXPLLC code into per-model source files and wire it up
with per-model callbacks. No functional changes.
The PIXPLLC pixel-clock is part of the CRTC, but really separate
hardware that varies with each model of the G200. Move the PIXPLLC
code for each model into the per-model source file and call it from
CRTC helpers via device functions.
This allows to remove struct mgag200_pll and the related code. The
new callbacks behave like the CRTC's atomic_check and atomic_enable
functions.
v3:
* clean up style
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-12-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200/mgag200_mode.c')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mode.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 2b1e9f069366..d999673e0278 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -660,9 +660,8 @@ static int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, { struct drm_device *dev = crtc->dev; struct mga_device *mdev = to_mga_device(dev); + const struct mgag200_device_funcs *funcs = mdev->funcs; struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc); - struct mgag200_pll *pixpll = &mdev->pixpll; - struct mgag200_crtc_state *mgag200_crtc_state = to_mgag200_crtc_state(new_crtc_state); struct drm_property_blob *new_gamma_lut = new_crtc_state->gamma_lut; int ret; @@ -674,10 +673,11 @@ static int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, return 0; if (new_crtc_state->mode_changed) { - ret = pixpll->funcs->compute(pixpll, new_crtc_state->mode.clock, - &mgag200_crtc_state->pixpllc); - if (ret) - return ret; + if (funcs->pixpllc_atomic_check) { + ret = funcs->pixpllc_atomic_check(crtc, new_state); + if (ret) + return ret; + } } if (new_crtc_state->color_mgmt_changed && new_gamma_lut) { @@ -718,7 +718,6 @@ static void mgag200_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; struct mgag200_crtc_state *mgag200_crtc_state = to_mgag200_crtc_state(crtc_state); const struct drm_format_info *format = mgag200_crtc_state->format; - struct mgag200_pll *pixpll = &mdev->pixpll; if (funcs->disable_vidrst) funcs->disable_vidrst(mdev); @@ -726,7 +725,8 @@ static void mgag200_crtc_helper_atomic_enable(struct drm_crtc *crtc, mgag200_set_format_regs(mdev, format); mgag200_set_mode_regs(mdev, adjusted_mode); - pixpll->funcs->update(pixpll, &mgag200_crtc_state->pixpllc); + if (funcs->pixpllc_atomic_update) + funcs->pixpllc_atomic_update(crtc, old_state); if (mdev->type == G200_ER) mgag200_g200er_reset_tagfifo(mdev); @@ -976,10 +976,6 @@ static int mgag200_pipeline_init(struct mga_device *mdev) struct drm_connector *connector = &mdev->connector; int ret; - ret = mgag200_pixpll_init(&mdev->pixpll, mdev); - if (ret) - return ret; - ret = drm_universal_plane_init(dev, primary_plane, 0, &mgag200_primary_plane_funcs, mgag200_primary_plane_formats, |