Skip to content

Commit 982f589

Browse files
bebarinosravnborg
authored andcommitted
drm/bridge: ti-sn65dsi86: Update reply on aux failures
We should be setting the drm_dp_aux_msg::reply field if a NACK or a SHORT reply happens. Update the error bit handling logic in ti_sn_aux_transfer() to handle these cases and notify upper layers that such errors have happened. This helps the retry logic understand that a timeout has happened, or to shorten the read length if the panel isn't able to handle the longest read possible. Note: I don't have any hardware that exhibits these code paths so this is written based on reading the datasheet for this bridge and inspecting the code and how this is called. Changes in v2: - Move WRITE_STATUS_UPDATE check from case to assignment Changes in v2: - Handle WRITE_STATUS_UPDATE properly Reviewed-by: Douglas Anderson <dianders@chromium.org> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Jernej Skrabec <jernej.skrabec@siol.net> Cc: Sean Paul <seanpaul@chromium.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20201102181144.3469197-5-swboyd@chromium.org
1 parent 58074b0 commit 982f589

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

‎drivers/gpu/drm/bridge/ti-sn65dsi86.c‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
878878
struct drm_dp_aux_msg *msg)
879879
{
880880
struct ti_sn_bridge *pdata = aux_to_ti_sn_bridge(aux);
881-
u32 request = msg->request & ~DP_AUX_I2C_MOT;
881+
u32 request = msg->request & ~(DP_AUX_I2C_MOT | DP_AUX_I2C_WRITE_STATUS_UPDATE);
882882
u32 request_val = AUX_CMD_REQ(msg->request);
883883
u8 *buf = msg->buffer;
884884
unsigned int len = msg->size;
@@ -895,6 +895,8 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
895895
case DP_AUX_NATIVE_READ:
896896
case DP_AUX_I2C_READ:
897897
regmap_write(pdata->regmap, SN_AUX_CMD_REG, request_val);
898+
/* Assume it's good */
899+
msg->reply = 0;
898900
break;
899901
default:
900902
return -EINVAL;
@@ -926,10 +928,33 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
926928
ret = regmap_read(pdata->regmap, SN_AUX_CMD_STATUS_REG, &val);
927929
if (ret)
928930
return ret;
929-
else if ((val & AUX_IRQ_STATUS_NAT_I2C_FAIL)
930-
|| (val & AUX_IRQ_STATUS_AUX_RPLY_TOUT)
931-
|| (val & AUX_IRQ_STATUS_AUX_SHORT))
932-
return -ENXIO;
931+
932+
if (val & AUX_IRQ_STATUS_AUX_RPLY_TOUT) {
933+
/*
934+
* The hardware tried the message seven times per the DP spec
935+
* but it hit a timeout. We ignore defers here because they're
936+
* handled in hardware.
937+
*/
938+
return -ETIMEDOUT;
939+
}
940+
941+
if (val & AUX_IRQ_STATUS_AUX_SHORT) {
942+
ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &len);
943+
if (ret)
944+
return ret;
945+
} else if (val & AUX_IRQ_STATUS_NAT_I2C_FAIL) {
946+
switch (request) {
947+
case DP_AUX_I2C_WRITE:
948+
case DP_AUX_I2C_READ:
949+
msg->reply |= DP_AUX_I2C_REPLY_NACK;
950+
break;
951+
case DP_AUX_NATIVE_READ:
952+
case DP_AUX_NATIVE_WRITE:
953+
msg->reply |= DP_AUX_NATIVE_REPLY_NACK;
954+
break;
955+
}
956+
return 0;
957+
}
933958

934959
if (request == DP_AUX_NATIVE_WRITE || request == DP_AUX_I2C_WRITE ||
935960
len == 0)

0 commit comments

Comments
 (0)