Skip to content

Commit 9d09cac

Browse files
committed
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 <[email protected]> Reviewed-by: Jocelyn Falempe <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent dc06efb commit 9d09cac

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

drivers/gpu/drm/mgag200/mgag200_mode.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_st
611611
struct mga_device *mdev = to_mga_device(dev);
612612
const struct mgag200_device_funcs *funcs = mdev->funcs;
613613
struct drm_crtc_state *new_crtc_state = drm_atomic_get_new_crtc_state(new_state, crtc);
614-
struct mgag200_crtc_state *new_mgag200_crtc_state = to_mgag200_crtc_state(new_crtc_state);
615614
struct drm_property_blob *new_gamma_lut = new_crtc_state->gamma_lut;
616615
int ret;
617616

@@ -622,8 +621,6 @@ int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_st
622621
if (ret)
623622
return ret;
624623

625-
new_mgag200_crtc_state->set_vidrst = mdev->info->sync_bmc;
626-
627624
if (new_crtc_state->mode_changed) {
628625
if (funcs->pixpllc_atomic_check) {
629626
ret = funcs->pixpllc_atomic_check(crtc, new_state);

drivers/gpu/drm/mgag200/mgag200_vga_bmc.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
#include "mgag200_ddc.h"
99
#include "mgag200_drv.h"
1010

11+
static int mgag200_vga_bmc_encoder_atomic_check(struct drm_encoder *encoder,
12+
struct drm_crtc_state *new_crtc_state,
13+
struct drm_connector_state *new_connector_state)
14+
{
15+
struct mga_device *mdev = to_mga_device(encoder->dev);
16+
struct mgag200_crtc_state *new_mgag200_crtc_state = to_mgag200_crtc_state(new_crtc_state);
17+
18+
new_mgag200_crtc_state->set_vidrst = mdev->info->sync_bmc;
19+
20+
return 0;
21+
}
22+
23+
static const struct drm_encoder_helper_funcs mgag200_dac_encoder_helper_funcs = {
24+
.atomic_check = mgag200_vga_bmc_encoder_atomic_check,
25+
};
26+
1127
static const struct drm_encoder_funcs mgag200_dac_encoder_funcs = {
1228
.destroy = drm_encoder_cleanup
1329
};
@@ -86,6 +102,8 @@ int mgag200_vga_bmc_output_init(struct mga_device *mdev)
86102
drm_err(dev, "drm_encoder_init() failed: %d\n", ret);
87103
return ret;
88104
}
105+
drm_encoder_helper_add(encoder, &mgag200_dac_encoder_helper_funcs);
106+
89107
encoder->possible_crtcs = drm_crtc_mask(crtc);
90108

91109
ddc = mgag200_ddc_create(mdev);

0 commit comments

Comments
 (0)