Message ID | 20240503151129.3901815-15-l.stach@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 61bfcd190820d1dce846e58a4c9ddca8db4751ed |
Headers | show |
Series | improve Analogix DP AUX channel handling | expand |
On Fri, May 3, 2024 at 5:12 PM Lucas Stach <l.stach@pengutronix.de> wrote: > > Timeouts on the AUX bus are to be expected in certain normal operating > conditions. There is no need to raise an error log or re-initialize the > whole AUX state machine. Simply acknowledge the AUX_ERR interrupt and > let upper layers know about the timeout. > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> > --- > drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 3 +++ > drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h | 9 +++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > index 0f016dca9f3d..3afc73c858c4 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > @@ -1016,6 +1016,9 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, > > writel(AUX_ERR, dp->reg_base + ANALOGIX_DP_INT_STA); > > + if (aux_status == AUX_STATUS_TIMEOUT_ERROR) > + return -ETIMEDOUT; > + > dev_warn(dp->dev, "AUX CH error happened: %#x (%d)\n", > aux_status, !!(reg & AUX_ERR)); > goto aux_error; > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h > index e284ee8da58b..12735139046c 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h > @@ -361,6 +361,15 @@ > /* ANALOGIX_DP_AUX_CH_STA */ > #define AUX_BUSY (0x1 << 4) > #define AUX_STATUS_MASK (0xf << 0) > +#define AUX_STATUS_OK (0x0 << 0) > +#define AUX_STATUS_NACK_ERROR (0x1 << 0) > +#define AUX_STATUS_TIMEOUT_ERROR (0x2 << 0) > +#define AUX_STATUS_UNKNOWN_ERROR (0x3 << 0) > +#define AUX_STATUS_MUCH_DEFER_ERROR (0x4 << 0) > +#define AUX_STATUS_TX_SHORT_ERROR (0x5 << 0) > +#define AUX_STATUS_RX_SHORT_ERROR (0x6 << 0) > +#define AUX_STATUS_NACK_WITHOUT_M_ERROR (0x7 << 0) > +#define AUX_STATUS_I2C_NACK_ERROR (0x8 << 0) > > /* ANALOGIX_DP_AUX_CH_DEFER_CTL */ > #define DEFER_CTRL_EN (0x1 << 7) > -- > 2.39.2 > Reviewed-by: Robert Foss <rfoss@kernel.org> This series has a few checkpath --strict warnings, could you fix those and I'll merge v2? Rob.
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 0f016dca9f3d..3afc73c858c4 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -1016,6 +1016,9 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, writel(AUX_ERR, dp->reg_base + ANALOGIX_DP_INT_STA); + if (aux_status == AUX_STATUS_TIMEOUT_ERROR) + return -ETIMEDOUT; + dev_warn(dp->dev, "AUX CH error happened: %#x (%d)\n", aux_status, !!(reg & AUX_ERR)); goto aux_error; diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h index e284ee8da58b..12735139046c 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h @@ -361,6 +361,15 @@ /* ANALOGIX_DP_AUX_CH_STA */ #define AUX_BUSY (0x1 << 4) #define AUX_STATUS_MASK (0xf << 0) +#define AUX_STATUS_OK (0x0 << 0) +#define AUX_STATUS_NACK_ERROR (0x1 << 0) +#define AUX_STATUS_TIMEOUT_ERROR (0x2 << 0) +#define AUX_STATUS_UNKNOWN_ERROR (0x3 << 0) +#define AUX_STATUS_MUCH_DEFER_ERROR (0x4 << 0) +#define AUX_STATUS_TX_SHORT_ERROR (0x5 << 0) +#define AUX_STATUS_RX_SHORT_ERROR (0x6 << 0) +#define AUX_STATUS_NACK_WITHOUT_M_ERROR (0x7 << 0) +#define AUX_STATUS_I2C_NACK_ERROR (0x8 << 0) /* ANALOGIX_DP_AUX_CH_DEFER_CTL */ #define DEFER_CTRL_EN (0x1 << 7)
Timeouts on the AUX bus are to be expected in certain normal operating conditions. There is no need to raise an error log or re-initialize the whole AUX state machine. Simply acknowledge the AUX_ERR interrupt and let upper layers know about the timeout. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 3 +++ drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h | 9 +++++++++ 2 files changed, 12 insertions(+)