2017-07-24 17:33:51

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi,

This adds support for command mode DSI panels to
omapdrm. I tested the patches on Nokia N950 (omap3)
and Motorola Droid 4 (omap4). This is basically
PATCHv3 of my series adding N950 display support,
but I started from scratch without reverting the
removal of manual display update support.

Tested:
* Framebuffer Console
* Display blanking
* kmstest
* Xorg with omap and modesetting driver
* No updates send when nothing needs to be sent

Known issues:
* Proper display rotation support
* N950 (and N9) has first and last few lines
covered by plastic, so we should expose a
smaller screen

I plan to look into these issues once basic support
has been merged.

-- Sebastian

Sebastian Reichel (13):
drm/omap: remove unused function defines
drm/omap: drop incorrect comment
drm/omap: plane: update fifo size on ovl setup
drm/omap: add framedone interrupt support
drm/omap: add manual update detection helper
drm/omap: add support for manually updated displays
drm/omap: add support for physical size hints from display drivers
drm/omap: panel-dsi-cm: add regulator support
drm/omap: panel-dsi-cm: add physical size support
drm/omap: panel-dsi-cm: add external backlight support
drm/omap: panel-dsi-cm: switch to gpiod
ARM: dts: omap4-droid4: improve LCD description
ARM: dts: n950: add display support

Tony Lindgren (1):
drm/omap: panel-dsi-cm: fix driver

arch/arm/boot/dts/omap3-n950.dts | 88 ++++++++
arch/arm/boot/dts/omap4-droid4-xt894.dts | 6 +-
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 289 +++++++++++++++++-------
drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++
drivers/gpu/drm/omapdrm/dss/omapdss.h | 5 +-
drivers/gpu/drm/omapdrm/omap_connector.c | 14 ++
drivers/gpu/drm/omapdrm/omap_crtc.c | 158 ++++++++++++-
drivers/gpu/drm/omapdrm/omap_drv.h | 4 +
drivers/gpu/drm/omapdrm/omap_fb.c | 20 ++
drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 -
drivers/gpu/drm/omapdrm/omap_irq.c | 24 ++
11 files changed, 529 insertions(+), 98 deletions(-)

--
2.13.2


2017-07-24 17:33:41

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 01/14] drm/omap: remove unused function defines

Remove driver (un)register API defines. They do not even exist
anymore.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 85953a0bc7c2..4e619ff360ae 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -575,9 +575,6 @@ struct omap_dss_driver {
enum omapdss_version omapdss_get_version(void);
bool omapdss_is_initialized(void);

-int omap_dss_register_driver(struct omap_dss_driver *);
-void omap_dss_unregister_driver(struct omap_dss_driver *);
-
int omapdss_register_display(struct omap_dss_device *dssdev);
void omapdss_unregister_display(struct omap_dss_device *dssdev);

--
2.13.2

2017-07-24 17:33:59

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 07/14] drm/omap: add support for physical size hints from display drivers

While physical size information is automatically parsed for EDID
based displays, we need to provide it manually for displays providing
one fixed mode.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 ++
drivers/gpu/drm/omapdrm/omap_connector.c | 6 ++++++
2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4e619ff360ae..530365e9c48d 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -560,6 +560,8 @@ struct omap_dss_driver {
struct videomode *vm);
void (*get_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
+ void (*get_size)(struct omap_dss_device *dssdev,
+ unsigned int *width, unsigned int *height);

int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
u32 (*get_wss)(struct omap_dss_device *dssdev);
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 5e941305ab1b..b2678105aaf2 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -136,6 +136,12 @@ static int omap_connector_get_modes(struct drm_connector *connector)
drm_mode_set_name(mode);
drm_mode_probed_add(connector, mode);

+ if (dssdrv->get_size) {
+ dssdrv->get_size(dssdev,
+ &connector->display_info.width_mm,
+ &connector->display_info.height_mm);
+ }
+
n = 1;
}

--
2.13.2

2017-07-24 17:34:07

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 06/14] drm/omap: add support for manually updated displays

This adds the required infrastructure for manually
updated displays, such as DSI command mode panels.

While those panels often support partial updates
we currently always do a full refresh. Display
will be refreshed when something calls the dirty
callback, such as libdrm's drmModeDirtyFB().

This is currently being implemented for the kernel
console and for Xorg. Weston currently does not
implement this and is known not to work on manually
updated displays.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/omap_crtc.c | 110 +++++++++++++++++++++++++++++++++---
drivers/gpu/drm/omapdrm/omap_drv.h | 1 +
drivers/gpu/drm/omapdrm/omap_fb.c | 20 +++++++
3 files changed, 123 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 404652ad8a6d..35a40271d1cb 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -42,6 +42,7 @@ struct omap_crtc {
bool pending;
wait_queue_head_t pending_wait;
struct drm_pending_vblank_event *event;
+ struct delayed_work update_work;

void (*framedone_handler)(void *);
void *framedone_handler_data;
@@ -133,6 +134,28 @@ 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 omap_drm_private *priv = omap_crtc->base.dev->dev_private;
+
+ priv->dispc_ops->mgr_enable(channel, true);
+}
+
+static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
+{
+ struct drm_connector *connector;
+ struct drm_connector_list_iter conn_iter;
+ bool result = false;
+
+ drm_connector_list_iter_begin(crtc->dev, &conn_iter);
+ drm_for_each_connector_iter(connector, &conn_iter) {
+ if (connector->state->crtc != crtc)
+ continue;
+ result = omap_connector_get_manually_updated(connector);
+ break;
+ }
+ drm_connector_list_iter_end(&conn_iter);
+
+ return result;
}

/* Called only from the encoder enable/disable and suspend/resume handlers. */
@@ -144,12 +167,17 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
enum omap_channel channel = omap_crtc->channel;
struct omap_irq_wait *wait;
u32 framedone_irq, vsync_irq;
+ bool is_manual = omap_crtc_is_manually_updated(crtc);
+ enum omap_display_type type = omap_crtc_output[channel]->output_type;
int ret;

if (WARN_ON(omap_crtc->enabled == enable))
return;

- if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) {
+ if (is_manual)
+ omap_irq_enable_framedone(crtc, enable);
+
+ if (is_manual || type == OMAP_DISPLAY_TYPE_HDMI) {
priv->dispc_ops->mgr_enable(channel, enable);
omap_crtc->enabled = enable;
return;
@@ -200,7 +228,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
}
}

-
static int omap_crtc_dss_enable(enum omap_channel channel)
{
struct omap_crtc *omap_crtc = omap_crtcs[channel];
@@ -360,6 +387,53 @@ void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus)
wake_up(&omap_crtc->pending_wait);
}

+void omap_crtc_flush(struct drm_crtc *crtc)
+{
+ struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+
+ if (!omap_crtc_is_manually_updated(crtc))
+ return;
+
+ if (!delayed_work_pending(&omap_crtc->update_work))
+ schedule_delayed_work(&omap_crtc->update_work, 0);
+}
+
+static void omap_crtc_manual_display_update(struct work_struct *data)
+{
+ struct omap_crtc *omap_crtc =
+ container_of(data, struct omap_crtc, update_work.work);
+ struct omap_dss_device *dssdev = omap_crtc_output[omap_crtc->channel];
+ struct drm_device *dev = omap_crtc->base.dev;
+ struct omap_dss_driver *dssdrv;
+ int ret, width, height;
+
+ if (!dssdev || !dssdev->dst) {
+ dev_err_once(dev->dev, "missing dssdev!");
+ return;
+ }
+
+ dssdev = dssdev->dst;
+ dssdrv = dssdev->driver;
+
+ if (!dssdrv || !dssdrv->update) {
+ dev_err_once(dev->dev, "incorrect dssdrv!");
+ return;
+ }
+
+ if (dssdrv->sync)
+ dssdrv->sync(dssdev);
+
+ width = dssdev->panel.vm.hactive;
+ height = dssdev->panel.vm.vactive;
+ ret = dssdrv->update(dssdev, 0, 0, width, height);
+ if (ret < 0) {
+ spin_lock_irq(&dev->event_lock);
+ omap_crtc->pending = false;
+ spin_unlock_irq(&dev->event_lock);
+ wake_up(&omap_crtc->pending_wait);
+ }
+}
+
static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
{
struct omap_drm_private *priv = crtc->dev->dev_private;
@@ -411,6 +485,10 @@ static void omap_crtc_enable(struct drm_crtc *crtc)

DBG("%s", omap_crtc->name);

+ /* manual updated display will not trigger vsync irq */
+ if (omap_crtc_is_manually_updated(crtc))
+ return;
+
spin_lock_irq(&crtc->dev->event_lock);
drm_crtc_vblank_on(crtc);
ret = drm_crtc_vblank_get(crtc);
@@ -423,6 +501,7 @@ static void omap_crtc_enable(struct drm_crtc *crtc)
static void omap_crtc_disable(struct drm_crtc *crtc)
{
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+ struct drm_device *dev = crtc->dev;

DBG("%s", omap_crtc->name);

@@ -433,6 +512,11 @@ static void omap_crtc_disable(struct drm_crtc *crtc)
}
spin_unlock_irq(&crtc->dev->event_lock);

+ cancel_delayed_work(&omap_crtc->update_work);
+
+ if (!omap_crtc_wait_pending(crtc))
+ dev_warn(dev->dev, "manual display update did not finish!");
+
drm_crtc_vblank_off(crtc);
}

@@ -535,13 +619,20 @@ 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_is_manually_updated(crtc)) {
+ ret = drm_crtc_vblank_get(crtc);
+ WARN_ON(ret != 0);

- spin_lock_irq(&crtc->dev->event_lock);
- priv->dispc_ops->mgr_go(omap_crtc->channel);
- omap_crtc_arm_event(crtc);
- spin_unlock_irq(&crtc->dev->event_lock);
+ spin_lock_irq(&crtc->dev->event_lock);
+ priv->dispc_ops->mgr_go(omap_crtc->channel);
+ omap_crtc_arm_event(crtc);
+ spin_unlock_irq(&crtc->dev->event_lock);
+ } else {
+ spin_lock_irq(&crtc->dev->event_lock);
+ omap_crtc_flush(crtc);
+ omap_crtc_arm_event(crtc);
+ spin_unlock_irq(&crtc->dev->event_lock);
+ }
}

static bool omap_crtc_is_plane_prop(struct drm_crtc *crtc,
@@ -677,6 +768,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
omap_crtc->channel = channel;
omap_crtc->name = channel_names[channel];

+ INIT_DELAYED_WORK(&omap_crtc->update_work,
+ omap_crtc_manual_display_update);
+
ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
&omap_crtc_funcs, NULL);
if (ret < 0) {
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index f6c48f254c9b..3cb9f9afba16 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -126,6 +126,7 @@ 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);
void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus);
+void omap_crtc_flush(struct drm_crtc *crtc);

struct drm_plane *omap_plane_init(struct drm_device *dev,
int idx, enum drm_plane_type type,
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index ddf7a457951b..423709132223 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -97,8 +97,28 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb)
kfree(omap_fb);
}

+static int omap_framebuffer_dirty(struct drm_framebuffer *fb,
+ struct drm_file *file_priv,
+ unsigned flags, unsigned color,
+ struct drm_clip_rect *clips,
+ unsigned num_clips)
+{
+ struct drm_connector *connector = NULL;
+
+ drm_modeset_lock_all(fb->dev);
+
+ while ((connector = omap_framebuffer_get_next_connector(fb, connector)))
+ if (connector->encoder && connector->encoder->crtc)
+ omap_crtc_flush(connector->encoder->crtc);
+
+ drm_modeset_unlock_all(fb->dev);
+
+ return 0;
+}
+
static const struct drm_framebuffer_funcs omap_framebuffer_funcs = {
.create_handle = omap_framebuffer_create_handle,
+ .dirty = omap_framebuffer_dirty,
.destroy = omap_framebuffer_destroy,
};

--
2.13.2

2017-07-24 17:34:18

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 05/14] drm/omap: add manual update detection helper

In preparation for manually updated display support, such as DSI
command mode panels, this adds a simple helper to see if a connector
is manually updated.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/omap_connector.c | 8 ++++++++
drivers/gpu/drm/omapdrm/omap_drv.h | 1 +
2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index c24b6b783e9a..5e941305ab1b 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -42,6 +42,14 @@ bool omap_connector_get_hdmi_mode(struct drm_connector *connector)
return omap_connector->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);
+}
+
static enum drm_connector_status omap_connector_detect(
struct drm_connector *connector, bool force)
{
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 22f3d94994d2..f6c48f254c9b 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -142,6 +142,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);

struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd);
--
2.13.2

2017-07-24 17:34:37

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 04/14] drm/omap: add framedone interrupt support

This prepares framedone interrupt handling for
manual display update support.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/omap_crtc.c | 48 +++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/omapdrm/omap_drv.h | 2 ++
drivers/gpu/drm/omapdrm/omap_irq.c | 24 +++++++++++++++++++
3 files changed, 74 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index dd0ef40ca469..404652ad8a6d 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -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;
};

/* -----------------------------------------------------------------------------
@@ -238,6 +241,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;
}

@@ -245,6 +259,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 = {
@@ -312,6 +336,30 @@ 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?");
+ 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);
+}
+
static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
{
struct omap_drm_private *priv = crtc->dev->dev_private;
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 4bd1e9070b31..22f3d94994d2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -97,6 +97,7 @@ void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
int omap_gem_resume(struct device *dev);
#endif

+int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable);
int omap_irq_enable_vblank(struct drm_crtc *crtc);
void omap_irq_disable_vblank(struct drm_crtc *crtc);
void omap_drm_irq_uninstall(struct drm_device *dev);
@@ -124,6 +125,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);
+void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus);

struct drm_plane *omap_plane_init(struct drm_device *dev,
int idx, enum drm_plane_type type,
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 013b0bba712f..301c0e7a70b7 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -87,6 +87,27 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
return ret == 0 ? -1 : 0;
}

+int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
+{
+ struct drm_device *dev = crtc->dev;
+ struct omap_drm_private *priv = dev->dev_private;
+ unsigned long flags;
+ enum omap_channel channel = omap_crtc_channel(crtc);
+ int framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(channel);
+
+ DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
+
+ spin_lock_irqsave(&priv->wait_lock, flags);
+ if (enable)
+ priv->irq_mask |= framedone_irq;
+ else
+ priv->irq_mask &= ~framedone_irq;
+ omap_irq_update(dev);
+ spin_unlock_irqrestore(&priv->wait_lock, flags);
+
+ return 0;
+}
+
/**
* enable_vblank - enable vblank interrupt events
* @dev: DRM device
@@ -217,6 +238,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)

if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(channel))
omap_crtc_error_irq(crtc, irqstatus);
+
+ if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(channel))
+ omap_crtc_framedone_irq(crtc, irqstatus);
}

omap_irq_ocp_error_handler(dev, irqstatus);
--
2.13.2

2017-07-24 17:35:02

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 13/14] ARM: dts: omap4-droid4: improve LCD description

This improves LCD support for the Droid 4.

Signed-off-by: Sebastian Reichel <[email protected]>
---
arch/arm/boot/dts/omap4-droid4-xt894.dts | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts
index 3af4905a6b61..942bb6ec99e5 100644
--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts
+++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts
@@ -192,6 +192,10 @@
vddi-supply = <&lcd_regulator>;
reset-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */

+ width-mm = <50>;
+ height-mm = <89>;
+ backlight = <&lcd_backlight>;
+
panel-timing {
clock-frequency = <0>; /* Calculated by dsi */

@@ -361,7 +365,7 @@

enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;

- backlight {
+ lcd_backlight: backlight {
compatible = "ti,lm3532-backlight";

lcd {
--
2.13.2

2017-07-24 17:35:59

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 14/14] ARM: dts: n950: add display support

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.

Signed-off-By: Sebastian Reichel <[email protected]>
---
arch/arm/boot/dts/omap3-n950.dts | 88 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts
index 646601a3ebd8..ef70aae99d1b 100644
--- a/arch/arm/boot/dts/omap3-n950.dts
+++ b/arch/arm/boot/dts/omap3-n950.dts
@@ -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,71 @@
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 */
+
+ width-mm = <49>; /* 48.960 mm */
+ height-mm = <88>; /* 88.128 mm */
+
+ /* TODO:
+ * - panel is upside-down
+ * - top + bottom 5px are not visible
+ */
+ 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>;
+ };
+
+ port {
+ lcd0_in: endpoint {
+ remote-endpoint = <&dsi_out_ep>;
+ };
+ };
+ };
+};
--
2.13.2

2017-07-24 17:36:33

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 12/14] drm/omap: panel-dsi-cm: switch to gpiod

Use the new descriptor based GPIO API instead of
the legacy one, which results in cleaner code
with less lines of code.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 74 +++++++++----------------
1 file changed, 27 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1eeb8b0d10c2..8f7463392047 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -22,7 +22,6 @@
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/of_device.h>
-#include <linux/of_gpio.h>
#include <linux/regulator/consumer.h>

#include <video/mipi_display.h>
@@ -59,8 +58,8 @@ struct panel_drv_data {
unsigned long hw_guard_wait; /* max guard time in jiffies */

/* panel HW configuration from DT or platform data */
- int reset_gpio;
- int ext_te_gpio;
+ struct gpio_desc *reset_gpio;
+ struct gpio_desc *ext_te_gpio;

struct regulator *vpnl;
struct regulator *vddi;
@@ -288,8 +287,8 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
if (r)
goto err;

- if (gpio_is_valid(ddata->ext_te_gpio))
- disable_irq(gpio_to_irq(ddata->ext_te_gpio));
+ if (ddata->ext_te_gpio)
+ disable_irq(gpiod_to_irq(ddata->ext_te_gpio));

in->ops.dsi->disable(in, false, true);

@@ -330,8 +329,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
goto err2;
}

- if (gpio_is_valid(ddata->ext_te_gpio))
- enable_irq(gpio_to_irq(ddata->ext_te_gpio));
+ if (ddata->ext_te_gpio)
+ enable_irq(gpiod_to_irq(ddata->ext_te_gpio));

dsicm_queue_ulps_work(ddata);

@@ -344,8 +343,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)

r = dsicm_panel_reset(ddata);
if (!r) {
- if (gpio_is_valid(ddata->ext_te_gpio))
- enable_irq(gpio_to_irq(ddata->ext_te_gpio));
+ if (ddata->ext_te_gpio)
+ enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
ddata->ulps_enabled = false;
}
err1:
@@ -591,16 +590,13 @@ static struct attribute_group dsicm_attr_group = {

static void dsicm_hw_reset(struct panel_drv_data *ddata)
{
- if (!gpio_is_valid(ddata->reset_gpio))
- return;
-
- gpio_set_value(ddata->reset_gpio, 1);
+ gpiod_set_value(ddata->reset_gpio, 1);
udelay(10);
/* reset the panel */
- gpio_set_value(ddata->reset_gpio, 0);
+ gpiod_set_value(ddata->reset_gpio, 0);
/* assert reset */
udelay(10);
- gpio_set_value(ddata->reset_gpio, 1);
+ gpiod_set_value(ddata->reset_gpio, 1);
/* wait after releasing reset */
usleep_range(5000, 10000);
}
@@ -954,7 +950,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
if (r)
goto err;

- if (ddata->te_enabled && gpio_is_valid(ddata->ext_te_gpio)) {
+ if (ddata->te_enabled && ddata->ext_te_gpio) {
schedule_delayed_work(&ddata->te_timeout_work,
msecs_to_jiffies(250));
atomic_set(&ddata->do_update, 1);
@@ -1001,7 +997,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
else
r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);

- if (!gpio_is_valid(ddata->ext_te_gpio))
+ if (!ddata->ext_te_gpio)
in->ops.dsi->enable_te(in, enable);

/* possible panel bug */
@@ -1229,21 +1225,21 @@ static int dsicm_probe_of(struct platform_device *pdev)
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in;
struct display_timing timing;
- int gpio, err;
+ int err;

- gpio = of_get_named_gpio(node, "reset-gpios", 0);
- if (!gpio_is_valid(gpio)) {
- dev_err(&pdev->dev, "failed to parse reset gpio\n");
- return gpio;
+ ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(ddata->reset_gpio)) {
+ err = PTR_ERR(ddata->reset_gpio);
+ dev_err(&pdev->dev, "reset gpio request failed: %d", err);
+ return err;
}
- ddata->reset_gpio = gpio;

- gpio = of_get_named_gpio(node, "te-gpios", 0);
- if (gpio_is_valid(gpio) || gpio == -ENOENT) {
- ddata->ext_te_gpio = gpio;
- } else {
- dev_err(&pdev->dev, "failed to parse TE gpio\n");
- return gpio;
+ ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
+ GPIOD_IN);
+ if (IS_ERR(ddata->ext_te_gpio)) {
+ err = PTR_ERR(ddata->ext_te_gpio);
+ dev_err(&pdev->dev, "TE gpio request failed: %d", err);
+ return err;
}

err = of_get_display_timing(node, "panel-timing", &timing);
@@ -1353,24 +1349,8 @@ static int dsicm_probe(struct platform_device *pdev)

atomic_set(&ddata->do_update, 0);

- if (gpio_is_valid(ddata->reset_gpio)) {
- r = devm_gpio_request_one(dev, ddata->reset_gpio,
- GPIOF_OUT_INIT_LOW, "taal rst");
- if (r) {
- dev_err(dev, "failed to request reset gpio\n");
- goto err_reg;
- }
- }
-
- if (gpio_is_valid(ddata->ext_te_gpio)) {
- r = devm_gpio_request_one(dev, ddata->ext_te_gpio,
- GPIOF_IN, "taal irq");
- if (r) {
- dev_err(dev, "GPIO request failed\n");
- goto err_reg;
- }
-
- r = devm_request_irq(dev, gpio_to_irq(ddata->ext_te_gpio),
+ if (ddata->ext_te_gpio) {
+ r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
dsicm_te_isr,
IRQF_TRIGGER_RISING,
"taal vsync", ddata);
--
2.13.2

2017-07-24 17:36:58

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 10/14] drm/omap: panel-dsi-cm: add physical size support

Add support to load physical size information from DT using
the properties defined by the common panel binding.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 95c28f518239..b50b1e81b2f5 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -66,6 +66,9 @@ struct panel_drv_data {

bool use_dsi_backlight;

+ int width_mm;
+ int height_mm;
+
struct omap_dsi_pin_config pin_config;

/* runtime variables */
@@ -1163,6 +1166,15 @@ static int dsicm_check_timings(struct omap_dss_device *dssdev,
return ret;
}

+static void dsicm_get_size(struct omap_dss_device *dssdev,
+ unsigned int *width, unsigned int *height)
+{
+ struct panel_drv_data *ddata = to_panel_data(dssdev);
+
+ *width = ddata->width_mm;
+ *height = ddata->height_mm;
+}
+
static struct omap_dss_driver dsicm_ops = {
.connect = dsicm_connect,
.disconnect = dsicm_disconnect,
@@ -1175,6 +1187,7 @@ static struct omap_dss_driver dsicm_ops = {

.get_timings = dsicm_get_timings,
.check_timings = dsicm_check_timings,
+ .get_size = dsicm_get_size,

.enable_te = dsicm_enable_te,
.get_te = dsicm_get_te,
@@ -1216,6 +1229,12 @@ static int dsicm_probe_of(struct platform_device *pdev)
"failed to get video timing, using defaults\n");
}

+ ddata->width_mm = 0;
+ of_property_read_u32(node, "width-mm", &ddata->width_mm);
+
+ ddata->height_mm = 0;
+ of_property_read_u32(node, "height-mm", &ddata->height_mm);
+
in = omapdss_of_find_source_for_first_ep(node);
if (IS_ERR(in)) {
dev_err(&pdev->dev, "failed to find video source\n");
--
2.13.2

2017-07-24 17:37:26

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 09/14] drm/omap: panel-dsi-cm: add regulator support

Add support for regulators used by panels found inside
of the Nokia N950, N9 and Motorola Droid 4.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 57 +++++++++++++++++++++++--
1 file changed, 53 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 3845a50537a6..95c28f518239 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -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);
+ return r;
+ }
+ }
+
+ if (ddata->vddi) {
+ r = regulator_enable(ddata->vddi);
+ if (r) {
+ dev_err(&ddata->pdev->dev,
+ "failed to enable VDDI: %d\n", r);
+ goto err_vpnl;
+ }
+ }
+
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 err_vddi;
}
}

r = in->ops.dsi->set_config(in, &dsi_config);
if (r) {
dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
- goto err0;
+ goto err_vddi;
}

r = in->ops.dsi->enable(in);
if (r) {
dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
- goto err0;
+ goto err_vddi;
}

dsicm_hw_reset(ddata);
@@ -666,7 +688,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);

in->ops.dsi->disable(in, true, false);
-err0:
+err_vddi:
+ if (ddata->vddi)
+ regulator_disable(ddata->vddi);
+err_vpnl:
+ if (ddata->vpnl)
+ regulator_disable(ddata->vpnl);
+
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;
}

@@ -1189,6 +1222,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 */
--
2.13.2

2017-07-24 17:37:44

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 08/14] drm/omap: panel-dsi-cm: fix driver

From: Tony Lindgren <[email protected]>

This adds support for get_timings() and check_timings()
to get the driver working and properly initializes the
timing information from DT.

Signed-off-by: Tony Lindgren <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 56 ++++++++++++++++++++++---
1 file changed, 51 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 76787a75a4dc..3845a50537a6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -25,6 +25,7 @@
#include <linux/of_gpio.h>

#include <video/mipi_display.h>
+#include <video/of_display_timing.h>

#include "../dss/omapdss.h"

@@ -1099,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,
@@ -1109,6 +1140,9 @@ static struct omap_dss_driver dsicm_ops = {
.update = dsicm_update,
.sync = dsicm_sync,

+ .get_timings = dsicm_get_timings,
+ .check_timings = dsicm_check_timings,
+
.enable_te = dsicm_enable_te,
.get_te = dsicm_get_te,

@@ -1120,7 +1154,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)) {
@@ -1137,6 +1172,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");
@@ -1171,14 +1217,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;
--
2.13.2

2017-07-24 17:38:23

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 03/14] drm/omap: plane: update fifo size on ovl setup

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.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index fd7504b37e3b..b6dca5ee34d4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -1398,6 +1398,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
}
}

+void dispc_ovl_set_manual_fifo_threshold(enum omap_plane_id plane)
+{
+ u32 fifo_low, fifo_high;
+ bool use_fifo_merge = false;
+ bool use_manual_update = true;
+
+ dispc_ovl_compute_fifo_thresholds(plane, &fifo_low, &fifo_high,
+ use_fifo_merge, use_manual_update);
+
+ dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high);
+}
+
static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable)
{
int bit;
@@ -2566,6 +2578,10 @@ static int dispc_ovl_setup(enum omap_plane_id plane,
oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
oi->rotation_type, replication, vm, mem_to_mem);

+ /* manual mode needs other fifo thresholds */
+ if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE))
+ dispc_ovl_set_manual_fifo_threshold(plane);
+
return r;
}

--
2.13.2

2017-07-24 17:38:35

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 02/14] drm/omap: drop incorrect comment

The wrappers have been removed in commit 5a35876e2830
(drm: omapdrm: Remove manual update display support)
and will not be reintroduced, since the normal sys
functions properly call the dirty callback.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index daf81a0a2899..929a3ef0fba0 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -84,9 +84,6 @@ static struct fb_ops omap_fb_ops = {
.owner = THIS_MODULE,
DRM_FB_HELPER_DEFAULT_OPS,

- /* Note: to properly handle manual update displays, we wrap the
- * basic fbdev ops which write to the framebuffer
- */
.fb_read = drm_fb_helper_sys_read,
.fb_write = drm_fb_helper_sys_write,
.fb_fillrect = drm_fb_helper_sys_fillrect,
--
2.13.2

2017-07-24 17:38:55

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv1 11/14] drm/omap: panel-dsi-cm: add external backlight support

Droid 4 has a command mode DSI panel, which does not have/use
DSI based backlight support. This adds proper support for this
using a backlight phandle property, which follows the common
panel binding.

If no backlight phandle is found, it is assumed, that the
native backlight should be used instead. This is used by
the Nokia N950.

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 91 ++++++++++++++++---------
1 file changed, 60 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index b50b1e81b2f5..1eeb8b0d10c2 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -51,6 +51,7 @@ struct panel_drv_data {
struct mutex lock;

struct backlight_device *bldev;
+ struct backlight_device *extbldev;

unsigned long hw_guard_end; /* next value of jiffies when we can
* issue the next sleep in/out command
@@ -100,6 +101,30 @@ static int dsicm_panel_reset(struct panel_drv_data *ddata);

static void dsicm_ulps_work(struct work_struct *work);

+static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
+{
+ struct backlight_device *backlight;
+
+ if (ddata->bldev)
+ backlight = ddata->bldev;
+ else if (ddata->extbldev)
+ backlight = ddata->extbldev;
+ else
+ return;
+
+ if (enable) {
+ backlight->props.fb_blank = FB_BLANK_UNBLANK;
+ backlight->props.state = ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED);
+ backlight->props.power = FB_BLANK_UNBLANK;
+ } else {
+ backlight->props.fb_blank = FB_BLANK_NORMAL;
+ backlight->props.power = FB_BLANK_POWERDOWN;
+ backlight->props.state |= BL_CORE_FBBLANK | BL_CORE_SUSPENDED;
+ }
+
+ backlight_update_status(backlight);
+}
+
static void hw_guard_start(struct panel_drv_data *ddata, int guard_msec)
{
ddata->hw_guard_wait = msecs_to_jiffies(guard_msec);
@@ -343,7 +368,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
struct omap_dss_device *in = ddata->in;
- int r;
+ int r = 0;
int level;

if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
@@ -364,8 +389,6 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);

in->ops.dsi->bus_unlock(in);
- } else {
- r = 0;
}

mutex_unlock(&ddata->lock);
@@ -819,6 +842,8 @@ static int dsicm_enable(struct omap_dss_device *dssdev)

mutex_unlock(&ddata->lock);

+ dsicm_bl_power(ddata, true);
+
return 0;
err:
dev_dbg(&ddata->pdev->dev, "enable failed\n");
@@ -834,6 +859,8 @@ static void dsicm_disable(struct omap_dss_device *dssdev)

dev_dbg(&ddata->pdev->dev, "disable\n");

+ dsicm_bl_power(ddata, false);
+
mutex_lock(&ddata->lock);

dsicm_cancel_ulps_work(ddata);
@@ -1198,6 +1225,7 @@ static struct omap_dss_driver dsicm_ops = {
static int dsicm_probe_of(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
+ struct device_node *backlight;
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in;
struct display_timing timing;
@@ -1259,14 +1287,25 @@ static int dsicm_probe_of(struct platform_device *pdev)

ddata->in = in;

- /* TODO: ulps, backlight */
+ backlight = of_parse_phandle(node, "backlight", 0);
+ if (backlight) {
+ ddata->extbldev = of_find_backlight_by_node(backlight);
+ of_node_put(backlight);
+
+ if (!ddata->extbldev)
+ return -EPROBE_DEFER;
+ } else {
+ /* assume native backlight support */
+ ddata->use_dsi_backlight = true;
+ }
+
+ /* TODO: ulps */

return 0;
}

static int dsicm_probe(struct platform_device *pdev)
{
- struct backlight_properties props;
struct panel_drv_data *ddata;
struct backlight_device *bldev = NULL;
struct device *dev = &pdev->dev;
@@ -1319,7 +1358,7 @@ static int dsicm_probe(struct platform_device *pdev)
GPIOF_OUT_INIT_LOW, "taal rst");
if (r) {
dev_err(dev, "failed to request reset gpio\n");
- return r;
+ goto err_reg;
}
}

@@ -1328,7 +1367,7 @@ static int dsicm_probe(struct platform_device *pdev)
GPIOF_IN, "taal irq");
if (r) {
dev_err(dev, "GPIO request failed\n");
- return r;
+ goto err_reg;
}

r = devm_request_irq(dev, gpio_to_irq(ddata->ext_te_gpio),
@@ -1338,7 +1377,7 @@ static int dsicm_probe(struct platform_device *pdev)

if (r) {
dev_err(dev, "IRQ request failed\n");
- return r;
+ goto err_reg;
}

INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
@@ -1348,48 +1387,43 @@ static int dsicm_probe(struct platform_device *pdev)
}

ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
- if (ddata->workqueue == NULL) {
- dev_err(dev, "can't create workqueue\n");
- return -ENOMEM;
+ if (!ddata->workqueue) {
+ r = -ENOMEM;
+ goto err_reg;
}
INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);

dsicm_hw_reset(ddata);

if (ddata->use_dsi_backlight) {
- memset(&props, 0, sizeof(props));
+ struct backlight_properties props = { 0 };
props.max_brightness = 255;
-
props.type = BACKLIGHT_RAW;
- bldev = backlight_device_register(dev_name(dev),
- dev, ddata, &dsicm_bl_ops, &props);
+
+ bldev = devm_backlight_device_register(dev, dev_name(dev),
+ dev, ddata, &dsicm_bl_ops, &props);
if (IS_ERR(bldev)) {
r = PTR_ERR(bldev);
goto err_bl;
}

ddata->bldev = bldev;
-
- bldev->props.fb_blank = FB_BLANK_UNBLANK;
- bldev->props.power = FB_BLANK_UNBLANK;
- bldev->props.brightness = 255;
-
- dsicm_bl_update_status(bldev);
}

r = sysfs_create_group(&dev->kobj, &dsicm_attr_group);
if (r) {
dev_err(dev, "failed to create sysfs files\n");
- goto err_sysfs_create;
+ goto err_bl;
}

return 0;

-err_sysfs_create:
- backlight_device_unregister(bldev);
err_bl:
destroy_workqueue(ddata->workqueue);
err_reg:
+ if (ddata->extbldev)
+ put_device(&ddata->extbldev->dev);
+
return r;
}

@@ -1397,7 +1431,6 @@ static int __exit dsicm_remove(struct platform_device *pdev)
{
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *dssdev = &ddata->dssdev;
- struct backlight_device *bldev;

dev_dbg(&pdev->dev, "remove\n");

@@ -1408,12 +1441,8 @@ static int __exit dsicm_remove(struct platform_device *pdev)

sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);

- bldev = ddata->bldev;
- if (bldev != NULL) {
- bldev->props.power = FB_BLANK_POWERDOWN;
- dsicm_bl_update_status(bldev);
- backlight_device_unregister(bldev);
- }
+ if (ddata->extbldev)
+ put_device(&ddata->extbldev->dev);

omap_dss_put_device(ddata->in);

--
2.13.2

2017-07-26 10:39:57

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCHv1 01/14] drm/omap: remove unused function defines

On Mon 2017-07-24 19:32:58, Sebastian Reichel wrote:
> Remove driver (un)register API defines. They do not even exist
> anymore.
>
> Signed-off-by: Sebastian Reichel <[email protected]>

Acked-by: Pavel Machek <[email protected]>


> ---
> drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 85953a0bc7c2..4e619ff360ae 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -575,9 +575,6 @@ struct omap_dss_driver {
> enum omapdss_version omapdss_get_version(void);
> bool omapdss_is_initialized(void);
>
> -int omap_dss_register_driver(struct omap_dss_driver *);
> -void omap_dss_unregister_driver(struct omap_dss_driver *);
> -
> int omapdss_register_display(struct omap_dss_device *dssdev);
> void omapdss_unregister_display(struct omap_dss_device *dssdev);
>

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


Attachments:
(No filename) (1.08 kB)
signature.asc (181.00 B)
Digital signature
Download all attachments

2017-07-26 10:40:06

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCHv1 02/14] drm/omap: drop incorrect comment

On Mon 2017-07-24 19:32:59, Sebastian Reichel wrote:
> The wrappers have been removed in commit 5a35876e2830
> (drm: omapdrm: Remove manual update display support)
> and will not be reintroduced, since the normal sys
> functions properly call the dirty callback.
>
> Signed-off-by: Sebastian Reichel <[email protected]>

Acked-by: Pavel Machek <[email protected]>

> ---
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index daf81a0a2899..929a3ef0fba0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -84,9 +84,6 @@ static struct fb_ops omap_fb_ops = {
> .owner = THIS_MODULE,
> DRM_FB_HELPER_DEFAULT_OPS,
>
> - /* Note: to properly handle manual update displays, we wrap the
> - * basic fbdev ops which write to the framebuffer
> - */
> .fb_read = drm_fb_helper_sys_read,
> .fb_write = drm_fb_helper_sys_write,
> .fb_fillrect = drm_fb_helper_sys_fillrect,

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


Attachments:
(No filename) (1.17 kB)
signature.asc (181.00 B)
Digital signature
Download all attachments

2017-07-26 10:41:04

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCHv1 14/14] ARM: dts: n950: add display support

On Mon 2017-07-24 19:33:11, Sebastian Reichel wrote:
> 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.
>
> Signed-off-By: Sebastian Reichel <[email protected]>

Acked-by: Pavel Machek <[email protected]>

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


Attachments:
(No filename) (512.00 B)
signature.asc (181.00 B)
Digital signature
Download all attachments

2017-07-26 10:41:49

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCHv1 07/14] drm/omap: add support for physical size hints from display drivers

On Mon 2017-07-24 19:33:04, Sebastian Reichel wrote:
> While physical size information is automatically parsed for EDID
> based displays, we need to provide it manually for displays providing
> one fixed mode.
>
> Signed-off-by: Sebastian Reichel <[email protected]>

Acked-by: Pavel Machek <[email protected]>

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


Attachments:
(No filename) (460.00 B)
signature.asc (181.00 B)
Digital signature
Download all attachments

2017-07-27 12:02:55

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

* Sebastian Reichel <[email protected]> [170724 10:34]:
> Hi,
>
> This adds support for command mode DSI panels to
> omapdrm. I tested the patches on Nokia N950 (omap3)
> and Motorola Droid 4 (omap4). This is basically
> PATCHv3 of my series adding N950 display support,
> but I started from scratch without reverting the
> removal of manual display update support.

Works for me:

Tested-by: Tony Lindgren <[email protected]>

2017-09-29 13:26:55

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi Tomi & Laurent,

ping?

-- Sebastian

On Mon, Jul 24, 2017 at 07:32:57PM +0200, Sebastian Reichel wrote:
> Hi,
>
> This adds support for command mode DSI panels to
> omapdrm. I tested the patches on Nokia N950 (omap3)
> and Motorola Droid 4 (omap4). This is basically
> PATCHv3 of my series adding N950 display support,
> but I started from scratch without reverting the
> removal of manual display update support.
>
> Tested:
> * Framebuffer Console
> * Display blanking
> * kmstest
> * Xorg with omap and modesetting driver
> * No updates send when nothing needs to be sent
>
> Known issues:
> * Proper display rotation support
> * N950 (and N9) has first and last few lines
> covered by plastic, so we should expose a
> smaller screen
>
> I plan to look into these issues once basic support
> has been merged.
>
> -- Sebastian
>
> Sebastian Reichel (13):
> drm/omap: remove unused function defines
> drm/omap: drop incorrect comment
> drm/omap: plane: update fifo size on ovl setup
> drm/omap: add framedone interrupt support
> drm/omap: add manual update detection helper
> drm/omap: add support for manually updated displays
> drm/omap: add support for physical size hints from display drivers
> drm/omap: panel-dsi-cm: add regulator support
> drm/omap: panel-dsi-cm: add physical size support
> drm/omap: panel-dsi-cm: add external backlight support
> drm/omap: panel-dsi-cm: switch to gpiod
> ARM: dts: omap4-droid4: improve LCD description
> ARM: dts: n950: add display support
>
> Tony Lindgren (1):
> drm/omap: panel-dsi-cm: fix driver
>
> arch/arm/boot/dts/omap3-n950.dts | 88 ++++++++
> arch/arm/boot/dts/omap4-droid4-xt894.dts | 6 +-
> drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 289 +++++++++++++++++-------
> drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++
> drivers/gpu/drm/omapdrm/dss/omapdss.h | 5 +-
> drivers/gpu/drm/omapdrm/omap_connector.c | 14 ++
> drivers/gpu/drm/omapdrm/omap_crtc.c | 158 ++++++++++++-
> drivers/gpu/drm/omapdrm/omap_drv.h | 4 +
> drivers/gpu/drm/omapdrm/omap_fb.c | 20 ++
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 -
> drivers/gpu/drm/omapdrm/omap_irq.c | 24 ++
> 11 files changed, 529 insertions(+), 98 deletions(-)
>
> --
> 2.13.2
>


Attachments:
(No filename) (2.32 kB)
signature.asc (833.00 B)
Download all attachments

2017-12-01 12:10:59

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 03/14] drm/omap: plane: update fifo size on ovl setup


On 24/07/17 20:33, Sebastian Reichel wrote:
> 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.
>
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index fd7504b37e3b..b6dca5ee34d4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -1398,6 +1398,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
> }
> }
>
> +void dispc_ovl_set_manual_fifo_threshold(enum omap_plane_id plane)
> +{
> + u32 fifo_low, fifo_high;
> + bool use_fifo_merge = false;
> + bool use_manual_update = true;
> +
> + dispc_ovl_compute_fifo_thresholds(plane, &fifo_low, &fifo_high,
> + use_fifo_merge, use_manual_update);
> +
> + dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high);
> +}
> +
> static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable)
> {
> int bit;
> @@ -2566,6 +2578,10 @@ static int dispc_ovl_setup(enum omap_plane_id plane,
> oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
> oi->rotation_type, replication, vm, mem_to_mem);
>
> + /* manual mode needs other fifo thresholds */
> + if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE))
> + dispc_ovl_set_manual_fifo_threshold(plane);
> +
> return r;
> }

We don't have the stallmode for all channels. And on OMAP2 it's for
RFBI, and I don't know if that needs different thresholds or not. Also,
I'm not sure if OMAP4-5 DSI needs this. And I think it's good to mention
the unknown bug in the comment too. And yes, it's unknown to me too, I
never figured it out. These thresholds just seemed to work, while the
default did not.

So I think we need to check that the platform is OMAP3 and channel is
LCD. We can later extend that to cover OMAP4-5 if needed.

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2017-12-01 12:25:08

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv1 03/14] drm/omap: plane: update fifo size on ovl setup

Hi Tomi,

On Fri, Dec 01, 2017 at 02:10:42PM +0200, Tomi Valkeinen wrote:
>
> On 24/07/17 20:33, Sebastian Reichel wrote:
> > 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.
> >
> > Signed-off-by: Sebastian Reichel <[email protected]>
> > ---
> > drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> > index fd7504b37e3b..b6dca5ee34d4 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> > @@ -1398,6 +1398,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
> > }
> > }
> >
> > +void dispc_ovl_set_manual_fifo_threshold(enum omap_plane_id plane)
> > +{
> > + u32 fifo_low, fifo_high;
> > + bool use_fifo_merge = false;
> > + bool use_manual_update = true;
> > +
> > + dispc_ovl_compute_fifo_thresholds(plane, &fifo_low, &fifo_high,
> > + use_fifo_merge, use_manual_update);
> > +
> > + dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high);
> > +}
> > +
> > static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable)
> > {
> > int bit;
> > @@ -2566,6 +2578,10 @@ static int dispc_ovl_setup(enum omap_plane_id plane,
> > oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
> > oi->rotation_type, replication, vm, mem_to_mem);
> >
> > + /* manual mode needs other fifo thresholds */
> > + if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE))
> > + dispc_ovl_set_manual_fifo_threshold(plane);
> > +
> > return r;
> > }
>
> We don't have the stallmode for all channels. And on OMAP2 it's for
> RFBI, and I don't know if that needs different thresholds or not. Also,
> I'm not sure if OMAP4-5 DSI needs this. And I think it's good to mention
> the unknown bug in the comment too. And yes, it's unknown to me too, I
> never figured it out. These thresholds just seemed to work, while the
> default did not.
>
> So I think we need to check that the platform is OMAP3 and channel is
> LCD. We can later extend that to cover OMAP4-5 if needed.

Ok. I will have a look at this later today. FWIW I test this
patchset with OMAP3 (N950) and OMAP4 (Droid 4). OMAP4 works
without this patch, but also with the changed thresholds.

-- Sebastian


Attachments:
(No filename) (2.41 kB)
signature.asc (833.00 B)
Download all attachments

2017-12-01 12:28:58

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 08/14] drm/omap: panel-dsi-cm: fix driver

Hi,

On 24/07/17 20:33, Sebastian Reichel wrote:
> From: Tony Lindgren <[email protected]>
>
> This adds support for get_timings() and check_timings()
> to get the driver working and properly initializes the
> timing information from DT.

I don't know if it matters much, but the timings added to dts in the
following patches are mostly not used, and do not make sense for DSI
command mode panel. Only hactive and vactive are used. But if full video
timings are present in the dts, then I think it would be good to have
the timings correct, so that also pixel clock is defined, and the
timings would produce 60Hz refresh rate.

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2017-12-01 12:32:00

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 01/14] drm/omap: remove unused function defines

On 24/07/17 20:32, Sebastian Reichel wrote:
> Remove driver (un)register API defines. They do not even exist
> anymore.
>
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 85953a0bc7c2..4e619ff360ae 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -575,9 +575,6 @@ struct omap_dss_driver {
> enum omapdss_version omapdss_get_version(void);
> bool omapdss_is_initialized(void);
>
> -int omap_dss_register_driver(struct omap_dss_driver *);
> -void omap_dss_unregister_driver(struct omap_dss_driver *);
> -
> int omapdss_register_display(struct omap_dss_device *dssdev);
> void omapdss_unregister_display(struct omap_dss_device *dssdev);

I picked this and the patch 2 for v4.16.

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2017-12-01 12:59:31

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi,

On 24/07/17 20:32, Sebastian Reichel wrote:
> Hi,
>
> This adds support for command mode DSI panels to
> omapdrm. I tested the patches on Nokia N950 (omap3)
> and Motorola Droid 4 (omap4). This is basically
> PATCHv3 of my series adding N950 display support,
> but I started from scratch without reverting the
> removal of manual display update support.
>
> Tested:
> * Framebuffer Console
> * Display blanking
> * kmstest
> * Xorg with omap and modesetting driver
> * No updates send when nothing needs to be sent
>
> Known issues:
> * Proper display rotation support
> * N950 (and N9) has first and last few lines
> covered by plastic, so we should expose a
> smaller screen
>
> I plan to look into these issues once basic support
> has been merged.
>
> -- Sebastian
>
> Sebastian Reichel (13):
> drm/omap: remove unused function defines
> drm/omap: drop incorrect comment
> drm/omap: plane: update fifo size on ovl setup
> drm/omap: add framedone interrupt support
> drm/omap: add manual update detection helper
> drm/omap: add support for manually updated displays
> drm/omap: add support for physical size hints from display drivers
> drm/omap: panel-dsi-cm: add regulator support
> drm/omap: panel-dsi-cm: add physical size support
> drm/omap: panel-dsi-cm: add external backlight support
> drm/omap: panel-dsi-cm: switch to gpiod
> ARM: dts: omap4-droid4: improve LCD description
> ARM: dts: n950: add display support
>
> Tony Lindgren (1):
> drm/omap: panel-dsi-cm: fix driver

I've also picked patches 7-12.

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2017-12-08 18:01:48

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi Tomi,

On Fri, Dec 01, 2017 at 02:58:13PM +0200, Tomi Valkeinen wrote:
> Hi,
>
> On 24/07/17 20:32, Sebastian Reichel wrote:
> > Hi,
> >
> > This adds support for command mode DSI panels to
> > omapdrm. I tested the patches on Nokia N950 (omap3)
> > and Motorola Droid 4 (omap4). This is basically
> > PATCHv3 of my series adding N950 display support,
> > but I started from scratch without reverting the
> > removal of manual display update support.
> >
> > Tested:
> > * Framebuffer Console
> > * Display blanking
> > * kmstest
> > * Xorg with omap and modesetting driver
> > * No updates send when nothing needs to be sent
> >
> > Known issues:
> > * Proper display rotation support
> > * N950 (and N9) has first and last few lines
> > covered by plastic, so we should expose a
> > smaller screen
> >
> > I plan to look into these issues once basic support
> > has been merged.
> >
> > -- Sebastian
> >
> > Sebastian Reichel (13):
> > [A] drm/omap: remove unused function defines
> > [A] drm/omap: drop incorrect comment
> > [ ] drm/omap: plane: update fifo size on ovl setup
> > [ ] drm/omap: add framedone interrupt support
> > [ ] drm/omap: add manual update detection helper
> > [ ] drm/omap: add support for manually updated displays
> > [A] drm/omap: add support for physical size hints from display drivers
> > [A] drm/omap: panel-dsi-cm: add regulator support
> > [A] drm/omap: panel-dsi-cm: add physical size support
> > [A] drm/omap: panel-dsi-cm: add external backlight support
> > [A] drm/omap: panel-dsi-cm: switch to gpiod
> > [A] ARM: dts: omap4-droid4: improve LCD description
> > [ ] ARM: dts: n950: add display support
> >
> > Tony Lindgren (1):
> > drm/omap: panel-dsi-cm: fix driver
>
> I've also picked patches 7-12.

Thanks. I just wanted to rebase the remaining patches on your
branch, but I don't see those patches in linux-next and your tree
does not seem to be updated properly either:

https://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git/

-- Sebastian


Attachments:
(No filename) (2.00 kB)
signature.asc (833.00 B)
Download all attachments

2017-12-11 08:31:21

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

On 08/12/17 20:01, Sebastian Reichel wrote:

>> I've also picked patches 7-12.
>
> Thanks. I just wanted to rebase the remaining patches on your
> branch, but I don't see those patches in linux-next and your tree
> does not seem to be updated properly either:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git/

I haven't kept a public tree for a while. I did push my work branch to
master in the above git tree, but note that I will most likely rebase it
on top of drm-next in the near future.

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2018-02-08 09:42:30

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi!

> I've also picked patches 7-12.

It seems that part of the support made it to v4.16. Is it supposed to
be complete?

I still have these in my tree, and result works on Nokia N9. Is there
any way I can help with the merge?

Best regards,

Pavel

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 15399a1..39b26cf 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -33,8 +33,6 @@
#define TCH 0

#define DCS_READ_NUM_ERRORS 0x05
-#define DCS_BRIGHTNESS 0x51
-#define DCS_CTRL_DISPLAY 0x53
#define DCS_GET_ID1 0xda
#define DCS_GET_ID2 0xdb
#define DCS_GET_ID3 0xdc
@@ -385,7 +383,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)

r = dsicm_wake_up(ddata);
if (!r)
- r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
+ r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+ level);

in->ops.dsi->bus_unlock(in);
}
@@ -667,11 +666,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;

- r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
+ r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
if (r)
goto err;

- r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
+ r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
(1<<2) | (1<<5)); /* BL | BCTRL */
if (r)
goto err;
@@ -685,6 +684,8 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;

+ mdelay(1000);
+
r = _dsicm_enable_te(ddata, ddata->te_enabled);
if (r)
goto err;
@@ -1100,7 +1101,8 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
goto err2;

while (buf_used < size) {
- u8 dcs_cmd = first ? 0x2e : 0x3e;
+ u8 dcs_cmd = first ? MIPI_DCS_READ_MEMORY_START :
+ MIPI_DCS_READ_MEMORY_CONTINUE;
first = 0;

r = in->ops.dsi->dcs_read(in, ddata->channel, dcs_cmd,
@@ -1378,6 +1380,7 @@ static int dsicm_probe(struct platform_device *pdev)
if (ddata->use_dsi_backlight) {
struct backlight_properties props = { 0 };
props.max_brightness = 255;
+ props.brightness = 128;
props.type = BACKLIGHT_RAW;

bldev = devm_backlight_device_register(dev, dev_name(dev),
@@ -1396,6 +1399,18 @@ static int dsicm_probe(struct platform_device *pdev)
goto err_bl;
}

+#if 0
+ mutex_lock(&ddata->lock);
+ ddata->in->ops.dsi->bus_lock(ddata->in);
+ r = dsicm_wake_up(ddata);
+ if (!r)
+ r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
+ r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
+ (1<<2) | (1<<5)); /* BL | BCTRL */
+ r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
+ ddata->in->ops.dsi->bus_unlock(ddata->in);
+ mutex_unlock(&ddata->lock);
+#endif
return 0;

err_bl:
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 4e8f68e..e63a783 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -1489,6 +1489,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
}
}

+void dispc_ovl_set_manual_fifo_threshold(enum omap_plane_id plane)
+{
+ u32 fifo_low, fifo_high;
+ bool use_fifo_merge = false;
+ bool use_manual_update = true;
+
+ dispc_ovl_compute_fifo_thresholds(plane, &fifo_low, &fifo_high,
+ use_fifo_merge, use_manual_update);
+
+ dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high);
+}
+
static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable)
{
int bit;
@@ -2652,6 +2664,10 @@ static int dispc_ovl_setup(enum omap_plane_id plane,
oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
oi->rotation_type, replication, vm, mem_to_mem);

+ /* manual mode needs other fifo thresholds */
+ if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE))
+ dispc_ovl_set_manual_fifo_threshold(plane);
+
return r;
}

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index a0d7b1d..a33b514 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -57,6 +57,14 @@ bool omap_connector_get_hdmi_mode(struct drm_connector *connector)
return omap_connector->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);
+}
+
static enum drm_connector_status omap_connector_detect(
struct drm_connector *connector, bool force)
{
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 1b8154e..c2defb51 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -51,6 +51,10 @@ struct omap_crtc {
bool pending;
wait_queue_head_t pending_wait;
struct drm_pending_vblank_event *event;
+ struct delayed_work update_work;
+
+ void (*framedone_handler)(void *);
+ void *framedone_handler_data;
};

/* -----------------------------------------------------------------------------
@@ -139,6 +143,28 @@ 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 omap_drm_private *priv = omap_crtc->base.dev->dev_private;
+
+ priv->dispc_ops->mgr_enable(channel, true);
+}
+
+static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
+{
+ struct drm_connector *connector;
+ struct drm_connector_list_iter conn_iter;
+ bool result = false;
+
+ drm_connector_list_iter_begin(crtc->dev, &conn_iter);
+ drm_for_each_connector_iter(connector, &conn_iter) {
+ if (connector->state->crtc != crtc)
+ continue;
+ result = omap_connector_get_manually_updated(connector);
+ break;
+ }
+ drm_connector_list_iter_end(&conn_iter);
+
+ return result;
}

/* Called only from the encoder enable/disable and suspend/resume handlers. */
@@ -150,12 +176,17 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
enum omap_channel channel = omap_crtc->channel;
struct omap_irq_wait *wait;
u32 framedone_irq, vsync_irq;
+ bool is_manual = omap_crtc_is_manually_updated(crtc);
+ enum omap_display_type type = omap_crtc_output[channel]->output_type;
int ret;

if (WARN_ON(omap_crtc->enabled == enable))
return;

- if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) {
+ if (is_manual)
+ omap_irq_enable_framedone(crtc, enable);
+
+ if (is_manual || type == OMAP_DISPLAY_TYPE_HDMI) {
priv->dispc_ops->mgr_enable(channel, enable);
omap_crtc->enabled = enable;
return;
@@ -206,7 +237,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
}
}

-
static int omap_crtc_dss_enable(enum omap_channel channel)
{
struct omap_crtc *omap_crtc = omap_crtcs[channel];
@@ -247,6 +277,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;
}

@@ -254,6 +295,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 = {
@@ -321,6 +372,77 @@ 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?");
+ 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)
+{
+ struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+
+ if (!omap_crtc_is_manually_updated(crtc))
+ return;
+
+ if (!delayed_work_pending(&omap_crtc->update_work))
+ schedule_delayed_work(&omap_crtc->update_work, 0);
+}
+
+static void omap_crtc_manual_display_update(struct work_struct *data)
+{
+ struct omap_crtc *omap_crtc =
+ container_of(data, struct omap_crtc, update_work.work);
+ struct omap_dss_device *dssdev = omap_crtc_output[omap_crtc->channel];
+ struct drm_device *dev = omap_crtc->base.dev;
+ struct omap_dss_driver *dssdrv;
+ int ret, width, height;
+
+ if (!dssdev || !dssdev->dst) {
+ dev_err_once(dev->dev, "missing dssdev!");
+ return;
+ }
+
+ dssdev = dssdev->dst;
+ dssdrv = dssdev->driver;
+
+ if (!dssdrv || !dssdrv->update) {
+ dev_err_once(dev->dev, "incorrect dssdrv!");
+ return;
+ }
+
+ if (dssdrv->sync)
+ dssdrv->sync(dssdev);
+
+ width = dssdev->panel.vm.hactive;
+ height = dssdev->panel.vm.vactive;
+ ret = dssdrv->update(dssdev, 0, 0, width, height);
+ if (ret < 0) {
+ spin_lock_irq(&dev->event_lock);
+ omap_crtc->pending = false;
+ spin_unlock_irq(&dev->event_lock);
+ wake_up(&omap_crtc->pending_wait);
+ }
+}
+
static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
{
struct omap_drm_private *priv = crtc->dev->dev_private;
@@ -373,6 +495,10 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,

DBG("%s", omap_crtc->name);

+ /* manual updated display will not trigger vsync irq */
+ if (omap_crtc_is_manually_updated(crtc))
+ return;
+
spin_lock_irq(&crtc->dev->event_lock);
drm_crtc_vblank_on(crtc);
ret = drm_crtc_vblank_get(crtc);
@@ -386,6 +512,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+ struct drm_device *dev = crtc->dev;

DBG("%s", omap_crtc->name);

@@ -396,6 +523,11 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc,
}
spin_unlock_irq(&crtc->dev->event_lock);

+ cancel_delayed_work(&omap_crtc->update_work);
+
+ if (!omap_crtc_wait_pending(crtc))
+ dev_warn(dev->dev, "manual display update did not finish!");
+
drm_crtc_vblank_off(crtc);
}

@@ -545,13 +677,20 @@ 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_is_manually_updated(crtc)) {
+ ret = drm_crtc_vblank_get(crtc);
+ WARN_ON(ret != 0);

- spin_lock_irq(&crtc->dev->event_lock);
- priv->dispc_ops->mgr_go(omap_crtc->channel);
- omap_crtc_arm_event(crtc);
- spin_unlock_irq(&crtc->dev->event_lock);
+ spin_lock_irq(&crtc->dev->event_lock);
+ priv->dispc_ops->mgr_go(omap_crtc->channel);
+ omap_crtc_arm_event(crtc);
+ spin_unlock_irq(&crtc->dev->event_lock);
+ } else {
+ spin_lock_irq(&crtc->dev->event_lock);
+ omap_crtc_flush(crtc);
+ omap_crtc_arm_event(crtc);
+ spin_unlock_irq(&crtc->dev->event_lock);
+ }
}

static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
@@ -713,6 +852,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
omap_crtc->channel = channel;
omap_crtc->name = channel_names[channel];

+ INIT_DELAYED_WORK(&omap_crtc->update_work,
+ omap_crtc_manual_display_update);
+
ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
&omap_crtc_funcs, NULL);
if (ret < 0) {
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index dd68b25..bc5b68e 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -74,36 +74,23 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
/* Apply the atomic update. */
drm_atomic_helper_commit_modeset_disables(dev, old_state);

- if (priv->omaprev != 0x3430) {
- /* With the current dss dispc implementation we have to enable
- * the new modeset before we can commit planes. The dispc ovl
- * configuration relies on the video mode configuration been
- * written into the HW when the ovl configuration is
- * calculated.
- *
- * This approach is not ideal because after a mode change the
- * plane update is executed only after the first vblank
- * interrupt. The dispc implementation should be fixed so that
- * it is able use uncommitted drm state information.
- */
- drm_atomic_helper_commit_modeset_enables(dev, old_state);
- omap_atomic_wait_for_completion(dev, old_state);
-
- drm_atomic_helper_commit_planes(dev, old_state, 0);
-
- drm_atomic_helper_commit_hw_done(old_state);
- } else {
- /*
- * OMAP3 DSS seems to have issues with the work-around above,
- * resulting in endless sync losts if a crtc is enabled without
- * a plane. For now, skip the WA for OMAP3.
- */
- drm_atomic_helper_commit_planes(dev, old_state, 0);
-
- drm_atomic_helper_commit_modeset_enables(dev, old_state);
-
- drm_atomic_helper_commit_hw_done(old_state);
- }
+ /* With the current dss dispc implementation we have to enable
+ * the new modeset before we can commit planes. The dispc ovl
+ * configuration relies on the video mode configuration been
+ * written into the HW when the ovl configuration is
+ * calculated.
+ *
+ * This approach is not ideal because after a mode change the
+ * plane update is executed only after the first vblank
+ * interrupt. The dispc implementation should be fixed so that
+ * it is able use uncommitted drm state information.
+ */
+ drm_atomic_helper_commit_modeset_enables(dev, old_state);
+ omap_atomic_wait_for_completion(dev, old_state);
+
+ drm_atomic_helper_commit_planes(dev, old_state, 0);
+
+ drm_atomic_helper_commit_hw_done(old_state);

/*
* Wait for completion of the page flips to ensure that old buffers
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index b2539a9..57b1767 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -95,8 +95,28 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb)
kfree(omap_fb);
}

+static int omap_framebuffer_dirty(struct drm_framebuffer *fb,
+ struct drm_file *file_priv,
+ unsigned flags, unsigned color,
+ struct drm_clip_rect *clips,
+ unsigned num_clips)
+{
+ struct drm_connector *connector = NULL;
+
+ drm_modeset_lock_all(fb->dev);
+
+ while ((connector = omap_framebuffer_get_next_connector(fb, connector)))
+ if (connector->encoder && connector->encoder->crtc)
+ omap_crtc_flush(connector->encoder->crtc);
+
+ drm_modeset_unlock_all(fb->dev);
+
+ return 0;
+}
+
static const struct drm_framebuffer_funcs omap_framebuffer_funcs = {
.create_handle = omap_framebuffer_create_handle,
+ .dirty = omap_framebuffer_dirty,
.destroy = omap_framebuffer_destroy,
};

diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 53ba424..354df35 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -85,6 +85,27 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
return ret == 0 ? -1 : 0;
}

+int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
+{
+ struct drm_device *dev = crtc->dev;
+ struct omap_drm_private *priv = dev->dev_private;
+ unsigned long flags;
+ enum omap_channel channel = omap_crtc_channel(crtc);
+ int framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(channel);
+
+ DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
+
+ spin_lock_irqsave(&priv->wait_lock, flags);
+ if (enable)
+ priv->irq_mask |= framedone_irq;
+ else
+ priv->irq_mask &= ~framedone_irq;
+ omap_irq_update(dev);
+ spin_unlock_irqrestore(&priv->wait_lock, flags);
+
+ return 0;
+}
+
/**
* enable_vblank - enable vblank interrupt events
* @dev: DRM device
@@ -215,6 +236,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)

if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(channel))
omap_crtc_error_irq(crtc, irqstatus);
+
+ if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(channel))
+ omap_crtc_framedone_irq(crtc, irqstatus);
}

omap_irq_ocp_error_handler(dev, irqstatus);
diff --git a/include/video/mipi_display.h b/include/video/mipi_display.h
index 19aa65a..1d9fdd6 100644
--- a/include/video/mipi_display.h
+++ b/include/video/mipi_display.h
@@ -102,7 +102,8 @@ enum {
MIPI_DCS_WRITE_MEMORY_START = 0x2C,
MIPI_DCS_WRITE_LUT = 0x2D,
MIPI_DCS_READ_MEMORY_START = 0x2E,
- MIPI_DCS_SET_PARTIAL_AREA = 0x30,
+ MIPI_DCS_SET_PARTIAL_ROWS = 0x30,
+ MIPI_DCS_SET_PARTIAL_COLUMNS = 0x31,
MIPI_DCS_SET_SCROLL_AREA = 0x33,
MIPI_DCS_SET_TEAR_OFF = 0x34,
MIPI_DCS_SET_TEAR_ON = 0x35,

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


Attachments:
(No filename) (17.63 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2018-02-08 10:54:29

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

On 08/02/18 11:41, Pavel Machek wrote:
> Hi!
>
>> I've also picked patches 7-12.
>
> It seems that part of the support made it to v4.16. Is it supposed to
> be complete?
>
> I still have these in my tree, and result works on Nokia N9. Is there
> any way I can help with the merge?

I picked the patches that seemed safe to pick. I think we can do another
review round if someone rebases and posts the patches. Although I see
that they have conflicts with other patches that have been posted, so
we'll see how it goes.

Btw, you seem to have something in your tree that was not in the series.
Nothing in the series touches mipi_display.h.

Tomi

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

2018-02-08 18:32:57

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi,

On Thu, Feb 08, 2018 at 12:53:16PM +0200, Tomi Valkeinen wrote:
> On 08/02/18 11:41, Pavel Machek wrote:
> >> I've also picked patches 7-12.
> >
> > It seems that part of the support made it to v4.16. Is it supposed to
> > be complete?
> >
> > I still have these in my tree, and result works on Nokia N9. Is there
> > any way I can help with the merge?
>
> I picked the patches that seemed safe to pick. I think we can do another
> review round if someone rebases and posts the patches. Although I see
> that they have conflicts with other patches that have been posted, so
> we'll see how it goes.
>
> Btw, you seem to have something in your tree that was not in the series.
> Nothing in the series touches mipi_display.h.

I have a rebased series based on recent origin/master. It works
properly on Droid 4 (omap4), but has issues on omap3 even with
the fifo bug fix applied. I do not yet know the reason, but I
think we should proceed anyways. I originally planned to send
this based on rc1, but will do so now.

-- Sebastian


Attachments:
(No filename) (1.04 kB)
signature.asc (849.00 B)
Download all attachments

2017-11-06 10:30:54

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi!

> > P.S.: I got asked by different people about the status of this
> > patchset, which is required for display support on N9, N950 and
> > Droid 4. It's not just me and Tony, that are interested in this :)
>
> Ok. If you agree to help with the DSI part in the future, I have no
> problems applying these (after review and testing, of course).
>
> My worry is not only with complicating Laurent's work towards common DRM
> drivers, but also with the maintenance burden this brings. Keeping DSI
> working in the future may be challenging due to the lack of users and
> (easy to use) boards. I do have a N950 and OMAP4 Blaze Tablet, though,
> so I'm able to test both command and video modes. But getting those boot
> up is not always trivial, especially for the blaze tablet.

Well... Yes, they are challenging to boot, because without working
display, debugging them is hard/impossible. Very few people have
serial cables for those, but at least the N9 is pretty common.

PostmarketOS is interested in using it as a target. I'm interested in
keeping it going. With working display, I'm pretty sure I can prevent
regressions... and there could be even some improvements :-).

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.34 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2017-10-27 18:01:31

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi,

On Thu, Oct 26, 2017 at 02:59:10PM +0300, Tomi Valkeinen wrote:
> On 24/10/17 01:01, Sebastian Reichel wrote:
> > Hi,
> >
> > On Fri, Oct 13, 2017 at 10:12:08AM -0700, Tony Lindgren wrote:
> >> * Tomi Valkeinen <[email protected]> [171012 01:46]:
> >>> On 29/09/17 16:26, Sebastian Reichel wrote:
> >>>> Hi Tomi & Laurent,
> >>>>
> >>>> ping?
> >>>
> >>> I've been having quick glances at this every now and then, but I'm not
> >>> sure what to do with the series.
> >>>
> >>> We have one work item that more or less overrides everything but
> >>> critical fixes: moving to common DRM encoder/panel drivers. Anything
> >>> that makes that work more difficult should be postponed.
> >>>
> >>> Especially patch 6 in this series most likely falls into that category,
> >>> and might require a very different implementation with common DRM
> >>> drivers. Also everything in panel-dsi-cm needs to be ported to a common
> >>> DRM panel driver when can use them.
> >>>
> >>> So my gut feeling is that it's best to keep this out for now, and rework
> >>> it after Laurent gets the common DRM drivers working with omapdrm.
> >>
> >> Laurent, got any other comments?
> >>
> >> Maybe some of patches can be already applied to shrink down this
> >> set a bit?
> >
> > I talked with Laurent at ELCE about this patchset and he is fine
> > with this series going in before his work assuming its fine
> > otherwise. He has not yet reviewed it, though and is busy the
> > next two weeks.
> >
> > Regarding the panel-dsi-cm porting work: I will take care of this
> > once the driver uses common DRM drivers. I don't expect major
> > problems once omapdrm implements common drm's mipi_dsi_host. I
> > do use the standard DT properties already.
> >
> > I do agree, that not applying this series makes Laurent's porting
> > work easier, since he can rip out all of DSI. It's not used by
> > anything except panel-dsi-cm, which is broken without this patchset.
> > I don't think that's a fair thing to do, though.
> >
> > P.S.: I got asked by different people about the status of this
> > patchset, which is required for display support on N9, N950 and
> > Droid 4. It's not just me and Tony, that are interested in this :)
>
> Ok. If you agree to help with the DSI part in the future, I have no
> problems applying these (after review and testing, of course).

Sure.

> My worry is not only with complicating Laurent's work towards common DRM
> drivers, but also with the maintenance burden this brings. Keeping DSI
> working in the future may be challenging due to the lack of users and
> (easy to use) boards. I do have a N950 and OMAP4 Blaze Tablet, though,
> so I'm able to test both command and video modes. But getting those boot
> up is not always trivial, especially for the blaze tablet.

I have N950, N9 and Droid 4 (omap4 based).
All of them have command mode panels.

> I've also spent many hours this year debugging obscure OMAP3 DSS HW
> issues, so my opinion about adding more OMAP3 DSS features may be a bit
> biased =).

This patchset is also for OMAP4 (Droid 4).

> I'll have a look at this series when I find a bit of spare time.

Thanks.

-- Sebastian


Attachments:
(No filename) (3.17 kB)
signature.asc (849.00 B)
Download all attachments

2017-10-26 12:00:00

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

On 24/10/17 01:01, Sebastian Reichel wrote:
> Hi,
>
> On Fri, Oct 13, 2017 at 10:12:08AM -0700, Tony Lindgren wrote:
>> * Tomi Valkeinen <[email protected]> [171012 01:46]:
>>> On 29/09/17 16:26, Sebastian Reichel wrote:
>>>> Hi Tomi & Laurent,
>>>>
>>>> ping?
>>>
>>> I've been having quick glances at this every now and then, but I'm not
>>> sure what to do with the series.
>>>
>>> We have one work item that more or less overrides everything but
>>> critical fixes: moving to common DRM encoder/panel drivers. Anything
>>> that makes that work more difficult should be postponed.
>>>
>>> Especially patch 6 in this series most likely falls into that category,
>>> and might require a very different implementation with common DRM
>>> drivers. Also everything in panel-dsi-cm needs to be ported to a common
>>> DRM panel driver when can use them.
>>>
>>> So my gut feeling is that it's best to keep this out for now, and rework
>>> it after Laurent gets the common DRM drivers working with omapdrm.
>>
>> Laurent, got any other comments?
>>
>> Maybe some of patches can be already applied to shrink down this
>> set a bit?
>
> I talked with Laurent at ELCE about this patchset and he is fine
> with this series going in before his work assuming its fine
> otherwise. He has not yet reviewed it, though and is busy the
> next two weeks.
>
> Regarding the panel-dsi-cm porting work: I will take care of this
> once the driver uses common DRM drivers. I don't expect major
> problems once omapdrm implements common drm's mipi_dsi_host. I
> do use the standard DT properties already.
>
> I do agree, that not applying this series makes Laurent's porting
> work easier, since he can rip out all of DSI. It's not used by
> anything except panel-dsi-cm, which is broken without this patchset.
> I don't think that's a fair thing to do, though.
>
> P.S.: I got asked by different people about the status of this
> patchset, which is required for display support on N9, N950 and
> Droid 4. It's not just me and Tony, that are interested in this :)

Ok. If you agree to help with the DSI part in the future, I have no
problems applying these (after review and testing, of course).

My worry is not only with complicating Laurent's work towards common DRM
drivers, but also with the maintenance burden this brings. Keeping DSI
working in the future may be challenging due to the lack of users and
(easy to use) boards. I do have a N950 and OMAP4 Blaze Tablet, though,
so I'm able to test both command and video modes. But getting those boot
up is not always trivial, especially for the blaze tablet.

I've also spent many hours this year debugging obscure OMAP3 DSS HW
issues, so my opinion about adding more OMAP3 DSS features may be a bit
biased =).

I'll have a look at this series when I find a bit of spare time.

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

From 1582087387615293647@xxx Mon Oct 23 22:01:47 +0000 2017
X-GM-THRID: 1573826888599063531
X-Gmail-Labels: Inbox,Category Forums

2017-10-23 22:01:48

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi,

On Fri, Oct 13, 2017 at 10:12:08AM -0700, Tony Lindgren wrote:
> * Tomi Valkeinen <[email protected]> [171012 01:46]:
> > On 29/09/17 16:26, Sebastian Reichel wrote:
> > > Hi Tomi & Laurent,
> > >
> > > ping?
> >
> > I've been having quick glances at this every now and then, but I'm not
> > sure what to do with the series.
> >
> > We have one work item that more or less overrides everything but
> > critical fixes: moving to common DRM encoder/panel drivers. Anything
> > that makes that work more difficult should be postponed.
> >
> > Especially patch 6 in this series most likely falls into that category,
> > and might require a very different implementation with common DRM
> > drivers. Also everything in panel-dsi-cm needs to be ported to a common
> > DRM panel driver when can use them.
> >
> > So my gut feeling is that it's best to keep this out for now, and rework
> > it after Laurent gets the common DRM drivers working with omapdrm.
>
> Laurent, got any other comments?
>
> Maybe some of patches can be already applied to shrink down this
> set a bit?

I talked with Laurent at ELCE about this patchset and he is fine
with this series going in before his work assuming its fine
otherwise. He has not yet reviewed it, though and is busy the
next two weeks.

Regarding the panel-dsi-cm porting work: I will take care of this
once the driver uses common DRM drivers. I don't expect major
problems once omapdrm implements common drm's mipi_dsi_host. I
do use the standard DT properties already.

I do agree, that not applying this series makes Laurent's porting
work easier, since he can rip out all of DSI. It's not used by
anything except panel-dsi-cm, which is broken without this patchset.
I don't think that's a fair thing to do, though.

P.S.: I got asked by different people about the status of this
patchset, which is required for display support on N9, N950 and
Droid 4. It's not just me and Tony, that are interested in this :)

-- Sebastian


Attachments:
(No filename) (1.98 kB)
signature.asc (849.00 B)
Download all attachments

2017-10-13 17:12:47

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

* Tomi Valkeinen <[email protected]> [171012 01:46]:
> On 29/09/17 16:26, Sebastian Reichel wrote:
> > Hi Tomi & Laurent,
> >
> > ping?
>
> I've been having quick glances at this every now and then, but I'm not
> sure what to do with the series.
>
> We have one work item that more or less overrides everything but
> critical fixes: moving to common DRM encoder/panel drivers. Anything
> that makes that work more difficult should be postponed.
>
> Especially patch 6 in this series most likely falls into that category,
> and might require a very different implementation with common DRM
> drivers. Also everything in panel-dsi-cm needs to be ported to a common
> DRM panel driver when can use them.
>
> So my gut feeling is that it's best to keep this out for now, and rework
> it after Laurent gets the common DRM drivers working with omapdrm.

Laurent, got any other comments?

Maybe some of patches can be already applied to shrink down this
set a bit?

Regards,

Tony

From 1581040764315799348@xxx Thu Oct 12 08:46:10 +0000 2017
X-GM-THRID: 1573826888599063531
X-Gmail-Labels: Inbox,Category Forums

2017-10-12 08:46:10

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCHv1 00/14] omapdrm: DSI command mode panel support

Hi Sebastian,


Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

On 29/09/17 16:26, Sebastian Reichel wrote:
> Hi Tomi & Laurent,
>
> ping?

I've been having quick glances at this every now and then, but I'm not
sure what to do with the series.

We have one work item that more or less overrides everything but
critical fixes: moving to common DRM encoder/panel drivers. Anything
that makes that work more difficult should be postponed.

Especially patch 6 in this series most likely falls into that category,
and might require a very different implementation with common DRM
drivers. Also everything in panel-dsi-cm needs to be ported to a common
DRM panel driver when can use them.

So my gut feeling is that it's best to keep this out for now, and rework
it after Laurent gets the common DRM drivers working with omapdrm.

Tomi


From 1579880719984103952@xxx Fri Sep 29 13:27:45 +0000 2017
X-GM-THRID: 1573826888599063531
X-Gmail-Labels: Inbox,Category Forums