diff mbox series

drm/bridge: ti-sn65dsi86: Clear old error bits before AUX transfers

Message ID 20200508163314.1.Idfa69d5d3fc9623083c0ff78572fea87dccb199c@changeid (mailing list archive)
State Accepted
Commit baef4d56195b6d6e0f681f6eac03d8c6db011d34
Headers show
Series drm/bridge: ti-sn65dsi86: Clear old error bits before AUX transfers | expand

Commit Message

Doug Anderson May 8, 2020, 11:33 p.m. UTC
The AUX channel transfer error bits in the status register are latched
and need to be cleared.  Clear them before doing our transfer so we
don't see old bits and get confused.

Without this patch having a single failure would mean that all future
transfers would look like they failed.

Fixes: b814ec6d4535 ("drm/bridge: ti-sn65dsi86: Implement AUX channel")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Rob Clark May 15, 2020, 9:48 p.m. UTC | #1
On Fri, May 8, 2020 at 4:33 PM Douglas Anderson <dianders@chromium.org> wrote:
>
> The AUX channel transfer error bits in the status register are latched
> and need to be cleared.  Clear them before doing our transfer so we
> don't see old bits and get confused.
>
> Without this patch having a single failure would mean that all future
> transfers would look like they failed.
>
> Fixes: b814ec6d4535 ("drm/bridge: ti-sn65dsi86: Implement AUX channel")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
>
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 6ad688b320ae..d865cc2565bc 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -827,6 +827,12 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
>                                      buf[i]);
>         }
>
> +       /* Clear old status bits before start so we don't get confused */
> +       regmap_write(pdata->regmap, SN_AUX_CMD_STATUS_REG,
> +                    AUX_IRQ_STATUS_NAT_I2C_FAIL |
> +                    AUX_IRQ_STATUS_AUX_RPLY_TOUT |
> +                    AUX_IRQ_STATUS_AUX_SHORT);
> +
>         regmap_write(pdata->regmap, SN_AUX_CMD_REG, request_val | AUX_CMD_SEND);
>
>         ret = regmap_read_poll_timeout(pdata->regmap, SN_AUX_CMD_REG, val,
> --
> 2.26.2.645.ge9eca65c58-goog
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sam Ravnborg May 18, 2020, 6:01 p.m. UTC | #2
On Fri, May 08, 2020 at 04:33:29PM -0700, Douglas Anderson wrote:
> The AUX channel transfer error bits in the status register are latched
> and need to be cleared.  Clear them before doing our transfer so we
> don't see old bits and get confused.
> 
> Without this patch having a single failure would mean that all future
> transfers would look like they failed.
> 
> Fixes: b814ec6d4535 ("drm/bridge: ti-sn65dsi86: Implement AUX channel")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Applied.

	Sam

> ---
> 
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 6ad688b320ae..d865cc2565bc 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -827,6 +827,12 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
>  				     buf[i]);
>  	}
>  
> +	/* Clear old status bits before start so we don't get confused */
> +	regmap_write(pdata->regmap, SN_AUX_CMD_STATUS_REG,
> +		     AUX_IRQ_STATUS_NAT_I2C_FAIL |
> +		     AUX_IRQ_STATUS_AUX_RPLY_TOUT |
> +		     AUX_IRQ_STATUS_AUX_SHORT);
> +
>  	regmap_write(pdata->regmap, SN_AUX_CMD_REG, request_val | AUX_CMD_SEND);
>  
>  	ret = regmap_read_poll_timeout(pdata->regmap, SN_AUX_CMD_REG, val,
> -- 
> 2.26.2.645.ge9eca65c58-goog
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index 6ad688b320ae..d865cc2565bc 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -827,6 +827,12 @@  static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
 				     buf[i]);
 	}
 
+	/* Clear old status bits before start so we don't get confused */
+	regmap_write(pdata->regmap, SN_AUX_CMD_STATUS_REG,
+		     AUX_IRQ_STATUS_NAT_I2C_FAIL |
+		     AUX_IRQ_STATUS_AUX_RPLY_TOUT |
+		     AUX_IRQ_STATUS_AUX_SHORT);
+
 	regmap_write(pdata->regmap, SN_AUX_CMD_REG, request_val | AUX_CMD_SEND);
 
 	ret = regmap_read_poll_timeout(pdata->regmap, SN_AUX_CMD_REG, val,