linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/bridge: Clear the DP_AUX_I2C_MOT bit passed in aux read command.
@ 2022-02-17  8:22 Hsin-Yi Wang
  2022-02-17  8:31 ` Xin Ji
  0 siblings, 1 reply; 4+ messages in thread
From: Hsin-Yi Wang @ 2022-02-17  8:22 UTC (permalink / raw)
  To: Xin Ji, Robert Foss
  Cc: Neil Armstrong, Jernej Skrabec, dri-devel, linux-kernel,
	Daniel Vetter, Andrzej Hajda

If the previous transfer didn't end with a command without DP_AUX_I2C_MOT,
the next read trasnfer will miss the first byte. But if the command in
previous transfer is requested with length 0, it's a no-op to anx7625
since it can't process this command. anx7625 requires the last command
to be read command with length > 0.

It's observed that if we clear the DP_AUX_I2C_MOT in read transfer, we
can still get correct data. Clear the read commands with DP_AUX_I2C_MOT
bit to fix this issue.

Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux channel")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
v1->v2: Offline discussed with Xin Ji, it's better to clear the bit on
read commands only.
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 633618bafd75d3..2805e9bed2c2f4 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -253,6 +253,8 @@ static int anx7625_aux_trans(struct anx7625_data *ctx, u8 op, u32 address,
 	addrm = (address >> 8) & 0xFF;
 	addrh = (address >> 16) & 0xFF;
 
+	if (!is_write)
+		op &= ~DP_AUX_I2C_MOT;
 	cmd = DPCD_CMD(len, op);
 
 	/* Set command and length */
-- 
2.35.1.265.g69c8d7142f-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/bridge: Clear the DP_AUX_I2C_MOT bit passed in aux read command.
  2022-02-17  8:22 [PATCH v2] drm/bridge: Clear the DP_AUX_I2C_MOT bit passed in aux read command Hsin-Yi Wang
@ 2022-02-17  8:31 ` Xin Ji
  2022-03-01  8:57   ` Hsin-Yi Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Xin Ji @ 2022-02-17  8:31 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Robert Foss, Neil Armstrong, Jernej Skrabec, dri-devel,
	linux-kernel, Daniel Vetter, Andrzej Hajda

On Thu, Feb 17, 2022 at 04:22:25PM +0800, Hsin-Yi Wang wrote:
> If the previous transfer didn't end with a command without DP_AUX_I2C_MOT,
> the next read trasnfer will miss the first byte. But if the command in
> previous transfer is requested with length 0, it's a no-op to anx7625
> since it can't process this command. anx7625 requires the last command
> to be read command with length > 0.
> 
> It's observed that if we clear the DP_AUX_I2C_MOT in read transfer, we
> can still get correct data. Clear the read commands with DP_AUX_I2C_MOT
> bit to fix this issue.

Hi Hsin-Yi, thanks for the patch!

Reviewed-by: Xin Ji <xji@analogixsemi.com>

Thanks,
Xin
> 
> Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux channel")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> v1->v2: Offline discussed with Xin Ji, it's better to clear the bit on
> read commands only.
> ---
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 633618bafd75d3..2805e9bed2c2f4 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -253,6 +253,8 @@ static int anx7625_aux_trans(struct anx7625_data *ctx, u8 op, u32 address,
>  	addrm = (address >> 8) & 0xFF;
>  	addrh = (address >> 16) & 0xFF;
>  
> +	if (!is_write)
> +		op &= ~DP_AUX_I2C_MOT;
>  	cmd = DPCD_CMD(len, op);
>  
>  	/* Set command and length */
> -- 
> 2.35.1.265.g69c8d7142f-goog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/bridge: Clear the DP_AUX_I2C_MOT bit passed in aux read command.
  2022-02-17  8:31 ` Xin Ji
@ 2022-03-01  8:57   ` Hsin-Yi Wang
  2022-03-01 13:03     ` Robert Foss
  0 siblings, 1 reply; 4+ messages in thread
From: Hsin-Yi Wang @ 2022-03-01  8:57 UTC (permalink / raw)
  To: Xin Ji
  Cc: Robert Foss, Neil Armstrong, Jernej Skrabec, dri-devel,
	linux-kernel, Daniel Vetter, Andrzej Hajda

On Thu, Feb 17, 2022 at 4:31 PM Xin Ji <xji@analogixsemi.com> wrote:
>
> On Thu, Feb 17, 2022 at 04:22:25PM +0800, Hsin-Yi Wang wrote:
> > If the previous transfer didn't end with a command without DP_AUX_I2C_MOT,
> > the next read trasnfer will miss the first byte. But if the command in
> > previous transfer is requested with length 0, it's a no-op to anx7625
> > since it can't process this command. anx7625 requires the last command
> > to be read command with length > 0.
> >
> > It's observed that if we clear the DP_AUX_I2C_MOT in read transfer, we
> > can still get correct data. Clear the read commands with DP_AUX_I2C_MOT
> > bit to fix this issue.
>
> Hi Hsin-Yi, thanks for the patch!
>
> Reviewed-by: Xin Ji <xji@analogixsemi.com>
>
> Thanks,
> Xin

Hi Robert,

Kindly ping on this fix. Thanks.

> >
> > Fixes: adca62ec370c ("drm/bridge: anx7625: Support reading edid through aux channel")
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > ---
> > v1->v2: Offline discussed with Xin Ji, it's better to clear the bit on
> > read commands only.
> > ---
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 633618bafd75d3..2805e9bed2c2f4 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -253,6 +253,8 @@ static int anx7625_aux_trans(struct anx7625_data *ctx, u8 op, u32 address,
> >       addrm = (address >> 8) & 0xFF;
> >       addrh = (address >> 16) & 0xFF;
> >
> > +     if (!is_write)
> > +             op &= ~DP_AUX_I2C_MOT;
> >       cmd = DPCD_CMD(len, op);
> >
> >       /* Set command and length */
> > --
> > 2.35.1.265.g69c8d7142f-goog

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/bridge: Clear the DP_AUX_I2C_MOT bit passed in aux read command.
  2022-03-01  8:57   ` Hsin-Yi Wang
@ 2022-03-01 13:03     ` Robert Foss
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Foss @ 2022-03-01 13:03 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Xin Ji, Neil Armstrong, Jernej Skrabec, dri-devel, linux-kernel,
	Daniel Vetter, Andrzej Hajda

Applied to drm-misc-next.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-01 13:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17  8:22 [PATCH v2] drm/bridge: Clear the DP_AUX_I2C_MOT bit passed in aux read command Hsin-Yi Wang
2022-02-17  8:31 ` Xin Ji
2022-03-01  8:57   ` Hsin-Yi Wang
2022-03-01 13:03     ` Robert Foss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).