]>
Commit | Line | Data |
---|---|---|
cd033818 SL |
1 | From 92db9400a500abaa76ea2936984e18b4cbc9ce12 Mon Sep 17 00:00:00 2001 |
2 | From: Matt Redfearn <matt.redfearn@thinci.com> | |
3 | Date: Wed, 24 Apr 2019 13:22:27 +0000 | |
4 | Subject: drm/bridge: adv7511: Fix low refresh rate selection | |
5 | ||
6 | [ Upstream commit 67793bd3b3948dc8c8384b6430e036a30a0ecb43 ] | |
7 | ||
8 | The driver currently sets register 0xfb (Low Refresh Rate) based on the | |
9 | value of mode->vrefresh. Firstly, this field is specified to be in Hz, | |
10 | but the magic numbers used by the code are Hz * 1000. This essentially | |
11 | leads to the low refresh rate always being set to 0x01, since the | |
12 | vrefresh value will always be less than 24000. Fix the magic numbers to | |
13 | be in Hz. | |
14 | Secondly, according to the comment in drm_modes.h, the field is not | |
15 | supposed to be used in a functional way anyway. Instead, use the helper | |
16 | function drm_mode_vrefresh(). | |
17 | ||
18 | Fixes: 9c8af882bf12 ("drm: Add adv7511 encoder driver") | |
19 | Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | |
20 | Signed-off-by: Matt Redfearn <matt.redfearn@thinci.com> | |
21 | Signed-off-by: Sean Paul <seanpaul@chromium.org> | |
22 | Link: https://patchwork.freedesktop.org/patch/msgid/20190424132210.26338-1-matt.redfearn@thinci.com | |
23 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
24 | --- | |
25 | drivers/gpu/drm/i2c/adv7511.c | 6 +++--- | |
26 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
27 | ||
28 | diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c | |
29 | index c7c243e9b808..4300e27ed113 100644 | |
30 | --- a/drivers/gpu/drm/i2c/adv7511.c | |
31 | +++ b/drivers/gpu/drm/i2c/adv7511.c | |
32 | @@ -781,11 +781,11 @@ static void adv7511_encoder_mode_set(struct drm_encoder *encoder, | |
33 | vsync_polarity = 1; | |
34 | } | |
35 | ||
36 | - if (mode->vrefresh <= 24000) | |
37 | + if (drm_mode_vrefresh(mode) <= 24) | |
38 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_24HZ; | |
39 | - else if (mode->vrefresh <= 25000) | |
40 | + else if (drm_mode_vrefresh(mode) <= 25) | |
41 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_25HZ; | |
42 | - else if (mode->vrefresh <= 30000) | |
43 | + else if (drm_mode_vrefresh(mode) <= 30) | |
44 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_30HZ; | |
45 | else | |
46 | low_refresh_rate = ADV7511_LOW_REFRESH_RATE_NONE; | |
47 | -- | |
48 | 2.20.1 | |
49 |