* [PATCH 0/1] Regression in analogix_anx78xx
@ 2020-01-09 8:48 Tobias Schramm
2020-01-09 8:48 ` [PATCH 1/1] drm/bridge: anx78xx: fix integer type used for storing dp link rate Tobias Schramm
0 siblings, 1 reply; 3+ messages in thread
From: Tobias Schramm @ 2020-01-09 8:48 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec
Cc: David Airlie, Tobias Schramm, dri-devel, linux-kernel
commit ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers")
stores the max link rate in a u8, overflowing it.
This will probably prevent the link training from working properly.
I've not tested this patch beyond a simple compile test since I do not own
any devices containing an anx78xx. So please test!
Tobias
Tobias Schramm (1):
drm/bridge: anx78xx: fix integer type used for storing dp link rate
drivers/gpu/drm/bridge/analogix-anx78xx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--
2.24.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] drm/bridge: anx78xx: fix integer type used for storing dp link rate
2020-01-09 8:48 [PATCH 0/1] Regression in analogix_anx78xx Tobias Schramm
@ 2020-01-09 8:48 ` Tobias Schramm
2020-01-17 10:03 ` Andrzej Hajda
0 siblings, 1 reply; 3+ messages in thread
From: Tobias Schramm @ 2020-01-09 8:48 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec
Cc: David Airlie, Tobias Schramm, dri-devel, linux-kernel
commit ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers")
changed the link training logic to remove use of drm_dp_link helpers. However
the new logic stores the maximum link rate in a u8, overflowing it.
This commit changes the logic to store the max link rate in a unsigned int
instead.
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
drivers/gpu/drm/bridge/analogix-anx78xx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c
index 274989f96a91..0f38b8c40dff 100644
--- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
@@ -748,6 +748,7 @@ static int anx78xx_init_pdata(struct anx78xx *anx78xx)
static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
{
u8 dp_bw, dpcd[2];
+ unsigned int max_link_rate;
int err;
err = regmap_write(anx78xx->map[I2C_IDX_RX_P0], SP_HDMI_MUTE_CTRL_REG,
@@ -866,8 +867,8 @@ static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
if (err)
return err;
- dpcd[0] = drm_dp_max_link_rate(anx78xx->dpcd);
- dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]);
+ max_link_rate = drm_dp_max_link_rate(anx78xx->dpcd);
+ dpcd[0] = drm_dp_link_rate_to_bw_code(max_link_rate);
err = regmap_write(anx78xx->map[I2C_IDX_TX_P0],
SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
if (err)
--
2.24.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] drm/bridge: anx78xx: fix integer type used for storing dp link rate
2020-01-09 8:48 ` [PATCH 1/1] drm/bridge: anx78xx: fix integer type used for storing dp link rate Tobias Schramm
@ 2020-01-17 10:03 ` Andrzej Hajda
0 siblings, 0 replies; 3+ messages in thread
From: Andrzej Hajda @ 2020-01-17 10:03 UTC (permalink / raw)
To: Tobias Schramm, Neil Armstrong, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec
Cc: David Airlie, dri-devel, linux-kernel
On 09.01.2020 09:48, Tobias Schramm wrote:
> commit ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers")
> changed the link training logic to remove use of drm_dp_link helpers. However
> the new logic stores the maximum link rate in a u8, overflowing it.
> This commit changes the logic to store the max link rate in a unsigned int
> instead.
>
> Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
> ---
> drivers/gpu/drm/bridge/analogix-anx78xx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c
> index 274989f96a91..0f38b8c40dff 100644
> --- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
> +++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
> @@ -748,6 +748,7 @@ static int anx78xx_init_pdata(struct anx78xx *anx78xx)
> static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
> {
> u8 dp_bw, dpcd[2];
> + unsigned int max_link_rate;
> int err;
>
> err = regmap_write(anx78xx->map[I2C_IDX_RX_P0], SP_HDMI_MUTE_CTRL_REG,
> @@ -866,8 +867,8 @@ static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
> if (err)
> return err;
>
> - dpcd[0] = drm_dp_max_link_rate(anx78xx->dpcd);
> - dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]);
> + max_link_rate = drm_dp_max_link_rate(anx78xx->dpcd);
> + dpcd[0] = drm_dp_link_rate_to_bw_code(max_link_rate);
The code converts bw_code to rate, then reverse, maybe it should be
simplified:
dpcd[0] = anx78xx->dpcd[DP_MAX_LINK_RATE];
Regards
Andrzej
> err = regmap_write(anx78xx->map[I2C_IDX_TX_P0],
> SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
> if (err)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-17 10:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 8:48 [PATCH 0/1] Regression in analogix_anx78xx Tobias Schramm
2020-01-09 8:48 ` [PATCH 1/1] drm/bridge: anx78xx: fix integer type used for storing dp link rate Tobias Schramm
2020-01-17 10:03 ` Andrzej Hajda
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).