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
This commit is contained in:
Thomas Zimmermann 2024-08-05 15:05:59 +02:00
parent dc06efbb79
commit 9d09cac47d
2 changed files with 18 additions and 3 deletions

View File

@ -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);

View File

@ -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);