* [PATCH 1/3] i.MX: IPUv3: Add parallel display support
@ 2016-12-08 17:04 Jan Luebbe
2016-12-08 17:04 ` [PATCH 2/3] video: IPU framebuffer: honor clock and enable polarities Jan Luebbe
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Luebbe @ 2016-12-08 17:04 UTC (permalink / raw)
To: barebox; +Cc: Philippe Leduc
From: Philippe Leduc <ledphilippe@gmail.com>
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>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
I've updated Philippe's patch to the current barebox (we now use bus_format
with defines like MEDIA_BUS_FMT_RGB888_1X24). Also, Sascha's comments on the
previous version have applied.
drivers/video/imx-ipu-v3/Kconfig | 4 ++
drivers/video/imx-ipu-v3/Makefile | 1 +
drivers/video/imx-ipu-v3/imx-pd.c | 118 ++++++++++++++++++++++++++++++++++++++
3 files changed, 123 insertions(+)
create mode 100644 drivers/video/imx-ipu-v3/imx-pd.c
diff --git a/drivers/video/imx-ipu-v3/Kconfig b/drivers/video/imx-ipu-v3/Kconfig
index b5ee4efb1566..d04123731434 100644
--- a/drivers/video/imx-ipu-v3/Kconfig
+++ b/drivers/video/imx-ipu-v3/Kconfig
@@ -16,4 +16,8 @@ config DRIVER_VIDEO_IMX_IPUV3_HDMI
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 2bc0aec5aeee..1f6812021e90 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 000000000000..09d8a3ae2a84
--- /dev/null
+++ b/drivers/video/imx-ipu-v3/imx-pd.c
@@ -0,0 +1,118 @@
+/*
+ * 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 <video/media-bus-format.h>
+#include <linux/err.h>
+
+#include "imx-ipu-v3.h"
+
+struct imx_pd {
+ struct device_d *dev;
+ struct display_timings *timings;
+ u32 bus_format;
+ 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->bus_format = imx_pd->bus_format;
+ 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->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
+ else if (!strcmp(fmt, "rgb565"))
+ imx_pd->bus_format = MEDIA_BUS_FMT_RGB565_1X16;
+ else if (!strcmp(fmt, "bgr666"))
+ imx_pd->bus_format = MEDIA_BUS_FMT_RGB666_1X18;
+ else {
+ dev_err(dev, "invalid interface-pix-fmt\n");
+ return -EINVAL;
+ }
+ }
+
+ imx_pd->timings = of_get_display_timings(node);
+ if (!imx_pd->timings) {
+ dev_err(dev, "No display timings panel found\n");
+ return -EINVAL;
+ }
+
+ 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");
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] video: IPU framebuffer: honor clock and enable polarities
2016-12-08 17:04 [PATCH 1/3] i.MX: IPUv3: Add parallel display support Jan Luebbe
@ 2016-12-08 17:04 ` Jan Luebbe
2016-12-08 17:04 ` [PATCH 3/3] PWM: update enable status when using the internal API Jan Luebbe
2016-12-12 5:12 ` [PATCH 1/3] i.MX: IPUv3: Add parallel display support Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Jan Luebbe @ 2016-12-08 17:04 UTC (permalink / raw)
To: barebox
These flags are already parsed from DT, so we can just use them to
configure the timings correctly.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
drivers/video/imx-ipu-v3/ipufb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/imx-ipu-v3/ipufb.c b/drivers/video/imx-ipu-v3/ipufb.c
index 63024b546d69..343f9e557868 100644
--- a/drivers/video/imx-ipu-v3/ipufb.c
+++ b/drivers/video/imx-ipu-v3/ipufb.c
@@ -128,8 +128,9 @@ int ipu_crtc_mode_set(struct ipufb_info *fbi,
if (mode->sync & FB_SYNC_VERT_HIGH_ACT)
sig_cfg.Vsync_pol = 1;
- sig_cfg.enable_pol = 1;
- sig_cfg.clk_pol = 0;
+ sig_cfg.enable_pol = !(mode->display_flags & DISPLAY_FLAGS_DE_LOW);
+ /* Default to driving pixel data on negative clock edges */
+ sig_cfg.clk_pol = !!(mode->display_flags & DISPLAY_FLAGS_PIXDATA_POSEDGE);
sig_cfg.width = mode->xres;
sig_cfg.height = mode->yres;
sig_cfg.h_start_width = mode->left_margin;
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] PWM: update enable status when using the internal API
2016-12-08 17:04 [PATCH 1/3] i.MX: IPUv3: Add parallel display support Jan Luebbe
2016-12-08 17:04 ` [PATCH 2/3] video: IPU framebuffer: honor clock and enable polarities Jan Luebbe
@ 2016-12-08 17:04 ` Jan Luebbe
2016-12-12 5:12 ` [PATCH 1/3] i.MX: IPUv3: Add parallel display support Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Jan Luebbe @ 2016-12-08 17:04 UTC (permalink / raw)
To: barebox
Without these, 'devinfo pwmX' will show enabled=0 even though the PWM
was enabled (for example by a pwm-backlight).
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
drivers/pwm/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 360520195a05..ee65619c4ea5 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -281,6 +281,8 @@ unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
*/
int pwm_enable(struct pwm_device *pwm)
{
+ pwm->p_enable = 1;
+
if (!test_and_set_bit(FLAG_ENABLED, &pwm->flags))
return pwm->chip->ops->enable(pwm->chip);
@@ -293,6 +295,8 @@ EXPORT_SYMBOL_GPL(pwm_enable);
*/
void pwm_disable(struct pwm_device *pwm)
{
+ pwm->p_enable = 0;
+
if (test_and_clear_bit(FLAG_ENABLED, &pwm->flags))
pwm->chip->ops->disable(pwm->chip);
}
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] i.MX: IPUv3: Add parallel display support
2016-12-08 17:04 [PATCH 1/3] i.MX: IPUv3: Add parallel display support Jan Luebbe
2016-12-08 17:04 ` [PATCH 2/3] video: IPU framebuffer: honor clock and enable polarities Jan Luebbe
2016-12-08 17:04 ` [PATCH 3/3] PWM: update enable status when using the internal API Jan Luebbe
@ 2016-12-12 5:12 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2016-12-12 5:12 UTC (permalink / raw)
To: Jan Luebbe; +Cc: Philippe Leduc, barebox
On Thu, Dec 08, 2016 at 06:04:39PM +0100, Jan Luebbe wrote:
> From: Philippe Leduc <ledphilippe@gmail.com>
>
> 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>
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-12-12 5:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 17:04 [PATCH 1/3] i.MX: IPUv3: Add parallel display support Jan Luebbe
2016-12-08 17:04 ` [PATCH 2/3] video: IPU framebuffer: honor clock and enable polarities Jan Luebbe
2016-12-08 17:04 ` [PATCH 3/3] PWM: update enable status when using the internal API Jan Luebbe
2016-12-12 5:12 ` [PATCH 1/3] i.MX: IPUv3: Add parallel display support Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox