Skip to content

Commit 019155e

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Use EDID from VBIOS embedded panel info
When an embedded panel has no DDC, read the EDID from the VBIOS embedded panel info and use that. Fixes: 7c7f5b1 ("drm/amd/display: Refactor edid read.") Link: https://gitlab.freedesktop.org/drm/amd/-/work_items/5192 Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 399b9ab)
1 parent 9ea16f6 commit 019155e

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,45 @@ dm_helpers_read_acpi_edid(struct amdgpu_dm_connector *aconnector)
10321032
return drm_edid_read_custom(connector, dm_helpers_probe_acpi_edid, connector);
10331033
}
10341034

1035+
static const struct drm_edid *
1036+
dm_helpers_read_vbios_hardcoded_edid(struct dc_link *link, struct amdgpu_dm_connector *aconnector)
1037+
{
1038+
struct dc_bios *bios = link->ctx->dc_bios;
1039+
struct embedded_panel_info info;
1040+
const struct drm_edid *edid;
1041+
enum bp_result r;
1042+
1043+
if (!dc_is_embedded_signal(link->connector_signal) ||
1044+
!bios->funcs->get_embedded_panel_info)
1045+
return NULL;
1046+
1047+
memset(&info, 0, sizeof(info));
1048+
r = bios->funcs->get_embedded_panel_info(bios, &info);
1049+
1050+
if (r != BP_RESULT_OK) {
1051+
dm_error("Error when reading embedded panel info: %u\n", r);
1052+
return NULL;
1053+
}
1054+
1055+
if (!info.fake_edid || !info.fake_edid_size) {
1056+
dm_error("Embedded panel info doesn't contain an EDID\n");
1057+
return NULL;
1058+
}
1059+
1060+
edid = drm_edid_alloc(info.fake_edid, info.fake_edid_size);
1061+
1062+
if (!drm_edid_valid(edid)) {
1063+
dm_error("EDID from embedded panel info is invalid\n");
1064+
drm_edid_free(edid);
1065+
return NULL;
1066+
}
1067+
1068+
aconnector->base.display_info.width_mm = info.panel_width_mm;
1069+
aconnector->base.display_info.height_mm = info.panel_height_mm;
1070+
1071+
return edid;
1072+
}
1073+
10351074
void populate_hdmi_info_from_connector(struct drm_hdmi_info *hdmi, struct dc_edid_caps *edid_caps)
10361075
{
10371076
edid_caps->scdc_present = hdmi->scdc.supported;
@@ -1052,6 +1091,9 @@ enum dc_edid_status dm_helpers_read_local_edid(
10521091

10531092
if (link->aux_mode)
10541093
ddc = &aconnector->dm_dp_aux.aux.ddc;
1094+
else if (link->ddc_hw_inst == GPIO_DDC_LINE_UNKNOWN &&
1095+
dc_is_embedded_signal(link->connector_signal))
1096+
ddc = NULL;
10551097
else
10561098
ddc = &aconnector->i2c->base;
10571099

@@ -1065,6 +1107,8 @@ enum dc_edid_status dm_helpers_read_local_edid(
10651107
drm_edid = dm_helpers_read_acpi_edid(aconnector);
10661108
if (drm_edid)
10671109
drm_info(connector->dev, "Using ACPI provided EDID for %s\n", connector->name);
1110+
else if (!ddc)
1111+
drm_edid = dm_helpers_read_vbios_hardcoded_edid(link, aconnector);
10681112
else
10691113
drm_edid = drm_edid_read_ddc(connector, ddc);
10701114
drm_edid_connector_update(connector, drm_edid);

0 commit comments

Comments
 (0)