}
static int mtk_dp_aux_do_transfer(struct mtk_dp *mtk_dp, bool is_read, u8 cmd,
- u32 addr, u8 *buf, size_t length)
+ u32 addr, u8 *buf, size_t length, u8 *reply_cmd)
{
int ret;
- u32 reply_cmd;
if (is_read && (length > DP_AUX_MAX_PAYLOAD_BYTES ||
(cmd == DP_AUX_NATIVE_READ && !length)))
/* Wait for feedback from sink device. */
ret = mtk_dp_aux_wait_for_completion(mtk_dp, is_read);
- reply_cmd = mtk_dp_read(mtk_dp, MTK_DP_AUX_P0_3624) &
- AUX_RX_REPLY_COMMAND_AUX_TX_P0_MASK;
+ *reply_cmd = mtk_dp_read(mtk_dp, MTK_DP_AUX_P0_3624) &
+ AUX_RX_REPLY_COMMAND_AUX_TX_P0_MASK;
- if (ret || reply_cmd) {
+ if (ret) {
u32 phy_status = mtk_dp_read(mtk_dp, MTK_DP_AUX_P0_3628) &
AUX_RX_PHY_STATE_AUX_TX_P0_MASK;
if (phy_status != AUX_RX_PHY_STATE_AUX_TX_P0_RX_IDLE) {
ret = mtk_dp_aux_do_transfer(mtk_dp, is_read, request,
msg->address + accessed_bytes,
msg->buffer + accessed_bytes,
- to_access);
+ to_access, &msg->reply);
if (ret) {
drm_info(mtk_dp->drm_dev,
accessed_bytes += to_access;
} while (accessed_bytes < msg->size);
- msg->reply = DP_AUX_NATIVE_REPLY_ACK | DP_AUX_I2C_REPLY_ACK;
return msg->size;
err:
msg->reply = DP_AUX_NATIVE_REPLY_NACK | DP_AUX_I2C_REPLY_NACK;