From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [linux-sunxi] [PATCH v3 1/3] video: sunxi: extract simplefb match code to a new file
Date: Wed, 13 Sep 2017 16:46:55 +0300 [thread overview]
Message-ID: <20170913164655.6afa5eb5@i7> (raw)
In-Reply-To: <20170913021751.9289-2-icenowy@aosc.io>
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
next prev parent reply other threads:[~2017-09-13 13:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Siarhei Siamashka [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170913164655.6afa5eb5@i7 \
--to=siarhei.siamashka@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox