Skip to content

Commit 2788c96

Browse files
laeyraudChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_hdmi_ddc_v2: Add transfer abort on timeout cases
During a read or write transfer, the mtk_hdmi_ddc_v2 driver polls the DDC_I2C_IN_PROG bit of HPD_DDC_STATUS register to check if the transfer completes but do no particular action if a timeout is reached. It could lead the next transfer attempts to fail because the faulty transfer was not aborted. So, add in both low level read and write functions a abort action by writing the DDC_CTRL register with the ABORT_XFER command value. Fixes: 8d0f798 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188") Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20251205-mtk-hdmi-ddc-v2-fixes-v1-1-260dd0d320f4@collabora.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 4e7fd55 commit 2788c96

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ static int mtk_ddc_wr_one(struct mtk_hdmi_ddc *ddc, u16 addr_id,
9696
!(val & DDC_I2C_IN_PROG), 500, 1000);
9797
if (ret) {
9898
dev_err(ddc->dev, "DDC I2C write timeout\n");
99+
100+
/* Abort transfer if it is still in progress */
101+
regmap_update_bits(ddc->regs, DDC_CTRL, DDC_CTRL_CMD,
102+
FIELD_PREP(DDC_CTRL_CMD, DDC_CMD_ABORT_XFER));
103+
99104
return ret;
100105
}
101106

@@ -179,6 +184,11 @@ static int mtk_ddcm_read_hdmi(struct mtk_hdmi_ddc *ddc, u16 uc_dev,
179184
500 * (temp_length + 5));
180185
if (ret) {
181186
dev_err(ddc->dev, "Timeout waiting for DDC I2C\n");
187+
188+
/* Abort transfer if it is still in progress */
189+
regmap_update_bits(ddc->regs, DDC_CTRL, DDC_CTRL_CMD,
190+
FIELD_PREP(DDC_CTRL_CMD, DDC_CMD_ABORT_XFER));
191+
182192
return ret;
183193
}
184194

0 commit comments

Comments
 (0)