From 3b2961139de3beaaf95c0fd89cdbb8332735f3c9 Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Wed, 28 Jan 2015 19:30:06 -0800 Subject: [PATCH] dp: Only increment segment pointer if required. It seems that monitors capable of MST, upon switching to SST mode in the monitor options menu, respond with NACK when the segment pointer is written. These same monitors ACK segment pointer writes when running in MST mode. Tested monitors that are SST only monitors also ACK segment pointer writes. The issue here is that MST monitors running in SST mode will error out when the I2C read function is called because the segment pointer is always being written to 0 (segment pointer is reset), and thus receives a NACK. This patch prevents this from happening. From now on, if the user changes the segment pointer, it is up to them to reset it to 0. The I2C read will only increment the segment pointer when required to do a read outside of the base EDID block. Signed-off-by: Andrei-Liviu Simion --- XilinxProcessorIPLib/drivers/dp/src/xdp.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/dp/src/xdp.c b/XilinxProcessorIPLib/drivers/dp/src/xdp.c index 15adf80f..83a7f89d 100644 --- a/XilinxProcessorIPLib/drivers/dp/src/xdp.c +++ b/XilinxProcessorIPLib/drivers/dp/src/xdp.c @@ -804,9 +804,8 @@ u32 XDp_TxIicRead(XDp *InstancePtr, u8 IicAddress, u16 Offset, NumBytesLeftInSeg = 256 - Offset; /* Set the segment pointer to 0. */ - Status = XDp_TxIicWrite(InstancePtr, XDP_SEGPTR_ADDR, 1, &SegPtr); - if (Status != XST_SUCCESS) { - return Status; + if (SegPtr != 0) { + XDp_TxIicWrite(InstancePtr, XDP_SEGPTR_ADDR, 1, &SegPtr); } /* Send I2C read message. Multiple transactions are required if the @@ -848,11 +847,8 @@ u32 XDp_TxIicRead(XDp *InstancePtr, u8 IicAddress, u16 Offset, Offset %= 256; SegPtr++; - Status = XDp_TxIicWrite(InstancePtr, - XDP_SEGPTR_ADDR, 1, &SegPtr); - if (Status != XST_SUCCESS) { - return Status; - } + XDp_TxIicWrite(InstancePtr, XDP_SEGPTR_ADDR, + 1, &SegPtr); } } /* Last I2C read. */ @@ -862,8 +858,10 @@ u32 XDp_TxIicRead(XDp *InstancePtr, u8 IicAddress, u16 Offset, } /* Reset the segment pointer to 0. */ - SegPtr = 0; - Status = XDp_TxIicWrite(InstancePtr, XDP_SEGPTR_ADDR, 1, &SegPtr); + if (SegPtr != 0) { + SegPtr = 0; + XDp_TxIicWrite(InstancePtr, XDP_SEGPTR_ADDR, 1, &SegPtr); + } return Status; }