Skip to contentSkip to conversation

drm/omap: DSS6 with dynamically allocated objects

RFC PATCH In review Jyri Sarha 3 participants 26 messages Feb 16, 2018 – Feb 28, 2018

Subsystems (3)
lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

cover drm/omap: DSS6 with dynamically allocated objects

This series is an RFC or a proof of concept, to demostrate what is needed to get DSS6 driver workin on top of Laurent Pinchart's "omapdrm: Allocate objects dynamically" -series:

https://patchwork.freedesktop.org/series/38152/

This series also contains my earlier "drm/omap: Make omapdss API more generic + related patches" -series:

https://patchwork.freedesktop.org/series/35884/

... however, I squeezed get_ off from olv_name and mgr_name dispc_ops. It is quite obvious from the prototype what these ops are for after all.

These patches, plus some other patches need to get DSS6 workin on k2g-evm can be found here:

[email protected]:jsarha/linux.git omapdrm-next-dss6

Jyri Sarha (7):
drm/omap: Update omapdss API to allow alternative DSS implementations drm/omap: Fail probe if irq registration fails
drm/omap: Add ovl_name() and mgr_name() to dispc_ops drm/omap: Make omapdss API more generic
drm/omap: move common stuff from dss.h to omapdss.h drm/omap: dss: Move platform_device_register from core.c to dss.c
probe
drm/omap: dss: platform_register_drivers() to dss.c and remove core.c

Tomi Valkeinen (2):
drm/omap: add TI DSS6 driver
drm/omap: boot-init: add k2g-dss

 drivers/gpu/drm/omapdrm/dss/Kconfig             |    8 +
 drivers/gpu/drm/omapdrm/dss/Makefile            |    5 +-
 drivers/gpu/drm/omapdrm/dss/base.c              |   11 +-
 drivers/gpu/drm/omapdrm/dss/core.c              |   88 --
 drivers/gpu/drm/omapdrm/dss/dispc.c             |  128 +-
 drivers/gpu/drm/omapdrm/dss/dispc.h             |   33 +
 drivers/gpu/drm/omapdrm/dss/dispc6.c            | 1438 +++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/dispc6.h            |  109 ++
 drivers/gpu/drm/omapdrm/dss/dpi6.c              |  283 +++++
 drivers/gpu/drm/omapdrm/dss/dss.c               |   58 +-
 drivers/gpu/drm/omapdrm/dss/dss.h               |   43 +-
 drivers/gpu/drm/omapdrm/dss/dss6.c              |  346 ++++++
 drivers/gpu/drm/omapdrm/dss/dss6.h              |   54 +
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c |    1 +
 drivers/gpu/drm/omapdrm/dss/omapdss.h           |  135 ++-
 drivers/gpu/drm/omapdrm/omap_crtc.c             |   30 +-
 drivers/gpu/drm/omapdrm/omap_crtc.h             |    2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c              |    4 +-
 drivers/gpu/drm/omapdrm/omap_drv.h              |    5 +-
 drivers/gpu/drm/omapdrm/omap_irq.c              |  107 +-
 drivers/gpu/drm/omapdrm/omap_irq.h              |    2 +-
 drivers/gpu/drm/omapdrm/omap_plane.c            |   18 +-
 drivers/gpu/drm/omapdrm/omap_plane.h            |    1 +
 23 files changed, 2607 insertions(+), 302 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/core.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dispc6.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dispc6.h
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dpi6.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dss6.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dss6.h
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

RFC PATCH 1/9 drm/omap: Update omapdss API to allow alternative DSS implementations

After this patch OMAP_DSS_BASE module is not including any OMAP2_DSS headers, only the API omapdss.h. "sturct dss_data", the piece of the data structure needed for base.c is defined in omapdss.h and added as a member to struct dss_device, and later to struct dss6_device.

The patch is still a bit hackish. The struct dispc_device declaration is currently shared between alternative dss implementations, with different internal definitions. It should be relatively simple to use a similar struct dispc_data as struct dss_data is for dss_device, move some common parts - maybe the dispc_ops itself - there and find the private data with container_of macro. Also the contents of struct dss_data in side dss_device is currently redundant. These should be easy enough to fix, if we decide to take this route.

---
 drivers/gpu/drm/omapdrm/dss/base.c    | 11 +++++------
 drivers/gpu/drm/omapdrm/dss/dispc.c   |  4 ++++
 drivers/gpu/drm/omapdrm/dss/dss.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/dss.h     |  2 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 +++++++++----
 drivers/gpu/drm/omapdrm/omap_drv.h    |  2 +-
 6 files changed, 22 insertions(+), 12 deletions(-)
drivers/gpu/drm/omapdrm/dss/base.c +5 -6
index 99e8cb8..42442f3 100644
@@ -19,10 +19,9 @@
 #include <linux/of_graph.h>
 #include <linux/list.h>
 
-#include "dss.h"
 #include "omapdss.h"
 
-static struct dss_device *dss_device;
+static struct dss_data *dss_device;
 
 static struct list_head omapdss_comp_list;
 
@@ -32,25 +31,25 @@ struct omapdss_comp_node {
 	bool dss_core_component;
 };
 
-struct dss_device *omapdss_get_dss(void)
+struct dss_data *omapdss_get_dss(void)
 {
 	return dss_device;
 }
 EXPORT_SYMBOL(omapdss_get_dss);
 
-void omapdss_set_dss(struct dss_device *dss)
+void omapdss_set_dss(struct dss_data *dss)
 {
 	dss_device = dss;
 }
 EXPORT_SYMBOL(omapdss_set_dss);
 
-struct dispc_device *dispc_get_dispc(struct dss_device *dss)
+struct dispc_device *dispc_get_dispc(struct dss_data *dss)
 {
 	return dss->dispc;
 }
 EXPORT_SYMBOL(dispc_get_dispc);
 
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
+const struct dispc_ops *dispc_get_ops(struct dss_data *dss)
 {
 	return dss->dispc_ops;
 }
drivers/gpu/drm/omapdrm/dss/dispc.c +4 -0
index ce470b5..338490d 100644
@@ -4791,6 +4791,10 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
 						 dispc);
 
+	// XXX get rid of the above redundant data members
+	dss->data.dispc = dss->dispc;
+	dss->data.dispc_ops = dss->dispc_ops;
+
 	return 0;
 
 err_runtime_get:
drivers/gpu/drm/omapdrm/dss/dss.c +1 -1
index 4a08bd1..5752328 100644
@@ -1326,7 +1326,7 @@ static int dss_bind(struct device *dev)
 	pm_set_vt_switch(0);
 
 	omapdss_gather_components(dev);
-	omapdss_set_dss(dss);
+	omapdss_set_dss(&dss->data);
 
 	return 0;
 }
drivers/gpu/drm/omapdrm/dss/dss.h +2 -0
index 6f6fd3d..434262a 100644
@@ -273,6 +273,8 @@ struct dss_device {
 	struct dss_pll	*video1_pll;
 	struct dss_pll	*video2_pll;
 
+	struct dss_data data;
+	// XXX these are redundant, use data instead
 	struct dispc_device *dispc;
 	const struct dispc_ops *dispc_ops;
 };
drivers/gpu/drm/omapdrm/dss/omapdss.h +9 -4
index a4f71e0..1299dd6 100644
@@ -589,8 +589,13 @@ struct omap_dss_driver {
 		const struct hdmi_avi_infoframe *avi);
 };
 
-struct dss_device *omapdss_get_dss(void);
-void omapdss_set_dss(struct dss_device *dss);
+struct dss_data {
+	const struct dispc_ops *dispc_ops;
+	struct dispc_device *dispc;
+};
+
+struct dss_data *omapdss_get_dss(void);
+void omapdss_set_dss(struct dss_data *dss);
 static inline bool omapdss_is_initialized(void)
 {
 	return !!omapdss_get_dss();
@@ -749,8 +754,8 @@ struct dispc_ops {
 					  enum omap_plane_id plane);
 };
 
-struct dispc_device *dispc_get_dispc(struct dss_device *dss);
-const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
+struct dispc_device *dispc_get_dispc(struct dss_data *dss);
+const struct dispc_ops *dispc_get_ops(struct dss_data *dss);
 
 bool omapdss_component_is_display(struct device_node *node);
 bool omapdss_component_is_output(struct device_node *node);
drivers/gpu/drm/omapdrm/omap_drv.h +1 -1
index 6eaee4d..3b7ec7e 100644
@@ -50,7 +50,7 @@ struct omap_drm_private {
 	struct device *dev;
 	u32 omaprev;
 
-	struct dss_device *dss;
+	struct dss_data *dss;
 	struct dispc_device *dispc;
 	const struct dispc_ops *dispc_ops;
 
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#4 lore raw

RFC PATCH 2/9 drm/omap: Fail probe if irq registration fails

In reply to Jyri Sarha

Call to omap_drm_irq_install() may fail with an error code. In such a case the driver probe should fail.

---
 drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_drv.c +3 -1
index 65a567d..979bede 100644
@@ -321,7 +321,9 @@ static int omap_modeset_init(struct drm_device *dev)
 
 	drm_mode_config_reset(dev);
 
-	omap_drm_irq_install(dev);
+	ret = omap_drm_irq_install(dev);
+	if (ret)
+		return ret;
 
 	return 0;
 }
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#6 lore raw

RFC PATCH 3/9 drm/omap: Add ovl_name() and mgr_name() to dispc_ops

In reply to Jyri Sarha

Add ovl_name() and mgr_name() to dispc_ops and get rid of adhoc names here and there in the omapdrm code. This moves the names of hardware entities to omapdss side where they have to be when new omapdss backend drivers are introduced.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c   | 23 +++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  5 +++++
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 11 ++---------
 drivers/gpu/drm/omapdrm/omap_irq.c    | 19 +++++++------------
 drivers/gpu/drm/omapdrm/omap_plane.c  | 13 +++----------
 5 files changed, 40 insertions(+), 31 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +23 -0
index 338490d..6f83b3e 100644
@@ -694,6 +694,26 @@ void dispc_runtime_put(struct dispc_device *dispc)
 	WARN_ON(r < 0 && r != -ENOSYS);
 }
 
+static const char *dispc_ovl_name(struct dispc_device *dispc,
+				  enum omap_plane_id plane)
+{
+	static const char * const ovl_names[] = {
+		[OMAP_DSS_GFX]		= "GFX",
+		[OMAP_DSS_VIDEO1]	= "VID1",
+		[OMAP_DSS_VIDEO2]	= "VID2",
+		[OMAP_DSS_VIDEO3]	= "VID3",
+		[OMAP_DSS_WB]		= "WB",
+	};
+
+	return ovl_names[plane];
+}
+
+static const char *dispc_mgr_name(struct dispc_device *dispc,
+				  enum omap_channel channel)
+{
+	return mgr_desc[channel].name;
+}
+
 static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
 				   enum omap_channel channel)
 {
@@ -4662,6 +4682,9 @@ static const struct dispc_ops dispc_ops = {
 	.get_num_ovls = dispc_get_num_ovls,
 	.get_num_mgrs = dispc_get_num_mgrs,
 
+	.ovl_name = dispc_ovl_name,
+	.mgr_name = dispc_mgr_name,
+
 	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
 
 	.mgr_enable = dispc_mgr_enable,
drivers/gpu/drm/omapdrm/dss/omapdss.h +5 -0
index 1299dd6..b84cfd8 100644
@@ -711,6 +711,11 @@ struct dispc_ops {
 	int (*get_num_ovls)(struct dispc_device *dispc);
 	int (*get_num_mgrs)(struct dispc_device *dispc);
 
+	const char *(*ovl_name)(struct dispc_device *dispc,
+				enum omap_plane_id plane);
+	const char *(*mgr_name)(struct dispc_device *dispc,
+				enum omap_channel channel);
+
 	u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
 
 	void (*mgr_enable)(struct dispc_device *dispc,
drivers/gpu/drm/omapdrm/omap_crtc.c +2 -9
index 6c4d40b..00ec959 100644
@@ -672,13 +672,6 @@ static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = {
  * Init and Cleanup
  */
 
-static const char *channel_names[] = {
-	[OMAP_DSS_CHANNEL_LCD] = "lcd",
-	[OMAP_DSS_CHANNEL_DIGIT] = "tv",
-	[OMAP_DSS_CHANNEL_LCD2] = "lcd2",
-	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
-};
-
 void omap_crtc_pre_init(struct omap_drm_private *priv)
 {
 	memset(omap_crtcs, 0, sizeof(omap_crtcs));
@@ -706,7 +699,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 	channel = out->dispc_channel;
 	omap_dss_put_device(out);
 
-	DBG("%s", channel_names[channel]);
+	DBG("%s", priv->dispc_ops->mgr_name(priv->dispc, channel));
 
 	/* Multiple displays on same channel is not allowed */
 	if (WARN_ON(omap_crtcs[channel] != NULL))
@@ -721,7 +714,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 	init_waitqueue_head(&omap_crtc->pending_wait);
 
 	omap_crtc->channel = channel;
-	omap_crtc->name = channel_names[channel];
+	omap_crtc->name = priv->dispc_ops->mgr_name(priv->dispc, channel);
 
 	ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
 					&omap_crtc_funcs, NULL);
drivers/gpu/drm/omapdrm/omap_irq.c +7 -12
index c8511504..5cc88b6 100644
@@ -146,15 +146,10 @@ static void omap_irq_fifo_underflow(struct omap_drm_private *priv,
 {
 	static DEFINE_RATELIMIT_STATE(_rs, DEFAULT_RATELIMIT_INTERVAL,
 				      DEFAULT_RATELIMIT_BURST);
-	static const struct {
-		const char *name;
-		u32 mask;
-	} sources[] = {
-		{ "gfx", DISPC_IRQ_GFX_FIFO_UNDERFLOW },
-		{ "vid1", DISPC_IRQ_VID1_FIFO_UNDERFLOW },
-		{ "vid2", DISPC_IRQ_VID2_FIFO_UNDERFLOW },
-		{ "vid3", DISPC_IRQ_VID3_FIFO_UNDERFLOW },
-	};
+	static const u32 irqbits[] = { DISPC_IRQ_GFX_FIFO_UNDERFLOW,
+				       DISPC_IRQ_VID1_FIFO_UNDERFLOW,
+				       DISPC_IRQ_VID2_FIFO_UNDERFLOW,
+				       DISPC_IRQ_VID3_FIFO_UNDERFLOW };
 
 	const u32 mask = DISPC_IRQ_GFX_FIFO_UNDERFLOW
 		       | DISPC_IRQ_VID1_FIFO_UNDERFLOW
@@ -174,9 +169,9 @@ static void omap_irq_fifo_underflow(struct omap_drm_private *priv,
 
 	DRM_ERROR("FIFO underflow on ");
 
-	for (i = 0; i < ARRAY_SIZE(sources); ++i) {
-		if (sources[i].mask & irqstatus)
-			pr_cont("%s ", sources[i].name);
+	for (i = 0; i < ARRAY_SIZE(irqbits); ++i) {
+		if (irqbits[i] & irqstatus)
+			pr_cont("%s ", priv->dispc_ops->ovl_name(priv->dispc, i));
 	}
 
 	pr_cont("(0x%08x)\n", irqstatus);
drivers/gpu/drm/omapdrm/omap_plane.c +3 -10
index 2899435..61b0753 100644
@@ -239,13 +239,6 @@ static const struct drm_plane_funcs omap_plane_funcs = {
 	.atomic_get_property = omap_plane_atomic_get_property,
 };
 
-static const char *plane_id_to_name[] = {
-	[OMAP_DSS_GFX] = "gfx",
-	[OMAP_DSS_VIDEO1] = "vid1",
-	[OMAP_DSS_VIDEO2] = "vid2",
-	[OMAP_DSS_VIDEO3] = "vid3",
-};
-
 static const enum omap_plane_id plane_idx_to_id[] = {
 	OMAP_DSS_GFX,
 	OMAP_DSS_VIDEO1,
@@ -272,7 +265,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 
 	id = plane_idx_to_id[idx];
 
-	DBG("%s: type=%d", plane_id_to_name[id], type);
+	DBG("%s: type=%d", priv->dispc_ops->ovl_name(priv->dispc, id), type);
 
 	omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL);
 	if (!omap_plane)
@@ -282,7 +275,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 	for (nformats = 0; formats[nformats]; ++nformats)
 		;
 	omap_plane->id = id;
-	omap_plane->name = plane_id_to_name[id];
+	omap_plane->name = priv->dispc_ops->ovl_name(priv->dispc, id);
 
 	plane = &omap_plane->base;
 
@@ -301,7 +294,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 
 error:
 	dev_err(dev->dev, "%s(): could not create plane: %s\n",
-		__func__, plane_id_to_name[id]);
+		__func__, priv->dispc_ops->ovl_name(priv->dispc, id));
 
 	kfree(omap_plane);
 	return NULL;
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#13 lore raw

RFC PATCH 4/9 drm/omap: Make omapdss API more generic

In reply to Jyri Sarha

The new omapdss API is HW independent and cleans up some of the DSS5 specific hacks from the omapdrm side and gets rid off the DSS5 IRQ register bits and replace them with HW independent generic u64 based macros. The new macros make it more straight forward to implement the IRQ code for the future DSS versions that do not share the same register structure as DSS2 to DSS5 has.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c   | 115 +++++++++++++++++++++++++---------
 drivers/gpu/drm/omapdrm/dss/dispc.h   |  33 ++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  80 +++++++++++------------
 drivers/gpu/drm/omapdrm/omap_crtc.c   |  19 +++---
 drivers/gpu/drm/omapdrm/omap_crtc.h   |   2 +-
 drivers/gpu/drm/omapdrm/omap_drv.h    |   3 +-
 drivers/gpu/drm/omapdrm/omap_irq.c    | 102 ++++++++++++------------------
 drivers/gpu/drm/omapdrm/omap_irq.h    |   2 +-
 drivers/gpu/drm/omapdrm/omap_plane.c  |   7 +++
 drivers/gpu/drm/omapdrm/omap_plane.h  |   1 +
 10 files changed, 219 insertions(+), 145 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +84 -31
index 6f83b3e..3df0a88 100644
@@ -714,30 +714,11 @@ static const char *dispc_mgr_name(struct dispc_device *dispc,
 	return mgr_desc[channel].name;
 }
 
-static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
-				   enum omap_channel channel)
+static bool dispc_mgr_has_framedone(struct dispc_device *dispc,
+				    enum omap_channel channel)
 {
-	return mgr_desc[channel].vsync_irq;
-}
-
-static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
-				       enum omap_channel channel)
-{
-	if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
-		return 0;
-
-	return mgr_desc[channel].framedone_irq;
-}
-
-static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
-				       enum omap_channel channel)
-{
-	return mgr_desc[channel].sync_lost_irq;
-}
-
-u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
-{
-	return DISPC_IRQ_FRAMEDONEWB;
+	return channel != OMAP_DSS_CHANNEL_DIGIT ||
+		dispc->feat->no_framedone_tv;
 }
 
 static void dispc_mgr_enable(struct dispc_device *dispc,
@@ -3752,6 +3733,77 @@ static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask)
 	dispc_read_reg(dispc, DISPC_IRQENABLE);
 }
 
+struct dispc_irq_bit {
+	u32 hw;
+	u64 api;
+};
+
+static const struct dispc_irq_bit dispc_irq_bits[] = {
+	{ DISPC_IRQ_OCP_ERR, DSS_IRQ_DEVICE_OCP_ERR },
+
+	{ DISPC_IRQ_FRAMEDONE, DSS_IRQ_MGR_FRAME_DONE(0) },
+	{ DISPC_IRQ_VSYNC, DSS_IRQ_MGR_VSYNC_EVEN(0) },
+	{ DISPC_IRQ_SYNC_LOST, DSS_IRQ_MGR_SYNC_LOST(0) },
+
+	{ DISPC_IRQ_EVSYNC_EVEN, DSS_IRQ_MGR_VSYNC_EVEN(1) },
+	{ DISPC_IRQ_EVSYNC_ODD, DSS_IRQ_MGR_VSYNC_ODD(1) },
+	{ DISPC_IRQ_SYNC_LOST_DIGIT, DSS_IRQ_MGR_SYNC_LOST(1) },
+	{ DISPC_IRQ_FRAMEDONETV, DSS_IRQ_MGR_FRAME_DONE(1) },
+
+	{ DISPC_IRQ_SYNC_LOST2, DSS_IRQ_MGR_SYNC_LOST(2) },
+	{ DISPC_IRQ_VSYNC2, DSS_IRQ_MGR_VSYNC_EVEN(2) },
+	{ DISPC_IRQ_FRAMEDONE2, DSS_IRQ_MGR_FRAME_DONE(2) },
+
+	{ DISPC_IRQ_SYNC_LOST3, DSS_IRQ_MGR_SYNC_LOST(3) },
+	{ DISPC_IRQ_VSYNC3, DSS_IRQ_MGR_VSYNC_EVEN(3) },
+	{ DISPC_IRQ_FRAMEDONE3, DSS_IRQ_MGR_FRAME_DONE(3) },
+
+	{ DISPC_IRQ_GFX_FIFO_UNDERFLOW, DSS_IRQ_OVL_FIFO_UNDERFLOW(0) },
+	{ DISPC_IRQ_VID1_FIFO_UNDERFLOW, DSS_IRQ_OVL_FIFO_UNDERFLOW(1) },
+	{ DISPC_IRQ_VID2_FIFO_UNDERFLOW, DSS_IRQ_OVL_FIFO_UNDERFLOW(2) },
+	{ DISPC_IRQ_VID3_FIFO_UNDERFLOW, DSS_IRQ_OVL_FIFO_UNDERFLOW(3) },
+};
+
+static u64 dispc_hw_to_api_irq(u32 hw)
+{
+	u64 api = 0;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(dispc_irq_bits); i++)
+		if (hw & dispc_irq_bits[i].hw)
+			api |= dispc_irq_bits[i].api;
+
+	return api;
+}
+
+static u32 dispc_api_to_hw_irq(u64 api)
+{
+	u32 hw = 0;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(dispc_irq_bits); i++)
+		if (api & dispc_irq_bits[i].api)
+			hw |= dispc_irq_bits[i].hw;
+
+	return hw;
+}
+
+static u64 dispc_api_read_and_clear_irqstatus(struct dispc_device *dispc)
+{
+	u32 hw_status = dispc_read_irqstatus(dispc);
+
+	dispc_clear_irqstatus(dispc, hw_status);
+
+	return dispc_hw_to_api_irq(hw_status);
+}
+
+static void dispc_api_write_irqenable(struct dispc_device *dispc, u64 enable)
+{
+	u32 hw_enable = dispc_api_to_hw_irq(enable);
+
+	dispc_write_irqenable(dispc, hw_enable);
+}
+
 void dispc_enable_sidle(struct dispc_device *dispc)
 {
 	/* SIDLEMODE: smart idle */
@@ -4473,6 +4525,10 @@ static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler,
 	if (dispc->user_handler != NULL)
 		return -EBUSY;
 
+	dispc_runtime_get(dispc);
+	dispc_clear_irqstatus(dispc, 0xffffffff);
+	dispc_runtime_put(dispc);
+
 	dispc->user_handler = handler;
 	dispc->user_data = dev_id;
 
@@ -4610,8 +4666,7 @@ static void dispc_errata_i734_wa_fini(struct dispc_device *dispc)
 
 static void dispc_errata_i734_wa(struct dispc_device *dispc)
 {
-	u32 framedone_irq = dispc_mgr_get_framedone_irq(dispc,
-							OMAP_DSS_CHANNEL_LCD);
+	u32 framedone_irq = DISPC_IRQ_FRAMEDONE;
 	struct omap_overlay_info ovli;
 	struct dss_lcd_mgr_config lcd_conf;
 	u32 gatestate;
@@ -4669,9 +4724,8 @@ static void dispc_errata_i734_wa(struct dispc_device *dispc)
 }
 
 static const struct dispc_ops dispc_ops = {
-	.read_irqstatus = dispc_read_irqstatus,
-	.clear_irqstatus = dispc_clear_irqstatus,
-	.write_irqenable = dispc_write_irqenable,
+	.read_and_clear_irqstatus = dispc_api_read_and_clear_irqstatus,
+	.write_irqenable = dispc_api_write_irqenable,
 
 	.request_irq = dispc_request_irq,
 	.free_irq = dispc_free_irq,
@@ -4685,13 +4739,12 @@ static const struct dispc_ops dispc_ops = {
 	.ovl_name = dispc_ovl_name,
 	.mgr_name = dispc_mgr_name,
 
+	.mgr_has_framedone = dispc_mgr_has_framedone,
+
 	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
 
 	.mgr_enable = dispc_mgr_enable,
 	.mgr_is_enabled = dispc_mgr_is_enabled,
-	.mgr_get_vsync_irq = dispc_mgr_get_vsync_irq,
-	.mgr_get_framedone_irq = dispc_mgr_get_framedone_irq,
-	.mgr_get_sync_lost_irq = dispc_mgr_get_sync_lost_irq,
 	.mgr_go_busy = dispc_mgr_go_busy,
 	.mgr_go = dispc_mgr_go,
 	.mgr_set_lcd_config = dispc_mgr_set_lcd_config,
drivers/gpu/drm/omapdrm/dss/dispc.h +33 -0
index e901dd1..e71266e 100644
@@ -18,6 +18,39 @@
 #ifndef __OMAP2_DISPC_REG_H
 #define __OMAP2_DISPC_REG_H
 
+/* DISPC IRQ bits */
+#define DISPC_IRQ_FRAMEDONE		(1 << 0)
+#define DISPC_IRQ_VSYNC			(1 << 1)
+#define DISPC_IRQ_EVSYNC_EVEN		(1 << 2)
+#define DISPC_IRQ_EVSYNC_ODD		(1 << 3)
+#define DISPC_IRQ_ACBIAS_COUNT_STAT	(1 << 4)
+#define DISPC_IRQ_PROG_LINE_NUM		(1 << 5)
+#define DISPC_IRQ_GFX_FIFO_UNDERFLOW	(1 << 6)
+#define DISPC_IRQ_GFX_END_WIN		(1 << 7)
+#define DISPC_IRQ_PAL_GAMMA_MASK	(1 << 8)
+#define DISPC_IRQ_OCP_ERR		(1 << 9)
+#define DISPC_IRQ_VID1_FIFO_UNDERFLOW	(1 << 10)
+#define DISPC_IRQ_VID1_END_WIN		(1 << 11)
+#define DISPC_IRQ_VID2_FIFO_UNDERFLOW	(1 << 12)
+#define DISPC_IRQ_VID2_END_WIN		(1 << 13)
+#define DISPC_IRQ_SYNC_LOST		(1 << 14)
+#define DISPC_IRQ_SYNC_LOST_DIGIT	(1 << 15)
+#define DISPC_IRQ_WAKEUP		(1 << 16)
+#define DISPC_IRQ_SYNC_LOST2		(1 << 17)
+#define DISPC_IRQ_VSYNC2		(1 << 18)
+#define DISPC_IRQ_VID3_END_WIN		(1 << 19)
+#define DISPC_IRQ_VID3_FIFO_UNDERFLOW	(1 << 20)
+#define DISPC_IRQ_ACBIAS_COUNT_STAT2	(1 << 21)
+#define DISPC_IRQ_FRAMEDONE2		(1 << 22)
+#define DISPC_IRQ_FRAMEDONEWB		(1 << 23)
+#define DISPC_IRQ_FRAMEDONETV		(1 << 24)
+#define DISPC_IRQ_WBBUFFEROVERFLOW	(1 << 25)
+#define DISPC_IRQ_WBUNCOMPLETEERROR	(1 << 26)
+#define DISPC_IRQ_SYNC_LOST3		(1 << 27)
+#define DISPC_IRQ_VSYNC3		(1 << 28)
+#define DISPC_IRQ_ACBIAS_COUNT_STAT3	(1 << 29)
+#define DISPC_IRQ_FRAMEDONE3		(1 << 30)
+
 /* DISPC common registers */
 #define DISPC_REVISION			0x0000
 #define DISPC_SYSCONFIG			0x0010
drivers/gpu/drm/omapdrm/dss/omapdss.h +40 -40

104 lines not on this page · raw message

drivers/gpu/drm/omapdrm/omap_crtc.c +9 -10
index 00ec959..85fc2b8 100644
@@ -153,7 +153,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 	enum omap_channel channel = omap_crtc->channel;
 	struct omap_irq_wait *wait;
-	u32 framedone_irq, vsync_irq;
+	u64 vsync_irq;
 	int ret;
 
 	if (WARN_ON(omap_crtc->enabled == enable))
@@ -173,10 +173,8 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 		omap_crtc->ignore_digit_sync_lost = true;
 	}
 
-	framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc,
-							       channel);
-	vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel);
-
+	vsync_irq = (DSS_IRQ_MGR_VSYNC_EVEN(channel) |
+		     DSS_IRQ_MGR_VSYNC_ODD(channel));
 	if (enable) {
 		wait = omap_irq_wait_init(dev, vsync_irq, 1);
 	} else {
@@ -189,8 +187,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
 		 * even and odd frames.
 		 */
 
-		if (framedone_irq)
-			wait = omap_irq_wait_init(dev, framedone_irq, 1);
+		if (priv->dispc_ops->mgr_has_framedone(priv->dispc, channel))
+			wait = omap_irq_wait_init(dev,
+					DSS_IRQ_MGR_FRAME_DONE(channel), 1);
 		else
 			wait = omap_irq_wait_init(dev, vsync_irq, 2);
 	}
@@ -281,17 +280,17 @@ static const struct dss_mgr_ops mgr_ops = {
  * Setup, Flush and Page Flip
  */
 
-void omap_crtc_error_irq(struct drm_crtc *crtc, u32 irqstatus)
+void omap_crtc_error_irq(struct drm_crtc *crtc, u64 irqstatus)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
 
 	if (omap_crtc->ignore_digit_sync_lost) {
-		irqstatus &= ~DISPC_IRQ_SYNC_LOST_DIGIT;
+		irqstatus &= ~DSS_IRQ_MGR_SYNC_LOST(omap_crtc->channel);
 		if (!irqstatus)
 			return;
 	}
 
-	DRM_ERROR_RATELIMITED("%s: errors: %08x\n", omap_crtc->name, irqstatus);
+	DRM_ERROR_RATELIMITED("%s: errors: %016llx\n", omap_crtc->name, irqstatus);
 }
 
 void omap_crtc_vblank_irq(struct drm_crtc *crtc)
drivers/gpu/drm/omapdrm/omap_crtc.h +1 -1
index eaab2d7..3c441ea 100644
@@ -37,7 +37,7 @@ void omap_crtc_pre_uninit(void);
 struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 		struct drm_plane *plane, struct omap_dss_device *dssdev);
 int omap_crtc_wait_pending(struct drm_crtc *crtc);
-void omap_crtc_error_irq(struct drm_crtc *crtc, u32 irqstatus);
+void omap_crtc_error_irq(struct drm_crtc *crtc, u64 irqstatus);
 void omap_crtc_vblank_irq(struct drm_crtc *crtc);
 
 #endif /* __OMAPDRM_CRTC_H__ */
drivers/gpu/drm/omapdrm/omap_drv.h +2 -1
index 3b7ec7e..08c8c11 100644
@@ -85,7 +85,8 @@ struct omap_drm_private {
 	/* irq handling: */
 	spinlock_t wait_lock;		/* protects the wait_list */
 	struct list_head wait_list;	/* list of omap_irq_wait */
-	u32 irq_mask;			/* enabled irqs in addition to wait_list */
+	u64 irq_mask;			/* enabled irqs in addition to wait_list */
+	u64 irq_uf_mask;		/* underflow irq bits for all planes */
 
 	/* memory bandwidth limit if it is needed on the platform */
 	unsigned int max_bandwidth;
drivers/gpu/drm/omapdrm/omap_irq.c +41 -61

212 lines not on this page · raw message

drivers/gpu/drm/omapdrm/omap_irq.h +1 -1
index 9d54414..8a7971d 100644
@@ -32,7 +32,7 @@ void omap_drm_irq_uninstall(struct drm_device *dev);
 int omap_drm_irq_install(struct drm_device *dev);
 
 struct omap_irq_wait *omap_irq_wait_init(struct drm_device *dev,
-		u32 irqmask, int count);
+		u64 irqmask, int count);
 int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
 		unsigned long timeout);
 
drivers/gpu/drm/omapdrm/omap_plane.c +7 -0
index 61b0753..be803a2 100644
@@ -239,6 +239,13 @@ static const struct drm_plane_funcs omap_plane_funcs = {
 	.atomic_get_property = omap_plane_atomic_get_property,
 };
 
+enum omap_plane_id omap_plane_get_id(struct drm_plane *plane)
+{
+	struct omap_plane *omap_plane = to_omap_plane(plane);
+
+	return omap_plane->id;
+}
+
 static const enum omap_plane_id plane_idx_to_id[] = {
 	OMAP_DSS_GFX,
 	OMAP_DSS_VIDEO1,
drivers/gpu/drm/omapdrm/omap_plane.h +1 -0
index dc5e82a..dbab345 100644
@@ -33,5 +33,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
 		u32 possible_crtcs);
 void omap_plane_install_properties(struct drm_plane *plane,
 		struct drm_mode_object *obj);
+enum omap_plane_id omap_plane_get_id(struct drm_plane *plane);
 
 #endif /* __OMAPDRM_PLANE_H__ */
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#15 lore raw

RFC PATCH 5/9 drm/omap: move common stuff from dss.h to omapdss.h

In reply to Jyri Sarha

The new DSS6 driver needs some structs and defines which are currently in dss.h, which is for the old DSS driver.

Move the required structs and defines from dss.h to omapdss.h.

---
 drivers/gpu/drm/omapdrm/dss/dss.h     | 41 ++---------------------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 37 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 39 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.h +2 -39
index 434262a..fa206ca 100644
@@ -70,14 +70,6 @@ struct seq_file;
 	pr_warn("omapdss: " format, ##__VA_ARGS__)
 #endif
 
-/* OMAP TRM gives bitfields as start:end, where start is the higher bit
-   number. For example 7:0 */
-#define FLD_MASK(start, end)	(((1 << ((start) - (end) + 1)) - 1) << (end))
-#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
-#define FLD_GET(val, start, end) (((val) & FLD_MASK(start, end)) >> (end))
-#define FLD_MOD(orig, val, start, end) \
-	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
-
 enum dss_model {
 	DSS_MODEL_OMAP2,
 	DSS_MODEL_OMAP3,
@@ -86,12 +78,6 @@ enum dss_model {
 	DSS_MODEL_DRA7,
 };
 
-enum dss_io_pad_mode {
-	DSS_IO_PAD_MODE_RESET,
-	DSS_IO_PAD_MODE_RFBI,
-	DSS_IO_PAD_MODE_BYPASS,
-};
-
 enum dss_hdmi_venc_clk_source_select {
 	DSS_VENC_TV_CLK = 0,
 	DSS_HDMI_M_PCLK = 1,
@@ -215,34 +201,11 @@ struct dss_reg_field {
 	u8 start, end;
 };
 
-struct dispc_clock_info {
-	/* rates that we get with dividers below */
-	unsigned long lck;
-	unsigned long pck;
-
-	/* dividers */
-	u16 lck_div;
-	u16 pck_div;
-};
-
-struct dss_lcd_mgr_config {
-	enum dss_io_pad_mode io_pad_mode;
-
-	bool stallmode;
-	bool fifohandcheck;
-
-	struct dispc_clock_info clock_info;
-
-	int video_port_width;
-
-	int lcden_sig_polarity;
-};
-
-#define DSS_SZ_REGS			SZ_512
+#define DSS_SZ_REGS                    SZ_512
 
 struct dss_device {
 	struct platform_device *pdev;
-	void __iomem    *base;
+	void __iomem	*base;
 	struct regmap	*syscon_pll_ctrl;
 	u32		syscon_pll_ctrl_offset;
 
drivers/gpu/drm/omapdrm/dss/omapdss.h +37 -0
index 493237e..9d789c2 100644
@@ -647,6 +647,43 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node);
 
+/* OMAP TRM gives bitfields as start:end, where start is the higher bit
+   number. For example 7:0 */
+#define FLD_MASK(start, end)	(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+#define FLD_GET(val, start, end) (((val) & FLD_MASK(start, end)) >> (end))
+#define FLD_MOD(orig, val, start, end) \
+	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
+
+enum dss_io_pad_mode {
+	DSS_IO_PAD_MODE_RESET,
+	DSS_IO_PAD_MODE_RFBI,
+	DSS_IO_PAD_MODE_BYPASS,
+};
+
+struct dispc_clock_info {
+	/* rates that we get with dividers below */
+	unsigned long lck;
+	unsigned long pck;
+
+	/* dividers */
+	u16 lck_div;
+	u16 pck_div;
+};
+
+struct dss_lcd_mgr_config {
+	enum dss_io_pad_mode io_pad_mode;
+
+	bool stallmode;
+	bool fifohandcheck;
+
+	struct dispc_clock_info clock_info;
+
+	int video_port_width;
+
+	int lcden_sig_polarity;
+};
+
 struct device_node *dss_of_port_get_parent_device(struct device_node *port);
 u32 dss_of_port_get_port_number(struct device_node *port);
 
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#18 lore raw

RFC PATCH 6/9 drm/omap: dss: Move platform_device_register from core.c to dss.c probe

In reply to Jyri Sarha

Register the omapdrm device when we know that dss device probe going to succeed. This avoids DSS6 and DSS2 omapdrm device registration from colliding with each other.

---
 drivers/gpu/drm/omapdrm/dss/core.c | 26 ++------------------------
 drivers/gpu/drm/omapdrm/dss/dss.c  | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/omapdrm/dss/core.c +2 -24
index acef7ec..6c9f667 100644
@@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[] = {
 #endif
 };
 
-static struct platform_device *omap_drm_device;
-
 static int __init omap_dss_init(void)
 {
-	int r;
-
-	r = platform_register_drivers(omap_dss_drivers,
-				      ARRAY_SIZE(omap_dss_drivers));
-	if (r)
-		goto err_reg;
-
-	omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
-	if (IS_ERR(omap_drm_device)) {
-		r = PTR_ERR(omap_drm_device);
-		goto err_reg;
-	}
-
-	return 0;
-
-err_reg:
-	platform_unregister_drivers(omap_dss_drivers,
-				    ARRAY_SIZE(omap_dss_drivers));
-
-	return r;
+	return platform_register_drivers(omap_dss_drivers,
+					 ARRAY_SIZE(omap_dss_drivers));
 }
 
 static void __exit omap_dss_exit(void)
 {
-	platform_device_unregister(omap_drm_device);
-
 	platform_unregister_drivers(omap_dss_drivers,
 				    ARRAY_SIZE(omap_dss_drivers));
 }
drivers/gpu/drm/omapdrm/dss/dss.c +19 -0
index 5752328..dda3237 100644
@@ -1314,6 +1314,17 @@ static const struct soc_device_attribute dss_soc_devices[] = {
 	{ /* sentinel */ }
 };
 
+static struct platform_device *omap_drm_device;
+
+static int initialize_omapdrm_device(void)
+{
+	omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
+	if (IS_ERR(omap_drm_device))
+		return PTR_ERR(omap_drm_device);
+
+	return 0;
+}
+
 static int dss_bind(struct device *dev)
 {
 	struct dss_device *dss = dev_get_drvdata(dev);
@@ -1323,6 +1334,12 @@ static int dss_bind(struct device *dev)
 	if (r)
 		return r;
 
+	r = initialize_omapdrm_device();
+	if (r) {
+		component_unbind_all(dev, NULL);
+		return r;
+	}
+
 	pm_set_vt_switch(0);
 
 	omapdss_gather_components(dev);
@@ -1335,6 +1352,8 @@ static void dss_unbind(struct device *dev)
 {
 	omapdss_set_dss(NULL);
 
+	platform_device_unregister(omap_drm_device);
+
 	component_unbind_all(dev, NULL);
 }
 
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#20 lore raw

RFC PATCH 7/9 drm/omap: dss: platform_register_drivers() to dss.c and remove core.c

In reply to Jyri Sarha

The core.c just for registering the drivers is kind of useless. Let's get rid of it and register the dss drivers in dss.c.

---
 drivers/gpu/drm/omapdrm/dss/Makefile |  2 +-
 drivers/gpu/drm/omapdrm/dss/core.c   | 66 ------------------------------------
 drivers/gpu/drm/omapdrm/dss/dss.c    | 37 ++++++++++++++++++++
 3 files changed, 38 insertions(+), 67 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/core.c
drivers/gpu/drm/omapdrm/dss/Makefile +1 -1
index 904101c..5950c3f 100644
@@ -6,7 +6,7 @@ omapdss-base-y := base.o display.o dss-of.o output.o
 
 obj-$(CONFIG_OMAP2_DSS) += omapdss.o
 # Core DSS files
-omapdss-y := core.o dss.o dispc.o dispc_coefs.o \
+omapdss-y := dss.o dispc.o dispc_coefs.o \
 	pll.o video-pll.o
 omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
 omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
drivers/gpu/drm/omapdrm/dss/core.c deleted +0 -66

66 lines not on this page · raw message

drivers/gpu/drm/omapdrm/dss/dss.c +37 -0
index dda3237..162fa3a 100644
@@ -1619,3 +1619,40 @@ struct platform_driver omap_dsshw_driver = {
 		.suppress_bind_attrs = true,
 	},
 };
+
+/* INIT */
+static struct platform_driver * const omap_dss_drivers[] = {
+	&omap_dsshw_driver,
+	&omap_dispchw_driver,
+#ifdef CONFIG_OMAP2_DSS_DSI
+	&omap_dsihw_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+	&omap_venchw_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+	&omapdss_hdmi4hw_driver,
+#endif
+#ifdef CONFIG_OMAP5_DSS_HDMI
+	&omapdss_hdmi5hw_driver,
+#endif
+};
+
+static int __init omap_dss_init(void)
+{
+	return platform_register_drivers(omap_dss_drivers,
+					 ARRAY_SIZE(omap_dss_drivers));
+}
+
+static void __exit omap_dss_exit(void)
+{
+	platform_unregister_drivers(omap_dss_drivers,
+				    ARRAY_SIZE(omap_dss_drivers));
+}
+
+module_init(omap_dss_init);
+module_exit(omap_dss_exit);
+
+MODULE_AUTHOR("Tomi Valkeinen <[email protected]>");
+MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
+MODULE_LICENSE("GPL v2");
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#22 lore raw

RFC PATCH 8/9 drm/omap: add TI DSS6 driver

In reply to Jyri Sarha

From: Tomi Valkeinen <[email protected]>

Add support for DSS6 IP on TI K2G SoC.

DSS6 is an evolution of the OMAP DSS (DSS2). OMAP DSS has been quite similar from OMAP2 to OMAP5 (including DRA7 and AM5 which have basically the same IP as OMAP5), but in DSS6 lots of things have been restructured.

DSS6 can still be considered as being the same family as DSS2, as the features offered are mostly the same, and the model how things happen and work are the same. What's changed are the registers and how the functionalities in the IP are divided.

Thus there was not much point in trying to share the low level parts of the driver, and instead a new driver was written from scratch.

This patch adds a new DSS driver for DSS6. The DSS2's panel and encoder drivers and also omapdrm driver can be used with DSS6.

---
 drivers/gpu/drm/omapdrm/dss/Kconfig  |    8 +
 drivers/gpu/drm/omapdrm/dss/Makefile |    3 +
 drivers/gpu/drm/omapdrm/dss/dispc6.c | 1438 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/dispc6.h |  109 +++
 drivers/gpu/drm/omapdrm/dss/dpi6.c   |  283 +++++++
 drivers/gpu/drm/omapdrm/dss/dss6.c   |  346 ++++++++
 drivers/gpu/drm/omapdrm/dss/dss6.h   |   54 ++
 7 files changed, 2241 insertions(+)
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dispc6.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dispc6.h
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dpi6.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dss6.c
 create mode 100644 drivers/gpu/drm/omapdrm/dss/dss6.h
drivers/gpu/drm/omapdrm/dss/Kconfig +8 -0
index f24ebf7..82faea6 100644
@@ -132,3 +132,11 @@ config OMAP2_DSS_SLEEP_AFTER_VENC_RESET
 	  disable the sleep if it doesn't cause problems on your platform.
 
 endif
+
+config TI_DSS6
+	tristate "TI DSS6 support"
+	select OMAP_DSS_BASE
+	select VIDEOMODE_HELPERS
+	select OMAP2_DSS_INIT
+	help
+	  Enable support for Texas Instruments DSS6 IP.
drivers/gpu/drm/omapdrm/dss/Makefile +3 -0
index 5950c3f..c669b2f 100644
@@ -18,3 +18,6 @@ omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi4.o hdmi4_core.o
 omapdss-$(CONFIG_OMAP4_DSS_HDMI_CEC) += hdmi4_cec.o
 omapdss-$(CONFIG_OMAP5_DSS_HDMI) += hdmi5.o hdmi5_core.o
 ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
+
+obj-$(CONFIG_TI_DSS6) += omapdss6.o
+omapdss6-y := dss6.o dispc6.o dpi6.o
drivers/gpu/drm/omapdrm/dss/dispc6.c new file +1438 -0

1,438 lines not on this page · raw message

drivers/gpu/drm/omapdrm/dss/dispc6.h new file +109 -0

109 lines not on this page · raw message

drivers/gpu/drm/omapdrm/dss/dpi6.c new file +283 -0

283 lines not on this page · raw message

drivers/gpu/drm/omapdrm/dss/dss6.c new file +346 -0

346 lines not on this page · raw message

drivers/gpu/drm/omapdrm/dss/dss6.h new file +54 -0

54 lines not on this page · raw message

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

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#23 lore raw

RFC PATCH 9/9 drm/omap: boot-init: add k2g-dss

In reply to Jyri Sarha

From: Tomi Valkeinen <[email protected]>

Add "ti,k2g-dss" to the list of DSS devices which need the mangling of the panels' & encoders' compatible strings.

---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c +1 -0
index 3bfb95d..698388e 100644
@@ -181,6 +181,7 @@ static const struct of_device_id omapdss_of_match[] __initconst = {
 	{ .compatible = "ti,omap4-dss", },
 	{ .compatible = "ti,omap5-dss", },
 	{ .compatible = "ti,dra7-dss", },
+	{ .compatible = "ti,k2g-dss", },
 	{},
 };
 
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

Re: [PATCH RFC 1/9] drm/omap: Update omapdss API to allow alternative DSS implementations

In reply to Jyri Sarha

Hi Jyri, Laurent,

Quoted 15 lines · Jyri Sarha

After this patch OMAP_DSS_BASE module is not including any OMAP2_DSS headers, only the API omapdss.h. "sturct dss_data", the piece of the data structure needed for base.c is defined in omapdss.h and added as a member to struct dss_device, and later to struct dss6_device.

The patch is still a bit hackish. The struct dispc_device declaration is currently shared between alternative dss implementations, with different internal definitions. It should be relatively simple to use a similar struct dispc_data as struct dss_data is for dss_device, move some common parts - maybe the dispc_ops itself - there and find the private data with container_of macro. Also the contents of struct dss_data in side dss_device is currently redundant. These should be easy enough to fix, if we decide to take this route.

Quoted 8 lines
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 11 +++++------
 drivers/gpu/drm/omapdrm/dss/dispc.c   |  4 ++++
 drivers/gpu/drm/omapdrm/dss/dss.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/dss.h     |  2 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 +++++++++----
 drivers/gpu/drm/omapdrm/omap_drv.h    |  2 +-
 6 files changed, 22 insertions(+), 12 deletions(-)

I think something in this direction would be good. I'd really like to keep it possible to run dss6 on top of omapdrm.

But I think this can be done slightly simpler like this:

drivers/gpu/drm/omapdrm/dss/base.c +11 -3
index 99e8cb8dc65b..08913e006e93 100644
@@ -19,10 +19,11 @@
 #include <linux/of_graph.h>
 #include <linux/list.h>
 
-#include "dss.h"
 #include "omapdss.h"
 
 static struct dss_device *dss_device;
+static struct dispc_device *s_dispc_device;
+static const struct dispc_ops *s_dispc_ops;
 
 static struct list_head omapdss_comp_list;
 
@@ -46,16 +47,23 @@ EXPORT_SYMBOL(omapdss_set_dss);
 
 struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
-	return dss->dispc;
+	return s_dispc_device;
 }
 EXPORT_SYMBOL(dispc_get_dispc);
 
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
 {
-	return dss->dispc_ops;
+	return s_dispc_ops;
 }
 EXPORT_SYMBOL(dispc_get_ops);
 
+void omapdss_set_dispc(struct dispc_device *dispc, const struct dispc_ops* dispc_ops)
+{
+	s_dispc_device = dispc;
+	s_dispc_ops = dispc_ops;
+}
+EXPORT_SYMBOL(omapdss_set_dispc);
+
 static bool omapdss_list_contains(const struct device_node *node)
 {
 	struct omapdss_comp_node *comp;
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -2
index ce470b51e326..b72f981d660e 100644
@@ -4786,7 +4786,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 	dispc_runtime_put(dispc);
 
 	dss->dispc = dispc;
-	dss->dispc_ops = &dispc_ops;
+	omapdss_set_dispc(dispc, &dispc_ops);
 
 	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
 						 dispc);
@@ -4807,8 +4807,8 @@ static void dispc_unbind(struct device *dev, struct device *master, void *data)
 
 	dss_debugfs_remove_file(dispc->debugfs);
 
+	omapdss_set_dispc(NULL, NULL);
 	dss->dispc = NULL;
-	dss->dispc_ops = NULL;
 
 	pm_runtime_disable(dev);
 
drivers/gpu/drm/omapdrm/dss/dss.h +0 -1
index 6f6fd3d1b159..3d23232ec1f7 100644
@@ -274,7 +274,6 @@ struct dss_device {
 	struct dss_pll	*video2_pll;
 
 	struct dispc_device *dispc;
-	const struct dispc_ops *dispc_ops;
 };
 
 /* core */
drivers/gpu/drm/omapdrm/dss/omapdss.h +1 -0
index a4f71e082c1c..b724dae22d7a 100644
@@ -751,6 +751,7 @@ struct dispc_ops {
 
 struct dispc_device *dispc_get_dispc(struct dss_device *dss);
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
+void omapdss_set_dispc(struct dispc_device *dispc, const struct dispc_ops* dispc_ops);
 
 bool omapdss_component_is_display(struct device_node *node);
 bool omapdss_component_is_output(struct device_node *node);

Yes, it adds two new globals. But I don't think those are a big issue. Note that I left the dss->dispc there, for dss internal use.

Laurent, what do you think? If this is fine, can you squash to your series? Or I can even have this on top as well. I think otherwise it's good for merging.

Can you also have a quick look at patches 2, 3, 4, 5, 6 and 7. While their aim is to get dss6 working, I think they're ok cleanups and shouldn't cause issues with the main dss rework.

Tomi

Signature · 5 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

Re: [PATCH RFC 5/9] drm/omap: move common stuff from dss.h to omapdss.h

In reply to Jyri Sarha

Hi Jyri,

Quoted 68 lines · Jyri Sarha

The new DSS6 driver needs some structs and defines which are currently in dss.h, which is for the old DSS driver.

Move the required structs and defines from dss.h to omapdss.h.

---
 drivers/gpu/drm/omapdrm/dss/dss.h     | 41 ++---------------------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 37 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 39 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.h +0 -34
index 434262a..fa206ca 100644
@@ -70,14 +70,6 @@ struct seq_file;
 	pr_warn("omapdss: " format, ##__VA_ARGS__)
 #endif
 
-/* OMAP TRM gives bitfields as start:end, where start is the higher bit
-   number. For example 7:0 */
-#define FLD_MASK(start, end)	(((1 << ((start) - (end) + 1)) - 1) << (end))
-#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
-#define FLD_GET(val, start, end) (((val) & FLD_MASK(start, end)) >> (end))
-#define FLD_MOD(orig, val, start, end) \
-	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
-
 enum dss_model {
 	DSS_MODEL_OMAP2,
 	DSS_MODEL_OMAP3,
@@ -86,12 +78,6 @@ enum dss_model {
 	DSS_MODEL_DRA7,
 };
 
-enum dss_io_pad_mode {
-	DSS_IO_PAD_MODE_RESET,
-	DSS_IO_PAD_MODE_RFBI,
-	DSS_IO_PAD_MODE_BYPASS,
-};
-
 enum dss_hdmi_venc_clk_source_select {
 	DSS_VENC_TV_CLK = 0,
 	DSS_HDMI_M_PCLK = 1,
@@ -215,34 +201,11 @@ struct dss_reg_field {
 	u8 start, end;
 };
 
-struct dispc_clock_info {
-	/* rates that we get with dividers below */
-	unsigned long lck;
-	unsigned long pck;
-
-	/* dividers */
-	u16 lck_div;
-	u16 pck_div;
-};
-
-struct dss_lcd_mgr_config {
-	enum dss_io_pad_mode io_pad_mode;
-
-	bool stallmode;
-	bool fifohandcheck;
-
-	struct dispc_clock_info clock_info;
-
-	int video_port_width;
-

drivers/gpu/drm/omapdrm/dss/dss.h struct dss_reg_field { · line 208

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/dss.h +2 -5
-	int lcden_sig_polarity;
-};
-
-#define DSS_SZ_REGS			SZ_512
+#define DSS_SZ_REGS                    SZ_512
 
 struct dss_device {
 	struct platform_device *pdev;
-	void __iomem    *base;
+	void __iomem	*base;

Extra changes here, and in the above SZ_REGS.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

Re: [PATCH RFC 4/9] drm/omap: Make omapdss API more generic

In reply to Jyri Sarha

Hi Jyri,

Quoted 6 lines · Jyri Sarha

The new omapdss API is HW independent and cleans up some of the DSS5 specific hacks from the omapdrm side and gets rid off the DSS5 IRQ register bits and replace them with HW independent generic u64 based macros. The new macros make it more straight forward to implement the IRQ code for the future DSS versions that do not share the same register structure as DSS2 to DSS5 has.

This removes DISPC_IRQ_FRAMEDONEWB.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 9/9
#24 lore raw

Re: [PATCH RFC 9/9] drm/omap: boot-init: add k2g-dss

In reply to Jyri Sarha

Hi Tomi,

Thank you for the patch.

Quoted 6 lines · On Friday, 16 February 2018 13:25:10 EET Jyri Sarha wrote:

From: Tomi Valkeinen <[email protected]>

Add "ti,k2g-dss" to the list of DSS devices which need the mangling of the panels' & encoders' compatible strings.

Based on the DT bindings from Documentation/devicetree/bindings/display/ti/ ti,k2g-dss.txt in [email protected]:jsarha/linux.git omapdrm-next-dss6,

Quoted 16 lines
---
 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c index 3bfb95d..698388e 100644

drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c +1 -0
@@ -181,6 +181,7 @@ static const struct of_device_id omapdss_of_match[]
 __initconst = { { .compatible = "ti,omap4-dss", },
 	{ .compatible = "ti,omap5-dss", },
 	{ .compatible = "ti,dra7-dss", },
+	{ .compatible = "ti,k2g-dss", },
 	{},
 };
Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 9/9] drm/omap: boot-init: add k2g-dss

Quoted 1 line · On Tuesday, 27 February 2018 16:15:11 EET Laurent Pinchart wrote:

Hi Tomi,

This should obviously have read Jyri :-)

Quoted 33 lines

Thank you for the patch.

Quoted 6 lines · On Friday, 16 February 2018 13:25:10 EET Jyri Sarha wrote:

From: Tomi Valkeinen <[email protected]>

Add "ti,k2g-dss" to the list of DSS devices which need the mangling of the panels' & encoders' compatible strings.

Based on the DT bindings from Documentation/devicetree/bindings/display/ti/ ti,k2g-dss.txt in [email protected]:jsarha/linux.git omapdrm-next-dss6,

Quoted 18 lines

---

 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c index 3bfb95d..698388e 100644

drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c +1 -0
@@ -181,6 +181,7 @@ static const struct of_device_id omapdss_of_match[]
 __initconst = {
 	{ .compatible = "ti,omap4-dss", },
 	{ .compatible = "ti,omap5-dss", },
 	{ .compatible = "ti,dra7-dss", },
+	{ .compatible = "ti,k2g-dss", },
 	{},
 };
Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 1/9] drm/omap: Update omapdss API to allow alternative DSS implementations

In reply to Tomi Valkeinen

Hi Tomi,

Quoted 130 lines · On Monday, 19 February 2018 14:01:05 EET Tomi Valkeinen wrote:
Quoted 17 lines · Jyri Sarha

After this patch OMAP_DSS_BASE module is not including any OMAP2_DSS headers, only the API omapdss.h. "sturct dss_data", the piece of the data structure needed for base.c is defined in omapdss.h and added as a member to struct dss_device, and later to struct dss6_device.

The patch is still a bit hackish. The struct dispc_device declaration is currently shared between alternative dss implementations, with different internal definitions. It should be relatively simple to use a similar struct dispc_data as struct dss_data is for dss_device, move some common parts - maybe the dispc_ops itself - there and find the private data with container_of macro. Also the contents of struct dss_data in side dss_device is currently redundant. These should be easy enough to fix, if we decide to take this route.

---

Quoted 7 lines
 drivers/gpu/drm/omapdrm/dss/base.c    | 11 +++++------
 drivers/gpu/drm/omapdrm/dss/dispc.c   |  4 ++++
 drivers/gpu/drm/omapdrm/dss/dss.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/dss.h     |  2 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 +++++++++----
 drivers/gpu/drm/omapdrm/omap_drv.h    |  2 +-
 6 files changed, 22 insertions(+), 12 deletions(-)

I think something in this direction would be good. I'd really like to keep it possible to run dss6 on top of omapdrm.

But I think this can be done slightly simpler like this:

(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/base.c index 99e8cb8dc65b..08913e006e93 100644

drivers/gpu/drm/omapdrm/dss/base.c +11 -3
@@ -19,10 +19,11 @@
 #include <linux/of_graph.h>
 #include <linux/list.h>
 
-#include "dss.h"
 #include "omapdss.h"
 
 static struct dss_device *dss_device;
+static struct dispc_device *s_dispc_device;
+static const struct dispc_ops *s_dispc_ops;
 
 static struct list_head omapdss_comp_list;
 
@@ -46,16 +47,23 @@ EXPORT_SYMBOL(omapdss_set_dss);
 
 struct dispc_device *dispc_get_dispc(struct dss_device *dss)
 {
-	return dss->dispc;
+	return s_dispc_device;
 }
 EXPORT_SYMBOL(dispc_get_dispc);
 
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
 {
-	return dss->dispc_ops;
+	return s_dispc_ops;
 }
 EXPORT_SYMBOL(dispc_get_ops);
 
+void omapdss_set_dispc(struct dispc_device *dispc, const struct dispc_ops*
 dispc_ops)
+{
+	s_dispc_device = dispc;
+	s_dispc_ops = dispc_ops;
+}
+EXPORT_SYMBOL(omapdss_set_dispc);
+
 static bool omapdss_list_contains(const struct device_node *node)
 {
drivers/gpu/drm/omapdrm/dss/base.c +0 -0
 	struct omapdss_comp_node *comp;
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dispc.c index ce470b51e326..b72f981d660e 100644

drivers/gpu/drm/omapdrm/dss/dispc.c +2 -2
@@ -4786,7 +4786,7 @@ static int dispc_bind(struct device *dev, struct
 device *master, void *data) dispc_runtime_put(dispc);
 
 	dss->dispc = dispc;
-	dss->dispc_ops = &dispc_ops;
+	omapdss_set_dispc(dispc, &dispc_ops);
 
 	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
 						 dispc);
@@ -4807,8 +4807,8 @@ static void dispc_unbind(struct device *dev, struct
 device *master, void *data)
 
 	dss_debugfs_remove_file(dispc->debugfs);
 
+	omapdss_set_dispc(NULL, NULL);
 	dss->dispc = NULL;
-	dss->dispc_ops = NULL;
 
 	pm_runtime_disable(dev);
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dss.h index 6f6fd3d1b159..3d23232ec1f7 100644

drivers/gpu/drm/omapdrm/dss/dss.h +0 -1
@@ -274,7 +274,6 @@ struct dss_device {
 	struct dss_pll	*video2_pll;
 
 	struct dispc_device *dispc;
-	const struct dispc_ops *dispc_ops;
 };
 
 /* core */
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/omapdss.h index a4f71e082c1c..b724dae22d7a 100644

drivers/gpu/drm/omapdrm/dss/omapdss.h +1 -0
@@ -751,6 +751,7 @@ struct dispc_ops {
 
 struct dispc_device *dispc_get_dispc(struct dss_device *dss);
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
+void omapdss_set_dispc(struct dispc_device *dispc, const struct dispc_ops*
 dispc_ops);
 
 bool omapdss_component_is_display(struct device_node *node);

bool omapdss_component_is_output(struct device_node *node);

Quoted 6 lines

Yes, it adds two new globals. But I don't think those are a big issue. Note that I left the dss->dispc there, for dss internal use.

Laurent, what do you think? If this is fine, can you squash to your series? Or I can even have this on top as well. I think otherwise it's good for merging.

To be honest I like Jyri's approach better, with a small caveat: we really need to standardize how we name our data structures. It will be painful (as in generating conflicts) but should make the code much clearer. dss_data vs. dss_device vs. omap_dss_device is just too confusing. If you agree to a rename of data structure I'll make a proposal.

Additionally, one thing I like about this patch is that the dss_data structure (to be renamed...) can store data shared between the DSS2-5 and DSS6 implementations, which would make it easier to share code where applicable. Being completely honest again I haven't reviewed the DSS6 implementation yet, so there might be no opportunity for code sharing.

Quoted 3 lines

Can you also have a quick look at patches 2, 3, 4, 5, 6 and 7. While their aim is to get dss6 working, I think they're ok cleanups and shouldn't cause issues with the main dss rework.

Sure, I'll review them now.

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/9
#5 lore raw

Re: [PATCH RFC 2/9] drm/omap: Fail probe if irq registration fails

In reply to Jyri Sarha

Hi Jyri,

Thank you for the patch.

Quoted 14 lines · On Friday, 16 February 2018 13:25:03 EET Jyri Sarha wrote:

Call to omap_drm_irq_install() may fail with an error code. In such a case the driver probe should fail.

---
 drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/omap_drv.c index 65a567d..979bede 100644

drivers/gpu/drm/omapdrm/omap_drv.c static int omap_modeset_init(struct drm_device *dev) · line 328

Quoted 9 lines
drivers/gpu/drm/omapdrm/omap_drv.c +3 -1
@@ -321,7 +321,9 @@ static int omap_modeset_init(struct drm_device *dev)
 
 	drm_mode_config_reset(dev);
 
-	omap_drm_irq_install(dev);
+	ret = omap_drm_irq_install(dev);
+	if (ret)
+		return ret;
 
 	return 0;

Or maybe just

	return omap_drm_irq_install(dev);
Quoted 1 line
drivers/gpu/drm/omapdrm/omap_drv.c +0 -0
 }
Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 3/9] drm/omap: Add ovl_name() and mgr_name() to dispc_ops

In reply to Jyri Sarha

Hi Jyri,

Thank you for the patch.

Quoted 100 lines · On Friday, 16 February 2018 13:25:04 EET Jyri Sarha wrote:

Add ovl_name() and mgr_name() to dispc_ops and get rid of adhoc names here and there in the omapdrm code. This moves the names of hardware entities to omapdss side where they have to be when new omapdss backend drivers are introduced.

---
 drivers/gpu/drm/omapdrm/dss/dispc.c   | 23 +++++++++++++++++++++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  5 +++++
 drivers/gpu/drm/omapdrm/omap_crtc.c   | 11 ++---------
 drivers/gpu/drm/omapdrm/omap_irq.c    | 19 +++++++------------
 drivers/gpu/drm/omapdrm/omap_plane.c  | 13 +++----------
 5 files changed, 40 insertions(+), 31 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dispc.c index 338490d..6f83b3e 100644

drivers/gpu/drm/omapdrm/dss/dispc.c +23 -0
@@ -694,6 +694,26 @@ void dispc_runtime_put(struct dispc_device *dispc)
 	WARN_ON(r < 0 && r != -ENOSYS);
 }
 
+static const char *dispc_ovl_name(struct dispc_device *dispc,
+				  enum omap_plane_id plane)
+{
+	static const char * const ovl_names[] = {
+		[OMAP_DSS_GFX]		= "GFX",
+		[OMAP_DSS_VIDEO1]	= "VID1",
+		[OMAP_DSS_VIDEO2]	= "VID2",
+		[OMAP_DSS_VIDEO3]	= "VID3",
+		[OMAP_DSS_WB]		= "WB",
+	};
+
+	return ovl_names[plane];
+}
+
+static const char *dispc_mgr_name(struct dispc_device *dispc,
+				  enum omap_channel channel)
+{
+	return mgr_desc[channel].name;
+}
+
 static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
 				   enum omap_channel channel)
 {
@@ -4662,6 +4682,9 @@ static const struct dispc_ops dispc_ops = {
 	.get_num_ovls = dispc_get_num_ovls,
 	.get_num_mgrs = dispc_get_num_mgrs,
 
+	.ovl_name = dispc_ovl_name,
+	.mgr_name = dispc_mgr_name,
+
 	.get_memory_bandwidth_limit = dispc_get_memory_bandwidth_limit,
 
 	.mgr_enable = dispc_mgr_enable,
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 1299dd6..b84cfd8 100644

drivers/gpu/drm/omapdrm/dss/omapdss.h +5 -0
@@ -711,6 +711,11 @@ struct dispc_ops {
 	int (*get_num_ovls)(struct dispc_device *dispc);
 	int (*get_num_mgrs)(struct dispc_device *dispc);
 
+	const char *(*ovl_name)(struct dispc_device *dispc,
+				enum omap_plane_id plane);
+	const char *(*mgr_name)(struct dispc_device *dispc,
+				enum omap_channel channel);
+
 	u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
 
 	void (*mgr_enable)(struct dispc_device *dispc,
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/omap_crtc.c index 6c4d40b..00ec959 100644

drivers/gpu/drm/omapdrm/omap_crtc.c +0 -0
@@ -672,13 +672,6 @@ static const struct drm_crtc_helper_funcs

omap_crtc_helper_funcs = { * Init and Cleanup
*/

drivers/gpu/drm/omapdrm/omap_crtc.c +1 -8
-static const char *channel_names[] = {
-	[OMAP_DSS_CHANNEL_LCD] = "lcd",
-	[OMAP_DSS_CHANNEL_DIGIT] = "tv",
-	[OMAP_DSS_CHANNEL_LCD2] = "lcd2",
-	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
-};
-
 void omap_crtc_pre_init(struct omap_drm_private *priv)
 {
 	memset(omap_crtcs, 0, sizeof(omap_crtcs));
@@ -706,7 +699,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 	channel = out->dispc_channel;
 	omap_dss_put_device(out);
 
-	DBG("%s", channel_names[channel]);
+	DBG("%s", priv->dispc_ops->mgr_name(priv->dispc, channel));
 
 	/* Multiple displays on same channel is not allowed */
 	if (WARN_ON(omap_crtcs[channel] != NULL))

drivers/gpu/drm/omapdrm/omap_crtc.c struct drm_crtc *omap_crtc_init(struct drm_device *dev, · line 717

Quoted 5 lines
drivers/gpu/drm/omapdrm/omap_crtc.c +1 -1
@@ -721,7 +714,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
 	init_waitqueue_head(&omap_crtc->pending_wait);
 
 	omap_crtc->channel = channel;
-	omap_crtc->name = channel_names[channel];
+	omap_crtc->name = priv->dispc_ops->mgr_name(priv->dispc, channel);

Possibly a small improvement here, you could cache the name in a local variable instead of calling the mgr_name operation twice.

Quoted 14 lines
drivers/gpu/drm/omapdrm/omap_crtc.c +0 -0
 	ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
 					&omap_crtc_funcs, NULL);
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/omap_irq.c index c8511504..5cc88b6 100644

drivers/gpu/drm/omapdrm/omap_irq.c +0 -3
@@ -146,15 +146,10 @@ static void omap_irq_fifo_underflow(struct
 omap_drm_private *priv, {
 	static DEFINE_RATELIMIT_STATE(_rs, DEFAULT_RATELIMIT_INTERVAL,
 				      DEFAULT_RATELIMIT_BURST);
-	static const struct {
-		const char *name;
-		u32 mask;

drivers/gpu/drm/omapdrm/omap_irq.c static void omap_irq_fifo_underflow(struct · line 152

Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_irq.c +4 -6
-	} sources[] = {
-		{ "gfx", DISPC_IRQ_GFX_FIFO_UNDERFLOW },
-		{ "vid1", DISPC_IRQ_VID1_FIFO_UNDERFLOW },
-		{ "vid2", DISPC_IRQ_VID2_FIFO_UNDERFLOW },
-		{ "vid3", DISPC_IRQ_VID3_FIFO_UNDERFLOW },
-	};
+	static const u32 irqbits[] = { DISPC_IRQ_GFX_FIFO_UNDERFLOW,
+				       DISPC_IRQ_VID1_FIFO_UNDERFLOW,
+				       DISPC_IRQ_VID2_FIFO_UNDERFLOW,
+				       DISPC_IRQ_VID3_FIFO_UNDERFLOW };

The indentation looks weird, I'd write it

	static const u32 irqbits[] = {
		DISPC_IRQ_GFX_FIFO_UNDERFLOW,
		DISPC_IRQ_VID1_FIFO_UNDERFLOW,
		DISPC_IRQ_VID2_FIFO_UNDERFLOW,
		DISPC_IRQ_VID3_FIFO_UNDERFLOW,
	};
Quoted 4 lines
drivers/gpu/drm/omapdrm/omap_irq.c +0 -0
 	const u32 mask = DISPC_IRQ_GFX_FIFO_UNDERFLOW
 		       | DISPC_IRQ_VID1_FIFO_UNDERFLOW
 

drivers/gpu/drm/omapdrm/omap_irq.c static void omap_irq_fifo_underflow(struct · line 175

Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_irq.c +3 -3
@@ -174,9 +169,9 @@ static void omap_irq_fifo_underflow(struct
 omap_drm_private *priv,
 
 	DRM_ERROR("FIFO underflow on ");
 
-	for (i = 0; i < ARRAY_SIZE(sources); ++i) {
-		if (sources[i].mask & irqstatus)
-			pr_cont("%s ", sources[i].name);
+	for (i = 0; i < ARRAY_SIZE(irqbits); ++i) {
+		if (irqbits[i] & irqstatus)
+			pr_cont("%s ", priv->dispc_ops->ovl_name(priv->dispc, i));

I wonder if it's worth it here, in the sense that you're splitting the name and mask, which are both DISPC-specific, in two. Would it make sense to move the whole omap_irq_fifo_underflow() and omap_irq_ocp_error_handler() IRQ handling to the DSS side, as they're not DRM/KMS-related ?

Quoted 32 lines
drivers/gpu/drm/omapdrm/omap_irq.c +0 -0
 	}
 
drivers/gpu/drm/omapdrm/omap_irq.c +0 -0
 	pr_cont("(0x%08x)\n", irqstatus);
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/omap_plane.c index 2899435..61b0753 100644

drivers/gpu/drm/omapdrm/omap_plane.c +1 -8
@@ -239,13 +239,6 @@ static const struct drm_plane_funcs omap_plane_funcs =
 { .atomic_get_property = omap_plane_atomic_get_property,
 };
 
-static const char *plane_id_to_name[] = {
-	[OMAP_DSS_GFX] = "gfx",
-	[OMAP_DSS_VIDEO1] = "vid1",
-	[OMAP_DSS_VIDEO2] = "vid2",
-	[OMAP_DSS_VIDEO3] = "vid3",
-};
-
 static const enum omap_plane_id plane_idx_to_id[] = {
 	OMAP_DSS_GFX,
 	OMAP_DSS_VIDEO1,
@@ -272,7 +265,7 @@ struct drm_plane *omap_plane_init(struct drm_device
 *dev,
 
 	id = plane_idx_to_id[idx];
 
-	DBG("%s: type=%d", plane_id_to_name[id], type);
+	DBG("%s: type=%d", priv->dispc_ops->ovl_name(priv->dispc, id), type);
 
 	omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL);
drivers/gpu/drm/omapdrm/omap_plane.c +0 -0
 	if (!omap_plane)

drivers/gpu/drm/omapdrm/omap_plane.c struct drm_plane *omap_plane_init(struct drm_device · line 278

Quoted 5 lines
drivers/gpu/drm/omapdrm/omap_plane.c +1 -1
@@ -282,7 +275,7 @@ struct drm_plane *omap_plane_init(struct drm_device
 *dev, for (nformats = 0; formats[nformats]; ++nformats)
 		;
 	omap_plane->id = id;
-	omap_plane->name = plane_id_to_name[id];
+	omap_plane->name = priv->dispc_ops->ovl_name(priv->dispc, id);

Same here, we could cache the name.

drivers/gpu/drm/omapdrm/omap_plane.c struct drm_plane *omap_plane_init(struct drm_device · line 298

Quoted 10 lines
drivers/gpu/drm/omapdrm/omap_plane.c +1 -1
 	plane = &omap_plane->base;
 
@@ -301,7 +294,7 @@ struct drm_plane *omap_plane_init(struct drm_device
 *dev,
 
 error:
 	dev_err(dev->dev, "%s(): could not create plane: %s\n",
-		__func__, plane_id_to_name[id]);
+		__func__, priv->dispc_ops->ovl_name(priv->dispc, id));

You could use omap_plane->name here.

Quoted 3 lines
drivers/gpu/drm/omapdrm/omap_plane.c +0 -0
 	kfree(omap_plane);
 	return NULL;
Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 5/9] drm/omap: move common stuff from dss.h to omapdss.h

In reply to Jyri Sarha

Hi Jyri,

Thank you for the patch.

Quoted 17 lines · On Friday, 16 February 2018 13:25:06 EET Jyri Sarha wrote:

The new DSS6 driver needs some structs and defines which are currently in dss.h, which is for the old DSS driver.

Move the required structs and defines from dss.h to omapdss.h.

---
 drivers/gpu/drm/omapdrm/dss/dss.h     | 41 ++-----------------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 37 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 39 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dss.h index 434262a..fa206ca 100644

drivers/gpu/drm/omapdrm/dss/dss.h struct seq_file; · line 75

Quoted 6 lines
drivers/gpu/drm/omapdrm/dss/dss.h +0 -3
@@ -70,14 +70,6 @@ struct seq_file;
 	pr_warn("omapdss: " format, ##__VA_ARGS__)
 #endif
 
-/* OMAP TRM gives bitfields as start:end, where start is the higher bit
-   number. For example 7:0 */
-#define FLD_MASK(start, end)	(((1 << ((start) - (end) + 1)) - 1) << 

(end))

Quoted 66 lines
drivers/gpu/drm/omapdrm/dss/dss.h +2 -36
-#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
-#define FLD_GET(val, start, end) (((val) & FLD_MASK(start, end)) >> (end))
-#define FLD_MOD(orig, val, start, end) \
-	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
-
 enum dss_model {
 	DSS_MODEL_OMAP2,
 	DSS_MODEL_OMAP3,
@@ -86,12 +78,6 @@ enum dss_model {
 	DSS_MODEL_DRA7,
 };
 
-enum dss_io_pad_mode {
-	DSS_IO_PAD_MODE_RESET,
-	DSS_IO_PAD_MODE_RFBI,
-	DSS_IO_PAD_MODE_BYPASS,
-};
-
 enum dss_hdmi_venc_clk_source_select {
 	DSS_VENC_TV_CLK = 0,
 	DSS_HDMI_M_PCLK = 1,
@@ -215,34 +201,11 @@ struct dss_reg_field {
 	u8 start, end;
 };
 
-struct dispc_clock_info {
-	/* rates that we get with dividers below */
-	unsigned long lck;
-	unsigned long pck;
-
-	/* dividers */
-	u16 lck_div;
-	u16 pck_div;
-};
-
-struct dss_lcd_mgr_config {
-	enum dss_io_pad_mode io_pad_mode;
-
-	bool stallmode;
-	bool fifohandcheck;
-
-	struct dispc_clock_info clock_info;
-
-	int video_port_width;
-
-	int lcden_sig_polarity;
-};
-
-#define DSS_SZ_REGS			SZ_512
+#define DSS_SZ_REGS                    SZ_512
 
 struct dss_device {
 	struct platform_device *pdev;
-	void __iomem    *base;
+	void __iomem	*base;
 	struct regmap	*syscon_pll_ctrl;
 	u32		syscon_pll_ctrl_offset;
 
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 493237e..9d789c2 100644

drivers/gpu/drm/omapdrm/dss/omapdss.h +0 -0
@@ -647,6 +647,43 @@ static inline bool omapdss_device_is_enabled(struct

omap_dss_device *dssdev) struct omap_dss_device *
omapdss_of_find_source_for_first_ep(struct device_node *node);

drivers/gpu/drm/omapdrm/dss/omapdss.h static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)

Quoted 3 lines
drivers/gpu/drm/omapdrm/dss/omapdss.h +3 -0
+/* OMAP TRM gives bitfields as start:end, where start is the higher bit
+   number. For example 7:0 */
+#define FLD_MASK(start, end)	(((1 << ((start) - (end) + 1)) - 1) << 

(end))

While at it would it make sense to use GENMASK to implement this ?

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/omapdss.h +10 -0
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+#define FLD_GET(val, start, end) (((val) & FLD_MASK(start, end)) >> (end))
+#define FLD_MOD(orig, val, start, end) \
+	(((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
+
+enum dss_io_pad_mode {
+	DSS_IO_PAD_MODE_RESET,
+	DSS_IO_PAD_MODE_RFBI,
+	DSS_IO_PAD_MODE_BYPASS,
+};

drivers/gpu/drm/omapdrm/dss/omapdss.h static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) · line 672

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/omapdss.h +10 -0
+
+struct dispc_clock_info {
+	/* rates that we get with dividers below */
+	unsigned long lck;
+	unsigned long pck;
+
+	/* dividers */
+	u16 lck_div;
+	u16 pck_div;
+};

I think we should start documenting the common structures and enums with kerneldoc. omapdss.h and dss.h are a bit of a mess, let's try to make them readable :-)

Quoted 16 lines
drivers/gpu/drm/omapdrm/dss/omapdss.h +13 -0
+struct dss_lcd_mgr_config {
+	enum dss_io_pad_mode io_pad_mode;
+
+	bool stallmode;
+	bool fifohandcheck;
+
+	struct dispc_clock_info clock_info;
+
+	int video_port_width;
+
+	int lcden_sig_polarity;
+};
+
 struct device_node *dss_of_port_get_parent_device(struct device_node

*port);
u32 dss_of_port_get_port_number(struct device_node *port);

Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 6/9] drm/omap: dss: Move platform_device_register from core.c to dss.c probe

In reply to Jyri Sarha

Hi Jyri,

Thank you for the patch.

Quoted 58 lines · On Friday, 16 February 2018 13:25:07 EET Jyri Sarha wrote:

Register the omapdrm device when we know that dss device probe going to succeed. This avoids DSS6 and DSS2 omapdrm device registration from colliding with each other.

---
 drivers/gpu/drm/omapdrm/dss/core.c | 26 ++------------------------
 drivers/gpu/drm/omapdrm/dss/dss.c  | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 24 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/core.c index acef7ec..6c9f667 100644

drivers/gpu/drm/omapdrm/dss/core.c +0 -0
@@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[]

= { #endif
};

drivers/gpu/drm/omapdrm/dss/core.c +2 -24
-static struct platform_device *omap_drm_device;
-
 static int __init omap_dss_init(void)
 {
-	int r;
-
-	r = platform_register_drivers(omap_dss_drivers,
-				      ARRAY_SIZE(omap_dss_drivers));
-	if (r)
-		goto err_reg;
-
-	omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
-	if (IS_ERR(omap_drm_device)) {
-		r = PTR_ERR(omap_drm_device);
-		goto err_reg;
-	}
-
-	return 0;
-
-err_reg:
-	platform_unregister_drivers(omap_dss_drivers,
-				    ARRAY_SIZE(omap_dss_drivers));
-
-	return r;
+	return platform_register_drivers(omap_dss_drivers,
+					 ARRAY_SIZE(omap_dss_drivers));
 }
 
 static void __exit omap_dss_exit(void)
 {
-	platform_device_unregister(omap_drm_device);
-
 	platform_unregister_drivers(omap_dss_drivers,
 				    ARRAY_SIZE(omap_dss_drivers));
 }
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dss.c index 5752328..dda3237 100644

drivers/gpu/drm/omapdrm/dss/dss.c static const struct soc_device_attribute · line 1317

Quoted 4 lines
drivers/gpu/drm/omapdrm/dss/dss.c +1 -0
@@ -1314,6 +1314,17 @@ static const struct soc_device_attribute
 dss_soc_devices[] = { { /* sentinel */ }
 };
 
+static struct platform_device *omap_drm_device;

Let's store this in the dss_device structure instead of adding a new global variable. I've spent enough time chasing the globals, I don't want any new one :-)

Quoted 13 lines
drivers/gpu/drm/omapdrm/dss/dss.c +9 -0
+static int initialize_omapdrm_device(void)
+{
+	omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
+	if (IS_ERR(omap_drm_device))
+		return PTR_ERR(omap_drm_device);
+
+	return 0;
+}
+
 static int dss_bind(struct device *dev)
 {
 	struct dss_device *dss = dev_get_drvdata(dev);

drivers/gpu/drm/omapdrm/dss/dss.c static int dss_bind(struct device *dev) · line 1342

Quoted 9 lines
drivers/gpu/drm/omapdrm/dss/dss.c +6 -0
@@ -1323,6 +1334,12 @@ static int dss_bind(struct device *dev)
 	if (r)
 		return r;
 
+	r = initialize_omapdrm_device();
+	if (r) {
+		component_unbind_all(dev, NULL);
+		return r;
+	}
+

Should this be called after omapdss_gather_components() and omapdss_set_dss() to make sure the omapdrm probe won't be deferred by the DSS not being initialized ?

drivers/gpu/drm/omapdrm/dss/dss.c static void dss_unbind(struct device *dev) · line 1356

Quoted 9 lines
drivers/gpu/drm/omapdrm/dss/dss.c +2 -0
 	pm_set_vt_switch(0);
 
 	omapdss_gather_components(dev);
@@ -1335,6 +1352,8 @@ static void dss_unbind(struct device *dev)
 {
 	omapdss_set_dss(NULL);
 
+	platform_device_unregister(omap_drm_device);
+

Same here, should this be called before omapdss_set_dss() for symmetry ?

Quoted 2 lines
drivers/gpu/drm/omapdrm/dss/dss.c +0 -0
 	component_unbind_all(dev, NULL);
 }
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 7/9
#21 lore raw

Re: [PATCH RFC 7/9] drm/omap: dss: platform_register_drivers() to dss.c and remove core.c

In reply to Jyri Sarha

Hi Jyri,

Thank you for the patch.

Quoted 4 lines · On Friday, 16 February 2018 13:25:08 EET Jyri Sarha wrote:

The core.c just for registering the drivers is kind of useless. Let's get rid of it and register the dss drivers in dss.c.

Quoted 141 lines
---
 drivers/gpu/drm/omapdrm/dss/Makefile |  2 +-
 drivers/gpu/drm/omapdrm/dss/core.c   | 66 ---------------------------------
 drivers/gpu/drm/omapdrm/dss/dss.c    | 37 ++++++++++++++++++++
 3 files changed, 38 insertions(+), 67 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/core.c
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/Makefile index 904101c..5950c3f 100644

drivers/gpu/drm/omapdrm/dss/Makefile +1 -1
@@ -6,7 +6,7 @@ omapdss-base-y := base.o display.o dss-of.o output.o
 
 obj-$(CONFIG_OMAP2_DSS) += omapdss.o
 # Core DSS files
-omapdss-y := core.o dss.o dispc.o dispc_coefs.o \
+omapdss-y := dss.o dispc.o dispc_coefs.o \
 	pll.o video-pll.o
 omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
 omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/core.c deleted file mode 100644 index 6c9f667..0000000

drivers/gpu/drm/omapdrm/dss/core.c deleted +0 -9
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 Nokia Corporation
- * Author: Tomi Valkeinen <[email protected]>
- *
- * Some code and ideas taken from drivers/video/omap/ driver
- * by Imre Deak.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published

by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */

drivers/gpu/drm/omapdrm/dss/core.c deleted +0 -47
-
-#define DSS_SUBSYS_NAME "CORE"
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-
-#include "omapdss.h"
-#include "dss.h"
-
-/* INIT */
-static struct platform_driver * const omap_dss_drivers[] = {
-	&omap_dsshw_driver,
-	&omap_dispchw_driver,
-#ifdef CONFIG_OMAP2_DSS_DSI
-	&omap_dsihw_driver,
-#endif
-#ifdef CONFIG_OMAP2_DSS_VENC
-	&omap_venchw_driver,
-#endif
-#ifdef CONFIG_OMAP4_DSS_HDMI
-	&omapdss_hdmi4hw_driver,
-#endif
-#ifdef CONFIG_OMAP5_DSS_HDMI
-	&omapdss_hdmi5hw_driver,
-#endif
-};
-
-static int __init omap_dss_init(void)
-{
-	return platform_register_drivers(omap_dss_drivers,
-					 ARRAY_SIZE(omap_dss_drivers));
-}
-
-static void __exit omap_dss_exit(void)
-{
-	platform_unregister_drivers(omap_dss_drivers,
-				    ARRAY_SIZE(omap_dss_drivers));
-}
-
-module_init(omap_dss_init);
-module_exit(omap_dss_exit);
-
-MODULE_AUTHOR("Tomi Valkeinen <[email protected]>");
-MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
-MODULE_LICENSE("GPL v2");
-
(quoted diff) +0 -0

b/drivers/gpu/drm/omapdrm/dss/dss.c index dda3237..162fa3a 100644

drivers/gpu/drm/omapdrm/dss/dss.c +37 -0
@@ -1619,3 +1619,40 @@ struct platform_driver omap_dsshw_driver = {
 		.suppress_bind_attrs = true,
 	},
 };
+
+/* INIT */
+static struct platform_driver * const omap_dss_drivers[] = {
+	&omap_dsshw_driver,
+	&omap_dispchw_driver,
+#ifdef CONFIG_OMAP2_DSS_DSI
+	&omap_dsihw_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+	&omap_venchw_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+	&omapdss_hdmi4hw_driver,
+#endif
+#ifdef CONFIG_OMAP5_DSS_HDMI
+	&omapdss_hdmi5hw_driver,
+#endif
+};
+
+static int __init omap_dss_init(void)
+{
+	return platform_register_drivers(omap_dss_drivers,
+					 ARRAY_SIZE(omap_dss_drivers));
+}
+
+static void __exit omap_dss_exit(void)
+{
+	platform_unregister_drivers(omap_dss_drivers,
+				    ARRAY_SIZE(omap_dss_drivers));
+}
+
+module_init(omap_dss_init);
+module_exit(omap_dss_exit);
+
+MODULE_AUTHOR("Tomi Valkeinen <[email protected]>");
+MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
+MODULE_LICENSE("GPL v2");
Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 3/9] drm/omap: Add ovl_name() and mgr_name() to dispc_ops

In reply to Laurent Pinchart
Quoted 2 lines · Laurent Pinchart

the whole omap_irq_fifo_underflow() and omap_irq_ocp_error_handler() IRQ handling to the DSS side, as they're not DRM/KMS-related ?

I think we should react to both errors somehow (I'm not sure how, disable output probably), and that has to be done on the KMS level. We don't do that now, but moving this to DSS side would make error handling more difficult to do in the future.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

Re: [PATCH RFC 3/9] drm/omap: Add ovl_name() and mgr_name() to dispc_ops

Hi Tomi,

Quoted 8 lines · On Wednesday, 28 February 2018 13:37:48 EET Tomi Valkeinen wrote:
Quoted 2 lines · Laurent Pinchart

the whole omap_irq_fifo_underflow() and omap_irq_ocp_error_handler() IRQ handling to the DSS side, as they're not DRM/KMS-related ?

I think we should react to both errors somehow (I'm not sure how, disable output probably), and that has to be done on the KMS level. We don't do that now, but moving this to DSS side would make error handling more difficult to do in the future.

Ideally I'd demultiplex interrupts on the DSS side and report events to the KMS side (page flip completion, underflows, ...).

Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 3/9] drm/omap: Add ovl_name() and mgr_name() to dispc_ops

Quoted 7 lines · Laurent Pinchart

Hi Tomi,

Quoted 4 lines · On Wednesday, 28 February 2018 13:37:48 EET Tomi Valkeinen wrote:
Quoted 2 lines · Laurent Pinchart

the whole omap_irq_fifo_underflow() and omap_irq_ocp_error_handler() IRQ handling to the DSS side, as they're not DRM/KMS-related ?

Quoted 7 lines
Quoted 4 lines

I think we should react to both errors somehow (I'm not sure how, disable output probably), and that has to be done on the KMS level. We don't do that now, but moving this to DSS side would make error handling more difficult to do in the future.

Ideally I'd demultiplex interrupts on the DSS side and report events to the KMS side (page flip completion, underflows, ...).

That's more or less what Jyri's "drm/omap: Make omapdss API more generic" does, isn't it? Or what is the difference with interrupt and event in your mind? Function calls vs status bits?

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

Re: [PATCH RFC 3/9] drm/omap: Add ovl_name() and mgr_name() to dispc_ops

Hi Tomi,

Quoted 11 lines · On Wednesday, 28 February 2018 16:05:34 EET Tomi Valkeinen wrote:
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines · On Wednesday, 28 February 2018 13:37:48 EET Tomi Valkeinen wrote:
Quoted 2 lines · Laurent Pinchart

the whole omap_irq_fifo_underflow() and omap_irq_ocp_error_handler() IRQ handling to the DSS side, as they're not DRM/KMS-related ?

I think we should react to both errors somehow (I'm not sure how, disable output probably), and that has to be done on the KMS level. We don't do that now, but moving this to DSS side would make error handling more difficult to do in the future.

Quoted 6 lines
Quoted 2 lines

Ideally I'd demultiplex interrupts on the DSS side and report events to the KMS side (page flip completion, underflows, ...).

That's more or less what Jyri's "drm/omap: Make omapdss API more generic" does, isn't it? Or what is the difference with interrupt and event in your mind? Function calls vs status bits?

Yes, that's the difference in my mind. I'd keep the status bits on the DSS side. We don't have to implement one callback function for each status bit, we could translate them into abstract event bits that are not specific to a particular DSS version. What I'd like to avoid is omapdrm calling into omapdss to retrieve a name for a bit that is DSS-specific. If we want hardware names in debug messages I think they should be printed on the omapdss side, and if we want to handle status bits on the omapdrm side they shouldn't require hardware names.

Signature · 8 lines
Regards,

Laurent Pinchart

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

Re: [PATCH RFC 3/9] drm/omap: Add ovl_name() and mgr_name() to dispc_ops

Quoted 21 lines · Laurent Pinchart

Hi Tomi,

Quoted 11 lines · On Wednesday, 28 February 2018 16:05:34 EET Tomi Valkeinen wrote:
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines · On Wednesday, 28 February 2018 13:37:48 EET Tomi Valkeinen wrote:
Quoted 2 lines · Laurent Pinchart

the whole omap_irq_fifo_underflow() and omap_irq_ocp_error_handler() IRQ handling to the DSS side, as they're not DRM/KMS-related ?

I think we should react to both errors somehow (I'm not sure how, disable output probably), and that has to be done on the KMS level. We don't do that now, but moving this to DSS side would make error handling more difficult to do in the future.

Quoted 6 lines
Quoted 2 lines

Ideally I'd demultiplex interrupts on the DSS side and report events to the KMS side (page flip completion, underflows, ...).

That's more or less what Jyri's "drm/omap: Make omapdss API more generic" does, isn't it? Or what is the difference with interrupt and event in your mind? Function calls vs status bits?

Quoted 8 lines

Yes, that's the difference in my mind. I'd keep the status bits on the DSS side. We don't have to implement one callback function for each status bit, we could translate them into abstract event bits that are not specific to a particular DSS version. What I'd like to avoid is omapdrm calling into omapdss to retrieve a name for a bit that is DSS-specific. If we want hardware names in debug messages I think they should be printed on the omapdss side, and if we want to handle status bits on the omapdrm side they shouldn't require hardware names.

Ok, yes, I see your point, and agree.

Here, I think what's done (after the IRQ change patch) is that we get a an abstracted bit for the underflow. Omapdrm can map that bit to an omap_plane, and should get the name from omap_plane, instead of asking it directly from dispc.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel