Skip to contentSkip to conversation

drm/arm/malidp: fix mode_valid couldn't cull invalid modes issue

PATCH In review [email protected] 2 participants 2 messages Aug 10, 2021 – Aug 13, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/arm/malidp: fix mode_valid couldn't cull invalid modes issue

From: Sandor Yu <[email protected]>

In function malidp_crtc_mode_valid, mode->crtc_mode = 0 when run in drm_helper_probe_single_connector_modes.
Invalid video modes are not culled
and all modes move to the connector's modes list.
It is not expected by mode_valid.

Replace mode->crtc_clock with mode->clock to fix the issue.

---
 drivers/gpu/drm/arm/malidp_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_crtc.c +1 -1
index 494075ddbef6..55890334385d 100644
@@ -31,7 +31,7 @@ static enum drm_mode_status malidp_crtc_mode_valid(struct drm_crtc *crtc,
 	 * check that the hardware can drive the required clock rate,
 	 * but skip the check if the clock is meant to be disabled (req_rate = 0)
 	 */
-	long rate, req_rate = mode->crtc_clock * 1000;
+	long rate, req_rate = mode->clock * 1000;
 
 	if (req_rate) {
 		rate = clk_round_rate(hwdev->pxlclk, req_rate);
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Tue, Aug 10, 2021 at 10:43:31AM +0800, [email protected] wrote:

From: Sandor Yu <[email protected]>

In function malidp_crtc_mode_valid, mode->crtc_mode = 0 when run in drm_helper_probe_single_connector_modes.
Invalid video modes are not culled
and all modes move to the connector's modes list.
It is not expected by mode_valid.

Replace mode->crtc_clock with mode->clock to fix the issue.

It looks like at least drm/bridge/cdns-dsi.c does the same thing of using mode->clock when validating, so looks like a legit bug.

Many thanks,
Liviu

Quoted 20 lines
---
 drivers/gpu/drm/arm/malidp_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_crtc.c +1 -1
index 494075ddbef6..55890334385d 100644
@@ -31,7 +31,7 @@ static enum drm_mode_status malidp_crtc_mode_valid(struct drm_crtc *crtc,
 	 * check that the hardware can drive the required clock rate,
 	 * but skip the check if the clock is meant to be disabled (req_rate = 0)
 	 */
-	long rate, req_rate = mode->crtc_clock * 1000;
+	long rate, req_rate = mode->clock * 1000;
 
 	if (req_rate) {
 		rate = clk_round_rate(hwdev->pxlclk, req_rate);
Signature · 1 line
2.17.1
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯