Skip to contentSkip to conversation

Nokia N950 basic display support

PATCH In review Sebastian Reichel 4 participants 31 messages Mar 4, 2017 – Mar 24, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Nokia N950 basic display support

Hi,

Some of you may remember, that I sent a series for the N950 display some time ago. N950 has command mode DSI panel, so the main part of the patchset takes care of adding manual display update support in omapdrm.

The N950 also requires display rotation (the panel is mounted vertically and bottom-up) and offset. The required bits will be sent separately.

The patchset is based on 2d62e0768d3c, which is the current commit torvald's master branch points to. I tested the patches on N950 with kernel console (fbcon), Tomi's kmstest and Xorg from Debian sid.

Rough changelog, most of that work was done by Tony (thanks!)

* lots of patches dropped for now
* rebased to current omapdrm interface
* added OMAP4 support
* misc. cleanup

-- Sebastian

Sebastian Reichel (7):
drm: omapdrm: panel-dsi-cm: add regulator support Revert "drm: omapdrm: Remove manual update display support"
drm: omapdrm: crtc: save framedone callback from dss
drm: omapdrm: crtc: detect manually updated displays
drm: omapdrm: crtc: add support for manual updated displays
drm: omapdrm: plane: update fifo size on atomic update
ARM: dts: n950: add display support

Tony Lindgren (3):
drm: omapdrm: panel-dsi-cm: Fix probe for device tree
drm: omapdrm: crtc: handle framedone directly
drm: omapdrm: crtc: get manual mode displays working

 arch/arm/boot/dts/omap3-n950.dts                |  89 +++++++++++++
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 120 ++++++++++++++---
 drivers/gpu/drm/omapdrm/dss/dispc.c             |   2 +
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |   5 +
 drivers/gpu/drm/omapdrm/dss/output.c            |   6 +
 drivers/gpu/drm/omapdrm/omap_connector.c        |   7 +
 drivers/gpu/drm/omapdrm/omap_crtc.c             | 165 ++++++++++++++++++++++--
 drivers/gpu/drm/omapdrm/omap_drv.h              |   8 ++
 drivers/gpu/drm/omapdrm/omap_fb.c               |  28 ++++
 drivers/gpu/drm/omapdrm/omap_fbdev.c            |  57 +++++++-
 drivers/gpu/drm/omapdrm/omap_irq.c              |   7 +-
 drivers/gpu/drm/omapdrm/omap_plane.c            |  23 ++++
 12 files changed, 487 insertions(+), 30 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/10 drm: omapdrm: panel-dsi-cm: Fix probe for device tree

From: Tony Lindgren <[email protected]>

Things are a bit whacked right now for panel-dsi-cm:

1. We're missing call to of_get_display_timing() and videomode_from_timing()

2. We need to call dsicm_probe_of() after we initialize the default values to not overwrite device tree configured values

3. We need to implement minimal get_timings() and check_timings() for the panel to work

With these changes we get panel-dsi-cm to probe with device tree configuraion. Note that the dsicm_check_timings adapted from an earlier patch by Sebastian Reichel <[email protected]>.

---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 65 ++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 13 deletions(-)
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +52 -13
index ac5800c72cb4..ad1058fafe92 100644
@@ -25,6 +25,7 @@
 #include <linux/of_gpio.h>
 
 #include <video/mipi_display.h>
+#include <video/of_display_timing.h>
 
 #include "../dss/omapdss.h"
 
@@ -379,13 +380,6 @@ static const struct backlight_ops dsicm_bl_ops = {
 	.update_status  = dsicm_bl_update_status,
 };
 
-static void dsicm_get_resolution(struct omap_dss_device *dssdev,
-		u16 *xres, u16 *yres)
-{
-	*xres = dssdev->panel.vm.hactive;
-	*yres = dssdev->panel.vm.vactive;
-}
-
 static ssize_t dsicm_num_errors_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -1106,6 +1100,36 @@ static void dsicm_ulps_work(struct work_struct *work)
 	mutex_unlock(&ddata->lock);
 }
 
+static void dsicm_get_timings(struct omap_dss_device *dssdev,
+			      struct videomode *vm)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+
+	*vm = ddata->vm;
+}
+
+static int dsicm_check_timings(struct omap_dss_device *dssdev,
+			       struct videomode *vm)
+{
+	struct panel_drv_data *ddata = to_panel_data(dssdev);
+	int ret = 0;
+
+	if (vm->hactive != ddata->vm.hactive)
+		ret = -EINVAL;
+
+	if (vm->vactive != ddata->vm.vactive)
+		ret = -EINVAL;
+
+	if (ret) {
+		dev_warn(dssdev->dev, "wrong resolution: %d x %d",
+			 vm->hactive, vm->vactive);
+		dev_warn(dssdev->dev, "panel resolution: %d x %d",
+			 ddata->vm.hactive, ddata->vm.vactive);
+	}
+
+	return ret;
+}
+
 static struct omap_dss_driver dsicm_ops = {
 	.connect	= dsicm_connect,
 	.disconnect	= dsicm_disconnect,
@@ -1116,7 +1140,10 @@ static struct omap_dss_driver dsicm_ops = {
 	.update		= dsicm_update,
 	.sync		= dsicm_sync,
 
-	.get_resolution	= dsicm_get_resolution,
+	.get_timings	= dsicm_get_timings,
+	.check_timings	= dsicm_check_timings,
+
+	.get_resolution	= omapdss_default_get_resolution,
 	.get_recommended_bpp = omapdss_default_get_recommended_bpp,
 
 	.enable_te	= dsicm_enable_te,
@@ -1130,7 +1157,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
 	struct device_node *node = pdev->dev.of_node;
 	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
 	struct omap_dss_device *in;
-	int gpio;
+	struct display_timing timing;
+	int gpio, err;
 
 	gpio = of_get_named_gpio(node, "reset-gpios", 0);
 	if (!gpio_is_valid(gpio)) {
@@ -1147,6 +1175,17 @@ static int dsicm_probe_of(struct platform_device *pdev)
 		return gpio;
 	}
 
+	err = of_get_display_timing(node, "panel-timing", &timing);
+	if (!err) {
+		videomode_from_timing(&timing, &ddata->vm);
+		if (!ddata->vm.pixelclock)
+			ddata->vm.pixelclock =
+				ddata->vm.hactive * ddata->vm.vactive * 60;
+	} else {
+		dev_warn(&pdev->dev,
+			 "failed to get video timing, using defaults\n");
+	}
+
 	in = omapdss_of_find_source_for_first_ep(node);
 	if (IS_ERR(in)) {
 		dev_err(&pdev->dev, "failed to find video source\n");
@@ -1181,14 +1220,14 @@ static int dsicm_probe(struct platform_device *pdev)
 	if (!pdev->dev.of_node)
 		return -ENODEV;
 
-	r = dsicm_probe_of(pdev);
-	if (r)
-		return r;
-
 	ddata->vm.hactive = 864;
 	ddata->vm.vactive = 480;
 	ddata->vm.pixelclock = 864 * 480 * 60;
 
+	r = dsicm_probe_of(pdev);
+	if (r)
+		return r;
+
 	dssdev = &ddata->dssdev;
 	dssdev->dev = dev;
 	dssdev->driver = &dsicm_ops;
Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/10 drm: omapdrm: panel-dsi-cm: add regulator support

The N950's display requires two regulators.

---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 55 +++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +52 -3
index ad1058fafe92..8d13123708ae 100644
@@ -23,6 +23,7 @@
 #include <linux/workqueue.h>
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
+#include <linux/regulator/consumer.h>
 
 #include <video/mipi_display.h>
 #include <video/of_display_timing.h>
@@ -60,6 +61,9 @@ struct panel_drv_data {
 	int reset_gpio;
 	int ext_te_gpio;
 
+	struct regulator *vpnl;
+	struct regulator *vddi;
+
 	bool use_dsi_backlight;
 
 	struct omap_dsi_pin_config pin_config;
@@ -590,25 +594,43 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		.lp_clk_max = 10000000,
 	};
 
+	if (ddata->vpnl) {
+		r = regulator_enable(ddata->vpnl);
+		if (r) {
+			dev_err(&ddata->pdev->dev,
+				"failed to enable VPNL: %d\n", r);
+			goto err0;
+		}
+	}
+
+	if (ddata->vddi) {
+		r = regulator_enable(ddata->vddi);
+		if (r) {
+			dev_err(&ddata->pdev->dev,
+				"failed to enable VDDI: %d\n", r);
+			goto err1;
+		}
+	}
+
 	if (ddata->pin_config.num_pins > 0) {
 		r = in->ops.dsi->configure_pins(in, &ddata->pin_config);
 		if (r) {
 			dev_err(&ddata->pdev->dev,
 				"failed to configure DSI pins\n");
-			goto err0;
+			goto err2;
 		}
 	}
 
 	r = in->ops.dsi->set_config(in, &dsi_config);
 	if (r) {
 		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
-		goto err0;
+		goto err2;
 	}
 
 	r = in->ops.dsi->enable(in);
 	if (r) {
 		dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
-		goto err0;
+		goto err2;
 	}
 
 	dsicm_hw_reset(ddata);
@@ -666,6 +688,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 	dsicm_hw_reset(ddata);
 
 	in->ops.dsi->disable(in, true, false);
+err2:
+	if (ddata->vddi)
+		regulator_disable(ddata->vddi);
+err1:
+	if (ddata->vpnl)
+		regulator_disable(ddata->vpnl);
 err0:
 	return r;
 }
@@ -689,6 +717,11 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
 
 	in->ops.dsi->disable(in, true, false);
 
+	if (ddata->vddi)
+		regulator_disable(ddata->vddi);
+	if (ddata->vpnl)
+		regulator_disable(ddata->vpnl);
+
 	ddata->enabled = 0;
 }
 
@@ -1192,6 +1225,22 @@ static int dsicm_probe_of(struct platform_device *pdev)
 		return PTR_ERR(in);
 	}
 
+	ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
+	if (IS_ERR(ddata->vpnl)) {
+		err = PTR_ERR(ddata->vpnl);
+		if (err == -EPROBE_DEFER)
+			return err;
+		ddata->vpnl = NULL;
+	}
+
+	ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
+	if (IS_ERR(ddata->vddi)) {
+		err = PTR_ERR(ddata->vddi);
+		if (err == -EPROBE_DEFER)
+			return err;
+		ddata->vddi = NULL;
+	}
+
 	ddata->in = in;
 
 	/* TODO: ulps, backlight */
Signature · 1 line
2.11.0
Tested-by on v2 2/10
#3 lore raw

Re: [PATCHv2 02/10] drm: omapdrm: panel-dsi-cm: add regulator support

Quoted 1 line · Sebastian Reichel

The N950's display requires two regulators.

Also needed for droid 4:

#4 lore raw

Re: [PATCHv2 02/10] drm: omapdrm: panel-dsi-cm: add regulator support

In reply to Sebastian Reichel

Hi!

Quoted 9 lines

The N950's display requires two regulators.

---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 55 +++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +0 -0
@@ -590,25 +594,43 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
 		.lp_clk_max = 10000000,

drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c static int dsicm_power_on(struct panel_drv_data *ddata) · line 604

Quoted 10 lines
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +8 -0
 	};
 
+	if (ddata->vpnl) {
+		r = regulator_enable(ddata->vpnl);
+		if (r) {
+			dev_err(&ddata->pdev->dev,
+				"failed to enable VPNL: %d\n", r);
+			goto err0;
+		}
+	}

Having err0 that just returns .. is quite confusing. Just return here?

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

PATCH v2 3/10 Revert "drm: omapdrm: Remove manual update display support"

In reply to Sebastian Reichel

This reverts commit 5a35876e2830511cb8110667fc426c6a6165a593.

Revert the removal of manual update display support in preparation for DSI command mode panels.

[[email protected]: left out unused omap_framebuffer_dirty]
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 12 +++++++
 drivers/gpu/drm/omapdrm/omap_drv.h       |  4 +++
 drivers/gpu/drm/omapdrm/omap_fb.c        | 28 ++++++++++++++++
 drivers/gpu/drm/omapdrm/omap_fbdev.c     | 57 +++++++++++++++++++++++++++++---
 4 files changed, 97 insertions(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/omap_connector.c +12 -0
index f90e2d22c5ec..7b2a9f680dce 100644
@@ -205,6 +205,18 @@ static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
 	.mode_valid = omap_connector_mode_valid,
 };
 
+/* flush an area of the framebuffer (in case of manual update display that
+ * is not automatically flushed)
+ */
+void omap_connector_flush(struct drm_connector *connector,
+		int x, int y, int w, int h)
+{
+	struct omap_connector *omap_connector = to_omap_connector(connector);
+
+	/* TODO: enable when supported in dss */
+	VERB("%s: %d,%d, %dx%d", omap_connector->dssdev->name, x, y, w, h);
+}
+
 /* initialize connector */
 struct drm_connector *omap_connector_init(struct drm_device *dev,
 		int connector_type, struct omap_dss_device *dssdev,
drivers/gpu/drm/omapdrm/omap_drv.h +4 -0
index 65977982f15f..5b1061586401 100644
@@ -155,6 +155,8 @@ struct drm_connector *omap_connector_init(struct drm_device *dev,
 struct drm_encoder *omap_connector_attached_encoder(
 		struct drm_connector *connector);
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
+void omap_connector_flush(struct drm_connector *connector,
+		int x, int y, int w, int h);
 
 uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats,
 		uint32_t max_formats, enum omap_color_mode supported_modes);
@@ -169,6 +171,8 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 struct drm_connector *omap_framebuffer_get_next_connector(
 		struct drm_framebuffer *fb, struct drm_connector *from);
 bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb);
+void omap_framebuffer_flush(struct drm_framebuffer *fb,
+		int x, int y, int w, int h);
 
 void omap_gem_init(struct drm_device *dev);
 void omap_gem_deinit(struct drm_device *dev);
drivers/gpu/drm/omapdrm/omap_fb.c +28 -0
index 29dc677dd4d3..b6ae28fe3257 100644
@@ -333,6 +333,34 @@ struct drm_connector *omap_framebuffer_get_next_connector(
 	return NULL;
 }
 
+/* flush an area of the framebuffer (in case of manual update display that
+ * is not automatically flushed)
+ */
+void omap_framebuffer_flush(struct drm_framebuffer *fb,
+		int x, int y, int w, int h)
+{
+	struct drm_connector *connector = NULL;
+
+	VERB("flush: %d,%d %dx%d, fb=%p", x, y, w, h, fb);
+
+	/* FIXME: This is racy - no protection against modeset config changes. */
+	while ((connector = omap_framebuffer_get_next_connector(fb, connector))) {
+		/* only consider connectors that are part of a chain */
+		if (connector->encoder && connector->encoder->crtc) {
+			/* TODO: maybe this should propagate thru the crtc who
+			 * could do the coordinate translation..
+			 */
+			struct drm_crtc *crtc = connector->encoder->crtc;
+			int cx = max(0, x - crtc->x);
+			int cy = max(0, y - crtc->y);
+			int cw = w + (x - crtc->x) - cx;
+			int ch = h + (y - crtc->y) - cy;
+
+			omap_connector_flush(connector, cx, cy, cw, ch);
+		}
+	}
+}
+
 #ifdef CONFIG_DEBUG_FS
 void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m)
 {
drivers/gpu/drm/omapdrm/omap_fbdev.c +53 -4

77 lines not on this page · raw message

Signature · 1 line
2.11.0
#6 lore raw

Re: [PATCHv2 03/10] Revert "drm: omapdrm: Remove manual update display support"

Quoted 4 lines · Sebastian Reichel

This reverts commit 5a35876e2830511cb8110667fc426c6a6165a593.

Revert the removal of manual update display support in preparation for DSI command mode panels.

I think it's much better to just add the manual update support from scratch rather than first reverting this old cleanup commit and then adding more bits and pieces.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: [PATCHv2 03/10] Revert "drm: omapdrm: Remove manual update display support"

Quoted 9 lines · Tomi Valkeinen
Quoted 4 lines · Sebastian Reichel

This reverts commit 5a35876e2830511cb8110667fc426c6a6165a593.

Revert the removal of manual update display support in preparation for DSI command mode panels.

I think it's much better to just add the manual update support from scratch rather than first reverting this old cleanup commit and then adding more bits and pieces.

Do you know if the command mode panels support partial refresh?

Just wondering if we want to keep "int x, int y, int w, int h" around for omap_connector_flush() or whatever it ends up being?

Regards,

Tony

#8 lore raw

Re: [PATCHv2 03/10] Revert "drm: omapdrm: Remove manual update display support"

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Tomi Valkeinen
Quoted 4 lines · Sebastian Reichel

This reverts commit 5a35876e2830511cb8110667fc426c6a6165a593.

Revert the removal of manual update display support in preparation for DSI command mode panels.

Quoted 8 lines
Quoted 3 lines

I think it's much better to just add the manual update support from scratch rather than first reverting this old cleanup commit and then adding more bits and pieces.

Do you know if the command mode panels support partial refresh?

Just wondering if we want to keep "int x, int y, int w, int h" around for omap_connector_flush() or whatever it ends up being?

Partial update? Yes they do. But setting everything up for partial update on the DSS side is horribly complex, and support for that was removed from DSS driver long ago.

So I think those parameters can be removed.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Re: [PATCHv2 03/10] Revert "drm: omapdrm: Remove manual update display support"

Quoted 14 lines · Tomi Valkeinen
Quoted 13 lines · Tony Lindgren
Quoted 9 lines · Tomi Valkeinen
Quoted 4 lines · Sebastian Reichel

This reverts commit 5a35876e2830511cb8110667fc426c6a6165a593.

Revert the removal of manual update display support in preparation for DSI command mode panels.

I think it's much better to just add the manual update support from scratch rather than first reverting this old cleanup commit and then adding more bits and pieces.

Do you know if the command mode panels support partial refresh?

Quoted 8 lines
Quoted 2 lines

Just wondering if we want to keep "int x, int y, int w, int h" around for omap_connector_flush() or whatever it ends up being?

Partial update? Yes they do. But setting everything up for partial update on the DSS side is horribly complex, and support for that was removed from DSS driver long ago.

So I think those parameters can be removed.

OK works for me.

Regards,

Tony

#10 lore raw

PATCH v2 4/10 drm: omapdrm: crtc: save framedone callback from dss

In reply to Sebastian Reichel

Save the framedone callback supplied by dss for later usage.

---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpu/drm/omapdrm/omap_crtc.c +24 -0
index b68c70eb395f..76a411fe957a 100644
@@ -42,6 +42,9 @@ struct omap_crtc {
 	bool pending;
 	wait_queue_head_t pending_wait;
 	struct drm_pending_vblank_event *event;
+
+	void (*framedone_handler)(void *);
+	void *framedone_handler_data;
 };
 
 /* -----------------------------------------------------------------------------
@@ -241,6 +244,17 @@ static int omap_crtc_dss_register_framedone(
 		enum omap_channel channel,
 		void (*handler)(void *), void *data)
 {
+	struct omap_crtc *omap_crtc = omap_crtcs[channel];
+	struct drm_device *dev = omap_crtc->base.dev;
+
+	if (omap_crtc->framedone_handler)
+		return -EBUSY;
+
+	dev_dbg(dev->dev, "register framedone %s", omap_crtc->name);
+
+	omap_crtc->framedone_handler = handler;
+	omap_crtc->framedone_handler_data = data;
+
 	return 0;
 }
 
@@ -248,6 +262,16 @@ static void omap_crtc_dss_unregister_framedone(
 		enum omap_channel channel,
 		void (*handler)(void *), void *data)
 {
+	struct omap_crtc *omap_crtc = omap_crtcs[channel];
+	struct drm_device *dev = omap_crtc->base.dev;
+
+	dev_dbg(dev->dev, "unregister framedone %s", omap_crtc->name);
+
+	WARN_ON(omap_crtc->framedone_handler != handler);
+	WARN_ON(omap_crtc->framedone_handler_data != data);
+
+	omap_crtc->framedone_handler = NULL;
+	omap_crtc->framedone_handler_data = NULL;
 }
 
 static const struct dss_mgr_ops mgr_ops = {
Signature · 1 line
2.11.0
#12 lore raw

PATCH v2 5/10 drm: omapdrm: crtc: detect manually updated displays

In reply to Sebastian Reichel
[[email protected]: rebased on event_lock changes]
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h    |  1 +
 drivers/gpu/drm/omapdrm/dss/output.c     |  6 ++++++
 drivers/gpu/drm/omapdrm/omap_connector.c |  7 +++++++
 drivers/gpu/drm/omapdrm/omap_crtc.c      | 29 +++++++++++++++++++++++++++--
 drivers/gpu/drm/omapdrm/omap_drv.h       |  2 ++
 5 files changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/dss/omapdss.h +1 -0
index 5b3b961127bd..5666ecbe4b80 100644
@@ -918,5 +918,6 @@ int dss_mgr_register_framedone_handler(enum omap_channel channel,
 		void (*handler)(void *), void *data);
 void dss_mgr_unregister_framedone_handler(enum omap_channel channel,
 		void (*handler)(void *), void *data);
+bool dss_lcd_mgr_config_get_stallmode(const struct dss_lcd_mgr_config *config);
 
 #endif /* __OMAP_DRM_DSS_H */
drivers/gpu/drm/omapdrm/dss/output.c +6 -0
index a901af5a9bc3..08c730d1dada 100644
@@ -214,6 +214,12 @@ void dss_mgr_set_lcd_config(enum omap_channel channel,
 }
 EXPORT_SYMBOL(dss_mgr_set_lcd_config);
 
+bool dss_lcd_mgr_config_get_stallmode(const struct dss_lcd_mgr_config *config)
+{
+	return config->stallmode;
+}
+EXPORT_SYMBOL(dss_lcd_mgr_config_get_stallmode);
+
 int dss_mgr_enable(enum omap_channel channel)
 {
 	return dss_mgr_ops->enable(channel);
drivers/gpu/drm/omapdrm/omap_connector.c +7 -0
index 7b2a9f680dce..b09d8989b789 100644
@@ -35,6 +35,13 @@ struct omap_connector {
 	bool hdmi_mode;
 };
 
+bool omap_connector_get_manually_updated(struct drm_connector *connector)
+{
+	struct omap_connector *omap_connector = to_omap_connector(connector);
+
+	return !!(omap_connector->dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE);
+}
+
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector)
 {
 	struct omap_connector *omap_connector = to_omap_connector(connector);
drivers/gpu/drm/omapdrm/omap_crtc.c +27 -2
index 76a411fe957a..03351ca2ee41 100644
@@ -35,6 +35,7 @@ struct omap_crtc {
 	enum omap_channel channel;
 
 	struct videomode vm;
+	bool manually_updated;
 
 	bool ignore_digit_sync_lost;
 
@@ -89,6 +90,12 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
 				  msecs_to_jiffies(250));
 }
 
+bool omap_crtc_is_manual_updated(struct drm_crtc *crtc)
+{
+	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+	return omap_crtc->manually_updated;
+}
+
 /* -----------------------------------------------------------------------------
  * DSS Manager Functions
  */
@@ -237,6 +244,9 @@ static void omap_crtc_dss_set_lcd_config(enum omap_channel channel,
 {
 	struct omap_crtc *omap_crtc = omap_crtcs[channel];
 	DBG("%s", omap_crtc->name);
+
+	omap_crtc->manually_updated = dss_lcd_mgr_config_get_stallmode(config);
+
 	dispc_mgr_set_lcd_config(omap_crtc->channel, config);
 }
 
@@ -355,10 +365,23 @@ static void omap_crtc_destroy(struct drm_crtc *crtc)
 static void omap_crtc_enable(struct drm_crtc *crtc)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+	struct drm_device *dev = crtc->dev;
+	struct drm_connector *connector;
 	int ret;
 
 	DBG("%s", omap_crtc->name);
 
+	/* manual updated display will not trigger vsync irq */
+	/* omap_crtc->manually_updated is not yet set */
+	drm_for_each_connector(connector, crtc->dev) {
+		if (connector->state->crtc != crtc)
+			continue;
+		if (!omap_connector_get_manually_updated(connector))
+			continue;
+		dev_dbg(dev->dev, "manually updated display detected!");
+		return;
+	}
+
 	spin_lock_irq(&crtc->dev->event_lock);
 	drm_crtc_vblank_on(crtc);
 	ret = drm_crtc_vblank_get(crtc);
@@ -440,8 +463,10 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 
 	DBG("%s: GO", omap_crtc->name);
 
-	ret = drm_crtc_vblank_get(crtc);
-	WARN_ON(ret != 0);
+	if (!omap_crtc->manually_updated) {
+		ret = drm_crtc_vblank_get(crtc);
+		WARN_ON(ret != 0);
+	}
 
 	spin_lock_irq(&crtc->dev->event_lock);
 	dispc_mgr_go(omap_crtc->channel);
drivers/gpu/drm/omapdrm/omap_drv.h +2 -0
index 5b1061586401..5a0106239be2 100644
@@ -139,6 +139,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 int omap_crtc_wait_pending(struct drm_crtc *crtc);
 void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus);
 void omap_crtc_vblank_irq(struct drm_crtc *crtc);
+bool omap_crtc_is_manual_updated(struct drm_crtc *crtc);
 
 struct drm_plane *omap_plane_init(struct drm_device *dev,
 		int id, enum drm_plane_type type,
@@ -155,6 +156,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev,
 struct drm_encoder *omap_connector_attached_encoder(
 		struct drm_connector *connector);
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
+bool omap_connector_get_manually_updated(struct drm_connector *connector);
 void omap_connector_flush(struct drm_connector *connector,
 		int x, int y, int w, int h);
 
Signature · 1 line
2.11.0
#14 lore raw

PATCH v2 6/10 drm: omapdrm: crtc: add support for manual updated displays

In reply to Sebastian Reichel
[[email protected]: rebased and fixed up to work with droid 4]
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 12 ------
 drivers/gpu/drm/omapdrm/omap_crtc.c      | 65 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.h       |  2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c        |  2 +-
 4 files changed, 67 insertions(+), 14 deletions(-)
drivers/gpu/drm/omapdrm/omap_connector.c +0 -12
index b09d8989b789..5ab672cac0b2 100644
@@ -212,18 +212,6 @@ static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
 	.mode_valid = omap_connector_mode_valid,
 };
 
-/* flush an area of the framebuffer (in case of manual update display that
- * is not automatically flushed)
- */
-void omap_connector_flush(struct drm_connector *connector,
-		int x, int y, int w, int h)
-{
-	struct omap_connector *omap_connector = to_omap_connector(connector);
-
-	/* TODO: enable when supported in dss */
-	VERB("%s: %d,%d, %dx%d", omap_connector->dssdev->name, x, y, w, h);
-}
-
 /* initialize connector */
 struct drm_connector *omap_connector_init(struct drm_device *dev,
 		int connector_type, struct omap_dss_device *dssdev,
drivers/gpu/drm/omapdrm/omap_crtc.c +65 -0

104 lines not on this page · raw message

drivers/gpu/drm/omapdrm/omap_drv.h +1 -1
index 5a0106239be2..ee8901dc0381 100644
@@ -157,7 +157,7 @@ struct drm_encoder *omap_connector_attached_encoder(
 		struct drm_connector *connector);
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
 bool omap_connector_get_manually_updated(struct drm_connector *connector);
-void omap_connector_flush(struct drm_connector *connector,
+void omap_crtc_flush(struct drm_crtc *crtc,
 		int x, int y, int w, int h);
 
 uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats,
drivers/gpu/drm/omapdrm/omap_fb.c +1 -1
index b6ae28fe3257..5bf05916de03 100644
@@ -356,7 +356,7 @@ void omap_framebuffer_flush(struct drm_framebuffer *fb,
 			int cw = w + (x - crtc->x) - cx;
 			int ch = h + (y - crtc->y) - cy;
 
-			omap_connector_flush(connector, cx, cy, cw, ch);
+			omap_crtc_flush(crtc, cx, cy, cw, ch);
 		}
 	}
 }
Signature · 1 line
2.11.0
#15 lore raw

PATCH v2 7/10 drm: omapdrm: plane: update fifo size on atomic update

In reply to Sebastian Reichel

This is a workaround for a hardware bug occuring on OMAP3 with manually updated panels. Details about the HW bug are unknown to me, but without this fix the panel refresh does not work at all on Nokia N950.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c   |  2 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 ++++
 drivers/gpu/drm/omapdrm/omap_drv.h    |  1 +
 drivers/gpu/drm/omapdrm/omap_plane.c  | 23 +++++++++++++++++++++++
 4 files changed, 30 insertions(+)
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -0
index d956e6266368..97240e59b248 100644
@@ -1321,6 +1321,7 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
 			plane != OMAP_DSS_WB)
 		dispc_write_reg(DISPC_OVL_PRELOAD(plane), min(high, 0xfffu));
 }
+EXPORT_SYMBOL(dispc_ovl_set_fifo_threshold);
 
 void dispc_enable_fifomerge(bool enable)
 {
@@ -1379,6 +1380,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
 		*fifo_high = total_fifo_size - buf_unit;
 	}
 }
+EXPORT_SYMBOL(dispc_ovl_compute_fifo_thresholds);
 
 static void dispc_ovl_set_mflag(enum omap_plane plane, bool enable)
 {
drivers/gpu/drm/omapdrm/dss/omapdss.h +4 -0
index 5666ecbe4b80..65c3530a3b53 100644
@@ -878,6 +878,10 @@ void dispc_ovl_set_channel_out(enum omap_plane plane,
 		enum omap_channel channel);
 int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
 		bool replication, const struct videomode *vm, bool mem_to_mem);
+void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
+		u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
+		bool manual_update);
+void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high);
 
 enum omap_dss_output_id dispc_mgr_get_supported_outputs(enum omap_channel channel);
 
drivers/gpu/drm/omapdrm/omap_drv.h +1 -0
index ee8901dc0381..71b5c5e25ee4 100644
@@ -146,6 +146,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 		u32 possible_crtcs);
 void omap_plane_install_properties(struct drm_plane *plane,
 		struct drm_mode_object *obj);
+void omap_plane_update_fifo(struct drm_plane *plane);
 
 struct drm_encoder *omap_encoder_init(struct drm_device *dev,
 		struct omap_dss_device *dssdev);
drivers/gpu/drm/omapdrm/omap_plane.c +23 -0
index 386d90af70f7..8d290cfe8925 100644
@@ -73,6 +73,28 @@ static void omap_plane_cleanup_fb(struct drm_plane *plane,
 		omap_framebuffer_unpin(old_state->fb);
 }
 
+void omap_plane_update_fifo(struct drm_plane *plane)
+{
+	struct omap_plane *omap_plane = to_omap_plane(plane);
+	struct drm_plane_state *state = plane->state;
+	struct drm_device *dev = plane->dev;
+	bool use_fifo_merge = false;
+	u32 fifo_low, fifo_high;
+	bool use_manual_update;
+
+	if (!dispc_ovl_enabled(omap_plane->id))
+		return;
+
+	use_manual_update = omap_crtc_is_manual_updated(state->crtc);
+
+	dispc_ovl_compute_fifo_thresholds(omap_plane->id, &fifo_low, &fifo_high,
+			use_fifo_merge, use_manual_update);
+
+	dev_dbg(dev->dev, "update fifo: %d %d", fifo_low, fifo_high);
+
+	dispc_ovl_set_fifo_threshold(omap_plane->id, fifo_low, fifo_high);
+}
+
 static void omap_plane_atomic_update(struct drm_plane *plane,
 				     struct drm_plane_state *old_state)
 {
@@ -137,6 +159,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	}
 
 	dispc_ovl_enable(omap_plane->id, true);
+	omap_plane_update_fifo(plane);
 }
 
 static void omap_plane_atomic_disable(struct drm_plane *plane,
Signature · 1 line
2.11.0
#16 lore raw

PATCH v2 8/10 drm: omapdrm: crtc: handle framedone directly

In reply to Sebastian Reichel

From: Tony Lindgren <[email protected]>

We can handle framedone interrupt directly simlar to commit e0519af75d6e ("drm: omapdrm: Handle CRTC error IRQs directly").

By default we just print a warning on framedone and do nothing. Any manually refreshed displays can register a callback.

[Drop REVISIT comment for omap3, patch works on N950]
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 25 +++++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.h  |  1 +
 drivers/gpu/drm/omapdrm/omap_irq.c  |  7 ++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_crtc.c +25 -0
index 432ad6023f27..4601533215d6 100644
@@ -349,6 +349,31 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc)
 	DBG("%s: apply done", omap_crtc->name);
 }
 
+void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus)
+{
+	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+
+	if (!omap_crtc->framedone_handler) {
+		dev_warn(omap_crtc->base.dev->dev, "no framedone handler?\n");
+
+		return;
+	}
+
+	omap_crtc->framedone_handler(omap_crtc->framedone_handler_data);
+
+	spin_lock(&crtc->dev->event_lock);
+	/* Send the vblank event if one has been requested. */
+	if (omap_crtc->event) {
+		drm_crtc_send_vblank_event(crtc, omap_crtc->event);
+		omap_crtc->event = NULL;
+	}
+	omap_crtc->pending = false;
+	spin_unlock(&crtc->dev->event_lock);
+
+	/* Wake up omap_atomic_complete. */
+	wake_up(&omap_crtc->pending_wait);
+}
+
 void omap_crtc_flush(struct drm_crtc *crtc,
 		int x, int y, int w, int h)
 {
drivers/gpu/drm/omapdrm/omap_drv.h +1 -0
index 71b5c5e25ee4..9586551960e9 100644
@@ -138,6 +138,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 		struct drm_plane *plane, enum omap_channel channel, int id);
 int omap_crtc_wait_pending(struct drm_crtc *crtc);
 void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus);
+void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus);
 void omap_crtc_vblank_irq(struct drm_crtc *crtc);
 bool omap_crtc_is_manual_updated(struct drm_crtc *crtc);
 
drivers/gpu/drm/omapdrm/omap_irq.c +6 -1
index 9adfa7c99695..fb39601721f6 100644
@@ -215,6 +215,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
 
 		if (irqstatus & dispc_mgr_get_sync_lost_irq(channel))
 			omap_crtc_error_irq(crtc, irqstatus);
+
+		if (irqstatus & dispc_mgr_get_framedone_irq(channel))
+			omap_crtc_framedone_irq(crtc, irqstatus);
 	}
 
 	omap_irq_ocp_error_handler(irqstatus);
@@ -264,8 +267,10 @@ int omap_drm_irq_install(struct drm_device *dev)
 			priv->irq_mask |= omap_underflow_irqs[i];
 	}
 
-	for (i = 0; i < num_mgrs; ++i)
+	for (i = 0; i < num_mgrs; ++i) {
 		priv->irq_mask |= dispc_mgr_get_sync_lost_irq(i);
+		priv->irq_mask |= dispc_mgr_get_framedone_irq(i);
+	}
 
 	dispc_runtime_get();
 	dispc_clear_irqstatus(0xffffffff);
Signature · 1 line
2.11.0
Acked-by on v2 8/10
#17 lore raw

Re: [PATCHv2 08/10] drm: omapdrm: crtc: handle framedone directly

drivers/gpu/drm/omapdrm/omap_irq.c int omap_drm_irq_install(struct drm_device *dev) · line 274

Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_irq.c +3 -1
@@ -264,8 +267,10 @@ int omap_drm_irq_install(struct drm_device *dev)
 			priv->irq_mask |= omap_underflow_irqs[i];
 	}
 
-	for (i = 0; i < num_mgrs; ++i)
+	for (i = 0; i < num_mgrs; ++i) {
 		priv->irq_mask |= dispc_mgr_get_sync_lost_irq(i);
+		priv->irq_mask |= dispc_mgr_get_framedone_irq(i);
+	}
 

i++, we are no C++. OTOH, not your fault.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#18 lore raw

PATCH v2 9/10 drm: omapdrm: crtc: get manual mode displays working

In reply to Sebastian Reichel

From: Tony Lindgren <[email protected]>

With manual mode displays we need to flush the panel manually.

Let's add flushing so we get Tomi's fbtest, kmstest, kmstest --flip, and X and wayland working.

---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/omapdrm/omap_crtc.c +15 -7
index 4601533215d6..e07b0a0be4bf 100644
@@ -97,6 +97,11 @@ bool omap_crtc_is_manual_updated(struct drm_crtc *crtc)
 	return omap_crtc->manually_updated;
 }
 
+static void omap_crtc_manual_needs_flush(struct drm_crtc *crtc)
+{
+	omap_crtc_flush(crtc, 0, 0, 0, 0);
+}
+
 /* -----------------------------------------------------------------------------
  * DSS Manager Functions
  */
@@ -139,7 +144,11 @@ static void omap_crtc_dss_disconnect(enum omap_channel channel,
 
 static void omap_crtc_dss_start_update(enum omap_channel channel)
 {
+	struct omap_crtc *omap_crtc = omap_crtcs[channel];
+	struct drm_crtc *crtc = &omap_crtc->base;
+
 	dispc_mgr_enable(channel, true);
+	omap_crtc_manual_needs_flush(crtc);
 }
 
 /* Called only from the encoder enable/disable and suspend/resume handlers. */
@@ -155,11 +164,12 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 	if (WARN_ON(omap_crtc->enabled == enable))
 		return;
 
-	if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) {
-		dispc_mgr_enable(channel, enable);
-		omap_crtc->enabled = enable;
+	dispc_mgr_enable(channel, enable);
+	omap_crtc->enabled = enable;
+	omap_crtc_manual_needs_flush(crtc);
+
+	if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI)
 		return;
-	}
 
 	if (omap_crtc->channel == OMAP_DSS_CHANNEL_DIGIT) {
 		/*
@@ -190,9 +200,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 			wait = omap_irq_wait_init(dev, vsync_irq, 2);
 	}
 
-	dispc_mgr_enable(channel, enable);
-	omap_crtc->enabled = enable;
-
 	ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
 	if (ret) {
 		dev_err(dev->dev, "%s: timeout waiting for %s\n",
@@ -554,6 +561,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 		ret = drm_crtc_vblank_get(crtc);
 		WARN_ON(ret != 0);
 	}
+	omap_crtc_flush(&omap_crtc->base, 0, 0, 0, 0);
 
 	spin_lock_irq(&crtc->dev->event_lock);
 	dispc_mgr_enable(omap_crtc->channel, true);
Signature · 1 line
2.11.0
#19 lore raw

Re: [PATCHv2 09/10] drm: omapdrm: crtc: get manual mode displays working

Quoted 16 lines · Sebastian Reichel

From: Tony Lindgren <[email protected]>

With manual mode displays we need to flush the panel manually.

Let's add flushing so we get Tomi's fbtest, kmstest, kmstest --flip, and X and wayland working.

drivers/gpu/drm/omapdrm/omap_crtc.c +4 -0
@@ -97,6 +97,11 @@ bool omap_crtc_is_manual_updated(struct drm_crtc *crtc)
 	return omap_crtc->manually_updated;
 }
 
+static void omap_crtc_manual_needs_flush(struct drm_crtc *crtc)
+{
+	omap_crtc_flush(crtc, 0, 0, 0, 0);
+}

...

drivers/gpu/drm/omapdrm/omap_crtc.c static void omap_crtc_atomic_flush(struct drm_crtc *crtc, · line 564

Quoted 5 lines
drivers/gpu/drm/omapdrm/omap_crtc.c +1 -0
@@ -554,6 +561,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 		ret = drm_crtc_vblank_get(crtc);
 		WARN_ON(ret != 0);
 	}
+	omap_crtc_flush(&omap_crtc->base, 0, 0, 0, 0);

Just noticed that this should also just use omap_crtc_manual_needs_flush() here if you care to update it.

Regards,

Tony

#20 lore raw

Re: [PATCHv2 09/10] drm: omapdrm: crtc: get manual mode displays working

In reply to Sebastian Reichel
Quoted 43 lines · Sebastian Reichel

From: Tony Lindgren <[email protected]>

With manual mode displays we need to flush the panel manually.

Let's add flushing so we get Tomi's fbtest, kmstest, kmstest --flip, and X and wayland working.

---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/gpu/drm/omapdrm/omap_crtc.c +9 -0
index 4601533215d6..e07b0a0be4bf 100644
@@ -97,6 +97,11 @@ bool omap_crtc_is_manual_updated(struct drm_crtc *crtc)
 	return omap_crtc->manually_updated;
 }
 
+static void omap_crtc_manual_needs_flush(struct drm_crtc *crtc)
+{
+	omap_crtc_flush(crtc, 0, 0, 0, 0);
+}
+
 /* -----------------------------------------------------------------------------
  * DSS Manager Functions
  */
@@ -139,7 +144,11 @@ static void omap_crtc_dss_disconnect(enum omap_channel channel,
 
 static void omap_crtc_dss_start_update(enum omap_channel channel)
 {
+	struct omap_crtc *omap_crtc = omap_crtcs[channel];
+	struct drm_crtc *crtc = &omap_crtc->base;
+
 	dispc_mgr_enable(channel, true);
+	omap_crtc_manual_needs_flush(crtc);
 }
 
 /* Called only from the encoder enable/disable and suspend/resume handlers. */

drivers/gpu/drm/omapdrm/omap_crtc.c static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) · line 167

Quoted 7 lines
drivers/gpu/drm/omapdrm/omap_crtc.c +1 -3
@@ -155,11 +164,12 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 	if (WARN_ON(omap_crtc->enabled == enable))
 		return;
 
-	if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) {
-		dispc_mgr_enable(channel, enable);
-		omap_crtc->enabled = enable;
+	dispc_mgr_enable(channel, enable);

Moving the mgr_enable here causes a race issue, as the irqs are only registered later below.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw

PATCH v2 10/10 ARM: dts: n950: add display support

In reply to Sebastian Reichel

Add basic panel support for the Nokia N950. It must be tweaked a little bit later, since the panel was built into the device upside-down. Also the first 5 and the last 5 pixels are covered by plastic.

---
 arch/arm/boot/dts/omap3-n950.dts | 89 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
arch/arm/boot/dts/omap3-n950.dts +89 -0
index 646601a3ebd8..1aa4251b39d7 100644
@@ -51,6 +51,26 @@
 	};
 };
 
+&omap3_pmx_core {
+	dsi_pins: pinmux_dsi_pins {
+		pinctrl-single,pins = <
+			OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE1) /* dsi_dx0 - data0+ */
+			OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE1) /* dsi_dy0 - data0- */
+			OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE1) /* dsi_dx1 - clk+   */
+			OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE1) /* dsi_dy1 - clk-   */
+			OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE1) /* dsi_dx2 - data1+ */
+			OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE1) /* dsi_dy2 - data1- */
+		>;
+	};
+
+	display_pins: pinmux_display_pins {
+		pinctrl-single,pins = <
+			OMAP3_CORE1_IOPAD(0x20ca, PIN_INPUT | MUX_MODE4) /* gpio 62 - display te */
+			OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE4) /* gpio 87 - display reset */
+		>;
+	};
+};
+
 &i2c2 {
 	smia_1: camera@10 {
 		compatible = "nokia,smia";
@@ -185,3 +205,72 @@
 	st,max-limit-y = <32>;
 	st,max-limit-z = <32>;
 };
+
+&dss {
+	status = "ok";
+
+	vdda_video-supply = <&vdac>;
+};
+
+&dsi {
+	status = "ok";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&dsi_pins>;
+
+	vdd-supply = <&vpll2>;
+
+	port {
+		dsi_out_ep: endpoint {
+			remote-endpoint = <&lcd0_in>;
+			lanes = <2 3 0 1 4 5>;
+		};
+	};
+
+	lcd0: display {
+		compatible = "nokia,himalaya", "panel-dsi-cm";
+		label = "lcd0";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&display_pins>;
+
+		vpnl-supply = <&vmmc2>;
+		vddi-supply = <&vio>;
+
+		reset-gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;	/* 87 */
+		te-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;	/* 62 */
+
+		has-dsi-backlight;
+
+		/* panel is upside-down, 480x464 pixels */
+		/* top and bottom 5 lines are not visible */
+		/* physical dimensions: 48960µm x 88128µm */
+		panel-timing {
+			clock-frequency = <0>;          /* Calculated by dsi */
+
+			hback-porch = <2>;
+			hactive = <480>;
+			hfront-porch = <0>;
+			hsync-len = <2>;
+
+			vback-porch = <1>;
+			vactive = <864>;
+			vfront-porch = <0>;
+			vsync-len = <1>;
+
+			hsync-active = <0>;
+			vsync-active = <0>;
+			de-active = <1>;
+			pixelclk-active = <1>;
+
+			/* TODO: rotate panel by 180° */
+			/* TODO: add 5 pixel y-offset and limit vactive to 854 */
+		};
+
+		port {
+			lcd0_in: endpoint {
+				remote-endpoint = <&dsi_out_ep>;
+			};
+		};
+	};
+};
Signature · 1 line
2.11.0
#22 lore raw

Re: [PATCHv2 10/10] ARM: dts: n950: add display support

Quoted 4 lines · Sebastian Reichel

Add basic panel support for the Nokia N950. It must be tweaked a little bit later, since the panel was built into the device upside-down. Also the first 5 and the last 5 pixels are covered by plastic.

This one seems safe to apply separately to shrink the pending patches a bit. Please confirm if that's the case and I'll apply this one.

Regards,

Tony

#23 lore raw

Re: [PATCHv2 10/10] ARM: dts: n950: add display support

Quoted 9 lines · Tony Lindgren
Quoted 4 lines · Sebastian Reichel

Add basic panel support for the Nokia N950. It must be tweaked a little bit later, since the panel was built into the device upside-down. Also the first 5 and the last 5 pixels are covered by plastic.

This one seems safe to apply separately to shrink the pending patches a bit. Please confirm if that's the case and I'll apply this one.

No, I think there are too many open questions to apply this one. And we need to move to common DRM drivers at some point (hopefully soon) so the bindings must be aligned with those if and when possible.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#24 lore raw

Re: [PATCHv2 10/10] ARM: dts: n950: add display support

Quoted 7 lines · Tomi Valkeinen
Quoted 6 lines · Tony Lindgren
Quoted 4 lines · Sebastian Reichel

Add basic panel support for the Nokia N950. It must be tweaked a little bit later, since the panel was built into the device upside-down. Also the first 5 and the last 5 pixels are covered by plastic.

Quoted 7 lines
Quoted 3 lines

This one seems safe to apply separately to shrink the pending patches a bit. Please confirm if that's the case and I'll apply this one.

No, I think there are too many open questions to apply this one. And we need to move to common DRM drivers at some point (hopefully soon) so the bindings must be aligned with those if and when possible.

Hmm so what are the open questions and do you have in mind for the panel bindings?

Naturally we still need to support the current bindings too.

Regards,

Tony

#25 lore raw

Re: [PATCHv2 10/10] ARM: dts: n950: add display support

Quoted 12 lines · Tony Lindgren
Quoted 11 lines · Tomi Valkeinen
Quoted 9 lines · Tony Lindgren
Quoted 4 lines · Sebastian Reichel

Add basic panel support for the Nokia N950. It must be tweaked a little bit later, since the panel was built into the device upside-down. Also the first 5 and the last 5 pixels are covered by plastic.

This one seems safe to apply separately to shrink the pending patches a bit. Please confirm if that's the case and I'll apply this one.

Quoted 6 lines
Quoted 3 lines

No, I think there are too many open questions to apply this one. And we need to move to common DRM drivers at some point (hopefully soon) so the bindings must be aligned with those if and when possible.

Hmm so what are the open questions and do you have in mind for the panel bindings?

Well, until we have driver that supports the panel without problems, we can't be sure if we have everything in the binding. At least the TE was missing or broken.

Normal videotimings don't really make sense for DSI command mode panels, so I'm not overly enthusiastic in having them in the bindings. Possibly that's the easy way to go, but I'm not sure yet.

There are the "TODO" parts in the bindings, that's a clear sign of open questions.

I haven't looked at how the other DRM drivers handle DSI command mode panels. That's something to study, before adding anything new to the omap specific bindings.

Quoted 1 line

Naturally we still need to support the current bindings too.

Do the current bindings work? I guess they did work on omapfb... Do these new bindings work with omapfb?

Generally speaking, I've been bitten badly enough with DT bindings that weren't up to the task after all, and then changing the later was a major pain (or working around it). So I'd rather not merge anything to DT if there are any unclarities, and a driver not working which uses those bindings is an unclarity. Especially if the only reason to merge is to get a single patch out from a bigger patch series, without actually enabling anything.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#26 lore raw

Re: [PATCHv2 10/10] ARM: dts: n950: add display support

Quoted 17 lines · Tomi Valkeinen
Quoted 16 lines · Tony Lindgren
Quoted 14 lines · Tomi Valkeinen
Quoted 9 lines · Tony Lindgren
Quoted 4 lines · Sebastian Reichel

Add basic panel support for the Nokia N950. It must be tweaked a little bit later, since the panel was built into the device upside-down. Also the first 5 and the last 5 pixels are covered by plastic.

This one seems safe to apply separately to shrink the pending patches a bit. Please confirm if that's the case and I'll apply this one.

No, I think there are too many open questions to apply this one. And we need to move to common DRM drivers at some point (hopefully soon) so the bindings must be aligned with those if and when possible.

Quoted 6 lines
Quoted 2 lines

Hmm so what are the open questions and do you have in mind for the panel bindings?

Well, until we have driver that supports the panel without problems, we can't be sure if we have everything in the binding. At least the TE was missing or broken.

Sure, I don't think that needs a binding though?

Quoted 3 lines

Normal videotimings don't really make sense for DSI command mode panels, so I'm not overly enthusiastic in having them in the bindings. Possibly that's the easy way to go, but I'm not sure yet.

Are you talking about passing the clock-frequency = <0> where dsi calculates it or also some other things too?

Quoted 2 lines

There are the "TODO" parts in the bindings, that's a clear sign of open questions.

Yeah the default rotation part seems to be completely open :) We should probably stick with just kernel cmdline for that for now until there is some generic solution.

Quoted 3 lines

I haven't looked at how the other DRM drivers handle DSI command mode panels. That's something to study, before adding anything new to the omap specific bindings.

OK. I suggest we just stick to standard existing bindings for now.

Quoted 4 lines
Quoted 1 line

Naturally we still need to support the current bindings too.

Do the current bindings work? I guess they did work on omapfb... Do these new bindings work with omapfb?

Well yeah in general they work just fine for the basic resolution + clock + control GPIOs. I think that binding is just fine. So we should probably stick to that before adding more stuff.

For command mode panels, looking at patch 1 of this series we always had the resolution hardcoded into the driver.. And talking about patch 1, do you also have some issues with it other than that typo there pointed out by Pavel?

Quoted 7 lines

Generally speaking, I've been bitten badly enough with DT bindings that weren't up to the task after all, and then changing the later was a major pain (or working around it). So I'd rather not merge anything to DT if there are any unclarities, and a driver not working which uses those bindings is an unclarity. Especially if the only reason to merge is to get a single patch out from a bigger patch series, without actually enabling anything.

Sure. The solution there is to just stick to basics until with the binding until things are clear. So in this case resolutions + clocks + control GPIOs + regulators. Those all are existing standard bindings that can easily be supported.

Regards,

Tony

Acked-by on v2 1/10
#27 lore raw

Re: [PATCHv2 01/10] drm: omapdrm: panel-dsi-cm: Fix probe for device tree

In reply to Sebastian Reichel
Quoted 11 lines · Sebastian Reichel

From: Tony Lindgren <[email protected]>

Things are a bit whacked right now for panel-dsi-cm:

1. We're missing call to of_get_display_timing() and videomode_from_timing()

2. We need to call dsicm_probe_of() after we initialize the default values to not overwrite device tree configured values

Quoted 5 lines

3. We need to implement minimal get_timings() and check_timings() for the panel to work

With these changes we get panel-dsi-cm to probe with device tree configuraion. Note that the dsicm_check_timings adapted from an

Typo: configuraion.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#28 lore raw
In reply to Sebastian Reichel

Hi,

Quoted 14 lines · Sebastian Reichel

Hi,

Some of you may remember, that I sent a series for the N950 display some time ago. N950 has command mode DSI panel, so the main part of the patchset takes care of adding manual display update support in omapdrm.

The N950 also requires display rotation (the panel is mounted vertically and bottom-up) and offset. The required bits will be sent separately.

The patchset is based on 2d62e0768d3c, which is the current commit torvald's master branch points to. I tested the patches on N950 with kernel console (fbcon), Tomi's kmstest and Xorg from Debian sid.

Quoted 6 lines

Rough changelog, most of that work was done by Tony (thanks!)

* lots of patches dropped for now
* rebased to current omapdrm interface
* added OMAP4 support
* misc. cleanup

I haven't been able to go through this series with time, but looking at the patches, there were multiple places where I felt quite uneasy with the changes. It didn't help that many of the patches did not have descriptions.

So as an RFC series, it's quite nice and shows that the manual update can be gotten to work. But I'm not ready to apply this until the patches touching the omapdrm enable, disable and commit sequences are split up into smaller patches with proper descriptions.

Also, a minor note that rotating the display on N950 will cause tearing. Probably not a huge issue, though.

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#29 lore raw
Quoted 29 lines · Tomi Valkeinen

Hi,

Quoted 14 lines · Sebastian Reichel

Hi,

Some of you may remember, that I sent a series for the N950 display some time ago. N950 has command mode DSI panel, so the main part of the patchset takes care of adding manual display update support in omapdrm.

The N950 also requires display rotation (the panel is mounted vertically and bottom-up) and offset. The required bits will be sent separately.

The patchset is based on 2d62e0768d3c, which is the current commit torvald's master branch points to. I tested the patches on N950 with kernel console (fbcon), Tomi's kmstest and Xorg from Debian sid.

Quoted 6 lines

Rough changelog, most of that work was done by Tony (thanks!)

* lots of patches dropped for now
* rebased to current omapdrm interface
* added OMAP4 support
* misc. cleanup

I haven't been able to go through this series with time, but looking at the patches, there were multiple places where I felt quite uneasy with the changes. It didn't help that many of the patches did not have descriptions.

Quoted 4 lines

So as an RFC series, it's quite nice and shows that the manual update can be gotten to work. But I'm not ready to apply this until the patches touching the omapdrm enable, disable and commit sequences are split up into smaller patches with proper descriptions.

I made a quick test on my OMAP4 SDP (it has similar panel to N950), and I did get a picture on the LCD, and kmstest --flip works. It's tearing, though, and the fps is ~80, so apparently TE signal is not used for synchronization here. I think nobody is calling the enable_te().

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#30 lore raw
Quoted 35 lines · Tomi Valkeinen
Quoted 29 lines · Tomi Valkeinen

Hi,

Quoted 14 lines · Sebastian Reichel

Hi,

Some of you may remember, that I sent a series for the N950 display some time ago. N950 has command mode DSI panel, so the main part of the patchset takes care of adding manual display update support in omapdrm.

The N950 also requires display rotation (the panel is mounted vertically and bottom-up) and offset. The required bits will be sent separately.

The patchset is based on 2d62e0768d3c, which is the current commit torvald's master branch points to. I tested the patches on N950 with kernel console (fbcon), Tomi's kmstest and Xorg from Debian sid.

Quoted 6 lines

Rough changelog, most of that work was done by Tony (thanks!)

* lots of patches dropped for now
* rebased to current omapdrm interface
* added OMAP4 support
* misc. cleanup

I haven't been able to go through this series with time, but looking at the patches, there were multiple places where I felt quite uneasy with the changes. It didn't help that many of the patches did not have descriptions.

Quoted 4 lines

So as an RFC series, it's quite nice and shows that the manual update can be gotten to work. But I'm not ready to apply this until the patches touching the omapdrm enable, disable and commit sequences are split up into smaller patches with proper descriptions.

Quoted 4 lines

I made a quick test on my OMAP4 SDP (it has similar panel to N950), and I did get a picture on the LCD, and kmstest --flip works. It's tearing, though, and the fps is ~80, so apparently TE signal is not used for synchronization here. I think nobody is calling the enable_te().

Oh, and I also see these.

[   42.550170] omapdrm omapdrm.0: lcd: timeout waiting for disable
[   42.690216] omapdrm omapdrm.0: lcd2: timeout waiting for disable
[  104.280212] omapdrm omapdrm.0: lcd: timeout waiting for enable

Tomi

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel