mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
drm/mgag200: Only set VIDRST bits in CRTC modesetting
The VRSTEN and HRSTEN bits control whether a CRTC synchronizes its display signal with an external source on the VIDRST pin. The G200WB and G200EW3 models synchronize with a BMC chip, but different external video encoders, such as the Matrox Maven, can also be attached to the pin. Only set VRSTEN and HRSTEN bits in the CRTC mode-setting code, so the bits are independent from the BMC. Add the field set_vidrst to the CRTC state for this purpose. Off by default, control the CRTC VIDRST setting from the CRTC's atomic_check helper. v3: - don't clear bits unnecessary (Jocelyn) v2: - keep logic entirely in CRTC (Jocelyn) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240711072415.11831-2-tzimmermann@suse.de
This commit is contained in:
parent
0b91c6daca
commit
cd3a2e8b0a
@ -77,11 +77,6 @@ void mgag200_bmc_enable_vidrst(struct mga_device *mdev)
|
||||
{
|
||||
u8 tmp;
|
||||
|
||||
/* Ensure that the vrsten and hrsten are set */
|
||||
WREG8(MGAREG_CRTCEXT_INDEX, 1);
|
||||
tmp = RREG8(MGAREG_CRTCEXT_DATA);
|
||||
WREG8(MGAREG_CRTCEXT_DATA, tmp | 0x88);
|
||||
|
||||
/* Assert rstlvl2 */
|
||||
WREG8(DAC_INDEX, MGA1064_REMHEADCTL2);
|
||||
tmp = RREG8(DAC_DATA);
|
||||
|
@ -179,6 +179,8 @@ struct mgag200_crtc_state {
|
||||
const struct drm_format_info *format;
|
||||
|
||||
struct mgag200_pll_values pixpllc;
|
||||
|
||||
bool set_vidrst;
|
||||
};
|
||||
|
||||
static inline struct mgag200_crtc_state *to_mgag200_crtc_state(struct drm_crtc_state *base)
|
||||
@ -430,7 +432,8 @@ void mgag200_crtc_atomic_destroy_state(struct drm_crtc *crtc, struct drm_crtc_st
|
||||
.atomic_duplicate_state = mgag200_crtc_atomic_duplicate_state, \
|
||||
.atomic_destroy_state = mgag200_crtc_atomic_destroy_state
|
||||
|
||||
void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mode *mode);
|
||||
void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mode *mode,
|
||||
bool set_vidrst);
|
||||
void mgag200_set_format_regs(struct mga_device *mdev, const struct drm_format_info *format);
|
||||
void mgag200_enable_display(struct mga_device *mdev);
|
||||
void mgag200_init_registers(struct mga_device *mdev);
|
||||
|
@ -195,7 +195,7 @@ static void mgag200_g200er_crtc_helper_atomic_enable(struct drm_crtc *crtc,
|
||||
funcs->disable_vidrst(mdev);
|
||||
|
||||
mgag200_set_format_regs(mdev, format);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode, mgag200_crtc_state->set_vidrst);
|
||||
|
||||
if (funcs->pixpllc_atomic_update)
|
||||
funcs->pixpllc_atomic_update(crtc, old_state);
|
||||
|
@ -196,7 +196,7 @@ static void mgag200_g200ev_crtc_helper_atomic_enable(struct drm_crtc *crtc,
|
||||
funcs->disable_vidrst(mdev);
|
||||
|
||||
mgag200_set_format_regs(mdev, format);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode, mgag200_crtc_state->set_vidrst);
|
||||
|
||||
if (funcs->pixpllc_atomic_update)
|
||||
funcs->pixpllc_atomic_update(crtc, old_state);
|
||||
|
@ -327,7 +327,7 @@ static void mgag200_g200se_crtc_helper_atomic_enable(struct drm_crtc *crtc,
|
||||
funcs->disable_vidrst(mdev);
|
||||
|
||||
mgag200_set_format_regs(mdev, format);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode, mgag200_crtc_state->set_vidrst);
|
||||
|
||||
if (funcs->pixpllc_atomic_update)
|
||||
funcs->pixpllc_atomic_update(crtc, old_state);
|
||||
|
@ -201,9 +201,9 @@ void mgag200_init_registers(struct mga_device *mdev)
|
||||
WREG8(MGA_MISC_OUT, misc);
|
||||
}
|
||||
|
||||
void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mode *mode)
|
||||
void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mode *mode,
|
||||
bool set_vidrst)
|
||||
{
|
||||
const struct mgag200_device_info *info = mdev->info;
|
||||
unsigned int hdisplay, hsyncstart, hsyncend, htotal;
|
||||
unsigned int vdisplay, vsyncstart, vsyncend, vtotal;
|
||||
u8 misc, crtcext1, crtcext2, crtcext5;
|
||||
@ -238,7 +238,7 @@ void mgag200_set_mode_regs(struct mga_device *mdev, const struct drm_display_mod
|
||||
((hdisplay & 0x100) >> 7) |
|
||||
((hsyncstart & 0x100) >> 6) |
|
||||
(htotal & 0x40);
|
||||
if (info->has_vidrst)
|
||||
if (set_vidrst)
|
||||
crtcext1 |= MGAREG_CRTCEXT1_VRSTEN |
|
||||
MGAREG_CRTCEXT1_HRSTEN;
|
||||
|
||||
@ -597,6 +597,7 @@ 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;
|
||||
|
||||
@ -607,6 +608,8 @@ 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->has_vidrst;
|
||||
|
||||
if (new_crtc_state->mode_changed) {
|
||||
if (funcs->pixpllc_atomic_check) {
|
||||
ret = funcs->pixpllc_atomic_check(crtc, new_state);
|
||||
@ -656,7 +659,7 @@ void mgag200_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_
|
||||
funcs->disable_vidrst(mdev);
|
||||
|
||||
mgag200_set_format_regs(mdev, format);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode);
|
||||
mgag200_set_mode_regs(mdev, adjusted_mode, mgag200_crtc_state->set_vidrst);
|
||||
|
||||
if (funcs->pixpllc_atomic_update)
|
||||
funcs->pixpllc_atomic_update(crtc, old_state);
|
||||
@ -717,6 +720,7 @@ struct drm_crtc_state *mgag200_crtc_atomic_duplicate_state(struct drm_crtc *crtc
|
||||
new_mgag200_crtc_state->format = mgag200_crtc_state->format;
|
||||
memcpy(&new_mgag200_crtc_state->pixpllc, &mgag200_crtc_state->pixpllc,
|
||||
sizeof(new_mgag200_crtc_state->pixpllc));
|
||||
new_mgag200_crtc_state->set_vidrst = mgag200_crtc_state->set_vidrst;
|
||||
|
||||
return &new_mgag200_crtc_state->base;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user