Allwinner DE2 HDMI SimpleFB support
Subsystems (2)
v3 cover Allwinner DE2 HDMI SimpleFB support
This patchset is 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 the DE1 simplefb support should also be converted to it.
Icenowy Zheng (3):
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
drivers/video/Kconfig | 10 +++++ drivers/video/sunxi/Makefile | 4 +- drivers/video/sunxi/simplefb_common.c | 29 ++++++++++++++ drivers/video/sunxi/simplefb_common.h | 22 +++++++++++ drivers/video/sunxi/sunxi_de2.c | 72 +++++++++++++++++++++++++++++++++++ drivers/video/sunxi/sunxi_display.c | 13 +------ 6 files changed, 137 insertions(+), 13 deletions(-) create mode 100644 drivers/video/sunxi/simplefb_common.c create mode 100644 drivers/video/sunxi/simplefb_common.h
Signature · 1 line
2.13.5
PATCH v3 1/3 video: sunxi: extract simplefb match code to a new file
As the DE2 simplefb setup code can also benefit from the simplefb match code, extract it to a new source file.
---
Changes in v3:
- Use /** to start kerndoc.
drivers/video/sunxi/Makefile | 2 +- drivers/video/sunxi/simplefb_common.c | 29 +++++++++++++++++++++++++++++ drivers/video/sunxi/simplefb_common.h | 22 ++++++++++++++++++++++ drivers/video/sunxi/sunxi_display.c | 13 ++----------- 4 files changed, 54 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
@@ -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 +29 -0
@@ -0,0 +1,29 @@ +/* +* Common code for Allwinner SimpleFB with pipeline. +* +* (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
@@ -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
@@ -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.5
PATCH v3 1/3 video: sunxi: extract simplefb match code to a new file
Quoted 5 lines · Icenowy Zheng
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 <[email protected]>Reviewed-by Andre Przywara <[email protected]>
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170913/0f8169db/attachment.sig>
PATCH v3 1/3 video: sunxi: extract simplefb match code to a new file
In reply to Icenowy ZhengQuoted 34 lines · On Wed, 13 Sep 2017 10:17:49 +0800 Icenowy Zheng <[email protected]> wrote:
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 <[email protected]>Reviewed-by Andre Przywara <[email protected]>---
Changes in v3:
- Use /** to start kerndoc.drivers/video/sunxi/Makefile | 2 +- drivers/video/sunxi/simplefb_common.c | 29 +++++++++++++++++++++++++++++ drivers/video/sunxi/simplefb_common.h | 22 ++++++++++++++++++++++ drivers/video/sunxi/sunxi_display.c | 13 ++----------- 4 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 drivers/video/sunxi/simplefb_common.c create mode 100644 drivers/video/sunxi/simplefb_common.hdrivers/video/sunxi/Makefile +1
-1@@ -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.odrivers/video/sunxi/simplefb_common.c new file +0
-0
drivers/video/sunxi/simplefb_common.c line 4
Quoted 4 lines
drivers/video/sunxi/simplefb_common.c new file +4
-0@@ -0,0 +1,29 @@ +/* +* Common code for Allwinner SimpleFB with pipeline. +* +* (C) Copyright 2014-2015 Hans de Goede <[email protected]>
Your copyright notice seems to be missing
* (C) Copyright 2013-2014 Luc Verhaegen <[email protected]>
Quoted 74 lines
drivers/video/sunxi/simplefb_common.c new file +25
-0+* (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@@ -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 +1
-5@@ -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",
drivers/video/sunxi/sunxi_display.c int sunxi_simplefb_setup(void *blob) · line 1384
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +1
-6- 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 */
Here is the "git blame" output for this part of code that you are moving around by your patch:
2dae800f drivers/video/sunxi_display.c (Hans de Goede 2014-12-21 16:28:32 +0100 1380) /* Find a prefilled simpefb node, matching out pipeline config */
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1381) offset = fdt_node_offset_by_compatible(blob, -1,
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1382) "allwinner,simple-framebuffer");
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1383) while (offset >= 0) {
b02e4044 drivers/video/sunxi_display.c (Simon Glass 2016-10-02 17:59:28 -0600 1384) ret = fdt_stringlist_search(blob, offset, "allwinner,pipeline",
6e67f176 drivers/video/sunxi_display.c (Masahiro Yamada 2016-10-17 20:43:01 +0900 1385) pipeline);
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1386) if (ret == 0)
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1387) break;
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1388) offset = fdt_node_offset_by_compatible(blob, offset,
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1389) "allwinner,simple-framebuffer");
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1390) }
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1391) if (offset < 0) {
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1392) eprintf("Cannot setup simplefb: node not found\n");
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1393) return 0; /* Keep older kernels working */
2d7a084b drivers/video/sunxi_display.c (Luc Verhaegen 2014-08-13 07:55:07 +0200 1394) }Luc Verhaegen is the real author of the sunxi DE1 simplefb code in U-Boot. If you need to pick only one copyright line from the old code, then you should mention Luc instead of Hans. Hans de Goede surely has done a lot of massaging for this code later (plus added EDID and LCD support). But it was Luc, who made it happen back in 2014 by providing a usable graphics support for the mainline kernel users and laid down the foundation for all the further incremental improvements.
If not for Luc Verhaegen, we don't even know what would be the current state of the graphics support on sunxi hardware. And the number of commits does not matter, what matters is having the job done. And Luc did just that. So let's give credit where it is due.
With a proper copyright notice, this patch is
Signature · 2 lines
Best regards, Siarhei Siamashka
PATCH v3 2/3 video: add an option for video simplefb via DT
In reply to Icenowy ZhengAdd 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 DE2 driver uses this option.
--- drivers/video/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/video/Kconfig +10 -0
@@ -601,4 +601,14 @@ 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" + depends on VIDEO_DE2 + default y + 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
Signature · 1 line
2.13.5
PATCH v3 2/3 video: add an option for video simplefb via DT
Hi,
Quoted 16 lines · 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 DE2 driver uses this option.
Signed-off-by Icenowy Zheng <[email protected]>--- drivers/video/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/video/Kconfig +0
-0
drivers/video/Kconfig config VIDEO_DW_HDMI · line 607
Quoted 7 lines
drivers/video/Kconfig +4
-0@@ -601,4 +601,14 @@ 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" + depends on VIDEO_DE2 + default y
SIMPLEFB is also used by other platforms, but most platforms also won't use it.
Adding an imply VIDEO_DT_SIMPLEFB to VIDEO_DE2 would make everyone happy I guess.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170913/7d5dd865/attachment.sig>
[U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
Quoted 31 lines · 在 2017-09-13 20:04,Maxime Ripard 写道:
Hi,
Quoted 17 lines · 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 DE2 driver uses this option.
Signed-off-by Icenowy Zheng <[email protected]>--- drivers/video/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/video/Kconfig +0
-0drivers/video/Kconfig config VIDEO_DW_HDMI · line 607
Quoted 7 lines
drivers/video/Kconfig +4
-0@@ -601,4 +601,14 @@ 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" + depends on VIDEO_DE2 + default ySIMPLEFB is also used by other platforms, but most platforms also won't use it.
Quoted 2 lines
Adding an imply
VIDEO_DT_SIMPLEFBtoVIDEO_DE2would make everyone happy I guess.
Then should I drop the "depends on VIDEO_DE2"?
Quoted 7 lines
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
Quoted 32 lines · icenowy at aosc.io
Quoted 31 lines · 在 2017-09-13 20:04,Maxime Ripard 写道:
Hi,
Quoted 17 lines · 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 DE2 driver uses this option.
Signed-off-by Icenowy Zheng <[email protected]>--- drivers/video/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/video/Kconfig +0
-0drivers/video/Kconfig config VIDEO_DW_HDMI · line 607
Quoted 7 lines
drivers/video/Kconfig +4
-0@@ -601,4 +601,14 @@ 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" + depends on VIDEO_DE2 + default ySIMPLEFB is also used by other platforms, but most platforms also won't use it.
Quoted 4 lines
Quoted 2 lines
Adding an imply
VIDEO_DT_SIMPLEFBtoVIDEO_DE2would make everyone happy I guess.Then should I drop the "depends on
VIDEO_DE2"?
Yes.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170913/1d0eda6a/attachment.sig>
[U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
In reply to Maxime RipardQuoted 5 lines
SIMPLEFB is also used by other platforms, but most platforms also won't use it.
Adding an imply
VIDEO_DT_SIMPLEFBtoVIDEO_DE2would make everyone happy I guess.
You meant adding a "select VIDEO_DT_SIMPLEFB" to VIDEO_DE2 ?
Signature · 1 line
Vincent Legoll
[U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
Hi,
Quoted 7 lines · Vincent Legoll
Quoted 5 lines
SIMPLEFB is also used by other platforms, but most platforms also won't use it.
Adding an imply
VIDEO_DT_SIMPLEFBtoVIDEO_DE2would make everyone happy I guess.You meant adding a "select
VIDEO_DT_SIMPLEFB" toVIDEO_DE2?
I think he explicitly meant "imply", which is a rather recent addition to Kconfig [1]:
===============
- weak reverse dependencies: "imply" <symbol> ["if" <expr>] This is similar to "select" as it enforces a lower limit on another symbol except that the "implied" symbol's value may still be set to n from a direct dependency or with a visible prompt.
===============
Cheers,
Andre
PATCH v3 3/3 sunxi: setup simplefb for Allwinner DE2
In reply to Icenowy ZhengAs 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 v3:
- Extract CONFIG_VIDEO_DT_SIMPLEFB to a Kconfig option.
Changes in v2:
- Extract the simplefb node searching code.
drivers/video/sunxi/Makefile | 2 +- drivers/video/sunxi/sunxi_de2.c | 72 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-)
drivers/video/sunxi/Makefile +1 -1
@@ -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.5
PATCH v3 3/3 sunxi: setup simplefb for Allwinner DE2
Quoted 6 lines · 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.
Signed-off-by Icenowy Zheng <[email protected]>
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170913/6f0ec9e5/attachment.sig>