drm: rockchip: rk628: Fix reading 4block EDID for hdmi

After the current driver had read the EDID of 4block once,
hdmi->i2c->segment cannot reset to zero, which will cause the
data when restart reading to be block2 data not the expected
block0 data.
   At the same time, when msg->addr equal to DDC_SEGMENT_ADDR,
the next setting the same EDID related register, which will lead
to repeated reading of the data of block2, but unable to read the
address of block3.

Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Change-Id: I490c4b16d977dc044ce3b3ce2d6cfaebd8922f0c
This commit is contained in:
Nickey Yang
2020-11-11 09:53:38 +08:00
committed by Tao Huang
parent f251460759
commit 0b8aec3f03

View File

@@ -1267,10 +1267,12 @@ static int rk628_hdmi_i2c_write(struct rk628_hdmi *hdmi, struct i2c_msg *msgs)
((msgs->addr != DDC_ADDR) && (msgs->addr != DDC_SEGMENT_ADDR)))
return -EINVAL;
if (msgs->addr == DDC_SEGMENT_ADDR)
hdmi->i2c->segment_addr = msgs->buf[0];
if (msgs->addr == DDC_ADDR)
hdmi->i2c->ddc_addr = msgs->buf[0];
if (msgs->addr == DDC_SEGMENT_ADDR) {
hdmi->i2c->segment_addr = msgs->buf[0];
return 0;
}
/* Set edid fifo first addr */
hdmi_writeb(hdmi, HDMI_EDID_FIFO_OFFSET, 0x00);
@@ -1293,6 +1295,9 @@ static int rk628_hdmi_i2c_xfer(struct i2c_adapter *adap,
mutex_lock(&i2c->lock);
hdmi->i2c->ddc_addr = 0;
hdmi->i2c->segment_addr = 0;
/* Clear the EDID interrupt flag and unmute the interrupt */
hdmi_writeb(hdmi, HDMI_INTERRUPT_STATUS1, INT_EDID_READY);
hdmi_writeb(hdmi, HDMI_INTERRUPT_MASK1, INT_EDID_READY_MASK);