mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
drm/mgag200: Add VGA-BMC output
Duplicate VGA output to VGA-BMC output and update all code for Matrox server chips. The new output represents a VGA output that has a BMC attached to it. No functional changes so far. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240805130622.63458-2-tzimmermann@suse.de
This commit is contained in:
parent
17419a5c8c
commit
f551072660
@ -12,6 +12,7 @@ mgag200-y := \
|
||||
mgag200_g200se.o \
|
||||
mgag200_g200wb.o \
|
||||
mgag200_mode.o \
|
||||
mgag200_vga_bmc.o \
|
||||
mgag200_vga.o
|
||||
|
||||
obj-$(CONFIG_DRM_MGAG200) += mgag200.o
|
||||
|
@ -437,6 +437,9 @@ void mgag200_enable_display(struct mga_device *mdev);
|
||||
void mgag200_init_registers(struct mga_device *mdev);
|
||||
int mgag200_mode_config_init(struct mga_device *mdev, resource_size_t vram_available);
|
||||
|
||||
/* mgag200_vga_bmc.c */
|
||||
int mgag200_vga_bmc_output_init(struct mga_device *mdev);
|
||||
|
||||
/* mgag200_vga.c */
|
||||
int mgag200_vga_output_init(struct mga_device *mdev);
|
||||
|
||||
|
@ -215,7 +215,7 @@ static int mgag200_g200eh_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -119,7 +119,7 @@ static int mgag200_g200eh3_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -258,7 +258,7 @@ static int mgag200_g200er_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -259,7 +259,7 @@ static int mgag200_g200ev_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -128,7 +128,7 @@ static int mgag200_g200ew3_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -390,7 +390,7 @@ static int mgag200_g200se_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -262,7 +262,7 @@ static int mgag200_g200wb_pipeline_init(struct mga_device *mdev)
|
||||
drm_mode_crtc_set_gamma_size(crtc, MGAG200_LUT_SIZE);
|
||||
drm_crtc_enable_color_mgmt(crtc, 0, false, MGAG200_LUT_SIZE);
|
||||
|
||||
ret = mgag200_vga_output_init(mdev);
|
||||
ret = mgag200_vga_bmc_output_init(mdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
72
drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
Normal file
72
drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
Normal file
@ -0,0 +1,72 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
|
||||
#include "mgag200_ddc.h"
|
||||
#include "mgag200_drv.h"
|
||||
|
||||
static const struct drm_encoder_funcs mgag200_dac_encoder_funcs = {
|
||||
.destroy = drm_encoder_cleanup
|
||||
};
|
||||
|
||||
static const struct drm_connector_helper_funcs mgag200_vga_connector_helper_funcs = {
|
||||
.get_modes = drm_connector_helper_get_modes,
|
||||
.detect_ctx = drm_connector_helper_detect_from_ddc
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs mgag200_vga_connector_funcs = {
|
||||
.reset = drm_atomic_helper_connector_reset,
|
||||
.fill_modes = drm_helper_probe_single_connector_modes,
|
||||
.destroy = drm_connector_cleanup,
|
||||
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state
|
||||
};
|
||||
|
||||
int mgag200_vga_bmc_output_init(struct mga_device *mdev)
|
||||
{
|
||||
struct drm_device *dev = &mdev->base;
|
||||
struct drm_crtc *crtc = &mdev->crtc;
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_connector *connector;
|
||||
struct i2c_adapter *ddc;
|
||||
int ret;
|
||||
|
||||
encoder = &mdev->output.vga.encoder;
|
||||
ret = drm_encoder_init(dev, encoder, &mgag200_dac_encoder_funcs,
|
||||
DRM_MODE_ENCODER_DAC, NULL);
|
||||
if (ret) {
|
||||
drm_err(dev, "drm_encoder_init() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
encoder->possible_crtcs = drm_crtc_mask(crtc);
|
||||
|
||||
ddc = mgag200_ddc_create(mdev);
|
||||
if (IS_ERR(ddc)) {
|
||||
ret = PTR_ERR(ddc);
|
||||
drm_err(dev, "failed to add DDC bus: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
connector = &mdev->output.vga.connector;
|
||||
ret = drm_connector_init_with_ddc(dev, connector,
|
||||
&mgag200_vga_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_VGA, ddc);
|
||||
if (ret) {
|
||||
drm_err(dev, "drm_connector_init_with_ddc() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
drm_connector_helper_add(connector, &mgag200_vga_connector_helper_funcs);
|
||||
|
||||
connector->polled = DRM_CONNECTOR_POLL_CONNECT |
|
||||
DRM_CONNECTOR_POLL_DISCONNECT;
|
||||
|
||||
ret = drm_connector_attach_encoder(connector, encoder);
|
||||
if (ret) {
|
||||
drm_err(dev, "drm_connector_attach_encoder() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user