drm/panel/panel-sitronix-st7701: Fix RTNI calculation
PATCH v2 1/1 drm/panel/panel-sitronix-st7701: Fix RTNI calculation
The RTNI field is multiplied by 16 and incremented by 512 before being used as the minimum number of pixel clock per horizontal line, hence it is necessary to subtract those 512 bytes from htotal and then divide the result by 16 before writing the value into the RTNI field. Fix the calculation.
---
Cc: Guido Günther <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Thierry Reding <[email protected]>
---
V2: Clamp the htotal to range 512...1008, so RTNI always fits the bitfield
--- drivers/gpu/drm/panel/panel-sitronix-st7701.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-sitronix-st7701.c +1 -1
@@ -244,7 +244,7 @@ static void st7701_init_sequence(struct st7701 *st7701)DSI_CMD2_BK0_INVSEL_ONES_MASK |FIELD_PREP (DSI_CMD2_BK0_INVSEL_NLINV_MASK , desc->nlinv),FIELD_PREP (DSI_CMD2_BK0_INVSEL_RTNI_MASK , - DIV_ROUND_UP(mode->htotal, 16))); + (clamp((u32)mode->htotal, 512U, 1008U) - 512) / 16));/* Command2, BK1 */ ST7701_DSI(st7701, DSI_CMD2BKX_SEL,
Signature · 1 line
2.35.1
Quoted 8 lines · Marek Vasut
The RTNI field is multiplied by 16 and incremented by 512 before being used as the minimum number of pixel clock per horizontal line, hence it is necessary to subtract those 512 bytes from htotal and then divide the result by 16 before writing the value into the RTNI field. Fix the calculation.
Fixes de2b4917843c ("drm/panel/panel-sitronix-st7701: Infer horizontal pixel count from TFT mode")Signed-off-by Marek Vasut <[email protected]>
Quoted 9 lines
---
Cc: Guido Günther <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Thierry Reding <[email protected]>
---
V2: Clamp the htotal to range 512...1008, so RTNI always fits the bitfield
I tried to apply this to drm-misc-fixes but the branch has not yet been moved forward to v6.1-rc1.
Yours,
Linus Walleij
Quoted 20 lines · Linus Walleij
Quoted 8 lines · Marek Vasut
The RTNI field is multiplied by 16 and incremented by 512 before being used as the minimum number of pixel clock per horizontal line, hence it is necessary to subtract those 512 bytes from htotal and then divide the result by 16 before writing the value into the RTNI field. Fix the calculation.
Fixes de2b4917843c ("drm/panel/panel-sitronix-st7701: Infer horizontal pixel count from TFT mode")Signed-off-by Marek Vasut <[email protected]>Quoted 9 lines
---
Cc: Guido Günther <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Thierry Reding <[email protected]>
---
V2: Clamp the htotal to range 512...1008, so RTNI always fits the bitfield
Quoted 2 lines
I tried to apply this to drm-misc-fixes but the branch has not yet been moved forward to v6.1-rc1.
Can I maybe get RB until then ?
Linus Walleij
Reviewed-byQuoted 21 lines · Marek Vasut
Quoted 20 lines · Linus Walleij
Quoted 17 lines · Marek Vasut
The RTNI field is multiplied by 16 and incremented by 512 before being used as the minimum number of pixel clock per horizontal line, hence it is necessary to subtract those 512 bytes from htotal and then divide the result by 16 before writing the value into the RTNI field. Fix the calculation.
Fixes de2b4917843c ("drm/panel/panel-sitronix-st7701: Infer horizontal pixel count from TFT mode")Signed-off-by Marek Vasut <[email protected]>---
Cc: Guido Günther <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Thierry Reding <[email protected]>
---
V2: Clamp the htotal to range 512...1008, so RTNI always fits the bitfield
Quoted 4 lines
Quoted 2 lines
I tried to apply this to drm-misc-fixes but the branch has not yet been moved forward to v6.1-rc1.
Can I maybe get RB until then ?
I've been told to go and poke the DRM git people at IRC to rebase the fixes branch.
Yours,
Linus Walleij
Quoted 22 lines · Linus Walleij
Quoted 21 lines · Marek Vasut
Quoted 20 lines · Linus Walleij
Quoted 17 lines · Marek Vasut
The RTNI field is multiplied by 16 and incremented by 512 before being used as the minimum number of pixel clock per horizontal line, hence it is necessary to subtract those 512 bytes from htotal and then divide the result by 16 before writing the value into the RTNI field. Fix the calculation.
Fixes de2b4917843c ("drm/panel/panel-sitronix-st7701: Infer horizontal pixel count from TFT mode")Signed-off-by Marek Vasut <[email protected]>---
Cc: Guido Günther <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Thierry Reding <[email protected]>
---
V2: Clamp the htotal to range 512...1008, so RTNI always fits the bitfield
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I tried to apply this to drm-misc-fixes but the branch has not yet been moved forward to v6.1-rc1.
Can I maybe get RB until then ?
Reviewed-by Linus Walleij <[email protected]>
Thank you
Quoted 2 lines
I've been told to go and poke the DRM git people at IRC to rebase the fixes branch.
That would be #dri-devel on OFTC I think ?
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Linus Walleij
I've been told to go and poke the DRM git people at IRC to rebase the fixes branch.
That would be #dri-devel on OFTC I think ?
Yups, I pinged and mlankhorst says he will fix it.
Yours,
Linus Walleij