Skip to contentSkip to conversation

Allwinner SimpleFB Kconfig cleanup and DE2 SimpleFB support

PATCH RESEND New Icenowy Zheng 2 participants 6 messages Oct 26, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v5 cover Allwinner SimpleFB Kconfig cleanup and DE2 SimpleFB support

This patchset is resent to inform the video maintainers.

Here's the original cover letter:

This patchset is mainly for Allwinner DE2 HDMI SimpleFB support.

The framebuffer initialized by the Allwinner DE2 driver can be passed by to the kernel as simplefb, and this can enable the kernel to display graphics without having full DE2 driver.

Add the suppot of simplefb in DE2 code.

The code to find a simplefb with sunxi extension and a suitable pipeline is extracted to a new source file in video/sunxi/.

An option is added for device tree simplefb, and furtherly other simplefb support code should also be converted to it. The current only user to the CONFIG_VIDEO_DT_SIMPLEFB, Allwinner DE1 legacy video, has already converted to use the Kconfig option in this patchset. A cleanup commit is introduced for this conversion.

Icenowy Zheng (4):
sunxi: change the DE1 video option to CONFIG_VIDEO_SUNXI
video: sunxi: extract simplefb match code to a new file
video: add an option for video simplefb via DT
sunxi: setup simplefb for Allwinner DE2

 arch/arm/mach-sunxi/Kconfig           | 31 ++++++++-------
 drivers/video/Kconfig                 |  8 ++++
 drivers/video/sunxi/Makefile          |  4 +-
 drivers/video/sunxi/simplefb_common.c | 30 +++++++++++++++
 drivers/video/sunxi/simplefb_common.h | 22 +++++++++++
 drivers/video/sunxi/sunxi_de2.c       | 72 +++++++++++++++++++++++++++++++++++
 drivers/video/sunxi/sunxi_display.c   | 13 +------
 include/configs/sunxi-common.h        |  9 +----
 scripts/config_whitelist.txt          |  1 -
 9 files changed, 155 insertions(+), 35 deletions(-)
 create mode 100644 drivers/video/sunxi/simplefb_common.c
 create mode 100644 drivers/video/sunxi/simplefb_common.h
Signature · 1 line
2.13.6
#1 lore raw

PATCH RESEND v5 1/4 sunxi: change the DE1 video option to CONFIG_VIDEO_SUNXI

The sunxi DE1 video option used to be CONFIG_VIDEO, which has the same name as the "Enable legacy video support" option in drivers/video/Kconfig.

Change the option name to CONFIG_VIDEO_SUNXI, which is really used by Makefile under drivers/video/sunxi/, and defined in sunxi-common.h when CONFIG_VIDEO is selected before this change. Now CONFIG_VIDEO_SUNXI selects CONFIG_VIDEO and the usages of CONFIG_VIDEO in sunxi Kconfig and config headers are all converted to use CONFIG_VIDEO_SUNXI.

---
 arch/arm/mach-sunxi/Kconfig    | 29 +++++++++++++++--------------
 include/configs/sunxi-common.h |  6 ++----
 scripts/config_whitelist.txt   |  1 -
 3 files changed, 17 insertions(+), 19 deletions(-)
arch/arm/mach-sunxi/Kconfig +15 -14
index 2309f59999..3c29fc61f7 100644
@@ -606,7 +606,7 @@ config AXP_GPIO
 	---help---
 	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
 
-config VIDEO
+config VIDEO_SUNXI
 	bool "Enable graphical uboot console on HDMI, LCD or VGA"
 	depends on !MACH_SUN8I_A83T
 	depends on !MACH_SUNXI_H3_H5
@@ -614,6 +614,7 @@ config VIDEO
 	depends on !MACH_SUN8I_V3S
 	depends on !MACH_SUN9I
 	depends on !MACH_SUN50I
+	select VIDEO
 	default y
 	---help---
 	Say Y here to add support for using a cfb console on the HDMI, LCD
@@ -622,21 +623,21 @@ config VIDEO
 
 config VIDEO_HDMI
 	bool "HDMI output support"
-	depends on VIDEO && !MACH_SUN8I
+	depends on VIDEO_SUNXI && !MACH_SUN8I
 	default y
 	---help---
 	Say Y here to add support for outputting video over HDMI.
 
 config VIDEO_VGA
 	bool "VGA output support"
-	depends on VIDEO && (MACH_SUN4I || MACH_SUN7I)
+	depends on VIDEO_SUNXI && (MACH_SUN4I || MACH_SUN7I)
 	default n
 	---help---
 	Say Y here to add support for outputting video over VGA.
 
 config VIDEO_VGA_VIA_LCD
 	bool "VGA via LCD controller support"
-	depends on VIDEO && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I)
+	depends on VIDEO_SUNXI && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I)
 	default n
 	---help---
 	Say Y here to add support for external DACs connected to the parallel
@@ -663,14 +664,14 @@ config VIDEO_VGA_EXTERNAL_DAC_EN
 
 config VIDEO_COMPOSITE
 	bool "Composite video output support"
-	depends on VIDEO && (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I)
+	depends on VIDEO_SUNXI && (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I)
 	default n
 	---help---
 	Say Y here to add support for outputting composite video.
 
 config VIDEO_LCD_MODE
 	string "LCD panel timing details"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default ""
 	---help---
 	LCD panel timing details string, leave empty if there is no LCD panel.
@@ -680,14 +681,14 @@ config VIDEO_LCD_MODE
 
 config VIDEO_LCD_DCLK_PHASE
 	int "LCD panel display clock phase"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default 1
 	---help---
 	Select LCD panel display clock phase shift, range 0-3.
 
 config VIDEO_LCD_POWER
 	string "LCD panel power enable pin"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default ""
 	---help---
 	Set the power enable pin for the LCD panel. This takes a string in the
@@ -695,7 +696,7 @@ config VIDEO_LCD_POWER
 
 config VIDEO_LCD_RESET
 	string "LCD panel reset pin"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default ""
 	---help---
 	Set the reset pin for the LCD panel. This takes a string in the format
@@ -703,7 +704,7 @@ config VIDEO_LCD_RESET
 
 config VIDEO_LCD_BL_EN
 	string "LCD panel backlight enable pin"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default ""
 	---help---
 	Set the backlight enable pin for the LCD panel. This takes a string in the
@@ -712,7 +713,7 @@ config VIDEO_LCD_BL_EN
 
 config VIDEO_LCD_BL_PWM
 	string "LCD panel backlight pwm pin"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default ""
 	---help---
 	Set the backlight pwm pin for the LCD panel. This takes a string in the
@@ -720,14 +721,14 @@ config VIDEO_LCD_BL_PWM
 
 config VIDEO_LCD_BL_PWM_ACTIVE_LOW
 	bool "LCD panel backlight pwm is inverted"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default y
 	---help---
 	Set this if the backlight pwm output is active low.
 
 config VIDEO_LCD_PANEL_I2C
 	bool "LCD panel needs to be configured via i2c"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	default n
 	select CMD_I2C
 	---help---
@@ -776,7 +777,7 @@ config VIDEO_DE2
 
 choice
 	prompt "LCD panel support"
-	depends on VIDEO
+	depends on VIDEO_SUNXI
 	---help---
 	Select which type of LCD panel to support.
 
include/configs/sunxi-common.h +2 -4
index 91751171ec..7d86b58417 100644
@@ -268,7 +268,7 @@ extern int soft_i2c_gpio_scl;
 /* GPIO */
 #define CONFIG_SUNXI_GPIO
 
-#ifdef CONFIG_VIDEO
+#ifdef CONFIG_VIDEO_SUNXI
 /*
  * The amount of RAM to keep free at the top of RAM when relocating u-boot,
  * to use as framebuffer. This must be a multiple of 4096.
@@ -278,8 +278,6 @@ extern int soft_i2c_gpio_scl;
 /* Do we want to initialize a simple FB? */
 #define CONFIG_VIDEO_DT_SIMPLEFB
 
-#define CONFIG_VIDEO_SUNXI
-
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_VIDEO_STD_TIMINGS
 #define CONFIG_I2C_EDID
@@ -288,7 +286,7 @@ extern int soft_i2c_gpio_scl;
 /* allow both serial and cfb console. */
 /* stop x86 thinking in cfbconsole from trying to init a pc keyboard */
 
-#endif /* CONFIG_VIDEO */
+#endif /* CONFIG_VIDEO_SUNXI */
 
 /* Ethernet support */
 #ifdef CONFIG_SUNXI_EMAC
scripts/config_whitelist.txt +0 -1
index 5ee1601f0e..a39d3d5c42 100644
@@ -5067,7 +5067,6 @@ CONFIG_VIDEO_MXS
 CONFIG_VIDEO_MXS_MODE_SYSTEM
 CONFIG_VIDEO_OMAP3
 CONFIG_VIDEO_STD_TIMINGS
-CONFIG_VIDEO_SUNXI
 CONFIG_VIDEO_VCXK
 CONFIG_VID_FLS_ENV
 CONFIG_VM86
Signature · 1 line
2.13.6
#2 lore raw

PATCH RESEND v5 2/4 video: sunxi: extract simplefb match code to a new file

In reply to Icenowy Zheng

As the DE2 simplefb setup code can also benefit from the simplefb match code, extract it to a new source file.

---
Changes in v4:
- Add missing copyright for Luc.
Changes in v3:
- Use /** to start kerndoc.

 drivers/video/sunxi/Makefile          |  2 +-
 drivers/video/sunxi/simplefb_common.c | 30 ++++++++++++++++++++++++++++++
 drivers/video/sunxi/simplefb_common.h | 22 ++++++++++++++++++++++
 drivers/video/sunxi/sunxi_display.c   | 13 ++-----------
 4 files changed, 55 insertions(+), 12 deletions(-)
 create mode 100644 drivers/video/sunxi/simplefb_common.c
 create mode 100644 drivers/video/sunxi/simplefb_common.h
drivers/video/sunxi/Makefile +1 -1
index 0d64c2021f..10862edaca 100644
@@ -5,5 +5,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o lcdc.o tve_common.o ../videomodes.o
+obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o simplefb_common.o lcdc.o tve_common.o ../videomodes.o
 obj-$(CONFIG_VIDEO_DE2) += sunxi_de2.o sunxi_dw_hdmi.o lcdc.o ../dw_hdmi.o
drivers/video/sunxi/simplefb_common.c new file +30 -0
new file mode 100644
index 0000000000..7befb736da
@@ -0,0 +1,30 @@
+/*
+ * Common code for Allwinner SimpleFB with pipeline.
+ *
+ * (C) Copyright 2013-2014 Luc Verhaegen <[email protected]>
+ * (C) Copyright 2014-2015 Hans de Goede <[email protected]>
+ * (C) Copyright 2017 Icenowy Zheng <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <fdtdec.h>
+
+int sunxi_simplefb_fdt_match(void *blob, const char *pipeline)
+{
+	int offset, ret;
+
+	/* Find a prefilled simpefb node, matching out pipeline config */
+	offset = fdt_node_offset_by_compatible(blob, -1,
+					       "allwinner,simple-framebuffer");
+	while (offset >= 0) {
+		ret = fdt_stringlist_search(blob, offset, "allwinner,pipeline",
+					    pipeline);
+		if (ret == 0)
+			break;
+		offset = fdt_node_offset_by_compatible(blob, offset,
+					       "allwinner,simple-framebuffer");
+	}
+
+	return offset;
+}
drivers/video/sunxi/simplefb_common.h new file +22 -0
new file mode 100644
index 0000000000..1a2bfabf00
@@ -0,0 +1,22 @@
+/*
+ * (C) Copyright 2017 Icenowy Zheng <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __SIMPLEFB_COMMON_H
+#define __SIMPLEFB_COMMON_H
+
+/**
+ * sunxi_simplefb_fdt_match() - match a sunxi simplefb node
+ *
+ * Match a sunxi simplefb device node with a specified pipeline, and
+ * return its offset.
+ *
+ * @blob: device tree blob
+ * @pipeline: display pipeline
+ * @return device node offset in blob, or negative values if failed
+ */
+int sunxi_simplefb_fdt_match(void *blob, const char *pipeline);
+
+#endif
drivers/video/sunxi/sunxi_display.c +2 -11
index de768ba94a..7f25ed5f26 100644
@@ -29,6 +29,7 @@
 #include "../anx9804.h"
 #include "../hitachi_tx18d42vm_lcd.h"
 #include "../ssd2828.h"
+#include "simplefb_common.h"
 
 #ifdef CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW
 #define PWM_ON 0
@@ -1377,17 +1378,7 @@ int sunxi_simplefb_setup(void *blob)
 		break;
 	}
 
-	/* Find a prefilled simpefb node, matching out pipeline config */
-	offset = fdt_node_offset_by_compatible(blob, -1,
-					       "allwinner,simple-framebuffer");
-	while (offset >= 0) {
-		ret = fdt_stringlist_search(blob, offset, "allwinner,pipeline",
-					    pipeline);
-		if (ret == 0)
-			break;
-		offset = fdt_node_offset_by_compatible(blob, offset,
-					       "allwinner,simple-framebuffer");
-	}
+	offset = sunxi_simplefb_fdt_match(blob, pipeline);
 	if (offset < 0) {
 		eprintf("Cannot setup simplefb: node not found\n");
 		return 0; /* Keep older kernels working */
Signature · 1 line
2.13.6
#3 lore raw

PATCH RESEND v5 3/4 video: add an option for video simplefb via DT

In reply to Icenowy Zheng

Add an option to indicate that the video driver should setup a SimpleFB node that passes the video framebuffer initialized by U-Boot to the operating system kernel.

Currently only the Allwinner DE driver uses this option, and the definition of this option in the sunxi-common.h config header is converted to an imply of this option from CONFIG_VIDEO_SUNXI.

---
Changes in v5:
- Convert Allwinner DE1 to use the option.
Changes in v4:
- Remove the dependency of VIDEO_DT_SIMPLEFB.

 arch/arm/mach-sunxi/Kconfig    | 1 +
 drivers/video/Kconfig          | 8 ++++++++
 include/configs/sunxi-common.h | 3 ---
 3 files changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-sunxi/Kconfig +1 -0
index 3c29fc61f7..33869a3dde 100644
@@ -615,6 +615,7 @@ config VIDEO_SUNXI
 	depends on !MACH_SUN9I
 	depends on !MACH_SUN50I
 	select VIDEO
+	imply VIDEO_DT_SIMPLEFB
 	default y
 	---help---
 	Say Y here to add support for using a cfb console on the HDMI, LCD
drivers/video/Kconfig +8 -0
index e6b7f11dc9..45a105db06 100644
@@ -650,4 +650,12 @@ config VIDEO_SIMPLE
 	  before u-boot starts, and u-boot will simply render to the pre-
 	  allocated frame buffer surface.
 
+config VIDEO_DT_SIMPLEFB
+	bool "Enable SimpleFB support for passing framebuffer to OS"
+	help
+	  Enables the code to pass the framebuffer to the kernel as a
+	  simple framebuffer in the device tree.
+	  The video output is initialized by U-Boot, and kept by the
+	  kernel.
+
 endmenu
include/configs/sunxi-common.h +0 -3
index 7d86b58417..4207398eb9 100644
@@ -275,9 +275,6 @@ extern int soft_i2c_gpio_scl;
  */
 #define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
 
-/* Do we want to initialize a simple FB? */
-#define CONFIG_VIDEO_DT_SIMPLEFB
-
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_VIDEO_STD_TIMINGS
 #define CONFIG_I2C_EDID
Signature · 1 line
2.13.6
#4 lore raw

PATCH RESEND v5 4/4 sunxi: setup simplefb for Allwinner DE2

In reply to Icenowy Zheng

As the support of EFI boot on Allwinner H3 is broken, we still need to use simplefb to pass the framebuffer to Linux.

Add code to setup simplefb for Allwinner DE2 driver.

---
Changes in v4:
- Imply CONFIG_VIDEO_DT_SIMPLEFB.

Changes in v3:
- Extract CONFIG_VIDEO_DT_SIMPLEFB to a Kconfig option.

Changes in v2:
- Extract the simplefb node searching code.

 arch/arm/mach-sunxi/Kconfig     |  1 +
 drivers/video/sunxi/Makefile    |  2 +-
 drivers/video/sunxi/sunxi_de2.c | 72 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +1 -0
index 33869a3dde..bb57d4ff81 100644
@@ -770,6 +770,7 @@ config VIDEO_DE2
 	depends on SUNXI_DE2
 	select DM_VIDEO
 	select DISPLAY
+	imply VIDEO_DT_SIMPLEFB
 	default y
 	---help---
 	Say y here if you want to build DE2 video driver which is present on
drivers/video/sunxi/Makefile +1 -1
index 10862edaca..aec32b79b9 100644
@@ -6,4 +6,4 @@
 #
 
 obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o simplefb_common.o lcdc.o tve_common.o ../videomodes.o
-obj-$(CONFIG_VIDEO_DE2) += sunxi_de2.o sunxi_dw_hdmi.o lcdc.o ../dw_hdmi.o
+obj-$(CONFIG_VIDEO_DE2) += sunxi_de2.o sunxi_dw_hdmi.o simplefb_common.o lcdc.o ../dw_hdmi.o
drivers/video/sunxi/sunxi_de2.c +72 -0

87 lines not on this page · raw message

Signature · 1 line
2.13.6
#5 lore raw

v5 cover Allwinner SimpleFB Kconfig cleanup and DE2 SimpleFB support

In reply to Icenowy Zheng

On Thu, 26 Oct 2017 11:14:43 +0800
Icenowy Zheng icenowy at aosc.io wrote:
...

Quoted 6 lines

Icenowy Zheng (4):
sunxi: change the DE1 video option to CONFIG_VIDEO_SUNXI
video: sunxi: extract simplefb match code to a new file
video: add an option for video simplefb via DT
sunxi: setup simplefb for Allwinner DE2

Quoted 12 lines
 arch/arm/mach-sunxi/Kconfig           | 31 ++++++++-------
 drivers/video/Kconfig                 |  8 ++++
 drivers/video/sunxi/Makefile          |  4 +-
 drivers/video/sunxi/simplefb_common.c | 30 +++++++++++++++
 drivers/video/sunxi/simplefb_common.h | 22 +++++++++++
 drivers/video/sunxi/sunxi_de2.c       | 72 +++++++++++++++++++++++++++++++++++
 drivers/video/sunxi/sunxi_display.c   | 13 +------
 include/configs/sunxi-common.h        |  9 +----
 scripts/config_whitelist.txt          |  1 -
 9 files changed, 155 insertions(+), 35 deletions(-)
 create mode 100644 drivers/video/sunxi/simplefb_common.c
 create mode 100644 drivers/video/sunxi/simplefb_common.h

Applied to u-boot-video/master, thanks!

--
Anatolij