All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code
@ 2017-08-11 13:49 Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 01/11] drm: omapdrm: hdmi: Rename functions and structures to use hdmi_ prefix Laurent Pinchart
                   ` (10 more replies)
  0 siblings, 11 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel
  Cc: Tony Lindgren, Mark Brown, Tomi Valkeinen, Bartlomiej Zolnierkiewicz

Hello,

This patch series is a third attempt at removing the omapdrm and omapdss
devices from platform code. Most of the patches from the previous version have
been picked up already, this version contains all the leftovers.

The omapdss/omapdrm initialization code is quite a mess. The physical devices
are instantiated from DT, but two virtual devices named omapdrm and omapdss
are instanciated from platform code to pass SoC version information to the
drivers through platform data.

The only remaining users of the platform data are the OMAP HDMI encoders. The
series starts with a small cleanup in patch 01/11, followed by patches 02/11
to 05/11 that replace the SoC version with HDMI encoder version. Another small
cleanup in patch 06/11 completes the HDMI encoders part of the series.

The next step is to remove the omapdss platform driver (for the virtual
omapdss platform device, also known as core code, not to be confused with the
omapdss_dss driver for the DSS hardware device). Patches 07/11 adds omapdrm
platform device registration to the omapdss_dss driver to replace board code,
and patch 08/11 finally removes the omapdss platform driver.

Note that registering the omapdrm platform device from within the omapdss_dss
driver is a hack, but isn't worse than the current situation. Quite the
contrary, given that the omapdrm device exists for the sole purpose of
supporting the omapdrm/omapdss driver architecture, moving it out of platform
code can be considered as (slightly) cleaner. In any case, it will be easier
to refactor the code as everything is now isolated on the driver side.

Patches 09/11 and 10/11 remove the now unnecessary platform devices from
platform code, and patch 11/11 removes the now unused omapdrm platform data
structure.

A few patches touch the ARM mach-omap2 code, the OMAP sound driver and the
OMAP fbdev driver. The ARM and sound patches have all been posted before and
acked by Tony for mach-omap2 and Mark for sound for upstreaming through the
drm tree. The fbdev change in patch 03/11 is new, and I'd like to get
Bartlomiej's ack on it.

The series is based on top of "[PATCH v3 00/35] omapdrm: Deconstruct DSS
features".

Laurent Pinchart (11):
  drm: omapdrm: hdmi: Rename functions and structures to use hdmi_
    prefix
  drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit
    version
  drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio
  drm: omapdrm: hdmi: Configure the PLL from the HDMI core version
  drm: omapdrm: hdmi: Configure the PHY from the HDMI core version
  drm: omapdrm: hdmi: Don't allocate PHY features dynamically
  drm: omapdrm: Register omapdrm platform device in omapdss driver
  drm: omapdrm: Remove the omapdss driver
  ARM: OMAP2+: Remove unused omapdrm platform device
  ARM: OMAP2+: Don't register omapdss device for omapdrm
  drm: omapdrm: Remove omapdrm platform data

 arch/arm/mach-omap2/Makefile                 |   2 +-
 arch/arm/mach-omap2/display.c                | 118 ++++++++++++++-------------
 arch/arm/mach-omap2/display.h                |   1 -
 arch/arm/mach-omap2/drm.c                    |  53 ------------
 drivers/gpu/drm/omapdrm/dss/core.c           |  62 ++++----------
 drivers/gpu/drm/omapdrm/dss/hdmi.h           |   7 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c          |   6 +-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c          |   6 +-
 drivers/gpu/drm/omapdrm/dss/hdmi_phy.c       |  45 ++--------
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c       |  24 ++----
 drivers/gpu/drm/omapdrm/dss/hdmi_wp.c        |  12 ++-
 drivers/gpu/drm/omapdrm/dss/omapdss.h        |   1 -
 drivers/gpu/drm/omapdrm/omap_drv.c           |   2 +-
 drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c |   2 +-
 drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c |   2 +-
 include/linux/platform_data/omap_drm.h       |  53 ------------
 include/sound/omap-hdmi-audio.h              |   2 +-
 sound/soc/omap/omap-hdmi-audio.c             |   9 +-
 18 files changed, 112 insertions(+), 295 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/drm.c
 delete mode 100644 include/linux/platform_data/omap_drm.h

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v3 01/11] drm: omapdrm: hdmi: Rename functions and structures to use hdmi_ prefix
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 02/11] drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit version Laurent Pinchart
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The dsi_pll_ops structure and dsi_init_pll_data() function incorrectly
use a dsi_ prefix, likely due to copy & paste. Fix it by using the
correct hdmi_ prefix.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index 46239358655a..0988f2d7a31f 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -71,7 +71,7 @@ static void hdmi_pll_disable(struct dss_pll *dsspll)
 	WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static const struct dss_pll_ops dsi_pll_ops = {
+static const struct dss_pll_ops hdmi_pll_ops = {
 	.enable = hdmi_pll_enable,
 	.disable = hdmi_pll_disable,
 	.set_config = dss_pll_write_config_type_b,
@@ -128,7 +128,8 @@ static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = {
 	.has_refsel = true,
 };
 
-static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data *hpll)
+static int hdmi_init_pll_data(struct platform_device *pdev,
+			      struct hdmi_pll_data *hpll)
 {
 	struct dss_pll *pll = &hpll->pll;
 	struct clk *clk;
@@ -161,7 +162,7 @@ static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data
 		return -ENODEV;
 	}
 
-	pll->ops = &dsi_pll_ops;
+	pll->ops = &hdmi_pll_ops;
 
 	r = dss_pll_register(pll);
 	if (r)
@@ -184,7 +185,7 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
 	if (IS_ERR(pll->base))
 		return PTR_ERR(pll->base);
 
-	r = dsi_init_pll_data(pdev, pll);
+	r = hdmi_init_pll_data(pdev, pll);
 	if (r) {
 		DSSERR("failed to init HDMI PLL\n");
 		return r;
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 02/11] drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit version
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 01/11] drm: omapdrm: hdmi: Rename functions and structures to use hdmi_ prefix Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 03/11] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio Laurent Pinchart
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The HDMI wrapper code only needs to differentiate between major OMAP
revisions, which can be obtained from the HDMI transmitter compatible
string. Replace the OMAP SoC model checks to prepare for removal of the
OMAP SoC version platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi.h    |  4 +++-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi_wp.c | 12 +++++-------
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi.h b/drivers/gpu/drm/omapdrm/dss/hdmi.h
index 3738a5b397d9..eef717120b33 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi.h
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi.h
@@ -234,6 +234,7 @@ struct hdmi_core_audio_config {
 struct hdmi_wp_data {
 	void __iomem *base;
 	phys_addr_t phys_base;
+	unsigned int version;
 };
 
 struct hdmi_pll_data {
@@ -312,7 +313,8 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp,
 		struct videomode *vm);
 void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt,
 		struct videomode *vm, struct hdmi_config *param);
-int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp);
+int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp,
+		 unsigned int version);
 phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp);
 
 /* HDMI PLL funcs */
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 2a99b11c8b5e..438f47d8ab69 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -699,7 +699,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
 	if (r)
 		return r;
 
-	r = hdmi_wp_init(pdev, &hdmi.wp);
+	r = hdmi_wp_init(pdev, &hdmi.wp, 4);
 	if (r)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 5f5b0a06800d..8ab76b50662a 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -731,7 +731,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
 	if (r)
 		return r;
 
-	r = hdmi_wp_init(pdev, &hdmi.wp);
+	r = hdmi_wp_init(pdev, &hdmi.wp, 5);
 	if (r)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
index ab129df2e310..88034fbe0e9f 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
@@ -178,9 +178,7 @@ void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp,
 	 * However, we don't support OMAP5 ES1 at all, so we can just check for
 	 * OMAP4 here.
 	 */
-	if (omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES1 ||
-	    omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES2 ||
-	    omapdss_get_version() == OMAPDSS_VER_OMAP4)
+	if (wp->version == 4)
 		hsync_len_offset = 0;
 
 	timing_h |= FLD_VAL(vm->hback_porch, 31, 20);
@@ -235,9 +233,7 @@ void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp,
 	DSSDBG("Enter hdmi_wp_audio_config_format\n");
 
 	r = hdmi_read_reg(wp->base, HDMI_WP_AUDIO_CFG);
-	if (omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES1 ||
-	    omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES2 ||
-	    omapdss_get_version() == OMAPDSS_VER_OMAP4) {
+	if (wp->version == 4) {
 		r = FLD_MOD(r, aud_fmt->stereo_channels, 26, 24);
 		r = FLD_MOD(r, aud_fmt->active_chnnls_msk, 23, 16);
 	}
@@ -282,7 +278,8 @@ int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable)
 	return 0;
 }
 
-int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
+int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp,
+		 unsigned int version)
 {
 	struct resource *res;
 
@@ -292,6 +289,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp)
 		return PTR_ERR(wp->base);
 
 	wp->phys_base = res->start;
+	wp->version = version;
 
 	return 0;
 }
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 03/11] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 01/11] drm: omapdrm: hdmi: Rename functions and structures to use hdmi_ prefix Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 02/11] drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit version Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 14:38   ` Bartlomiej Zolnierkiewicz
  2017-08-11 13:49 ` [PATCH v3 04/11] drm: omapdrm: hdmi: Configure the PLL from the HDMI core version Laurent Pinchart
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Mark Brown, Tomi Valkeinen, Bartlomiej Zolnierkiewicz

The HDMI audio driver only needs to know which generation of HDMI
transmitter it deals with, not the detailed SoC model. Pass the version
number as an integer to prepare for removal of the OMAP SoC version from
the omapdrm driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Mark Brown <broonie@kernel.org>
---
Changes since v2:

- Update the omapfb driver
---
 drivers/gpu/drm/omapdrm/dss/hdmi4.c          | 2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c          | 2 +-
 drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c | 2 +-
 drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c | 2 +-
 include/sound/omap-hdmi-audio.h              | 2 +-
 sound/soc/omap/omap-hdmi-audio.c             | 9 +++------
 6 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 438f47d8ab69..4c131d710282 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -667,7 +667,7 @@ static int hdmi_audio_register(struct device *dev)
 {
 	struct omap_hdmi_audio_pdata pdata = {
 		.dev = dev,
-		.dss_version = omapdss_get_version(),
+		.version = 4,
 		.audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp),
 		.ops = &hdmi_audio_ops,
 	};
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 8ab76b50662a..a6adddeee5bb 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -694,7 +694,7 @@ static int hdmi_audio_register(struct device *dev)
 {
 	struct omap_hdmi_audio_pdata pdata = {
 		.dev = dev,
-		.dss_version = omapdss_get_version(),
+		.version = 5,
 		.audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp),
 		.ops = &hdmi_audio_ops,
 	};
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c
index 156a254705ea..ec78d61bc551 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c
@@ -664,7 +664,7 @@ static int hdmi_audio_register(struct device *dev)
 {
 	struct omap_hdmi_audio_pdata pdata = {
 		.dev = dev,
-		.dss_version = omapdss_get_version(),
+		.version = 4,
 		.audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp),
 		.ops = &hdmi_audio_ops,
 	};
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c
index 4da36bcab977..2e2fcc3d6d4f 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c
@@ -695,7 +695,7 @@ static int hdmi_audio_register(struct device *dev)
 {
 	struct omap_hdmi_audio_pdata pdata = {
 		.dev = dev,
-		.dss_version = omapdss_get_version(),
+		.version = 5,
 		.audio_dma_addr = hdmi_wp_get_audio_dma_addr(&hdmi.wp),
 		.ops = &hdmi_audio_ops,
 	};
diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
index 1df2ff61a4dd..0e495ed8872e 100644
--- a/include/sound/omap-hdmi-audio.h
+++ b/include/sound/omap-hdmi-audio.h
@@ -39,7 +39,7 @@ struct omap_hdmi_audio_ops {
 /* HDMI audio initalization data */
 struct omap_hdmi_audio_pdata {
 	struct device *dev;
-	enum omapdss_version dss_version;
+	unsigned int version;
 	phys_addr_t audio_dma_addr;
 
 	const struct omap_hdmi_audio_ops *ops;
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
index 888133f9e65d..3e9cc4842a1d 100644
--- a/sound/soc/omap/omap-hdmi-audio.c
+++ b/sound/soc/omap/omap-hdmi-audio.c
@@ -337,14 +337,11 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
 	ad->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	mutex_init(&ad->current_stream_lock);
 
-	switch (ha->dss_version) {
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
+	switch (ha->version) {
+	case 4:
 		dai_drv = &omap4_hdmi_dai;
 		break;
-	case OMAPDSS_VER_OMAP5:
-	case OMAPDSS_VER_DRA7xx:
+	case 5:
 		dai_drv = &omap5_hdmi_dai;
 		break;
 	default:
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 04/11] drm: omapdrm: hdmi: Configure the PLL from the HDMI core version
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (2 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 03/11] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 05/11] drm: omapdrm: hdmi: Configure the PHY " Laurent Pinchart
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The OMAP4 and OMAP5 PLLs have different properties that require specific
handling in the HDMI PLL driver. This needs knowledge of the PLL
version, which is currently inferred from the DSS version. AS part of
the effort to remove usage of the DSS version, use the HDMI controller
version instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index 0988f2d7a31f..55bee81f4dd5 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -146,21 +146,10 @@ static int hdmi_init_pll_data(struct platform_device *pdev,
 	pll->base = hpll->base;
 	pll->clkin = clk;
 
-	switch (omapdss_get_version()) {
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
+	if (hpll->wp->version == 4)
 		pll->hw = &dss_omap4_hdmi_pll_hw;
-		break;
-
-	case OMAPDSS_VER_OMAP5:
-	case OMAPDSS_VER_DRA7xx:
+	else
 		pll->hw = &dss_omap5_hdmi_pll_hw;
-		break;
-
-	default:
-		return -ENODEV;
-	}
 
 	pll->ops = &hdmi_pll_ops;
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 05/11] drm: omapdrm: hdmi: Configure the PHY from the HDMI core version
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (3 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 04/11] drm: omapdrm: hdmi: Configure the PLL from the HDMI core version Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 06/11] drm: omapdrm: hdmi: Don't allocate PHY features dynamically Laurent Pinchart
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The OMAP4 and OMAP5 HDMI PHYs have different properties that require
specific handling in the HDMI PHY driver. This needs knowledge of the
PHY version, which is currently inferred from the DSS version. As part
of the effort to remove usage of the DSS version, use the HDMI
controller version instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi.h     |  3 ++-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c    |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c    |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi_phy.c | 23 +++++++----------------
 4 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi.h b/drivers/gpu/drm/omapdrm/dss/hdmi.h
index eef717120b33..a820b394af09 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi.h
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi.h
@@ -327,7 +327,8 @@ void hdmi_pll_uninit(struct hdmi_pll_data *hpll);
 int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk,
 	unsigned long lfbitclk);
 void hdmi_phy_dump(struct hdmi_phy_data *phy, struct seq_file *s);
-int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy);
+int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy,
+		  unsigned int version);
 int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes);
 
 /* HDMI common funcs */
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 4c131d710282..f169348da377 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -707,7 +707,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
 	if (r)
 		return r;
 
-	r = hdmi_phy_init(pdev, &hdmi.phy);
+	r = hdmi_phy_init(pdev, &hdmi.phy, 4);
 	if (r)
 		goto err;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index a6adddeee5bb..b3221ca5bcd8 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -739,7 +739,7 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
 	if (r)
 		return r;
 
-	r = hdmi_phy_init(pdev, &hdmi.phy);
+	r = hdmi_phy_init(pdev, &hdmi.phy, 5);
 	if (r)
 		goto err;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
index bff1ea11ed2f..95770c3203a1 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
@@ -183,7 +183,8 @@ static const struct hdmi_phy_features omap54xx_phy_feats = {
 };
 
 static int hdmi_phy_init_features(struct platform_device *pdev,
-				  struct hdmi_phy_data *phy)
+				  struct hdmi_phy_data *phy,
+				  unsigned int version)
 {
 	struct hdmi_phy_features *dst;
 	const struct hdmi_phy_features *src;
@@ -194,21 +195,10 @@ static int hdmi_phy_init_features(struct platform_device *pdev,
 		return -ENOMEM;
 	}
 
-	switch (omapdss_get_version()) {
-	case OMAPDSS_VER_OMAP4430_ES1:
-	case OMAPDSS_VER_OMAP4430_ES2:
-	case OMAPDSS_VER_OMAP4:
+	if (version == 4)
 		src = &omap44xx_phy_feats;
-		break;
-
-	case OMAPDSS_VER_OMAP5:
-	case OMAPDSS_VER_DRA7xx:
+	else
 		src = &omap54xx_phy_feats;
-		break;
-
-	default:
-		return -ENODEV;
-	}
 
 	memcpy(dst, src, sizeof(*dst));
 	phy->features = dst;
@@ -216,12 +206,13 @@ static int hdmi_phy_init_features(struct platform_device *pdev,
 	return 0;
 }
 
-int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy)
+int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy,
+		  unsigned int version)
 {
 	int r;
 	struct resource *res;
 
-	r = hdmi_phy_init_features(pdev, phy);
+	r = hdmi_phy_init_features(pdev, phy, version);
 	if (r)
 		return r;
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 06/11] drm: omapdrm: hdmi: Don't allocate PHY features dynamically
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (4 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 05/11] drm: omapdrm: hdmi: Configure the PHY " Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

There's no need to allocate memory dynamically to duplicate the contents
of a const structure, only to store the memory pointer in a const
pointer field. Just use the original structures directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi_phy.c | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
index 95770c3203a1..a156292b1820 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
@@ -182,39 +182,15 @@ static const struct hdmi_phy_features omap54xx_phy_feats = {
 	.max_phy	=	186000000,
 };
 
-static int hdmi_phy_init_features(struct platform_device *pdev,
-				  struct hdmi_phy_data *phy,
-				  unsigned int version)
-{
-	struct hdmi_phy_features *dst;
-	const struct hdmi_phy_features *src;
-
-	dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
-	if (!dst) {
-		dev_err(&pdev->dev, "Failed to allocate HDMI PHY Features\n");
-		return -ENOMEM;
-	}
-
-	if (version == 4)
-		src = &omap44xx_phy_feats;
-	else
-		src = &omap54xx_phy_feats;
-
-	memcpy(dst, src, sizeof(*dst));
-	phy->features = dst;
-
-	return 0;
-}
-
 int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy,
 		  unsigned int version)
 {
-	int r;
 	struct resource *res;
 
-	r = hdmi_phy_init_features(pdev, phy, version);
-	if (r)
-		return r;
+	if (version == 4)
+		phy->features = &omap44xx_phy_feats;
+	else
+		phy->features = &omap54xx_phy_feats;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
 	phy->base = devm_ioremap_resource(&pdev->dev, res);
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (5 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 06/11] drm: omapdrm: hdmi: Don't allocate PHY features dynamically Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-15 12:13   ` Tomi Valkeinen
                     ` (2 more replies)
  2017-08-11 13:49 ` [PATCH v3 08/11] drm: omapdrm: Remove the " Laurent Pinchart
                   ` (3 subsequent siblings)
  10 siblings, 3 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The omapdrm platform device is a virtual device created for the sole
purpose of handling the omapdss/omapdrm driver split. It should
eventually be removed. As a first step to ease refactoring move its
registration from platform code to driver code.

The omapdrm driver name must be changed internally to avoid probing both
the device registered in platform code and the device registered in the
omapdss driver, as that would otherwise break bisection.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
Changes since v1:

- Drop the CONFIG_DRM_OMAP conditional compilation
- Unregister the platform device at exit time
---
 drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
index 4dabe32c7098..8678d8b4efce 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -22,6 +22,7 @@
 
 #define DSS_SUBSYS_NAME "CORE"
 
+#include <linux/dma-mapping.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/clk.h>
@@ -103,6 +104,14 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
 	dss_uninit_platform_driver,
 };
 
+static struct platform_device omap_drm_device = {
+	.dev = {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	},
+	.name = "omapdrm_",
+	.id = 0,
+};
+
 static int __init omap_dss_init(void)
 {
 	int r;
@@ -118,6 +127,10 @@ static int __init omap_dss_init(void)
 			goto err_reg;
 	}
 
+	r = platform_device_register(&omap_drm_device);
+	if (r)
+		goto err_reg;
+
 	return 0;
 
 err_reg:
@@ -135,6 +148,8 @@ static void __exit omap_dss_exit(void)
 {
 	int i;
 
+	platform_device_unregister(&omap_drm_device);
+
 	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
 		dss_output_drv_unreg_funcs[i]();
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 022029ea6972..9ab22e0c0b84 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -734,7 +734,7 @@ static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);
 
 static struct platform_driver pdev = {
 	.driver = {
-		.name = DRIVER_NAME,
+		.name = "omapdrm_",
 		.pm = &omapdrm_pm_ops,
 	},
 	.probe = pdev_probe,
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 08/11] drm: omapdrm: Remove the omapdss driver
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (6 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 09/11] ARM: OMAP2+: Remove unused omapdrm platform device Laurent Pinchart
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The omapdss driver (not to be confused with the omapdss_dss driver) is
now a dummy driver with empty probe and remove functions. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/core.c    | 47 -----------------------------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  1 -
 2 files changed, 48 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
index 8678d8b4efce..79bf6b8e2515 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -25,50 +25,11 @@
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/clk.h>
-#include <linux/err.h>
 #include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/device.h>
-#include <linux/regulator/consumer.h>
-#include <linux/suspend.h>
-#include <linux/slab.h>
 
 #include "omapdss.h"
 #include "dss.h"
 
-static struct {
-	struct platform_device *pdev;
-} core;
-
-enum omapdss_version omapdss_get_version(void)
-{
-	struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
-	return pdata->version;
-}
-EXPORT_SYMBOL(omapdss_get_version);
-
-/* PLATFORM DEVICE */
-
-static int __init omap_dss_probe(struct platform_device *pdev)
-{
-	core.pdev = pdev;
-
-	return 0;
-}
-
-static int omap_dss_remove(struct platform_device *pdev)
-{
-	return 0;
-}
-
-static struct platform_driver omap_dss_driver = {
-	.remove         = omap_dss_remove,
-	.driver         = {
-		.name   = "omapdss",
-	},
-};
-
 /* INIT */
 static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
 	dss_init_platform_driver,
@@ -117,10 +78,6 @@ static int __init omap_dss_init(void)
 	int r;
 	int i;
 
-	r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
-	if (r)
-		return r;
-
 	for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
 		r = dss_output_drv_reg_funcs[i]();
 		if (r)
@@ -139,8 +96,6 @@ static int __init omap_dss_init(void)
 			++i)
 		dss_output_drv_unreg_funcs[i]();
 
-	platform_driver_unregister(&omap_dss_driver);
-
 	return r;
 }
 
@@ -152,8 +107,6 @@ static void __exit omap_dss_exit(void)
 
 	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
 		dss_output_drv_unreg_funcs[i]();
-
-	platform_driver_unregister(&omap_dss_driver);
 }
 
 module_init(omap_dss_init);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 2bc75b7148df..ffabd5505895 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -565,7 +565,6 @@ struct omap_dss_driver {
 		const struct hdmi_avi_infoframe *avi);
 };
 
-enum omapdss_version omapdss_get_version(void);
 bool omapdss_is_initialized(void);
 
 int omap_dss_register_driver(struct omap_dss_driver *);
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 09/11] ARM: OMAP2+: Remove unused omapdrm platform device
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (7 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 08/11] drm: omapdrm: Remove the " Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 10/11] ARM: OMAP2+: Don't register omapdss device for omapdrm Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 11/11] drm: omapdrm: Remove omapdrm platform data Laurent Pinchart
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tony Lindgren, linux-omap, Tomi Valkeinen

The omapdrm platform device is unused, as a replacement is now
registered in the omapdss driver. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/Makefile  |  2 +-
 arch/arm/mach-omap2/display.c |  7 ------
 arch/arm/mach-omap2/display.h |  1 -
 arch/arm/mach-omap2/drm.c     | 53 -------------------------------------------
 4 files changed, 1 insertion(+), 62 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/drm.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 779fb1f680b3..b3b3b3a19183 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -8,7 +8,7 @@ ccflags-y := -I$(srctree)/$(src)/include \
 # Common support
 obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \
 	 common.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
-	 omap_device.o omap-headsmp.o sram.o drm.o
+	 omap_device.o omap-headsmp.o sram.o
 
 hwmod-common				= omap_hwmod.o omap_hwmod_reset.o \
 					  omap_hwmod_common_data.o
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 8fa01c0ecdb2..5f5697668de8 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -384,13 +384,6 @@ int __init omapdss_init_of(void)
 		return r;
 	}
 
-	/* create DRM device */
-	r = omap_init_drm();
-	if (r < 0) {
-		pr_err("Unable to register omapdrm device\n");
-		return r;
-	}
-
 	/* create vrfb device */
 	r = omap_init_vrfb();
 	if (r < 0) {
diff --git a/arch/arm/mach-omap2/display.h b/arch/arm/mach-omap2/display.h
index 9a39646d4316..42ec2e99a2f4 100644
--- a/arch/arm/mach-omap2/display.h
+++ b/arch/arm/mach-omap2/display.h
@@ -26,7 +26,6 @@ struct omap_dss_dispc_dev_attr {
 	bool	has_framedonetv_irq;
 };
 
-int omap_init_drm(void);
 int omap_init_vrfb(void);
 int omap_init_fb(void);
 int omap_init_vout(void);
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
deleted file mode 100644
index 44fef961bb70..000000000000
--- a/arch/arm/mach-omap2/drm.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * DRM/KMS device registration for TI OMAP platforms
- *
- * Copyright (C) 2012 Texas Instruments
- * Author: Rob Clark <rob.clark@linaro.org>
- *
- * 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/>.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_data/omap_drm.h>
-
-#include "soc.h"
-#include "display.h"
-
-#if IS_ENABLED(CONFIG_DRM_OMAP)
-
-static struct omap_drm_platform_data platform_data;
-
-static struct platform_device omap_drm_device = {
-	.dev = {
-		.coherent_dma_mask = DMA_BIT_MASK(32),
-		.platform_data = &platform_data,
-	},
-	.name = "omapdrm",
-	.id = 0,
-};
-
-int __init omap_init_drm(void)
-{
-	platform_data.omaprev = GET_OMAP_TYPE;
-
-	return platform_device_register(&omap_drm_device);
-
-}
-#else
-int __init omap_init_drm(void) { return 0; }
-#endif
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 10/11] ARM: OMAP2+: Don't register omapdss device for omapdrm
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (8 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 09/11] ARM: OMAP2+: Remove unused omapdrm platform device Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  2017-08-11 13:49 ` [PATCH v3 11/11] drm: omapdrm: Remove omapdrm platform data Laurent Pinchart
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tony Lindgren, linux-omap, Tomi Valkeinen

The omapdrm driver doesn't need the omapdss device anymore. Although it
can't be removed completely as the fbdev driver still requires it, we
can condition its registration to the usage of the omapfb driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/display.c | 111 +++++++++++++++++++++++-------------------
 1 file changed, 60 insertions(+), 51 deletions(-)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 5f5697668de8..798fc718fffe 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -66,6 +66,7 @@
  */
 #define FRAMEDONE_IRQ_TIMEOUT		100
 
+#if defined(CONFIG_FB_OMAP2)
 static struct platform_device omap_display_device = {
 	.name          = "omapdss",
 	.id            = -1,
@@ -163,6 +164,64 @@ static enum omapdss_version __init omap_display_get_version(void)
 		return OMAPDSS_VER_UNKNOWN;
 }
 
+static int __init omapdss_init_fbdev(void)
+{
+	static struct omap_dss_board_info board_data = {
+		.dsi_enable_pads = omap_dsi_enable_pads,
+		.dsi_disable_pads = omap_dsi_disable_pads,
+		.set_min_bus_tput = omap_dss_set_min_bus_tput,
+	};
+	struct device_node *node;
+
+	board_data.version = omap_display_get_version();
+	if (board_data.version == OMAPDSS_VER_UNKNOWN) {
+		pr_err("DSS not supported on this SoC\n");
+		return -ENODEV;
+	}
+
+	omap_display_device.dev.platform_data = &board_data;
+
+	r = platform_device_register(&omap_display_device);
+	if (r < 0) {
+		pr_err("Unable to register omapdss device\n");
+		return r;
+	}
+
+	/* create vrfb device */
+	r = omap_init_vrfb();
+	if (r < 0) {
+		pr_err("Unable to register omapvrfb device\n");
+		return r;
+	}
+
+	/* create FB device */
+	r = omap_init_fb();
+	if (r < 0) {
+		pr_err("Unable to register omapfb device\n");
+		return r;
+	}
+
+	/* create V4L2 display device */
+	r = omap_init_vout();
+	if (r < 0) {
+		pr_err("Unable to register omap_vout device\n");
+		return r;
+	}
+
+	/* add DSI info for omap4 */
+	node = of_find_node_by_name(NULL, "omap4_padconf_global");
+	if (node)
+		omap4_dsi_mux_syscon = syscon_node_to_regmap(node);
+
+	return 0;
+}
+#else
+static inline int omapdss_init_fbdev(void)
+{
+	return 0;
+}
+#endif /* CONFIG_FB_OMAP2 */
+
 static void dispc_disable_outputs(void)
 {
 	u32 v, irq_mask = 0;
@@ -335,16 +394,9 @@ static struct device_node * __init omapdss_find_dss_of_node(void)
 int __init omapdss_init_of(void)
 {
 	int r;
-	enum omapdss_version ver;
 	struct device_node *node;
 	struct platform_device *pdev;
 
-	static struct omap_dss_board_info board_data = {
-		.dsi_enable_pads = omap_dsi_enable_pads,
-		.dsi_disable_pads = omap_dsi_disable_pads,
-		.set_min_bus_tput = omap_dss_set_min_bus_tput,
-	};
-
 	/* only create dss helper devices if dss is enabled in the .dts */
 
 	node = omapdss_find_dss_of_node();
@@ -354,13 +406,6 @@ int __init omapdss_init_of(void)
 	if (!of_device_is_available(node))
 		return 0;
 
-	ver = omap_display_get_version();
-
-	if (ver == OMAPDSS_VER_UNKNOWN) {
-		pr_err("DSS not supported on this SoC\n");
-		return -ENODEV;
-	}
-
 	pdev = of_find_device_by_node(node);
 
 	if (!pdev) {
@@ -374,41 +419,5 @@ int __init omapdss_init_of(void)
 		return r;
 	}
 
-	board_data.version = ver;
-
-	omap_display_device.dev.platform_data = &board_data;
-
-	r = platform_device_register(&omap_display_device);
-	if (r < 0) {
-		pr_err("Unable to register omapdss device\n");
-		return r;
-	}
-
-	/* create vrfb device */
-	r = omap_init_vrfb();
-	if (r < 0) {
-		pr_err("Unable to register omapvrfb device\n");
-		return r;
-	}
-
-	/* create FB device */
-	r = omap_init_fb();
-	if (r < 0) {
-		pr_err("Unable to register omapfb device\n");
-		return r;
-	}
-
-	/* create V4L2 display device */
-	r = omap_init_vout();
-	if (r < 0) {
-		pr_err("Unable to register omap_vout device\n");
-		return r;
-	}
-
-	/* add DSI info for omap4 */
-	node = of_find_node_by_name(NULL, "omap4_padconf_global");
-	if (node)
-		omap4_dsi_mux_syscon = syscon_node_to_regmap(node);
-
-	return 0;
+	return omapdss_init_fbdev();
 }
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v3 11/11] drm: omapdrm: Remove omapdrm platform data
  2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
                   ` (9 preceding siblings ...)
  2017-08-11 13:49 ` [PATCH v3 10/11] ARM: OMAP2+: Don't register omapdss device for omapdrm Laurent Pinchart
@ 2017-08-11 13:49 ` Laurent Pinchart
  10 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-11 13:49 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomi Valkeinen

The omapdrm platform data are not used anymore, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 include/linux/platform_data/omap_drm.h | 53 ----------------------------------
 1 file changed, 53 deletions(-)
 delete mode 100644 include/linux/platform_data/omap_drm.h

diff --git a/include/linux/platform_data/omap_drm.h b/include/linux/platform_data/omap_drm.h
deleted file mode 100644
index f4e4a237ebd2..000000000000
--- a/include/linux/platform_data/omap_drm.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * DRM/KMS platform data for TI OMAP platforms
- *
- * Copyright (C) 2012 Texas Instruments
- * Author: Rob Clark <rob.clark@linaro.org>
- *
- * 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/>.
- */
-
-#ifndef __PLATFORM_DATA_OMAP_DRM_H__
-#define __PLATFORM_DATA_OMAP_DRM_H__
-
-/*
- * Optional platform data to configure the default configuration of which
- * pipes/overlays/CRTCs are used.. if this is not provided, then instead the
- * first CONFIG_DRM_OMAP_NUM_CRTCS are used, and they are each connected to
- * one manager, with priority given to managers that are connected to
- * detected devices.  Remaining overlays are used as video planes.  This
- * should be a good default behavior for most cases, but yet there still
- * might be times when you wish to do something different.
- */
-struct omap_kms_platform_data {
-	/* overlays to use as CRTCs: */
-	int ovl_cnt;
-	const int *ovl_ids;
-
-	/* overlays to use as video planes: */
-	int pln_cnt;
-	const int *pln_ids;
-
-	int mgr_cnt;
-	const int *mgr_ids;
-
-	int dev_cnt;
-	const char **dev_names;
-};
-
-struct omap_drm_platform_data {
-	uint32_t omaprev;
-	struct omap_kms_platform_data *kms_pdata;
-};
-
-#endif /* __PLATFORM_DATA_OMAP_DRM_H__ */
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 03/11] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio
  2017-08-11 13:49 ` [PATCH v3 03/11] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio Laurent Pinchart
@ 2017-08-11 14:38   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 19+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-08-11 14:38 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Mark Brown, Tomi Valkeinen, dri-devel

On Friday, August 11, 2017 04:49:04 PM Laurent Pinchart wrote:
> The HDMI audio driver only needs to know which generation of HDMI
> transmitter it deals with, not the detailed SoC model. Pass the version
> number as an integer to prepare for removal of the OMAP SoC version from
> the omapdrm driver.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Acked-by: Mark Brown <broonie@kernel.org>

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-08-11 13:49 ` [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
@ 2017-08-15 12:13   ` Tomi Valkeinen
  2017-08-16  9:49   ` [PATCHv2] " Tomi Valkeinen
  2017-09-28  8:03   ` [PATCH v3 07/11] " Tomi Valkeinen
  2 siblings, 0 replies; 19+ messages in thread
From: Tomi Valkeinen @ 2017-08-15 12:13 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel

Hi Laurent,


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

On 11/08/17 16:49, Laurent Pinchart wrote:
> The omapdrm platform device is a virtual device created for the sole
> purpose of handling the omapdss/omapdrm driver split. It should
> eventually be removed. As a first step to ease refactoring move its
> registration from platform code to driver code.
> 
> The omapdrm driver name must be changed internally to avoid probing both
> the device registered in platform code and the device registered in the
> omapdss driver, as that would otherwise break bisection.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> Changes since v1:
> 
> - Drop the CONFIG_DRM_OMAP conditional compilation
> - Unregister the platform device at exit time
> ---
>  drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
>  drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
> index 4dabe32c7098..8678d8b4efce 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -22,6 +22,7 @@
>  
>  #define DSS_SUBSYS_NAME "CORE"
>  
> +#include <linux/dma-mapping.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/clk.h>
> @@ -103,6 +104,14 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
>  	dss_uninit_platform_driver,
>  };
>  
> +static struct platform_device omap_drm_device = {
> +	.dev = {
> +		.coherent_dma_mask = DMA_BIT_MASK(32),
> +	},
> +	.name = "omapdrm_",
> +	.id = 0,
> +};
> +
>  static int __init omap_dss_init(void)
>  {
>  	int r;
> @@ -118,6 +127,10 @@ static int __init omap_dss_init(void)
>  			goto err_reg;
>  	}
>  
> +	r = platform_device_register(&omap_drm_device);
> +	if (r)
> +		goto err_reg;
> +
>  	return 0;
>  
>  err_reg:
> @@ -135,6 +148,8 @@ static void __exit omap_dss_exit(void)
>  {
>  	int i;
>  
> +	platform_device_unregister(&omap_drm_device);
> +
>  	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
>  		dss_output_drv_unreg_funcs[i]();
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 022029ea6972..9ab22e0c0b84 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -734,7 +734,7 @@ static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);
>  
>  static struct platform_driver pdev = {
>  	.driver = {
> -		.name = DRIVER_NAME,
> +		.name = "omapdrm_",
>  		.pm = &omapdrm_pm_ops,
>  	},
>  	.probe = pdev_probe,
 
When unloading:

[   40.099847] WARNING: CPU: 1 PID: 247 at drivers/base/core.c:818 device_release+0x8c/0x9c
[   40.107992] Device 'omapdrm_.0' does not have a release() function, it is broken and must be fixed.
[   40.119120] Modules linked in: cfbfillrect cfbimgblt cfbcopyarea omapdss(-) omapdss_base [last unloaded: snd_soc_omap_hdmi_audio]
[   40.131311] CPU: 1 PID: 247 Comm: rmmod Not tainted 4.13.0-rc3-00056-g2e3e69f7fd0d #26
[   40.139279] Hardware name: Generic DRA74X (Flattened Device Tree)
[   40.145412] Backtrace: 
[   40.147903] [<c010dc10>] (dump_backtrace) from [<c010debc>] (show_stack+0x18/0x1c)
[   40.155521]  r7:c0ed4910 r6:60080013 r5:00000000 r4:c0ed4910
[   40.161241] [<c010dea4>] (show_stack) from [<c09288c4>] (dump_stack+0xa8/0xdc)
r[   40.168517] [<c092881c>] (dump_stack) from [<c013bd80>] (__warn+0xdc/0x108)
[   40.175599]  r9:c05caef0 r8:00000332 r7:00000009 r6:c0c2eb78 r5:00000000 r4:ed0ebe98
[   40.183396] [<c013bca4>] (__warn) from [<c013bde8>] (warn_slowpath_fmt+0x3c/0x44)
[   40.190926]  r9:ed0ea000 r8:c0108c04 r7:ee2415c0 r6:ed10da80 r5:bf041010 r4:c0c2ebbc
[   40.198722] [<c013bdb0>] (warn_slowpath_fmt) from [<c05caef0>] (device_release+0x8c/0x9c)
[   40.206947]  r3:ee2415c0 r2:c0c2ebbc
[   40.210550]  r4:bf041018
[   40.213115] [<c05cae64>] (device_release) from [<c092ce94>] (kobject_put+0xf8/0x228)
[   40.220905]  r7:ee2415c0 r6:c0eec2b0 r5:c0ea1870 r4:bf041018
        [   40.226616] [<c092cd9c>] (kobject_put) from [<c05cb3d8>] (put_device+0x1c/0x20)
[   40.234050]  r7:00000081 r6:0003cd4c r5:00000800 r4:bf041000
[   40.239758] [<c05cb3bc>] (put_device) from [<c05d2dd8>] (platform_device_unregister+0x24/0x28)
[   40.248493] [<c05d2db4>] (platform_device_unregister) from [<bf032f1c>] (omap_dss_exit+0x14/0x3c [omapdss])
[   40.258291]  r5:00000800 r4:bf042880
[   40.261961] [<bf032f08>] (omap_dss_exit [omapdss]) from [<c01ec8e4>] (SyS_delete_module+0x178/0x250)
[   40.271147]  r5:00000800 r4:bf042880
[   40.274759] [<c01ec76c>] (SyS_delete_module) from [<c0108a60>] (ret_fast_syscall+0x0/0x1c)
[   40.283074]  r6:beac9c10 r5:0003cd10 r4:beac9dfc
[   40.289781] ---[ end trace 197bbc25cd50eb0f ]---

I think we didn't encounter this earlier, as the device was never freed.

 Tomi

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCHv2] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-08-11 13:49 ` [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
  2017-08-15 12:13   ` Tomi Valkeinen
@ 2017-08-16  9:49   ` Tomi Valkeinen
  2017-08-16 12:31     ` Laurent Pinchart
  2017-09-28  8:03   ` [PATCH v3 07/11] " Tomi Valkeinen
  2 siblings, 1 reply; 19+ messages in thread
From: Tomi Valkeinen @ 2017-08-16  9:49 UTC (permalink / raw)
  To: dri-devel, Laurent Pinchart; +Cc: Tomi Valkeinen

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

The omapdrm platform device is a virtual device created for the sole
purpose of handling the omapdss/omapdrm driver split. It should
eventually be removed. As a first step to ease refactoring move its
registration from platform code to driver code.

The omapdrm driver name must be changed internally to avoid probing both
the device registered in platform code and the device registered in the
omapdss driver, as that would otherwise break bisection.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---

I reworked this patch to create the platform device dynamically.

 drivers/gpu/drm/omapdrm/dss/core.c | 10 ++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.c |  8 +++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
index 4dabe32c7098..6b3247c4f857 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -103,6 +103,8 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
 	dss_uninit_platform_driver,
 };
 
+static struct platform_device *omap_drm_device;
+
 static int __init omap_dss_init(void)
 {
 	int r;
@@ -118,6 +120,12 @@ static int __init omap_dss_init(void)
 			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:
@@ -135,6 +143,8 @@ static void __exit omap_dss_exit(void)
 {
 	int i;
 
+	platform_device_unregister(omap_drm_device);
+
 	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
 		dss_output_drv_unreg_funcs[i]();
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 10e24ca928f2..2b990daf0052 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -575,6 +575,12 @@ static int pdev_probe(struct platform_device *pdev)
 	if (omapdss_is_initialized() == false)
 		return -EPROBE_DEFER;
 
+	ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to set the DMA mask\n");
+		return ret;
+	}
+
 	omap_crtc_pre_init();
 
 	ret = omap_connect_dssdevs();
@@ -762,7 +768,7 @@ static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);
 
 static struct platform_driver pdev = {
 	.driver = {
-		.name = DRIVER_NAME,
+		.name = "omapdrm_",
 		.pm = &omapdrm_pm_ops,
 	},
 	.probe = pdev_probe,
-- 
2.7.4


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


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCHv2] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-08-16  9:49   ` [PATCHv2] " Tomi Valkeinen
@ 2017-08-16 12:31     ` Laurent Pinchart
  0 siblings, 0 replies; 19+ messages in thread
From: Laurent Pinchart @ 2017-08-16 12:31 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: dri-devel

Hi Tomi,

Thank you for the patch.

On Wednesday 16 Aug 2017 12:49:01 Tomi Valkeinen wrote:
> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> The omapdrm platform device is a virtual device created for the sole
> purpose of handling the omapdss/omapdrm driver split. It should
> eventually be removed. As a first step to ease refactoring move its
> registration from platform code to driver code.
> 
> The omapdrm driver name must be changed internally to avoid probing both
> the device registered in platform code and the device registered in the
> omapdss driver, as that would otherwise break bisection.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

This looks good to me, so

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I trust that you have tested the patch with module unloading given that was 
how you found the original issue :-)

> ---
> 
> I reworked this patch to create the platform device dynamically.
> 
>  drivers/gpu/drm/omapdrm/dss/core.c | 10 ++++++++++
>  drivers/gpu/drm/omapdrm/omap_drv.c |  8 +++++++-
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c
> b/drivers/gpu/drm/omapdrm/dss/core.c index 4dabe32c7098..6b3247c4f857
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -103,6 +103,8 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
>  	dss_uninit_platform_driver,
>  };
> 
> +static struct platform_device *omap_drm_device;
> +
>  static int __init omap_dss_init(void)
>  {
>  	int r;
> @@ -118,6 +120,12 @@ static int __init omap_dss_init(void)
>  			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:
> @@ -135,6 +143,8 @@ static void __exit omap_dss_exit(void)
>  {
>  	int i;
> 
> +	platform_device_unregister(omap_drm_device);
> +
>  	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
>  		dss_output_drv_unreg_funcs[i]();
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c
> b/drivers/gpu/drm/omapdrm/omap_drv.c index 10e24ca928f2..2b990daf0052
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -575,6 +575,12 @@ static int pdev_probe(struct platform_device *pdev)
>  	if (omapdss_is_initialized() == false)
>  		return -EPROBE_DEFER;
> 
> +	ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> +	if (ret) {
> +		dev_err(&pdev->dev, "Failed to set the DMA mask\n");
> +		return ret;
> +	}
> +
>  	omap_crtc_pre_init();
> 
>  	ret = omap_connect_dssdevs();
> @@ -762,7 +768,7 @@ static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops,
> omap_drm_suspend, omap_drm_resume);
> 
>  static struct platform_driver pdev = {
>  	.driver = {
> -		.name = DRIVER_NAME,
> +		.name = "omapdrm_",
>  		.pm = &omapdrm_pm_ops,
>  	},
>  	.probe = pdev_probe,

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-08-11 13:49 ` [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
  2017-08-15 12:13   ` Tomi Valkeinen
  2017-08-16  9:49   ` [PATCHv2] " Tomi Valkeinen
@ 2017-09-28  8:03   ` Tomi Valkeinen
  2017-09-28  8:56     ` Laurent Pinchart
  2 siblings, 1 reply; 19+ messages in thread
From: Tomi Valkeinen @ 2017-09-28  8:03 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: Sarha, Jyri

Hi Laurent,


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

On 11/08/17 16:49, Laurent Pinchart wrote:
> The omapdrm platform device is a virtual device created for the sole
> purpose of handling the omapdss/omapdrm driver split. It should
> eventually be removed. As a first step to ease refactoring move its
> registration from platform code to driver code.
> 
> The omapdrm driver name must be changed internally to avoid probing both
> the device registered in platform code and the device registered in the
> omapdss driver, as that would otherwise break bisection.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> Changes since v1:
> 
> - Drop the CONFIG_DRM_OMAP conditional compilation
> - Unregister the platform device at exit time
> ---
>  drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
>  drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
> index 4dabe32c7098..8678d8b4efce 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -22,6 +22,7 @@
>  
>  #define DSS_SUBSYS_NAME "CORE"
>  
> +#include <linux/dma-mapping.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/clk.h>
> @@ -103,6 +104,14 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
>  	dss_uninit_platform_driver,
>  };
>  
> +static struct platform_device omap_drm_device = {
> +	.dev = {
> +		.coherent_dma_mask = DMA_BIT_MASK(32),
> +	},
> +	.name = "omapdrm_",
> +	.id = 0,
> +};
> +
>  static int __init omap_dss_init(void)
>  {
>  	int r;
> @@ -118,6 +127,10 @@ static int __init omap_dss_init(void)
>  			goto err_reg;
>  	}
>  
> +	r = platform_device_register(&omap_drm_device);
> +	if (r)
> +		goto err_reg;
> +

Was there a reason to create the omapdrm device in omap_dss_init (i.e.
module_init), instead of omapdss's probe? Now the omapdrm device is
always created even if there's no DSS device on the SoC.

 Tomi

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-09-28  8:03   ` [PATCH v3 07/11] " Tomi Valkeinen
@ 2017-09-28  8:56     ` Laurent Pinchart
  2017-09-28  9:25       ` Tomi Valkeinen
  0 siblings, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2017-09-28  8:56 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: Sarha, Jyri, dri-devel

Hi Tomi,

On Thursday, 28 September 2017 11:03:32 EEST Tomi Valkeinen wrote:
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> On 11/08/17 16:49, Laurent Pinchart wrote:
> > The omapdrm platform device is a virtual device created for the sole
> > purpose of handling the omapdss/omapdrm driver split. It should
> > eventually be removed. As a first step to ease refactoring move its
> > registration from platform code to driver code.
> > 
> > The omapdrm driver name must be changed internally to avoid probing both
> > the device registered in platform code and the device registered in the
> > omapdss driver, as that would otherwise break bisection.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > ---
> > Changes since v1:
> > 
> > - Drop the CONFIG_DRM_OMAP conditional compilation
> > - Unregister the platform device at exit time
> > ---
> > 
> >  drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
> >  drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
> >  2 files changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/dss/core.c
> > b/drivers/gpu/drm/omapdrm/dss/core.c index 4dabe32c7098..8678d8b4efce
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/core.c
> > +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> > @@ -22,6 +22,7 @@
> > 
> >  #define DSS_SUBSYS_NAME "CORE"
> > 
> > +#include <linux/dma-mapping.h>
> > 
> >  #include <linux/kernel.h>
> >  #include <linux/module.h>
> >  #include <linux/clk.h>
> > 
> > @@ -103,6 +104,14 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
> > 
> >  	dss_uninit_platform_driver,
> >  
> >  };
> > 
> > +static struct platform_device omap_drm_device = {
> > +	.dev = {
> > +		.coherent_dma_mask = DMA_BIT_MASK(32),
> > +	},
> > +	.name = "omapdrm_",
> > +	.id = 0,
> > +};
> > +
> > 
> >  static int __init omap_dss_init(void)
> >  {
> >  
> >  	int r;
> > 
> > @@ -118,6 +127,10 @@ static int __init omap_dss_init(void)
> > 
> >  			goto err_reg;
> >  	
> >  	}
> > 
> > +	r = platform_device_register(&omap_drm_device);
> > +	if (r)
> > +		goto err_reg;
> > +
> 
> Was there a reason to create the omapdrm device in omap_dss_init (i.e.
> module_init), instead of omapdss's probe? Now the omapdrm device is
> always created even if there's no DSS device on the SoC.

Not really, no.

Do you think this requires a quick -stable fix ? I'm working on a patch series 
that will remove the omapdrm device completely.

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver
  2017-09-28  8:56     ` Laurent Pinchart
@ 2017-09-28  9:25       ` Tomi Valkeinen
  0 siblings, 0 replies; 19+ messages in thread
From: Tomi Valkeinen @ 2017-09-28  9:25 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Sarha, Jyri, dri-devel


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

On 28/09/17 11:56, Laurent Pinchart wrote:

>> Was there a reason to create the omapdrm device in omap_dss_init (i.e.
>> module_init), instead of omapdss's probe? Now the omapdrm device is
>> always created even if there's no DSS device on the SoC.
> 
> Not really, no.
> 
> Do you think this requires a quick -stable fix ? I'm working on a patch series 
> that will remove the omapdrm device completely.

With -stable, you mean 4.14? Afaics, the only downside is a small amount
of memory that's not used. It does behave differently than before, as
the now-removed platform code did only add the omapdrm device if there's
a dss device in the DT data. I don't think that really matters, though.

But still, maybe it's nice to fix for 4.14, as we're still only at -rc2.

We encountered this with TI kernel, which has DSS6 driver. The omapdrm
side is shared, but the dss side is different than with the current dss.
So, the dss6 driver needs to create omapdrm device, but old dss driver
already creates it...

We'll hack around it, as it's only an issue in a development kernel.

 Tomi

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-09-28  9:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11 13:49 [PATCH v3 00/11] omapdrm: Remove the omapdrm and omapdss devices from platform code Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 01/11] drm: omapdrm: hdmi: Rename functions and structures to use hdmi_ prefix Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 02/11] drm: omapdrm: hdmi: Replace OMAP SoC model check with HDMI xmit version Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 03/11] drm: omapdrm: hdmi: Pass HDMI core version as integer to HDMI audio Laurent Pinchart
2017-08-11 14:38   ` Bartlomiej Zolnierkiewicz
2017-08-11 13:49 ` [PATCH v3 04/11] drm: omapdrm: hdmi: Configure the PLL from the HDMI core version Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 05/11] drm: omapdrm: hdmi: Configure the PHY " Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 06/11] drm: omapdrm: hdmi: Don't allocate PHY features dynamically Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver Laurent Pinchart
2017-08-15 12:13   ` Tomi Valkeinen
2017-08-16  9:49   ` [PATCHv2] " Tomi Valkeinen
2017-08-16 12:31     ` Laurent Pinchart
2017-09-28  8:03   ` [PATCH v3 07/11] " Tomi Valkeinen
2017-09-28  8:56     ` Laurent Pinchart
2017-09-28  9:25       ` Tomi Valkeinen
2017-08-11 13:49 ` [PATCH v3 08/11] drm: omapdrm: Remove the " Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 09/11] ARM: OMAP2+: Remove unused omapdrm platform device Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 10/11] ARM: OMAP2+: Don't register omapdss device for omapdrm Laurent Pinchart
2017-08-11 13:49 ` [PATCH v3 11/11] drm: omapdrm: Remove omapdrm platform data Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.