From: Philippe Leduc <ledphilippe@gmail.com>
To: barebox@lists.infradead.org
Cc: Philippe Leduc <ledphilippe@gmail.com>
Subject: [RFC 1/1] i.MX: IPUv3: Add parallel display support
Date: Thu, 25 Feb 2016 17:01:20 +0100 [thread overview]
Message-ID: <1456416080-486-1-git-send-email-ledphilippe@gmail.com> (raw)
Add a driver compatible with "fsl,imx-parallel-display" in order
to enable parallel display with the i.MX IPUv3.
Signed-off-by: Philippe Leduc<ledphilippe@gmail.com>
--
diff --git a/drivers/video/imx-ipu-v3/Kconfig b/drivers/video/imx-ipu-v3/Kconfig
index b5ee4ef..5ec8031 100644
--- a/drivers/video/imx-ipu-v3/Kconfig
+++ b/drivers/video/imx-ipu-v3/Kconfig
@@ -15,5 +15,9 @@ config DRIVER_VIDEO_IMX_IPUV3_HDMI
bool "IPUv3 HDMI support"
depends on DRIVER_VIDEO_EDID
select OFDEVICE
+
+config DRIVER_VIDEO_IMX_IPUV3_PARALLEL
+ bool "IPUv3 parallel display support"
+ select OFDEVICE
endif
diff --git a/drivers/video/imx-ipu-v3/Makefile b/drivers/video/imx-ipu-v3/Makefile
index 2bc0aec..1f68120 100644
--- a/drivers/video/imx-ipu-v3/Makefile
+++ b/drivers/video/imx-ipu-v3/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3) += ipu-dp.o ipuv3-plane.o ipufb.o
obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3) += ipu-dc.o
obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3_LVDS) += imx-ldb.o
obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3_HDMI) += imx-hdmi.o
+obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3_PARALLEL) += imx-pd.o
diff --git a/drivers/video/imx-ipu-v3/imx-pd.c b/drivers/video/imx-ipu-v3/imx-pd.c
new file mode 100644
index 0000000..acfeed2
--- /dev/null
+++ b/drivers/video/imx-ipu-v3/imx-pd.c
@@ -0,0 +1,111 @@
+/*
+ * i.MX drm driver - parallel display implementation
+ *
+ * Copyright (C) 2016 Philippe Leduc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <fb.h>
+#include <io.h>
+#include <of_graph.h>
+#include <driver.h>
+#include <malloc.h>
+#include <errno.h>
+#include <init.h>
+#include <video/vpl.h>
+#include <linux/err.h>
+
+#include "imx-ipu-v3.h"
+
+struct imx_pd {
+ struct device_d *dev;
+ struct display_timings *timings;
+ u32 interface_pix_fmt;
+ struct vpl vpl;
+};
+
+
+
+static int imx_pd_ioctl(struct vpl *vpl, unsigned int port,
+ unsigned int cmd, void *data)
+{
+ struct imx_pd *imx_pd = container_of(vpl, struct imx_pd, vpl);
+ struct ipu_di_mode *mode;
+ struct display_timings *timings;
+
+ switch (cmd) {
+ case IMX_IPU_VPL_DI_MODE:
+ mode = data;
+
+ mode->di_clkflags = IPU_DI_CLKMODE_SYNC;
+ mode->interface_pix_fmt = imx_pd->interface_pix_fmt;
+ return 0;
+
+ case VPL_GET_VIDEOMODES:
+ timings = data;
+
+ timings->num_modes = imx_pd->timings->num_modes;
+ timings->native_mode = imx_pd->timings->native_mode;
+ timings->modes = imx_pd->timings->modes;
+ timings->edid = NULL;
+ return 0;
+ }
+
+ return 0;
+}
+
+static int imx_pd_probe(struct device_d *dev)
+{
+ struct device_node *node = dev->device_node;
+ struct imx_pd *imx_pd;
+ const char *fmt;
+ int ret;
+
+ imx_pd = xzalloc(sizeof(*imx_pd));
+ imx_pd->dev = dev;
+
+ ret = of_property_read_string(node, "interface-pix-fmt", &fmt);
+ if (!ret) {
+ if (!strcmp(fmt, "rgb24"))
+ imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB24;
+ else if (!strcmp(fmt, "rgb565"))
+ imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB565;
+ else if (!strcmp(fmt, "bgr666"))
+ imx_pd->interface_pix_fmt = V4L2_PIX_FMT_BGR666;
+ }
+
+ imx_pd->timings = of_get_display_timings(node);
+
+ imx_pd->vpl.node = node;
+ imx_pd->vpl.ioctl = &imx_pd_ioctl;
+ ret = vpl_register(&imx_pd->vpl);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static struct of_device_id imx_pd_dt_ids[] = {
+ { .compatible = "fsl,imx-parallel-display", },
+ { /* sentinel */ }
+};
+
+static struct driver_d imx_pd_driver = {
+ .probe = imx_pd_probe,
+ .of_compatible = imx_pd_dt_ids,
+ .name = "imx-parallel-display",
+};
+device_platform_driver(imx_pd_driver);
+
+MODULE_DESCRIPTION("i.MX Parallel display driver");
+MODULE_AUTHOR("Philippe Leduc");
+MODULE_LICENSE("GPL");
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2016-02-25 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 16:01 Philippe Leduc [this message]
2016-02-29 6:50 ` Sascha Hauer
2016-03-14 8:48 ` Philippe Leduc
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=1456416080-486-1-git-send-email-ledphilippe@gmail.com \
--to=ledphilippe@gmail.com \
--cc=barebox@lists.infradead.org \
/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