From: Stephen Boyd <swboyd@chromium.org> To: Andrzej Hajda <a.hajda@samsung.com>, Neil Armstrong <narmstrong@baylibre.com> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Douglas Anderson <dianders@chromium.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@siol.net>, Sean Paul <seanpaul@chromium.org> Subject: [PATCH v2 4/4] drm/bridge: ti-sn65dsi86: Update reply on aux failures Date: Thu, 29 Oct 2020 18:17:38 -0700 [thread overview] Message-ID: <20201030011738.2028313-5-swboyd@chromium.org> (raw) In-Reply-To: <20201030011738.2028313-1-swboyd@chromium.org> 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: - Handle WRITE_STATUS_UPDATE properly Cc: 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> Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 36 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index f86934fd6cc8..984ea41deca8 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -873,10 +873,16 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, return -EINVAL; switch (request) { + case DP_AUX_I2C_WRITE_STATUS_UPDATE: + /* WRITE_STATUS_UPDATE only matters for request_val */ + request &= ~DP_AUX_I2C_WRITE_STATUS_UPDATE; + fallthrough; case DP_AUX_NATIVE_WRITE: case DP_AUX_I2C_WRITE: case DP_AUX_NATIVE_READ: case DP_AUX_I2C_READ: + /* Assume it's good */ + msg->reply = 0; break; default: return -EINVAL; @@ -909,10 +915,32 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, ret = regmap_read(pdata->regmap, SN_AUX_CMD_STATUS_REG, &val); if (ret) return ret; - else if ((val & AUX_IRQ_STATUS_NAT_I2C_FAIL) - || (val & AUX_IRQ_STATUS_AUX_RPLY_TOUT) - || (val & AUX_IRQ_STATUS_AUX_SHORT)) - return -ENXIO; + + if (val & AUX_IRQ_STATUS_AUX_RPLY_TOUT) { + /* + * The hardware tried the message seven times per the DP spec + * but it hit a timeout. We ignore defers here because they're + * handled in hardware. + */ + return -ETIMEDOUT; + } + if (val & AUX_IRQ_STATUS_AUX_SHORT) { + ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &len); + if (ret) + return ret; + } else if (val & AUX_IRQ_STATUS_NAT_I2C_FAIL) { + switch (request) { + case DP_AUX_I2C_WRITE: + case DP_AUX_I2C_READ: + msg->reply |= DP_AUX_I2C_REPLY_NACK; + break; + case DP_AUX_NATIVE_READ: + case DP_AUX_NATIVE_WRITE: + msg->reply |= DP_AUX_NATIVE_REPLY_NACK; + break; + } + return 0; + } if (request == DP_AUX_NATIVE_WRITE || request == DP_AUX_I2C_WRITE || len == 0) -- Sent by a computer, using git, on the internet
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <swboyd@chromium.org> To: Andrzej Hajda <a.hajda@samsung.com>, Neil Armstrong <narmstrong@baylibre.com> Cc: Jernej Skrabec <jernej.skrabec@siol.net>, Jonas Karlman <jonas@kwiboo.se>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Douglas Anderson <dianders@chromium.org>, Sean Paul <seanpaul@chromium.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Subject: [PATCH v2 4/4] drm/bridge: ti-sn65dsi86: Update reply on aux failures Date: Thu, 29 Oct 2020 18:17:38 -0700 [thread overview] Message-ID: <20201030011738.2028313-5-swboyd@chromium.org> (raw) In-Reply-To: <20201030011738.2028313-1-swboyd@chromium.org> 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: - Handle WRITE_STATUS_UPDATE properly Cc: 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> Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 36 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index f86934fd6cc8..984ea41deca8 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -873,10 +873,16 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, return -EINVAL; switch (request) { + case DP_AUX_I2C_WRITE_STATUS_UPDATE: + /* WRITE_STATUS_UPDATE only matters for request_val */ + request &= ~DP_AUX_I2C_WRITE_STATUS_UPDATE; + fallthrough; case DP_AUX_NATIVE_WRITE: case DP_AUX_I2C_WRITE: case DP_AUX_NATIVE_READ: case DP_AUX_I2C_READ: + /* Assume it's good */ + msg->reply = 0; break; default: return -EINVAL; @@ -909,10 +915,32 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, ret = regmap_read(pdata->regmap, SN_AUX_CMD_STATUS_REG, &val); if (ret) return ret; - else if ((val & AUX_IRQ_STATUS_NAT_I2C_FAIL) - || (val & AUX_IRQ_STATUS_AUX_RPLY_TOUT) - || (val & AUX_IRQ_STATUS_AUX_SHORT)) - return -ENXIO; + + if (val & AUX_IRQ_STATUS_AUX_RPLY_TOUT) { + /* + * The hardware tried the message seven times per the DP spec + * but it hit a timeout. We ignore defers here because they're + * handled in hardware. + */ + return -ETIMEDOUT; + } + if (val & AUX_IRQ_STATUS_AUX_SHORT) { + ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &len); + if (ret) + return ret; + } else if (val & AUX_IRQ_STATUS_NAT_I2C_FAIL) { + switch (request) { + case DP_AUX_I2C_WRITE: + case DP_AUX_I2C_READ: + msg->reply |= DP_AUX_I2C_REPLY_NACK; + break; + case DP_AUX_NATIVE_READ: + case DP_AUX_NATIVE_WRITE: + msg->reply |= DP_AUX_NATIVE_REPLY_NACK; + break; + } + return 0; + } if (request == DP_AUX_NATIVE_WRITE || request == DP_AUX_I2C_WRITE || len == 0) -- Sent by a computer, using git, on the internet _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-10-30 1:17 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-30 1:17 [PATCH v2 0/4] drm/bridge: ti-sn65dsi86: Support EDID reading Stephen Boyd 2020-10-30 1:17 ` Stephen Boyd 2020-10-30 1:17 ` [PATCH v2 1/4] drm/bridge: ti-sn65dsi86: Combine register accesses in ti_sn_aux_transfer() Stephen Boyd 2020-10-30 1:17 ` Stephen Boyd 2020-11-02 16:18 ` Doug Anderson 2020-11-02 16:18 ` Doug Anderson 2020-11-02 17:06 ` Stephen Boyd 2020-11-02 17:06 ` Stephen Boyd 2020-10-30 1:17 ` [PATCH v2 2/4] drm/bridge: ti-sn65dsi86: Make polling a busy loop Stephen Boyd 2020-10-30 1:17 ` Stephen Boyd 2020-10-30 1:17 ` [PATCH v2 3/4] drm/bridge: ti-sn65dsi86: Read EDID blob over DDC Stephen Boyd 2020-10-30 1:17 ` Stephen Boyd 2020-11-01 19:20 ` Laurent Pinchart 2020-11-01 19:20 ` Laurent Pinchart 2020-11-02 16:06 ` Doug Anderson 2020-11-02 16:06 ` Doug Anderson 2020-11-02 17:38 ` Stephen Boyd 2020-11-02 17:38 ` Stephen Boyd 2020-11-02 21:55 ` Laurent Pinchart 2020-11-02 21:55 ` Laurent Pinchart 2020-10-30 1:17 ` Stephen Boyd [this message] 2020-10-30 1:17 ` [PATCH v2 4/4] drm/bridge: ti-sn65dsi86: Update reply on aux failures Stephen Boyd 2020-11-02 16:30 ` Doug Anderson 2020-11-02 16:30 ` Doug Anderson 2020-11-01 17:37 ` [PATCH v2 0/4] drm/bridge: ti-sn65dsi86: Support EDID reading Sam Ravnborg 2020-11-01 17:37 ` Sam Ravnborg 2020-11-02 16:37 ` Doug Anderson 2020-11-02 16:37 ` Doug Anderson 2020-11-02 17:09 ` Stephen Boyd 2020-11-02 17:09 ` Stephen Boyd 2020-11-03 6:11 ` Vinod Koul 2020-11-03 6:11 ` Vinod Koul 2020-11-03 1:15 ` Stephen Boyd 2020-11-03 1:15 ` Stephen Boyd 2020-11-03 2:38 ` Stephen Boyd 2020-11-03 2:38 ` Stephen Boyd 2021-03-23 0:00 ` Laurent Pinchart 2021-03-23 0:00 ` Laurent Pinchart 2021-03-23 7:25 ` Stephen Boyd 2021-03-23 7:25 ` Stephen Boyd
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201030011738.2028313-5-swboyd@chromium.org \ --to=swboyd@chromium.org \ --cc=Laurent.pinchart@ideasonboard.com \ --cc=a.hajda@samsung.com \ --cc=dianders@chromium.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=jernej.skrabec@siol.net \ --cc=jonas@kwiboo.se \ --cc=linux-kernel@vger.kernel.org \ --cc=narmstrong@baylibre.com \ --cc=seanpaul@chromium.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.