* [U-Boot] [PATCH 1/8] imx-common: add board_video_skip
@ 2014-04-02 19:57 Eric Bénard
2014-04-04 0:56 ` Eric Nelson
0 siblings, 1 reply; 4+ messages in thread
From: Eric Bénard @ 2014-04-02 19:57 UTC (permalink / raw)
To: u-boot
this function is shared by several board and thus can be factorized
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
arch/arm/imx-common/Makefile | 1 +
arch/arm/imx-common/video.c | 55 +++++++++++++++++++++++++++++++++
arch/arm/include/asm/imx-common/video.h | 20 ++++++++++++
3 files changed, 76 insertions(+)
create mode 100644 arch/arm/imx-common/video.c
create mode 100644 arch/arm/include/asm/imx-common/video.h
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 16809fe..2a7fc42 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -19,6 +19,7 @@ obj-y += misc.o
endif
ifeq ($(SOC),$(filter $(SOC),mx6))
obj-$(CONFIG_CMD_SATA) += sata.o
+obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
endif
obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
diff --git a/arch/arm/imx-common/video.c b/arch/arm/imx-common/video.c
new file mode 100644
index 0000000..8db5a84
--- /dev/null
+++ b/arch/arm/imx-common/video.c
@@ -0,0 +1,55 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/errno.h>
+#include <asm/imx-common/video.h>
+
+extern struct display_info_t const displays[];
+extern size_t display_number;
+
+int board_video_skip(void)
+{
+ int i;
+ int ret;
+ char const *panel = getenv("panel");
+ if (!panel) {
+ for (i = 0; i < display_number; i++) {
+ struct display_info_t const *dev = displays+i;
+ if (dev->detect && dev->detect(dev)) {
+ panel = dev->mode.name;
+ printf("auto-detected panel %s\n", panel);
+ break;
+ }
+ }
+ if (!panel) {
+ panel = displays[0].mode.name;
+ printf("No panel detected: default to %s\n", panel);
+ i = 0;
+ }
+ } else {
+ for (i = 0; i < display_number; i++) {
+ if (!strcmp(panel, displays[i].mode.name))
+ break;
+ }
+ }
+ if (i < display_number) {
+ ret = ipuv3_fb_init(&displays[i].mode, 0,
+ displays[i].pixfmt);
+ if (!ret) {
+ displays[i].enable(displays+i);
+ printf("Display: %s (%ux%u)\n",
+ displays[i].mode.name,
+ displays[i].mode.xres,
+ displays[i].mode.yres);
+ } else
+ printf("LCD %s cannot be configured: %d\n",
+ displays[i].mode.name, ret);
+ } else {
+ printf("unsupported panel %s\n", panel);
+ return -EINVAL;
+ }
+
+ return 0;
+}
diff --git a/arch/arm/include/asm/imx-common/video.h b/arch/arm/include/asm/imx-common/video.h
new file mode 100644
index 0000000..e0c4ef4
--- /dev/null
+++ b/arch/arm/include/asm/imx-common/video.h
@@ -0,0 +1,20 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __IMX_VIDEO_H_
+#define __IMX_VIDEO_H_
+
+#include <linux/fb.h>
+#include <ipu_pixfmt.h>
+
+struct display_info_t {
+ int bus;
+ int addr;
+ int pixfmt;
+ int (*detect)(struct display_info_t const *dev);
+ void (*enable)(struct display_info_t const *dev);
+ struct fb_videomode mode;
+};
+
+#endif
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH 1/8] imx-common: add board_video_skip
2014-04-02 19:57 [U-Boot] [PATCH 1/8] imx-common: add board_video_skip Eric Bénard
@ 2014-04-04 0:56 ` Eric Nelson
0 siblings, 0 replies; 4+ messages in thread
From: Eric Nelson @ 2014-04-04 0:56 UTC (permalink / raw)
To: u-boot
Hi Eric,
On 04/02/2014 12:57 PM, Eric B?nard wrote:
> this function is shared by several board and thus can be factorized
boards (plural).
>
> Signed-off-by: Eric B?nard <eric@eukrea.com>
> ---
> arch/arm/imx-common/Makefile | 1 +
> arch/arm/imx-common/video.c | 55 +++++++++++++++++++++++++++++++++
> arch/arm/include/asm/imx-common/video.h | 20 ++++++++++++
> 3 files changed, 76 insertions(+)
> create mode 100644 arch/arm/imx-common/video.c
> create mode 100644 arch/arm/include/asm/imx-common/video.h
>
> diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
> index 16809fe..2a7fc42 100644
> --- a/arch/arm/imx-common/Makefile
> +++ b/arch/arm/imx-common/Makefile
> @@ -19,6 +19,7 @@ obj-y += misc.o
> endif
> ifeq ($(SOC),$(filter $(SOC),mx6))
> obj-$(CONFIG_CMD_SATA) += sata.o
> +obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
> endif
> obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
> obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
Wouldn't video-skip.h/.c be a better match for the CONFIG name?
> diff --git a/arch/arm/imx-common/video.c b/arch/arm/imx-common/video.c
> new file mode 100644
> index 0000000..8db5a84
> --- /dev/null
> +++ b/arch/arm/imx-common/video.c
> @@ -0,0 +1,55 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <asm/errno.h>
> +#include <asm/imx-common/video.h>
> +
> +extern struct display_info_t const displays[];
> +extern size_t display_number;
I'd prefer display_count or num_displays, but that's a nit.
> +
> +int board_video_skip(void)
> +{
> + int i;
> + int ret;
> + char const *panel = getenv("panel");
> + if (!panel) {
> + for (i = 0; i < display_number; i++) {
> + struct display_info_t const *dev = displays+i;
> + if (dev->detect && dev->detect(dev)) {
> + panel = dev->mode.name;
> + printf("auto-detected panel %s\n", panel);
> + break;
> + }
> + }
> + if (!panel) {
> + panel = displays[0].mode.name;
> + printf("No panel detected: default to %s\n", panel);
> + i = 0;
> + }
> + } else {
> + for (i = 0; i < display_number; i++) {
> + if (!strcmp(panel, displays[i].mode.name))
> + break;
> + }
> + }
> + if (i < display_number) {
> + ret = ipuv3_fb_init(&displays[i].mode, 0,
> + displays[i].pixfmt);
> + if (!ret) {
> + displays[i].enable(displays+i);
> + printf("Display: %s (%ux%u)\n",
> + displays[i].mode.name,
> + displays[i].mode.xres,
> + displays[i].mode.yres);
> + } else
> + printf("LCD %s cannot be configured: %d\n",
> + displays[i].mode.name, ret);
> + } else {
> + printf("unsupported panel %s\n", panel);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> diff --git a/arch/arm/include/asm/imx-common/video.h b/arch/arm/include/asm/imx-common/video.h
> new file mode 100644
> index 0000000..e0c4ef4
> --- /dev/null
> +++ b/arch/arm/include/asm/imx-common/video.h
> @@ -0,0 +1,20 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#ifndef __IMX_VIDEO_H_
> +#define __IMX_VIDEO_H_
> +
> +#include <linux/fb.h>
> +#include <ipu_pixfmt.h>
> +
> +struct display_info_t {
> + int bus;
> + int addr;
> + int pixfmt;
> + int (*detect)(struct display_info_t const *dev);
> + void (*enable)(struct display_info_t const *dev);
> + struct fb_videomode mode;
> +};
> +
> +#endif
>
Otherwise, this looks like straightforward movement into a good spot.
Acked-by: Eric Nelson <eric.nelson@boundarydevices.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/8] imx-common: add board_video_skip
@ 2014-04-02 19:57 Eric Bénard
2014-04-04 10:05 ` Stefano Babic
0 siblings, 1 reply; 4+ messages in thread
From: Eric Bénard @ 2014-04-02 19:57 UTC (permalink / raw)
To: u-boot
this function is shared by several board and thus can be factorized
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
arch/arm/imx-common/Makefile | 1 +
arch/arm/imx-common/video.c | 55 +++++++++++++++++++++++++++++++++
arch/arm/include/asm/imx-common/video.h | 20 ++++++++++++
3 files changed, 76 insertions(+)
create mode 100644 arch/arm/imx-common/video.c
create mode 100644 arch/arm/include/asm/imx-common/video.h
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 16809fe..2a7fc42 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -19,6 +19,7 @@ obj-y += misc.o
endif
ifeq ($(SOC),$(filter $(SOC),mx6))
obj-$(CONFIG_CMD_SATA) += sata.o
+obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
endif
obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
diff --git a/arch/arm/imx-common/video.c b/arch/arm/imx-common/video.c
new file mode 100644
index 0000000..8db5a84
--- /dev/null
+++ b/arch/arm/imx-common/video.c
@@ -0,0 +1,55 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/errno.h>
+#include <asm/imx-common/video.h>
+
+extern struct display_info_t const displays[];
+extern size_t display_number;
+
+int board_video_skip(void)
+{
+ int i;
+ int ret;
+ char const *panel = getenv("panel");
+ if (!panel) {
+ for (i = 0; i < display_number; i++) {
+ struct display_info_t const *dev = displays+i;
+ if (dev->detect && dev->detect(dev)) {
+ panel = dev->mode.name;
+ printf("auto-detected panel %s\n", panel);
+ break;
+ }
+ }
+ if (!panel) {
+ panel = displays[0].mode.name;
+ printf("No panel detected: default to %s\n", panel);
+ i = 0;
+ }
+ } else {
+ for (i = 0; i < display_number; i++) {
+ if (!strcmp(panel, displays[i].mode.name))
+ break;
+ }
+ }
+ if (i < display_number) {
+ ret = ipuv3_fb_init(&displays[i].mode, 0,
+ displays[i].pixfmt);
+ if (!ret) {
+ displays[i].enable(displays+i);
+ printf("Display: %s (%ux%u)\n",
+ displays[i].mode.name,
+ displays[i].mode.xres,
+ displays[i].mode.yres);
+ } else
+ printf("LCD %s cannot be configured: %d\n",
+ displays[i].mode.name, ret);
+ } else {
+ printf("unsupported panel %s\n", panel);
+ return -EINVAL;
+ }
+
+ return 0;
+}
diff --git a/arch/arm/include/asm/imx-common/video.h b/arch/arm/include/asm/imx-common/video.h
new file mode 100644
index 0000000..e0c4ef4
--- /dev/null
+++ b/arch/arm/include/asm/imx-common/video.h
@@ -0,0 +1,20 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __IMX_VIDEO_H_
+#define __IMX_VIDEO_H_
+
+#include <linux/fb.h>
+#include <ipu_pixfmt.h>
+
+struct display_info_t {
+ int bus;
+ int addr;
+ int pixfmt;
+ int (*detect)(struct display_info_t const *dev);
+ void (*enable)(struct display_info_t const *dev);
+ struct fb_videomode mode;
+};
+
+#endif
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH 1/8] imx-common: add board_video_skip
2014-04-02 19:57 Eric Bénard
@ 2014-04-04 10:05 ` Stefano Babic
0 siblings, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2014-04-04 10:05 UTC (permalink / raw)
To: u-boot
Hi Eric,
On 02/04/2014 21:57, Eric B?nard wrote:
> this function is shared by several board and thus can be factorized
>
> Signed-off-by: Eric B?nard <eric@eukrea.com>
> ---
> arch/arm/imx-common/Makefile | 1 +
> arch/arm/imx-common/video.c | 55 +++++++++++++++++++++++++++++++++
> arch/arm/include/asm/imx-common/video.h | 20 ++++++++++++
> 3 files changed, 76 insertions(+)
> create mode 100644 arch/arm/imx-common/video.c
> create mode 100644 arch/arm/include/asm/imx-common/video.h
>
> diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
> index 16809fe..2a7fc42 100644
> --- a/arch/arm/imx-common/Makefile
> +++ b/arch/arm/imx-common/Makefile
> @@ -19,6 +19,7 @@ obj-y += misc.o
> endif
> ifeq ($(SOC),$(filter $(SOC),mx6))
> obj-$(CONFIG_CMD_SATA) += sata.o
> +obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
> endif
> obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
> obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
> diff --git a/arch/arm/imx-common/video.c b/arch/arm/imx-common/video.c
> new file mode 100644
> index 0000000..8db5a84
> --- /dev/null
> +++ b/arch/arm/imx-common/video.c
> @@ -0,0 +1,55 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <asm/errno.h>
> +#include <asm/imx-common/video.h>
> +
> +extern struct display_info_t const displays[];
> +extern size_t display_number;
> +
> +int board_video_skip(void)
> +{
> + int i;
> + int ret;
> + char const *panel = getenv("panel");
> + if (!panel) {
> + for (i = 0; i < display_number; i++) {
> + struct display_info_t const *dev = displays+i;
> + if (dev->detect && dev->detect(dev)) {
> + panel = dev->mode.name;
> + printf("auto-detected panel %s\n", panel);
> + break;
> + }
> + }
> + if (!panel) {
> + panel = displays[0].mode.name;
> + printf("No panel detected: default to %s\n", panel);
> + i = 0;
> + }
> + } else {
> + for (i = 0; i < display_number; i++) {
> + if (!strcmp(panel, displays[i].mode.name))
> + break;
> + }
> + }
> + if (i < display_number) {
> + ret = ipuv3_fb_init(&displays[i].mode, 0,
> + displays[i].pixfmt);
> + if (!ret) {
> + displays[i].enable(displays+i);
> + printf("Display: %s (%ux%u)\n",
> + displays[i].mode.name,
> + displays[i].mode.xres,
> + displays[i].mode.yres);
> + } else
> + printf("LCD %s cannot be configured: %d\n",
> + displays[i].mode.name, ret);
> + } else {
> + printf("unsupported panel %s\n", panel);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> diff --git a/arch/arm/include/asm/imx-common/video.h b/arch/arm/include/asm/imx-common/video.h
> new file mode 100644
> index 0000000..e0c4ef4
> --- /dev/null
> +++ b/arch/arm/include/asm/imx-common/video.h
> @@ -0,0 +1,20 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#ifndef __IMX_VIDEO_H_
> +#define __IMX_VIDEO_H_
> +
> +#include <linux/fb.h>
> +#include <ipu_pixfmt.h>
> +
> +struct display_info_t {
> + int bus;
> + int addr;
> + int pixfmt;
> + int (*detect)(struct display_info_t const *dev);
> + void (*enable)(struct display_info_t const *dev);
> + struct fb_videomode mode;
> +};
> +
> +#endif
>
Nice clean up, thanks for this !
Acked-by: Stefano Babic <sbabic@denx.de>
Regards,
Stefano
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-04 10:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 19:57 [U-Boot] [PATCH 1/8] imx-common: add board_video_skip Eric Bénard
2014-04-04 0:56 ` Eric Nelson
-- strict thread matches above, loose matches on Subject: below --
2014-04-02 19:57 Eric Bénard
2014-04-04 10:05 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox