balena-allwinner/layers/meta-balena-allwinner/recipes-kernel/linux/linux-4.19/0123-drm-sun4i-tcon-enable-dithering-on-tcon0-is-there-s-.patch
Vicentiu Galanopulo b167421e55 recipes-kernel/linux: Add linux_4.19.76.bb/bbappend
Add the latest linux available
from https://github.com/armbian/build
commit de58ac1faac92724c6449db12c22affaeb003875,
tag: sunxi-5.3, alongside all the patches
that it comes with.

Signed-off-by: Vicentiu Galanopulo <vicentiu@balena.io>
2019-10-10 11:50:43 +02:00

58 lines
2 KiB
Diff

From 4690963a2d219abac912ebe2f0b22529c028db06 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Sun, 28 Oct 2018 15:32:38 -0700
Subject: [PATCH 123/146] drm/sun4i: tcon: enable dithering on tcon0 is there's
bridge connected
RGB on A64 is 6bpc, so if bridge is connected we need to enable dithering
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 1b28fd9c2908..891ba4dbbf10 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -283,10 +283,6 @@ static void sun4i_tcon0_mode_set_dithering(struct sun4i_tcon *tcon,
u32 bus_format = 0;
u32 val = 0;
- /* XXX Would this ever happen? */
- if (!connector)
- return;
-
/*
* FIXME: Undocumented bits
*
@@ -304,11 +300,15 @@ static void sun4i_tcon0_mode_set_dithering(struct sun4i_tcon *tcon,
regmap_write(tcon->regs, SUN4I_TCON0_FRM_TBL2_REG, 0x57575555);
regmap_write(tcon->regs, SUN4I_TCON0_FRM_TBL3_REG, 0x7f7f7777);
+ /* Do dithering if there's bridge connected */
+ if (!connector)
+ val |= SUN4I_TCON0_FRM_CTL_EN;
+
/* Do dithering if panel only supports 6 bits per color */
- if (connector->display_info.bpc == 6)
+ if (connector && connector->display_info.bpc == 6)
val |= SUN4I_TCON0_FRM_CTL_EN;
- if (connector->display_info.num_bus_formats == 1)
+ if (connector && connector->display_info.num_bus_formats == 1)
bus_format = connector->display_info.bus_formats[0];
/* Check the connection format */
@@ -492,6 +492,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
/* Set dithering if needed */
if (tcon->panel)
sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+ else
+ sun4i_tcon0_mode_set_dithering(tcon, NULL);
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
--
2.17.1