[PATCH] sunxi: video: Support driver model LCDs
John Watts
contact at jookia.org
Fri Jun 14 14:24:06 CEST 2024
Currently the LCD code only supports reading panel timings from the
device tree. Change that so it can use a real panel.
Signed-off-by: John Watts <contact at jookia.org>
---
I've been working on a panel driver port from Linux for the T113 and
found I need this code to have the panel boot correctly.
---
drivers/video/sunxi/sunxi_lcd.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/video/sunxi/sunxi_lcd.c b/drivers/video/sunxi/sunxi_lcd.c
index 7a01cc343c..605ea90de1 100644
--- a/drivers/video/sunxi/sunxi_lcd.c
+++ b/drivers/video/sunxi/sunxi_lcd.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <display.h>
#include <log.h>
+#include <panel.h>
#include <video_bridge.h>
#include <backlight.h>
#include <dm.h>
@@ -45,6 +46,7 @@ static int sunxi_lcd_enable(struct udevice *dev, int bpp,
(struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE;
struct sunxi_lcd_priv *priv = dev_get_priv(dev);
struct udevice *backlight;
+ struct udevice *panel;
int clk_div, clk_double, ret;
/* Reset off */
@@ -60,6 +62,12 @@ static int sunxi_lcd_enable(struct udevice *dev, int bpp,
priv->panel_bpp, CONFIG_VIDEO_LCD_DCLK_PHASE);
lcdc_enable(lcdc, priv->panel_bpp);
+ ret = uclass_get_device(UCLASS_PANEL, 0, &panel);
+ if (ret == 0) {
+ if (panel_enable_backlight(panel) == 0)
+ return 0;
+ }
+
ret = uclass_get_device(UCLASS_PANEL_BACKLIGHT, 0, &backlight);
if (!ret)
backlight_enable(backlight);
@@ -116,6 +124,11 @@ static int sunxi_lcd_probe(struct udevice *dev)
return ret;
}
+ if (panel_get_display_timing(cdev, &priv->timing) == 0) {
+ priv->panel_bpp = 32;
+ return 0;
+ }
+
if (fdtdec_decode_display_timing(gd->fdt_blob, dev_of_offset(cdev),
0, &priv->timing)) {
debug("%s: Failed to decode display timing\n", __func__);
---
base-commit: c0ea27bccfb7d2d37fd36806ac2a2f7389099420
change-id: 20240601-sunxi_lcd-d39a4fb81c94
Best regards,
--
John Watts <contact at jookia.org>
More information about the U-Boot
mailing list