Skip to content

Commit 80e33e3

Browse files
Timur Kristófgregkh
authored andcommitted
drm/amd/display: Read EDID from VBIOS embedded panel info
[ Upstream commit 9ea16f6 ] Some board manufacturers hardcode the EDID for the embedded panel in the VBIOS. This EDID should be used when the panel doesn't have a DDC. For reference, see the legacy non-DC display code: amdgpu_atombios_encoder_get_lcd_info() This is necessary to support embedded connectors without DDC. Fixes: 4562236 ("drm/amd/dc: Add dc display driver (v2)") 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 eb105e6) Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e95c024 commit 80e33e3

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/dc/bios/bios_parser.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,60 @@ static enum bp_result bios_parser_get_embedded_panel_info(
12151215
return BP_RESULT_FAILURE;
12161216
}
12171217

1218+
static enum bp_result get_embedded_panel_extra_info(
1219+
struct bios_parser *bp,
1220+
struct embedded_panel_info *info,
1221+
const uint32_t table_offset)
1222+
{
1223+
uint8_t *record = bios_get_image(&bp->base, table_offset, 1);
1224+
ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record;
1225+
ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record;
1226+
1227+
while (*record != ATOM_RECORD_END_TYPE) {
1228+
switch (*record) {
1229+
case LCD_MODE_PATCH_RECORD_MODE_TYPE:
1230+
record += sizeof(ATOM_PATCH_RECORD_MODE);
1231+
break;
1232+
case LCD_RTS_RECORD_TYPE:
1233+
record += sizeof(ATOM_LCD_RTS_RECORD);
1234+
break;
1235+
case LCD_CAP_RECORD_TYPE:
1236+
record += sizeof(ATOM_LCD_MODE_CONTROL_CAP);
1237+
break;
1238+
case LCD_FAKE_EDID_PATCH_RECORD_TYPE:
1239+
fake_edid_record = (ATOM_FAKE_EDID_PATCH_RECORD *)record;
1240+
if (fake_edid_record->ucFakeEDIDLength) {
1241+
if (fake_edid_record->ucFakeEDIDLength == 128)
1242+
info->fake_edid_size =
1243+
fake_edid_record->ucFakeEDIDLength;
1244+
else
1245+
info->fake_edid_size =
1246+
fake_edid_record->ucFakeEDIDLength * 128;
1247+
1248+
info->fake_edid = fake_edid_record->ucFakeEDIDString;
1249+
1250+
record += struct_size(fake_edid_record,
1251+
ucFakeEDIDString,
1252+
info->fake_edid_size);
1253+
} else {
1254+
/* empty fake edid record must be 3 bytes long */
1255+
record += sizeof(ATOM_FAKE_EDID_PATCH_RECORD) + 1;
1256+
}
1257+
break;
1258+
case LCD_PANEL_RESOLUTION_RECORD_TYPE:
1259+
panel_res_record = (ATOM_PANEL_RESOLUTION_PATCH_RECORD *)record;
1260+
info->panel_width_mm = panel_res_record->usHSize;
1261+
info->panel_height_mm = panel_res_record->usVSize;
1262+
record += sizeof(ATOM_PANEL_RESOLUTION_PATCH_RECORD);
1263+
break;
1264+
default:
1265+
return BP_RESULT_BADBIOSTABLE;
1266+
}
1267+
}
1268+
1269+
return BP_RESULT_OK;
1270+
}
1271+
12181272
static enum bp_result get_embedded_panel_info_v1_2(
12191273
struct bios_parser *bp,
12201274
struct embedded_panel_info *info)
@@ -1331,6 +1385,10 @@ static enum bp_result get_embedded_panel_info_v1_2(
13311385
if (ATOM_PANEL_MISC_API_ENABLED & lvds->ucLVDS_Misc)
13321386
info->lcd_timing.misc_info.API_ENABLED = true;
13331387

1388+
if (lvds->usExtInfoTableOffset)
1389+
return get_embedded_panel_extra_info(bp, info,
1390+
le16_to_cpu(lvds->usExtInfoTableOffset) + DATA_TABLES(LCD_Info));
1391+
13341392
return BP_RESULT_OK;
13351393
}
13361394

@@ -1456,6 +1514,10 @@ static enum bp_result get_embedded_panel_info_v1_3(
14561514
(uint32_t) (ATOM_PANEL_MISC_V13_GREY_LEVEL &
14571515
lvds->ucLCD_Misc) >> ATOM_PANEL_MISC_V13_GREY_LEVEL_SHIFT;
14581516

1517+
if (lvds->usExtInfoTableOffset)
1518+
return get_embedded_panel_extra_info(bp, info,
1519+
le16_to_cpu(lvds->usExtInfoTableOffset) + DATA_TABLES(LCD_Info));
1520+
14591521
return BP_RESULT_OK;
14601522
}
14611523

drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ struct embedded_panel_info {
153153
uint32_t drr_enabled;
154154
uint32_t min_drr_refresh_rate;
155155
bool realtek_eDPToLVDS;
156+
uint16_t panel_width_mm;
157+
uint16_t panel_height_mm;
158+
uint16_t fake_edid_size;
159+
const uint8_t *fake_edid;
156160
};
157161

158162
struct dc_firmware_info {

0 commit comments

Comments
 (0)