drm/bridge: lt8912b: Fix corrupt display output due to wrong bridge config
cover drm/bridge: lt8912b: Fix corrupt display output due to wrong bridge config
From: Philippe Schenker <[email protected]>
This patch-set fixes the lt8912b driver that currently does not take care whether or not the attached display has postiive or negative syncs and or reports on EDID if it needs HDMI mode or DVI.
This series addresses also an issue where the LVDS startup sequence was written to the wrong I2C address (the lt8912 has three). This caused writing into reserved registers and causing an unstable HDMI picture that manifests itself only sometimes and depending on the monitor with a flickering and a repeating of going black and coming up again. While at it move also some sensible comments to the sequence.
Francesco Dolcini (2):
drm/bridge: lt8912b: fix corrupted image output
drm/bridge: lt8912b: clarify lvds output status
Philippe Schenker (2):
drm/bridge: lt8912b: add vsync hsync
drm/bridge: lt8912b: set hdmi or dvi mode
drivers/gpu/drm/bridge/lontium-lt8912b.c | 39 +++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-)
Signature · 1 line
2.37.3
PATCH 1/4 drm/bridge: lt8912b: add vsync hsync
From: Philippe Schenker <[email protected]>
Currently the bridge driver does not take care whether or not the display needs positive/negative vertical/horizontal syncs. Pass these two flags to the bridge from the EDID that was read out from the display.
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +8 -1
@@ -268,7 +268,7 @@ static int lt8912_video_setup(struct lt8912 *lt)u32 hactive, h_total, hpw, hfp, hbp;u32 vactive, v_total, vpw, vfp, vbp;u8 settle =0x08 ; -int ret; +int ret, hsync_activehigh, vsync_activehigh;if (!lt)return -EINVAL ;
@@ -278,12 +278,14 @@ static int lt8912_video_setup(struct lt8912 *lt) hpw = lt->mode.hsync_len; hbp = lt->mode.hback_porch; h_total = hactive + hfp + hpw + hbp; + hsync_activehigh = lt->mode.flags &DISPLAY_FLAGS_HSYNC_HIGH ; vactive = lt->mode.vactive; vfp = lt->mode.vfront_porch; vpw = lt->mode.vsync_len; vbp = lt->mode.vback_porch; v_total = vactive + vfp + vpw + vbp; + vsync_activehigh = lt->mode.flags &DISPLAY_FLAGS_VSYNC_HIGH ;if (vactive <=600 ) settle =0x04 ;
@@ -317,6 +319,11 @@ static int lt8912_video_setup(struct lt8912 *lt) ret |=regmap_write (lt->regmap[I2C_CEC_DSI ],0x3e , hfp &0xff ); ret |=regmap_write (lt->regmap[I2C_CEC_DSI ],0x3f , hfp >>8 ); + ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xab ,BIT (0 ), + vsync_activehigh ?BIT (0 ) :0 ); + ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xab ,BIT (1 ), + hsync_activehigh ?BIT (1 ) :0 ); +return ret; }
Signature · 1 line
2.37.3
Re: [PATCH 1/4] drm/bridge: lt8912b: add vsync hsync
Quoted 9 lines · Philippe Schenker
From: Philippe Schenker <[email protected]>
Currently the bridge driver does not take care whether or not the display needs positive/negative vertical/horizontal syncs. Pass these two flags to the bridge from the EDID that was read out from the display.
Fixes 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")Signed-off-by Philippe Schenker <[email protected]>
Quoted 49 lines
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/gpu/drm/bridge/lontium-lt8912b.c +8
-2@@ -268,7 +268,7 @@ static int lt8912_video_setup(struct lt8912 *lt)u32 hactive, h_total, hpw, hfp, hbp;u32 vactive, v_total, vpw, vfp, vbp;u8 settle =0x08 ; -int ret; +int ret, hsync_activehigh, vsync_activehigh;if (!lt)return -EINVAL ;@@ -278,12 +278,14 @@ static int lt8912_video_setup(struct lt8912 *lt) hpw = lt->mode.hsync_len; hbp = lt->mode.hback_porch; h_total = hactive + hfp + hpw + hbp; + hsync_activehigh = lt->mode.flags &DISPLAY_FLAGS_HSYNC_HIGH ; vactive = lt->mode.vactive; vfp = lt->mode.vfront_porch; vpw = lt->mode.vsync_len; vbp = lt->mode.vback_porch; v_total = vactive + vfp + vpw + vbp; + vsync_activehigh = lt->mode.flags &DISPLAY_FLAGS_VSYNC_HIGH ;if (vactive <=600 ) settle =0x04 ;@@ -317,6 +319,11 @@ static int lt8912_video_setup(struct lt8912 *lt) ret |=regmap_write (lt->regmap[I2C_CEC_DSI ],0x3e , hfp &0xff ); ret |=regmap_write (lt->regmap[I2C_CEC_DSI ],0x3f , hfp >>8 ); + ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xab ,BIT (0 ), + vsync_activehigh ?BIT (0 ) :0 ); + ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xab ,BIT (1 ), + hsync_activehigh ?BIT (1 ) :0 ); +return ret; } --2.37.3
PATCH 2/4 drm/bridge: lt8912b: set hdmi or dvi mode
In reply to Philippe SchenkerFrom: Philippe Schenker <[email protected]>
The Lontium LT8912 does have a setting for DVI or HDMI. This patch reads from EDID what the display needs and sets it accordingly.
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/lontium-lt8912b.c +2 -0
@@ -323,6 +323,8 @@ static int lt8912_video_setup(struct lt8912 *lt) vsync_activehigh ? BIT(0) : 0); ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xab ,BIT (1 ), hsync_activehigh ?BIT (1 ) :0 ); + ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xb2 ,BIT (0 ), + lt->connector.display_info.is_hdmi ?BIT (0 ) :0 );return ret; }
Signature · 1 line
2.37.3
Re: [PATCH 2/4] drm/bridge: lt8912b: set hdmi or dvi mode
Quoted 8 lines · Philippe Schenker
From: Philippe Schenker <[email protected]>
The Lontium LT8912 does have a setting for DVI or HDMI. This patch reads from EDID what the display needs and sets it accordingly.
Fixes 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")Signed-off-by Philippe Schenker <[email protected]>
Quoted 21 lines
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/bridge/lontium-lt8912b.c +2
-1@@ -323,6 +323,8 @@ static int lt8912_video_setup(struct lt8912 *lt) vsync_activehigh ? BIT(0) : 0); ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xab ,BIT (1 ), hsync_activehigh ?BIT (1 ) :0 ); + ret |=regmap_update_bits (lt->regmap[I2C_MAIN ],0xb2 ,BIT (0 ), + lt->connector.display_info.is_hdmi ?BIT (0 ) :0 );return ret; } --2.37.3
PATCH 3/4 drm/bridge: lt8912b: fix corrupted image output
In reply to Philippe SchenkerFrom: Francesco Dolcini <[email protected]>
Correct I2C address for the register list in lt8912_write_lvds_config(), these registers are on the first I2C address (0x48), the current function is just writing garbage to the wrong registers and this creates multiple issues (artifacts and output completely corrupted) on some HDMI displays.
Correct I2C address comes from Lontium documentation and it is the one used on other out-of-tree LT8912B drivers [1].
[1] https://github.com/boundarydevices/linux/blob/boundary-imx_5.10.x_2.0.0/drivers/video/lt8912.c#L296
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +1 -1
@@ -188,7 +188,7 @@ static int lt8912_write_lvds_config(struct lt8912 *lt) {0x03, 0xff}, }; -return regmap_multi_reg_write (lt->regmap[I2C_CEC_DSI ], seq,ARRAY_SIZE (seq)); +return regmap_multi_reg_write (lt->regmap[I2C_MAIN ], seq,ARRAY_SIZE (seq)); };static inline struct lt8912 *bridge_to_lt8912 (struct drm_bridge *b)
Signature · 1 line
2.37.3
Re: [PATCH 3/4] drm/bridge: lt8912b: fix corrupted image output
Quoted 9 lines · Philippe Schenker
From: Francesco Dolcini <[email protected]>
Correct I2C address for the register list in
lt8912_write_lvds_config(), these registers are on the first I2C address (0x48), the current function is just writing garbage to the wrong registers and this creates multiple issues (artifacts and output completely corrupted) on some HDMI displays.
Quoted 8 lines
Correct I2C address comes from Lontium documentation and it is the one used on other out-of-tree LT8912B drivers [1].
[1] https://github.com/boundarydevices/linux/blob/boundary-imx_5.10.x_2.0.0/drivers/video/lt8912.c#L296
Fixes 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")Signed-off-by Francesco Dolcini <[email protected]>Signed-off-by Philippe Schenker <[email protected]>
Quoted 21 lines
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/bridge/lontium-lt8912b.c +1
-2@@ -188,7 +188,7 @@ static int lt8912_write_lvds_config(struct lt8912 *lt) {0x03, 0xff}, }; -return regmap_multi_reg_write (lt->regmap[I2C_CEC_DSI ], seq,ARRAY_SIZE (seq)); +return regmap_multi_reg_write (lt->regmap[I2C_MAIN ], seq,ARRAY_SIZE (seq)); };static inline struct lt8912 *bridge_to_lt8912 (struct drm_bridge *b) --2.37.3
PATCH 4/4 drm/bridge: lt8912b: clarify lvds output status
In reply to Philippe SchenkerFrom: Francesco Dolcini <[email protected]>
Add comments on the lt8912_write_lvds_config() config to document the current settings and to make it clear that this is a hardcoded configuration not relevant for the HDMI output (could be removed without affecting the HDMI port).
No changes on the actual register writes.
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +17 -9
@@ -165,24 +165,32 @@ static int lt8912_write_rxlogicres_config(struct lt8912 *lt)return ret; }; +/* enable LVDS output with some hardcoded configuration, not required for the HDMI output */ static int lt8912_write_lvds_config (struct lt8912 *lt) {const struct reg_sequence seq[] = { +// lvds power up {0x44 ,0x30 }, {0x51 ,0x05 }, - {0x50 ,0x24 }, - {0x51 ,0x2d }, - {0x52 ,0x04 }, - {0x69 ,0x0e }, + +// core pll bypass + {0x50 ,0x24 },// cp=50uA + {0x51 ,0x2d },// Pix_clk as reference, second order passive LPF PLL + {0x52 ,0x04 },// loopdiv=0, use second-order PLL + {0x69 ,0x0e },// CP_PRESET_DIV_RATIO {0x69 ,0x8e }, {0x6a ,0x00 }, - {0x6c ,0xb8 }, + {0x6c ,0xb8 },// RGD_CP_SOFT_K_EN,RGD_CP_SOFT_K[13:8] {0x6b ,0x51 }, - {0x04 ,0xfb }, + + {0x04 ,0xfb },// core pll reset {0x04 ,0xff }, - {0x7f ,0x00 }, - {0xa8 ,0x13 }, - {0x02 ,0xf7 }, + +// scaler bypass + {0x7f ,0x00 },// disable scaler + {0xa8 ,0x13 },// 0x13: JEIDA, 0x33: VESA + + {0x02 ,0xf7 },// lvds pll reset {0x02 ,0xff }, {0x03 ,0xcf }, {0x03 ,0xff },
Signature · 1 line
2.37.3
Re: [PATCH 4/4] drm/bridge: lt8912b: clarify lvds output status
Quoted 8 lines · Philippe Schenker
From: Francesco Dolcini <[email protected]>
Add comments on the
lt8912_write_lvds_config()config to document the current settings and to make it clear that this is a hardcoded configuration not relevant for the HDMI output (could be removed without affecting the HDMI port).
Quoted 4 lines
No changes on the actual register writes.
Signed-off-by Francesco Dolcini <[email protected]>Signed-off-by Philippe Schenker <[email protected]>
Quoted 54 lines
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-)drivers/gpu/drm/bridge/lontium-lt8912b.c +17
-10@@ -165,24 +165,32 @@ static int lt8912_write_rxlogicres_config(struct lt8912 *lt)return ret; }; +/* enable LVDS output with some hardcoded configuration, not required for the HDMI output */ static int lt8912_write_lvds_config (struct lt8912 *lt) {const struct reg_sequence seq[] = { +// lvds power up {0x44 ,0x30 }, {0x51 ,0x05 }, - {0x50, 0x24}, - {0x51, 0x2d}, - {0x52, 0x04}, - {0x69, 0x0e}, + +// core pll bypass + {0x50 ,0x24 },// cp=50uA + {0x51 ,0x2d },// Pix_clk as reference, second order passive LPF PLL + {0x52 ,0x04 },// loopdiv=0, use second-order PLL + {0x69 ,0x0e },// CP_PRESET_DIV_RATIO {0x69 ,0x8e }, {0x6a ,0x00 }, - {0x6c, 0xb8}, + {0x6c ,0xb8 },// RGD_CP_SOFT_K_EN,RGD_CP_SOFT_K[13:8] {0x6b ,0x51 }, - {0x04, 0xfb}, + + {0x04 ,0xfb },// core pll reset {0x04 ,0xff }, - {0x7f, 0x00}, - {0xa8, 0x13}, - {0x02, 0xf7}, + +// scaler bypass + {0x7f ,0x00 },// disable scaler + {0xa8 ,0x13 },// 0x13: JEIDA, 0x33: VESA + + {0x02 ,0xf7 },// lvds pll reset {0x02 ,0xff }, {0x03 ,0xcf }, {0x03 ,0xff }, --2.37.3
Re: (subset) [PATCH 0/4] drm/bridge: lt8912b: Fix corrupt display output due to wrong bridge config
In reply to Philippe SchenkerHi,
Quoted 6 lines · Philippe Schenker
From: Philippe Schenker <[email protected]>
This patch-set fixes the lt8912b driver that currently does not take care whether or not the attached display has postiive or negative syncs and or reports on EDID if it needs HDMI mode or DVI.
Quoted 8 lines
This series addresses also an issue where the LVDS startup sequence was written to the wrong I2C address (the lt8912 has three). This caused writing into reserved registers and causing an unstable HDMI picture that manifests itself only sometimes and depending on the monitor with a flickering and a repeating of going black and coming up again. While at it move also some sensible comments to the sequence.
[...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-fixes)
[1/4] drm/bridge: lt8912b: add vsync hsync
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=da73a94fa282f78d485bd0aab36c8ac15b6f792c [2/4] drm/bridge: lt8912b: set hdmi or dvi mode https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6dd1de12e1243f2013e4fabf31e99e63b1a860d0 [3/4] drm/bridge: lt8912b: fix corrupted image output https://cgit.freedesktop.org/drm/drm-misc/commit/?id=051ad2788d35ca07aec8402542e5d38429f2426a
Signature · 1 line
Neil
Re: (subset) [PATCH 0/4] drm/bridge: lt8912b: Fix corrupt display output due to wrong bridge config
In reply to Philippe SchenkerHi,
Quoted 6 lines · Philippe Schenker
From: Philippe Schenker <[email protected]>
This patch-set fixes the lt8912b driver that currently does not take care whether or not the attached display has postiive or negative syncs and or reports on EDID if it needs HDMI mode or DVI.
Quoted 8 lines
This series addresses also an issue where the LVDS startup sequence was written to the wrong I2C address (the lt8912 has three). This caused writing into reserved registers and causing an unstable HDMI picture that manifests itself only sometimes and depending on the monitor with a flickering and a repeating of going black and coming up again. While at it move also some sensible comments to the sequence.
[...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)
[4/4] drm/bridge: lt8912b: clarify lvds output status
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=fc44f3636a4db6544fd1532280e8adcd1ef13ba2
Signature · 1 line
Neil
Robert Foss
AppliedQuoted 23 lines · Philippe Schenker
From: Philippe Schenker <[email protected]>
This patch-set fixes the lt8912b driver that currently does not take care whether or not the attached display has postiive or negative syncs and or reports on EDID if it needs HDMI mode or DVI.
This series addresses also an issue where the LVDS startup sequence was written to the wrong I2C address (the lt8912 has three). This caused writing into reserved registers and causing an unstable HDMI picture that manifests itself only sometimes and depending on the monitor with a flickering and a repeating of going black and coming up again. While at it move also some sensible comments to the sequence.
Francesco Dolcini (2):
drm/bridge: lt8912b: fix corrupted image output
drm/bridge: lt8912b: clarify lvds output statusPhilippe Schenker (2):
drm/bridge: lt8912b: add vsync hsync
drm/bridge: lt8912b: set hdmi or dvi mode
Quoted 6 lines
drivers/gpu/drm/bridge/lontium-lt8912b.c | 39 +++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-)--
2.37.3
Thanks for the series & the reviews.
Applied to drm-misc-next.