[PATCH 3/5] drm/mgag200: vga-bmc: Control CRTC VIDRST flag from encoder
Jocelyn Falempe
jfalempe at redhat.com
Tue Aug 6 12:10:07 UTC 2024
On 05/08/2024 15:05, Thomas Zimmermann wrote:
> 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.
Thanks for this work.
Reviewed-by: Jocelyn Falempe <jfalempe at redhat.com>
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/mgag200/mgag200_mode.c | 3 ---
> drivers/gpu/drm/mgag200/mgag200_vga_bmc.c | 18 ++++++++++++++++++
> 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);
More information about the dri-devel
mailing list