summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-08-05 15:05:59 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2024-08-09 08:13:47 +0200
commit9d09cac47de5358ace64dddd14278fea002e68c3 (patch)
tree47c1baef2f31f1caf1eaba3ba1644aed9bf734a5
parentdc06efbb7934405461d95bba5b702849058424a4 (diff)
drm/mgag200: vga-bmc: Control CRTC VIDRST flag from encoder
Control the VIDRST pin from the VGA-BMC encoder's atomic_check and remove the respective code from CRTC. Makes the VIDRST functionality fully composable. The VIDRST pin allows an external clock source to control the SYNC signals of the Matrox chip. The functionality is part of the CRTC, but depends on the presence of the clock source. This is the case for some BMCs, so control the pin from the VGA-BMC output. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240805130622.63458-4-tzimmermann@suse.de
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_mode.c3
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_vga_bmc.c18
2 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index dd125ef15559..8dc16821e1cd 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -611,7 +611,6 @@ int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_st
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_crtc_state *new_mgag200_crtc_state = to_mgag200_crtc_state(new_crtc_state);
struct drm_property_blob *new_gamma_lut = new_crtc_state->gamma_lut;
int ret;
@@ -622,8 +621,6 @@ int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_st
if (ret)
return ret;
- new_mgag200_crtc_state->set_vidrst = mdev->info->sync_bmc;
-
if (new_crtc_state->mode_changed) {
if (funcs->pixpllc_atomic_check) {
ret = funcs->pixpllc_atomic_check(crtc, new_state);
diff --git a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
index 3a958c3587ac..77340f2dee17 100644
--- a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
+++ b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
@@ -8,6 +8,22 @@
#include "mgag200_ddc.h"
#include "mgag200_drv.h"
+static int mgag200_vga_bmc_encoder_atomic_check(struct drm_encoder *encoder,
+ struct drm_crtc_state *new_crtc_state,
+ struct drm_connector_state *new_connector_state)
+{
+ struct mga_device *mdev = to_mga_device(encoder->dev);
+ struct mgag200_crtc_state *new_mgag200_crtc_state = to_mgag200_crtc_state(new_crtc_state);
+
+ new_mgag200_crtc_state->set_vidrst = mdev->info->sync_bmc;
+
+ return 0;
+}
+
+static const struct drm_encoder_helper_funcs mgag200_dac_encoder_helper_funcs = {
+ .atomic_check = mgag200_vga_bmc_encoder_atomic_check,
+};
+
static const struct drm_encoder_funcs mgag200_dac_encoder_funcs = {
.destroy = drm_encoder_cleanup
};
@@ -86,6 +102,8 @@ int mgag200_vga_bmc_output_init(struct mga_device *mdev)
drm_err(dev, "drm_encoder_init() failed: %d\n", ret);
return ret;
}
+ drm_encoder_helper_add(encoder, &mgag200_dac_encoder_helper_funcs);
+
encoder->possible_crtcs = drm_crtc_mask(crtc);
ddc = mgag200_ddc_create(mdev);