soc/mediatek/mt8196: Support 512 bytes EDID

Refine dptx_get_edid function to read extension edid to bring up 2.8k
120hz OLED panel.

BRANCH=rauru
BUG=b:392040003
TEST=check edp training pass and show log:
EQ training pass

Change-Id: If35782950ae02d892ea697580fa4991595c21533
Signed-off-by: Bincai Liu <bincai.liu@mediatek.corp-partner.google.com>
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86779
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Bincai Liu 2025-02-13 23:19:44 +08:00 committed by Matt DeVillier
commit f864a192e3
2 changed files with 28 additions and 5 deletions

View file

@ -73,17 +73,38 @@ bool dptx_auxread_dpcd(struct mtk_dp *mtk_dp, u8 cmd, u32 dpcd_addr,
int dptx_get_edid(struct mtk_dp *mtk_dp, struct edid *out)
{
int ret;
u8 edid[ONE_BLOCK_SIZE];
u8 edid[EDID_BUF_SIZE];
u8 tmp = 0;
u8 extblock = 0;
size_t total_size;
dptx_auxwrite_dpcd(mtk_dp, DP_AUX_I2C_WRITE, 0x50, 0x1, &tmp);
for (tmp = 0; tmp < ONE_BLOCK_SIZE / DP_AUX_MAX_PAYLOAD_BYTES; tmp++)
/* Read 1st block */
for (tmp = 0; tmp < EDID_BLOCK_SIZE / DP_AUX_MAX_PAYLOAD_BYTES; tmp++)
dptx_auxread_dpcd(mtk_dp, DP_AUX_I2C_READ,
0x50, DP_AUX_MAX_PAYLOAD_BYTES,
edid + tmp * 16);
edid + tmp * DP_AUX_MAX_PAYLOAD_BYTES);
ret = decode_edid(edid, ONE_BLOCK_SIZE, out);
extblock = edid[EDID_EXT_BLOCK_COUNT];
total_size = EDID_BLOCK_SIZE * (1 + extblock);
if (total_size > EDID_BUF_SIZE) {
printk(BIOS_WARNING, "The edid block size(%zu) is larger than %u bytes\n",
total_size, EDID_BUF_SIZE);
printk(BIOS_WARNING, "Read first %u bytes only\n", EDID_BUF_SIZE);
total_size = EDID_BUF_SIZE;
}
if (total_size > EDID_BLOCK_SIZE) {
for (tmp = EDID_BLOCK_SIZE / DP_AUX_MAX_PAYLOAD_BYTES;
tmp < total_size / DP_AUX_MAX_PAYLOAD_BYTES; tmp++)
dptx_auxread_dpcd(mtk_dp, DP_AUX_I2C_READ,
0x50, DP_AUX_MAX_PAYLOAD_BYTES,
edid + tmp * DP_AUX_MAX_PAYLOAD_BYTES);
}
ret = decode_edid(edid, total_size, out);
if (ret != EDID_CONFORMANT) {
printk(BIOS_ERR, "failed to decode edid(%d).\n", ret);
return -1;

View file

@ -8,7 +8,8 @@
#define ENABLE_DPTX_EF_MODE 0x1
#define DPTX_AUX_SET_ENAHNCED_FRAME 0x80
#define ONE_BLOCK_SIZE 128
#define EDID_BLOCK_SIZE 128
#define EDID_BUF_SIZE (EDID_BLOCK_SIZE * 4)
#define DP_LINK_CONSTANT_N_VALUE 0x8000
#define DP_LINK_STATUS_SIZE 6
@ -38,6 +39,7 @@
#define DP_EDP_14 0x03
#define DP_EDP_14a 0x04
#define DP_EDP_14b 0x05
#define EDID_EXT_BLOCK_COUNT 0x7E
/* Receiver Capability */
#define DP_DPCD_REV 0x000