All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/3] Allwinner DE2 HDMI SimpleFB support
@ 2017-09-13  2:17 Icenowy Zheng
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file Icenowy Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Icenowy Zheng @ 2017-09-13  2:17 UTC (permalink / raw)
  To: u-boot

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

-- 
2.13.5

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file
  2017-09-13  2:17 [U-Boot] [PATCH v3 0/3] Allwinner DE2 HDMI SimpleFB support Icenowy Zheng
@ 2017-09-13  2:17 ` Icenowy Zheng
  2017-09-13 11:51   ` Maxime Ripard
  2017-09-13 13:46   ` [U-Boot] [linux-sunxi] " Siarhei Siamashka
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 2/3] video: add an option for video simplefb via DT Icenowy Zheng
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 3/3] sunxi: setup simplefb for Allwinner DE2 Icenowy Zheng
  2 siblings, 2 replies; 12+ messages in thread
From: Icenowy Zheng @ 2017-09-13  2:17 UTC (permalink / raw)
  To: u-boot

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>
---
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

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..4823f13a0c
--- /dev/null
+++ b/drivers/video/sunxi/simplefb_common.c
@@ -0,0 +1,29 @@
+/*
+ * Common code for Allwinner SimpleFB with pipeline.
+ *
+ * (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 */
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/3] video: add an option for video simplefb via DT
  2017-09-13  2:17 [U-Boot] [PATCH v3 0/3] Allwinner DE2 HDMI SimpleFB support Icenowy Zheng
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file Icenowy Zheng
@ 2017-09-13  2:17 ` Icenowy Zheng
  2017-09-13 12:04   ` Maxime Ripard
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 3/3] sunxi: setup simplefb for Allwinner DE2 Icenowy Zheng
  2 siblings, 1 reply; 12+ messages in thread
From: Icenowy Zheng @ 2017-09-13  2:17 UTC (permalink / raw)
  To: u-boot

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 <icenowy@aosc.io>
---
 drivers/video/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 082cc4a528..e4e71763f5 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -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
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 3/3] sunxi: setup simplefb for Allwinner DE2
  2017-09-13  2:17 [U-Boot] [PATCH v3 0/3] Allwinner DE2 HDMI SimpleFB support Icenowy Zheng
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file Icenowy Zheng
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 2/3] video: add an option for video simplefb via DT Icenowy Zheng
@ 2017-09-13  2:17 ` Icenowy Zheng
  2017-09-13 12:05   ` Maxime Ripard
  2 siblings, 1 reply; 12+ messages in thread
From: Icenowy Zheng @ 2017-09-13  2:17 UTC (permalink / raw)
  To: u-boot

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>
---
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(-)

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 */
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file Icenowy Zheng
@ 2017-09-13 11:51   ` Maxime Ripard
  2017-09-13 13:46   ` [U-Boot] [linux-sunxi] " Siarhei Siamashka
  1 sibling, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2017-09-13 11:51 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 13, 2017 at 10:17:49AM +0800, Icenowy Zheng 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 <icenowy@aosc.io>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

-- 
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>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/3] video: add an option for video simplefb via DT
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 2/3] video: add an option for video simplefb via DT Icenowy Zheng
@ 2017-09-13 12:04   ` Maxime Ripard
  2017-09-13 13:17     ` [U-Boot] [linux-sunxi] " icenowy at aosc.io
  2017-09-13 15:50     ` Vincent Legoll
  0 siblings, 2 replies; 12+ messages in thread
From: Maxime Ripard @ 2017-09-13 12:04 UTC (permalink / raw)
  To: u-boot

Hi,

On Wed, Sep 13, 2017 at 10:17:50AM +0800, 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 DE2 driver uses this option.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/video/Kconfig | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 082cc4a528..e4e71763f5 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -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

-- 
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>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 3/3] sunxi: setup simplefb for Allwinner DE2
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 3/3] sunxi: setup simplefb for Allwinner DE2 Icenowy Zheng
@ 2017-09-13 12:05   ` Maxime Ripard
  0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2017-09-13 12:05 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 13, 2017 at 10:17:51AM +0800, Icenowy Zheng wrote:
> 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>

Maxime

-- 
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>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
  2017-09-13 12:04   ` Maxime Ripard
@ 2017-09-13 13:17     ` icenowy at aosc.io
  2017-09-13 17:42       ` Maxime Ripard
  2017-09-13 15:50     ` Vincent Legoll
  1 sibling, 1 reply; 12+ messages in thread
From: icenowy at aosc.io @ 2017-09-13 13:17 UTC (permalink / raw)
  To: u-boot

在 2017-09-13 20:04,Maxime Ripard 写道:
> Hi,
> 
> On Wed, Sep 13, 2017 at 10:17:50AM +0800, 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 DE2 driver uses this option.
>> 
>> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
>> ---
>>  drivers/video/Kconfig | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>> 
>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>> index 082cc4a528..e4e71763f5 100644
>> --- a/drivers/video/Kconfig
>> +++ b/drivers/video/Kconfig
>> @@ -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.

Then should I drop the "depends on VIDEO_DE2"?

> 
> Maxime
> 
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [linux-sunxi] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file
  2017-09-13  2:17 ` [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file Icenowy Zheng
  2017-09-13 11:51   ` Maxime Ripard
@ 2017-09-13 13:46   ` Siarhei Siamashka
  1 sibling, 0 replies; 12+ messages in thread
From: Siarhei Siamashka @ 2017-09-13 13:46 UTC (permalink / raw)
  To: u-boot

On Wed, 13 Sep 2017 10:17:49 +0800
Icenowy Zheng <icenowy@aosc.io> 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 <icenowy@aosc.io>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
> ---
> 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
> 
> 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..4823f13a0c
> --- /dev/null
> +++ b/drivers/video/sunxi/simplefb_common.c
> @@ -0,0 +1,29 @@
> +/*
> + * Common code for Allwinner SimpleFB with pipeline.
> + *
> + * (C) Copyright 2014-2015 Hans de Goede <hdegoede@redhat.com>

Your copyright notice seems to be missing

 * (C) Copyright 2013-2014 Luc Verhaegen <libv@skynet.be>

> + * (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 */

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
Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>

-- 
Best regards,
Siarhei Siamashka

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
  2017-09-13 12:04   ` Maxime Ripard
  2017-09-13 13:17     ` [U-Boot] [linux-sunxi] " icenowy at aosc.io
@ 2017-09-13 15:50     ` Vincent Legoll
  2017-09-13 15:55       ` Andre Przywara
  1 sibling, 1 reply; 12+ messages in thread
From: Vincent Legoll @ 2017-09-13 15:50 UTC (permalink / raw)
  To: u-boot

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

You meant adding a "select VIDEO_DT_SIMPLEFB" to VIDEO_DE2 ?

-- 
Vincent Legoll

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
  2017-09-13 15:50     ` Vincent Legoll
@ 2017-09-13 15:55       ` Andre Przywara
  0 siblings, 0 replies; 12+ messages in thread
From: Andre Przywara @ 2017-09-13 15:55 UTC (permalink / raw)
  To: u-boot

Hi,

On 13/09/17 16:50, Vincent Legoll wrote:
>> 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.
> 
> You meant adding a "select VIDEO_DT_SIMPLEFB" to VIDEO_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.
===============

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild/kconfig-language.txt#n116

Cheers,
Andre

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [linux-sunxi] Re: [PATCH v3 2/3] video: add an option for video simplefb via DT
  2017-09-13 13:17     ` [U-Boot] [linux-sunxi] " icenowy at aosc.io
@ 2017-09-13 17:42       ` Maxime Ripard
  0 siblings, 0 replies; 12+ messages in thread
From: Maxime Ripard @ 2017-09-13 17:42 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 13, 2017 at 09:17:21PM +0800, icenowy at aosc.io wrote:
> 在 2017-09-13 20:04,Maxime Ripard 写道:
> > Hi,
> > 
> > On Wed, Sep 13, 2017 at 10:17:50AM +0800, 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 DE2 driver uses this option.
> > > 
> > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > > ---
> > >  drivers/video/Kconfig | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> > > index 082cc4a528..e4e71763f5 100644
> > > --- a/drivers/video/Kconfig
> > > +++ b/drivers/video/Kconfig
> > > @@ -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.
> 
> Then should I drop the "depends on VIDEO_DE2"?

Yes.

Maxime

-- 
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>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-09-13 17:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13  2:17 [U-Boot] [PATCH v3 0/3] Allwinner DE2 HDMI SimpleFB support Icenowy Zheng
2017-09-13  2:17 ` [U-Boot] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file Icenowy Zheng
2017-09-13 11:51   ` Maxime Ripard
2017-09-13 13:46   ` [U-Boot] [linux-sunxi] " Siarhei Siamashka
2017-09-13  2:17 ` [U-Boot] [PATCH v3 2/3] video: add an option for video simplefb via DT Icenowy Zheng
2017-09-13 12:04   ` Maxime Ripard
2017-09-13 13:17     ` [U-Boot] [linux-sunxi] " icenowy at aosc.io
2017-09-13 17:42       ` Maxime Ripard
2017-09-13 15:50     ` Vincent Legoll
2017-09-13 15:55       ` Andre Przywara
2017-09-13  2:17 ` [U-Boot] [PATCH v3 3/3] sunxi: setup simplefb for Allwinner DE2 Icenowy Zheng
2017-09-13 12:05   ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.