drm/bridge: adv7511: Fix low refresh rate selection
Subsystems (3)
PATCH 1/1 drm/bridge: adv7511: Fix low refresh rate selection
The driver currently sets register 0xfb (Low Refresh Rate) based on the value of mode->vrefresh. Firstly, this field is specified to be in Hz, but the magic numbers used by the code are Hz * 1000. This essentially leads to the low refresh rate always being set to 0x01, since the vrefresh value will always be less than 24000. Fix the magic numbers to be in Hz.
Secondly, according to the comment in drm_modes.h, the field is not supposed to be used in a functional way anyway. Instead, use the helper function drm_mode_vrefresh().
---
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +3 -3
@@ -747,11 +747,11 @@ static void adv7511_mode_set(struct adv7511 *adv7511, vsync_polarity =1 ; } -if (mode->vrefresh <=24000 ) +if (drm_mode_vrefresh (mode) <=24 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_24HZ ; -else if (mode->vrefresh <=25000 ) +else if (drm_mode_vrefresh (mode) <=25 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_25HZ ; -else if (mode->vrefresh <=30000 ) +else if (drm_mode_vrefresh (mode) <=30 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_30HZ ;else low_refresh_rate =ADV7511_LOW_REFRESH_RATE_NONE ;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Matt,
Thank you for the patch.
Quoted 10 lines · Matt Redfearn
The driver currently sets register
0xfb(Low Refresh Rate) based on the value ofmode->vrefresh. Firstly, this field is specified to be in Hz, but the magic numbers used by the code are Hz * 1000. This essentially leads to the low refresh rate always being set to0x01, since the vrefresh value will always be less than 24000. Fix the magic numbers to be in Hz.
Secondly, according to the comment indrm_modes.h, the field is not supposed to be used in a functional way anyway. Instead, use the helper functiondrm_mode_vrefresh().
Quoted 2 lines
Fixes 9c8af882bf12 ("drm: Add adv7511 encoder driver")Signed-off-by Matt Redfearn <[email protected]>
Wow, a 4.5 year old bug fix, nice :-)
Quoted 24 lines
---
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +3
-3@@ -747,11 +747,11 @@ static void adv7511_mode_set(struct adv7511 *adv7511, vsync_polarity =1 ; } -if (mode->vrefresh <=24000 ) +if (drm_mode_vrefresh (mode) <=24 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_24HZ ; -else if (mode->vrefresh <=25000 ) +else if (drm_mode_vrefresh (mode) <=25 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_25HZ ; -else if (mode->vrefresh <=30000 ) +else if (drm_mode_vrefresh (mode) <=30 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_30HZ ;else low_refresh_rate =ADV7511_LOW_REFRESH_RATE_NONE ;
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sean Paul
AppliedQuoted 15 lines · Laurent Pinchart
Hi Matt,
Thank you for the patch.
Quoted 10 lines · Matt Redfearn
The driver currently sets register
0xfb(Low Refresh Rate) based on the value ofmode->vrefresh. Firstly, this field is specified to be in Hz, but the magic numbers used by the code are Hz * 1000. This essentially leads to the low refresh rate always being set to0x01, since the vrefresh value will always be less than 24000. Fix the magic numbers to be in Hz.
Secondly, according to the comment indrm_modes.h, the field is not supposed to be used in a functional way anyway. Instead, use the helper functiondrm_mode_vrefresh().
Quoted 7 lines
Quoted 2 lines
Fixes 9c8af882bf12 ("drm: Add adv7511 encoder driver")Signed-off-by Matt Redfearn <[email protected]>Wow, a 4.5 year old bug fix, nice :-)
Reviewed-by Laurent Pinchart <[email protected]>
Applied to drm-misc-next-fixes.
Thanks!
Sean
Quoted 33 lines
Quoted 24 lines
---
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +3
-3@@ -747,11 +747,11 @@ static void adv7511_mode_set(struct adv7511 *adv7511, vsync_polarity =1 ; } -if (mode->vrefresh <=24000 ) +if (drm_mode_vrefresh (mode) <=24 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_24HZ ; -else if (mode->vrefresh <=25000 ) +else if (drm_mode_vrefresh (mode) <=25 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_25HZ ; -else if (mode->vrefresh <=30000 ) +else if (drm_mode_vrefresh (mode) <=30 ) low_refresh_rate =ADV7511_LOW_REFRESH_RATE_30HZ ;else low_refresh_rate =ADV7511_LOW_REFRESH_RATE_NONE ;Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS