[U-Boot] [PATCH v5 0/4] Allwinner SimpleFB Kconfig cleanup and DE2 SimpleFB support

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

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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- arch/arm/mach-sunxi/Kconfig | 29 +++++++++++++++-------------- include/configs/sunxi-common.h | 6 ++---- scripts/config_whitelist.txt | 1 - 3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 2309f59999..3c29fc61f7 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -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.
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 1373b1f037..0f16ea543e 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -266,7 +266,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. @@ -276,8 +276,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 @@ -286,7 +284,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 diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 4651bb55e7..9ae774fca7 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -5143,7 +5143,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

Hi,
On Wed, Sep 20, 2017 at 04:18:19PM +0000, Icenowy Zheng wrote:
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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
The patch is fine, but you also seem to imply that it's an issue. It's not, you can very well define in Kconfig the same symbol in two different places, and Kconfig will merge the two by itself.
arch/arm/mach-sunxi/Kconfig | 29 +++++++++++++++-------------- include/configs/sunxi-common.h | 6 ++---- scripts/config_whitelist.txt | 1 - 3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 2309f59999..3c29fc61f7 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -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
Which means that this was just adding depends on and default to the existing CONFIG_VIDEO in drivers/video/Kconfig.
Maxime

于 2017年9月21日 GMT+08:00 下午3:40:23, Maxime Ripard maxime.ripard@free-electrons.com 写到:
Hi,
On Wed, Sep 20, 2017 at 04:18:19PM +0000, Icenowy Zheng wrote:
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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
The patch is fine, but you also seem to imply that it's an issue. It's not, you can very well define in Kconfig the same symbol in two different places, and Kconfig will merge the two by itself.
So I can drop this patch and simply add "imply VIDEO_DT_SIMPLEFB" in the VIDEO option at sunxi Kconfig?
arch/arm/mach-sunxi/Kconfig | 29 +++++++++++++++-------------- include/configs/sunxi-common.h | 6 ++---- scripts/config_whitelist.txt | 1 - 3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-sunxi/Kconfig
b/arch/arm/mach-sunxi/Kconfig
index 2309f59999..3c29fc61f7 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -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
Which means that this was just adding depends on and default to the existing CONFIG_VIDEO in drivers/video/Kconfig.
Maxime

On Thu, Sep 21, 2017 at 07:48:20AM +0000, Icenowy Zheng wrote:
于 2017年9月21日 GMT+08:00 下午3:40:23, Maxime Ripard maxime.ripard@free-electrons.com 写到:
Hi,
On Wed, Sep 20, 2017 at 04:18:19PM +0000, Icenowy Zheng wrote:
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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
The patch is fine, but you also seem to imply that it's an issue. It's not, you can very well define in Kconfig the same symbol in two different places, and Kconfig will merge the two by itself.
So I can drop this patch and simply add "imply VIDEO_DT_SIMPLEFB" in the VIDEO option at sunxi Kconfig?
I don't see anything wrong with this patch, there's no need to change it.
Maxime

在 2017-09-22 03:18,Maxime Ripard 写道:
On Thu, Sep 21, 2017 at 07:48:20AM +0000, Icenowy Zheng wrote:
于 2017年9月21日 GMT+08:00 下午3:40:23, Maxime Ripard maxime.ripard@free-electrons.com 写到:
Hi,
On Wed, Sep 20, 2017 at 04:18:19PM +0000, Icenowy Zheng wrote:
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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
The patch is fine, but you also seem to imply that it's an issue. It's not, you can very well define in Kconfig the same symbol in two different places, and Kconfig will merge the two by itself.
So I can drop this patch and simply add "imply VIDEO_DT_SIMPLEFB" in the VIDEO option at sunxi Kconfig?
I don't see anything wrong with this patch, there's no need to change it.
So this patchset can be applied if no further rejections?
Maxime
-- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com

On Fri, Sep 22, 2017 at 06:41:40AM +0000, icenowy@aosc.io wrote:
在 2017-09-22 03:18,Maxime Ripard 写道:
On Thu, Sep 21, 2017 at 07:48:20AM +0000, Icenowy Zheng wrote:
于 2017年9月21日 GMT+08:00 下午3:40:23, Maxime Ripard maxime.ripard@free-electrons.com 写到:
Hi,
On Wed, Sep 20, 2017 at 04:18:19PM +0000, Icenowy Zheng wrote:
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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
The patch is fine, but you also seem to imply that it's an issue. It's not, you can very well define in Kconfig the same symbol in two different places, and Kconfig will merge the two by itself.
So I can drop this patch and simply add "imply VIDEO_DT_SIMPLEFB" in the VIDEO option at sunxi Kconfig?
I don't see anything wrong with this patch, there's no need to change it.
So this patchset can be applied if no further rejections?
Yes, I'm just waiting for some feedback from the video people.
Maxime

在 2017-09-22 19:57,Maxime Ripard 写道:
On Fri, Sep 22, 2017 at 06:41:40AM +0000, icenowy@aosc.io wrote:
在 2017-09-22 03:18,Maxime Ripard 写道:
On Thu, Sep 21, 2017 at 07:48:20AM +0000, Icenowy Zheng wrote:
于 2017年9月21日 GMT+08:00 下午3:40:23, Maxime Ripard maxime.ripard@free-electrons.com 写到:
Hi,
On Wed, Sep 20, 2017 at 04:18:19PM +0000, Icenowy Zheng wrote:
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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
The patch is fine, but you also seem to imply that it's an issue. It's not, you can very well define in Kconfig the same symbol in two different places, and Kconfig will merge the two by itself.
So I can drop this patch and simply add "imply VIDEO_DT_SIMPLEFB" in the VIDEO option at sunxi Kconfig?
I don't see anything wrong with this patch, there's no need to change it.
So this patchset can be applied if no further rejections?
Yes, I'm just waiting for some feedback from the video people.
I didn't To: or Cc: them...
But I think U-Boot has Patchwork, right?
Maxime
-- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com

As the DE2 simplefb setup code can also benefit from the simplefb match code, extract it to a new source file.
Signed-off-by: Icenowy Zheng icenowy@aosc.io Reviewed-by: Andre Przywara andre.przywara@arm.com Acked-by: Maxime Ripard maxime.ripard@free-electrons.com --- 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
diff --git a/drivers/video/sunxi/Makefile b/drivers/video/sunxi/Makefile index 0d64c2021f..10862edaca 100644 --- a/drivers/video/sunxi/Makefile +++ b/drivers/video/sunxi/Makefile @@ -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 diff --git a/drivers/video/sunxi/simplefb_common.c b/drivers/video/sunxi/simplefb_common.c new file mode 100644 index 0000000000..7befb736da --- /dev/null +++ b/drivers/video/sunxi/simplefb_common.c @@ -0,0 +1,30 @@ +/* + * Common code for Allwinner SimpleFB with pipeline. + * + * (C) Copyright 2013-2014 Luc Verhaegen libv@skynet.be + * (C) Copyright 2014-2015 Hans de Goede hdegoede@redhat.com + * (C) Copyright 2017 Icenowy Zheng icenowy@aosc.io + * + * 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; +} diff --git a/drivers/video/sunxi/simplefb_common.h b/drivers/video/sunxi/simplefb_common.h new file mode 100644 index 0000000000..1a2bfabf00 --- /dev/null +++ b/drivers/video/sunxi/simplefb_common.h @@ -0,0 +1,22 @@ +/* + * (C) Copyright 2017 Icenowy Zheng icenowy@aosc.io + * + * 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 diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c index de768ba94a..7f25ed5f26 100644 --- a/drivers/video/sunxi/sunxi_display.c +++ b/drivers/video/sunxi/sunxi_display.c @@ -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 */

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 DE1 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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io --- 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(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 3c29fc61f7..33869a3dde 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -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 diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 082cc4a528..547d4cc0c7 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -601,4 +601,12 @@ config VIDEO_DW_HDMI rather requires a SoC-specific glue driver to call it), it can not be enabled from the configuration menu.
+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 diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 0f16ea543e..3bae86fa79 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -273,9 +273,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

On Wed, Sep 20, 2017 at 04:18:21PM +0000, Icenowy Zheng wrote:
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 DE1 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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io
Acked-by: Maxime Ripard maxime.ripard@free-electrons.com
Maxime

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.
Signed-off-by: Icenowy Zheng icenowy@aosc.io Acked-by: Maxime Ripard maxime.ripard@free-electrons.com --- 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(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 33869a3dde..bb57d4ff81 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -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 diff --git a/drivers/video/sunxi/Makefile b/drivers/video/sunxi/Makefile index 10862edaca..aec32b79b9 100644 --- a/drivers/video/sunxi/Makefile +++ b/drivers/video/sunxi/Makefile @@ -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 diff --git a/drivers/video/sunxi/sunxi_de2.c b/drivers/video/sunxi/sunxi_de2.c index ee67764ac5..67b937098c 100644 --- a/drivers/video/sunxi/sunxi_de2.c +++ b/drivers/video/sunxi/sunxi_de2.c @@ -10,6 +10,8 @@ #include <display.h> #include <dm.h> #include <edid.h> +#include <fdtdec.h> +#include <fdt_support.h> #include <video.h> #include <asm/global_data.h> #include <asm/io.h> @@ -17,6 +19,7 @@ #include <asm/arch/display2.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> +#include "simplefb_common.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -292,3 +295,72 @@ U_BOOT_DRIVER(sunxi_de2) = { U_BOOT_DEVICE(sunxi_de2) = { .name = "sunxi_de2" }; + +/* + * Simplefb support. + */ +#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_VIDEO_DT_SIMPLEFB) +int sunxi_simplefb_setup(void *blob) +{ + struct udevice *de2, *hdmi; + struct video_priv *de2_priv; + struct video_uc_platdata *de2_plat; + int mux; + int offset, ret; + u64 start, size; + const char *pipeline = NULL; + + debug("Setting up simplefb\n"); + + if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5)) + mux = 0; + else + mux = 1; + + /* Skip simplefb setting if DE2 / HDMI is not present */ + ret = uclass_find_device_by_name(UCLASS_VIDEO, + "sunxi_de2", &de2); + if (ret) { + debug("DE2 not present\n"); + return 0; + } + + ret = uclass_find_device_by_name(UCLASS_DISPLAY, + "sunxi_dw_hdmi", &hdmi); + if (ret) { + debug("HDMI not present\n"); + return 0; + } + + if (mux == 0) + pipeline = "mixer0-lcd0-hdmi"; + else + pipeline = "mixer1-lcd1-hdmi"; + + de2_priv = dev_get_uclass_priv(de2); + de2_plat = dev_get_uclass_platdata(de2); + + offset = sunxi_simplefb_fdt_match(blob, pipeline); + if (offset < 0) { + eprintf("Cannot setup simplefb: node not found\n"); + return 0; /* Keep older kernels working */ + } + + start = gd->bd->bi_dram[0].start; + size = de2_plat->base - start; + ret = fdt_fixup_memory_banks(blob, &start, &size, 1); + if (ret) { + eprintf("Cannot setup simplefb: Error reserving memory\n"); + return ret; + } + + ret = fdt_setup_simplefb_node(blob, offset, de2_plat->base, + de2_priv->xsize, de2_priv->ysize, + VNBYTES(de2_priv->bpix) * de2_priv->xsize, + "x8r8g8b8"); + if (ret) + eprintf("Cannot setup simplefb: Error setting properties\n"); + + return ret; +} +#endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */

在 2017-09-21 00:18,Icenowy Zheng 写道:
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
Hello Anatolij,
Could you look at this patchset?
I used to think it as a sunxi-only patchset, so I sent it to the sunxi maintainers. However, Maxime says that he needs feedback from video maintainers.
Thanks!
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

Hi,
On Mon, 09 Oct 2017 21:32:57 +0800 icenowy@aosc.io icenowy@aosc.io wrote: ...
Hello Anatolij,
Could you look at this patchset?
I used to think it as a sunxi-only patchset, so I sent it to the sunxi maintainers. However, Maxime says that he needs feedback from video maintainers.
Sorry for delay, I've applied v5 series now. Thanks!
-- Anatolij
participants (4)
-
Anatolij Gustschin
-
Icenowy Zheng
-
icenowy@aosc.io
-
Maxime Ripard