Skip to contentSkip to conversation

Allwinner DE2 HDMI SimpleFB support

PATCH Superseded Icenowy Zheng 3 participants 7 messages Sep 11, 2017 – Sep 12, 2017

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 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/.

Icenowy Zheng (2):
video: sunxi: extract simplefb match code to a new file
sunxi: setup simplefb for Allwinner DE2

 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 +------
 include/configs/sunxi-common.h        |  4 ++
 6 files changed, 131 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
#1 lore raw

PATCH v2 1/2 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.

---
 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
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 +29 -0
new file mode 100644
index 0000000000..4823f13a0c
@@ -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
new file mode 100644
index 0000000000..ac9bfcb087
@@ -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.5
#2 lore raw

PATCH v2 1/2 video: sunxi: extract simplefb match code to a new file

Hi Icenowy,

thanks for sending this!

Quoted 65 lines · Icenowy Zheng

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

---
 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
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 +29 -0
new file mode 100644
index 0000000000..4823f13a0c
@@ -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 +0 -0
new file mode 100644
index 0000000000..ac9bfcb087

drivers/video/sunxi/simplefb_common.h line 10

Quoted 10 lines
drivers/video/sunxi/simplefb_common.h new file +10 -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
+
+/*

Just a nit, but I think kerndoc requires two asterisks here ("/**").

The rest looks fine to me, so:

Cheers,
Andre.

Quoted 44 lines
drivers/video/sunxi/simplefb_common.h new file +12 -0
+ * 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 */
#3 lore raw

PATCH v2 2/2 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 v2:
- Extract the simplefb node searching code.

 drivers/video/sunxi/Makefile    |  2 +-
 drivers/video/sunxi/sunxi_de2.c | 72 +++++++++++++++++++++++++++++++++++++++++
 include/configs/sunxi-common.h  |  4 +++
 3 files changed, 77 insertions(+), 1 deletion(-)
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

include/configs/sunxi-common.h +4 -0
index 1373b1f037..c240fe4403 100644
@@ -288,6 +288,10 @@ extern int soft_i2c_gpio_scl;
 
 #endif /* CONFIG_VIDEO */
 
+#ifdef CONFIG_VIDEO_DE2
+#define CONFIG_VIDEO_DT_SIMPLEFB
+#endif
+
 /* Ethernet support */
 #ifdef CONFIG_SUNXI_EMAC
 #define CONFIG_PHY_ADDR		1
Signature · 1 line
2.13.5
#4 lore raw

PATCH v2 2/2 sunxi: setup simplefb for Allwinner DE2

Hi,

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 294

Quoted 12 lines · Icenowy Zheng
include/configs/sunxi-common.h +4 -0
index 1373b1f037..c240fe4403 100644
@@ -288,6 +288,10 @@ extern int soft_i2c_gpio_scl;
 
 #endif /* CONFIG_VIDEO */
 
+#ifdef CONFIG_VIDEO_DE2
+#define CONFIG_VIDEO_DT_SIMPLEFB
+#endif
+

Please use a Kconfig option for that one.

Thanks!
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/20170912/ab397b7a/attachment.sig>
#5 lore raw

PATCH v2 2/2 sunxi: setup simplefb for Allwinner DE2

Quoted 10 lines · 在 2017-09-12 16:18,Maxime Ripard 写道:

Hi,

Quoted 7 lines · Icenowy Zheng
include/configs/sunxi-common.h +0 -0
index 1373b1f037..c240fe4403 100644
@@ -288,6 +288,10 @@ extern int soft_i2c_gpio_scl;
 
Quoted 8 lines

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 294

Quoted 6 lines
include/configs/sunxi-common.h +4 -0
 #endif /* CONFIG_VIDEO */
 
+#ifdef CONFIG_VIDEO_DE2
+#define CONFIG_VIDEO_DT_SIMPLEFB
+#endif
+

Please use a Kconfig option for that one.

Should I also convert DE1 simplefb to a Kconfig option?

Quoted 3 lines

Thanks!
Maxime

#6 lore raw

PATCH v2 2/2 sunxi: setup simplefb for Allwinner DE2

Quoted 13 lines · icenowy at aosc.io
Quoted 12 lines · 在 2017-09-12 16:18,Maxime Ripard 写道:

Hi,

Quoted 9 lines · Icenowy Zheng
include/configs/sunxi-common.h +0 -0
index 1373b1f037..c240fe4403 100644
@@ -288,6 +288,10 @@ extern int soft_i2c_gpio_scl;
 
 #endif /* CONFIG_VIDEO */
 
Quoted 8 lines
Quoted 6 lines

include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 294

Quoted 4 lines
include/configs/sunxi-common.h +4 -0
+#ifdef CONFIG_VIDEO_DE2
+#define CONFIG_VIDEO_DT_SIMPLEFB
+#endif
+

Please use a Kconfig option for that one.

Should I also convert DE1 simplefb to a Kconfig option?

If you have some spare time, sure, but it's not a pre-requisite for this serie.

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/20170912/6ada6630/attachment.sig>