Skip to contentSkip to conversation

drm/exynos: Refactor parts of the exynos driver

PATCH In review Sean Paul 7 participants 62 messages Jan 30, 2014 – Apr 4, 2014

Subsystems (6)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

v4 cover drm/exynos: Refactor parts of the exynos driver

This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle suspend/resume through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Sean

Daniel Kurtz (1):
drm/exynos: hdmi: remove the i2c drivers and use devtree

Sean Paul (32):
drm/exynos: Rename hdmi_infoframe to avoid collision drm/exynos: Merge overlay_ops into manager_ops drm/exynos: Add an initialize function to manager and display drm/exynos: Use manager_op initialize in fimd drm/exynos: hdmi: Implement initialize op for hdmi drm/exynos: Pass exynos_drm_manager in manager ops instead of dev drm/exynos: Remove apply manager callback
drm/exynos: Remove dpms link between encoder/connector drm/exynos: Rename display_op power_on to dpms drm/exynos: Don't keep dpms state in encoder drm/exynos: Use unsigned long for possible_crtcs drm/exynos: Split manager/display/subdrv
ARM: dts: exynos: Add i2c phandles to hdmi node drm/exynos: Remove exynos_drm_hdmi shim
drm/exynos: Use drm_mode_copy to copy modes drm/exynos: Disable unused crtc planes from crtc drm/exynos: Add mode_set manager operation
drm/exynos: Implement mode_fixup manager operation drm/exynos: Use mode_set to configure fimd
drm/exynos: Remove unused/useless fimd_context members drm/exynos: Move dp driver from video/ to drm/ drm/exynos: Move display implementation into dp
ARM: dts: Move display-timings node from fimd to dp drm/exynos: Implement dpms display callback in DP drm/exynos: Clean up FIMD power on/off routines drm/exynos: Consolidate suspend/resume in drm_drv drm/exynos: Add create_connector callback
drm/exynos: Implement drm_connector in hdmi directly drm/exynos: Implement drm_connector directly in dp driver drm/exynos: Implement drm_connector directly in vidi driver drm/exynos: Move lvds bridge discovery into DP driver drm/exynos: Remove the exynos_drm_connector shim

Stéphane Marchesin (1):
drm/exynos: Remove useless slab.h include

 .../devicetree/bindings/video/exynos_dp.txt        |   17 +
 .../devicetree/bindings/video/exynos_hdmi.txt      |    5 +
 .../devicetree/bindings/video/samsung-fimd.txt     |    2 +
 MAINTAINERS                                        |    7 -
 arch/arm/boot/dts/cros5250-common.dtsi             |    6 +-
 arch/arm/boot/dts/exynos5250-arndale.dts           |    7 +-
 arch/arm/boot/dts/exynos5250-smdk5250.dts          |   13 +-
 arch/arm/boot/dts/exynos5250-snow.dts              |    7 +-
 arch/arm/boot/dts/exynos5420-smdk5420.dts          |    7 +-
 drivers/gpu/drm/exynos/Kconfig                     |    7 +
 drivers/gpu/drm/exynos/Makefile                    |    7 +-
 drivers/gpu/drm/exynos/exynos_ddc.c                |   63 -
 drivers/gpu/drm/exynos/exynos_dp_core.c            | 1357 ++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_core.h            |  329 +++++
 drivers/gpu/drm/exynos/exynos_dp_reg.c             | 1243 ++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_reg.h             |  366 ++++++
 drivers/gpu/drm/exynos/exynos_drm_connector.c      |  304 -----
 drivers/gpu/drm/exynos/exynos_drm_connector.h      |   24 -
 drivers/gpu/drm/exynos/exynos_drm_core.c           |  233 ++--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c           |  139 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h           |   20 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c            |  155 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h            |  154 ++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c        |  357 +----
 drivers/gpu/drm/exynos/exynos_drm_encoder.h        |   18 +-
 drivers/gpu/drm/exynos/exynos_drm_fb.c             |    4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c           |  682 ++++------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c           |  439 -------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h           |   67 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c          |   17 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.h          |    2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c           |  413 +++---
 drivers/gpu/drm/exynos/exynos_hdmi.c               |  370 +++---
 drivers/gpu/drm/exynos/exynos_hdmi.h               |   23 -
 drivers/gpu/drm/exynos/exynos_hdmiphy.c            |   65 -
 drivers/gpu/drm/exynos/exynos_mixer.c              |  573 ++++-----
 drivers/gpu/drm/exynos/exynos_mixer.h              |   20 +
 drivers/video/exynos/Kconfig                       |    7 -
 drivers/video/exynos/Makefile                      |    1 -
 drivers/video/exynos/exynos_dp_core.c              | 1156 -----------------
 drivers/video/exynos/exynos_dp_core.h              |  320 -----
 drivers/video/exynos/exynos_dp_reg.c               | 1243 ------------------
 drivers/video/exynos/exynos_dp_reg.h               |  366 ------
 43 files changed, 4864 insertions(+), 5751 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_mixer.h
 delete mode 100644 drivers/video/exynos/exynos_dp_core.c
 delete mode 100644 drivers/video/exynos/exynos_dp_core.h
 delete mode 100644 drivers/video/exynos/exynos_dp_reg.c
 delete mode 100644 drivers/video/exynos/exynos_dp_reg.h
Signature · 6 lines
1.8.5.1

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

PATCH v4 1/34 drm/exynos: Rename hdmi_infoframe to avoid collision

Rename hdmi_infoframe to exynos_hdmi_infoframe to avoid nameing collision.

---

Changes in v4:
- Added

 drivers/gpu/drm/exynos/exynos_hdmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +3 -3
index a0e10ae..e1c1bfc 100644
@@ -379,7 +379,7 @@ static const struct hdmiphy_config hdmiphy_v14_configs[] = {
 	},
 };
 
-struct hdmi_infoframe {
+struct exynos_hdmi_infoframe {
 	enum HDMI_PACKET_TYPE type;
 	u8 ver;
 	u8 len;
@@ -682,7 +682,7 @@ static u8 hdmi_chksum(struct hdmi_context *hdata,
 }
 
 static void hdmi_reg_infoframe(struct hdmi_context *hdata,
-			struct hdmi_infoframe *infoframe)
+			struct exynos_hdmi_infoframe *infoframe)
 {
 	u32 hdr_sum;
 	u8 chksum;
@@ -985,7 +985,7 @@ static void hdmi_conf_reset(struct hdmi_context *hdata)
 
 static void hdmi_conf_init(struct hdmi_context *hdata)
 {
-	struct hdmi_infoframe infoframe;
+	struct exynos_hdmi_infoframe infoframe;
 
 	/* disable HPD interrupts from HDMI IP block, use GPIO instead */
 	hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL |
Signature · 1 line
1.8.5.1
author
#2 lore raw

PATCH v4 2/34 drm/exynos: Remove useless slab.h include

In reply to Sean Paul

From: Stéphane Marchesin <[email protected]>

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/video/exynos/exynos_dp_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/video/exynos/exynos_dp_core.c +0 -1
index 5e1a715..b3af496 100644
@@ -12,7 +12,6 @@
 
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
Signature · 6 lines
1.8.5.1

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

PATCH v4 3/34 drm/exynos: Merge overlay_ops into manager_ops

In reply to Sean Paul

This patch merges overlay_ops into manager_ops. In all cases, overlay_ops is implemented in the same place as manager ops, it doesn't serve a functional purpose, and doesn't make things more clear.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Just moved fimd manager struct instead of manager functions (reduced diff)

 drivers/gpu/drm/exynos/exynos_drm_drv.h     | 29 ++++++++---------------
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 26 ++++++++++-----------
 drivers/gpu/drm/exynos/exynos_drm_fimd.c    | 29 ++++++++++-------------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c    | 36 +++++++++++++----------------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c    | 29 ++++++++++-------------
 drivers/gpu/drm/exynos/exynos_mixer.c       |  2 --
 6 files changed, 62 insertions(+), 89 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +9 -20
index 0eaf5a2..4288d0a 100644
@@ -54,22 +54,6 @@ enum exynos_drm_output_type {
 };
 
 /*
- * Exynos drm overlay ops structure.
- *
- * @mode_set: copy drm overlay info to hw specific overlay info.
- * @commit: apply hardware specific overlay data to registers.
- * @enable: enable hardware specific overlay.
- * @disable: disable hardware specific overlay.
- */
-struct exynos_drm_overlay_ops {
-	void (*mode_set)(struct device *subdrv_dev,
-			 struct exynos_drm_overlay *overlay);
-	void (*commit)(struct device *subdrv_dev, int zpos);
-	void (*enable)(struct device *subdrv_dev, int zpos);
-	void (*disable)(struct device *subdrv_dev, int zpos);
-};
-
-/*
  * Exynos drm common overlay structure.
  *
  * @fb_x: offset x on a framebuffer to be displayed.
@@ -169,6 +153,10 @@ struct exynos_drm_display_ops {
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
  * @wait_for_vblank: wait for vblank interrupt to make sure that
  *	hardware overlay is updated.
+ * @win_mode_set: copy drm overlay info to hw specific overlay info.
+ * @win_commit: apply hardware specific overlay data to registers.
+ * @win_enable: enable hardware specific overlay.
+ * @win_disable: disable hardware specific overlay.
  */
 struct exynos_drm_manager_ops {
 	void (*dpms)(struct device *subdrv_dev, int mode);
@@ -184,6 +172,11 @@ struct exynos_drm_manager_ops {
 	int (*enable_vblank)(struct device *subdrv_dev);
 	void (*disable_vblank)(struct device *subdrv_dev);
 	void (*wait_for_vblank)(struct device *subdrv_dev);
+	void (*win_mode_set)(struct device *subdrv_dev,
+				struct exynos_drm_overlay *overlay);
+	void (*win_commit)(struct device *subdrv_dev, int zpos);
+	void (*win_enable)(struct device *subdrv_dev, int zpos);
+	void (*win_disable)(struct device *subdrv_dev, int zpos);
 };
 
 /*
@@ -195,9 +188,6 @@ struct exynos_drm_manager_ops {
  * @ops: pointer to callbacks for exynos drm specific framebuffer.
  *	these callbacks should be set by specific drivers such fimd
  *	or hdmi driver and are used to control hardware global registers.
- * @overlay_ops: pointer to callbacks for exynos drm specific framebuffer.
- *	these callbacks should be set by specific drivers such fimd
- *	or hdmi driver and are used to control hardware overlay reigsters.
  * @display: pointer to callbacks for exynos drm specific framebuffer.
  *	these callbacks should be set by specific drivers such fimd
  *	or hdmi driver and are used to control display devices such as
@@ -207,7 +197,6 @@ struct exynos_drm_manager {
 	struct device *dev;
 	int pipe;
 	struct exynos_drm_manager_ops *ops;
-	struct exynos_drm_overlay_ops *overlay_ops;
 	struct exynos_drm_display_ops *display_ops;
 };
 
drivers/gpu/drm/exynos/exynos_drm_encoder.c +13 -13
index 06f1b2a..c255341 100644
@@ -133,7 +133,7 @@ static void disable_plane_to_crtc(struct drm_device *dev,
 			 *
 			 * plane->funcs->disable_plane call checks
 			 * if encoder->crtc is same as plane->crtc and if same
-			 * then overlay_ops->disable callback will be called
+			 * then manager_ops->win_disable callback will be called
 			 * to diasble current hw overlay so plane->crtc should
 			 * have new_crtc because new_crtc was set to
 			 * encoder->crtc in advance.
@@ -442,51 +442,51 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)
 {
 	struct exynos_drm_manager *manager =
 		to_exynos_encoder(encoder)->manager;
-	struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;
+	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 	struct exynos_drm_overlay *overlay = data;
 
-	if (overlay_ops && overlay_ops->mode_set)
-		overlay_ops->mode_set(manager->dev, overlay);
+	if (manager_ops && manager_ops->win_mode_set)
+		manager_ops->win_mode_set(manager->dev, overlay);
 }
 
 void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data)
 {
 	struct exynos_drm_manager *manager =
 		to_exynos_encoder(encoder)->manager;
-	struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;
+	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 	int zpos = DEFAULT_ZPOS;
 
 	if (data)
 		zpos = *(int *)data;
 
-	if (overlay_ops && overlay_ops->commit)
-		overlay_ops->commit(manager->dev, zpos);
+	if (manager_ops && manager_ops->win_commit)
+		manager_ops->win_commit(manager->dev, zpos);
 }
 
 void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data)
 {
 	struct exynos_drm_manager *manager =
 		to_exynos_encoder(encoder)->manager;
-	struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;
+	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 	int zpos = DEFAULT_ZPOS;
 
 	if (data)
 		zpos = *(int *)data;
 
-	if (overlay_ops && overlay_ops->enable)
-		overlay_ops->enable(manager->dev, zpos);
+	if (manager_ops && manager_ops->win_enable)
+		manager_ops->win_enable(manager->dev, zpos);
 }
 
 void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
 {
 	struct exynos_drm_manager *manager =
 		to_exynos_encoder(encoder)->manager;
-	struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;
+	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 	int zpos = DEFAULT_ZPOS;
 
 	if (data)
 		zpos = *(int *)data;
 
-	if (overlay_ops && overlay_ops->disable)
-		overlay_ops->disable(manager->dev, zpos);
+	if (manager_ops && manager_ops->win_disable)
+		manager_ops->win_disable(manager->dev, zpos);
 }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +12 -17
index a20440c..bc4001e 100644
@@ -219,14 +219,13 @@ static void fimd_apply(struct device *subdrv_dev)
 	struct fimd_context *ctx = get_fimd_context(subdrv_dev);
 	struct exynos_drm_manager *mgr = ctx->subdrv.manager;
 	struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
-	struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;
 	struct fimd_win_data *win_data;
 	int i;
 
 	for (i = 0; i < WINDOWS_NR; i++) {
 		win_data = &ctx->win_data[i];
-		if (win_data->enabled && (ovl_ops && ovl_ops->commit))
-			ovl_ops->commit(subdrv_dev, i);
+		if (win_data->enabled && (mgr_ops && mgr_ops->win_commit))
+			mgr_ops->win_commit(subdrv_dev, i);
 	}
 
 	if (mgr_ops && mgr_ops->commit)
@@ -351,15 +350,6 @@ static void fimd_wait_for_vblank(struct device *dev)
 		DRM_DEBUG_KMS("vblank wait timed out.\n");
 }
 
-static struct exynos_drm_manager_ops fimd_manager_ops = {
-	.dpms = fimd_dpms,
-	.apply = fimd_apply,
-	.commit = fimd_commit,
-	.enable_vblank = fimd_enable_vblank,
-	.disable_vblank = fimd_disable_vblank,
-	.wait_for_vblank = fimd_wait_for_vblank,
-};
-
 static void fimd_win_mode_set(struct device *dev,
 			      struct exynos_drm_overlay *overlay)
 {
@@ -669,16 +659,21 @@ static void fimd_win_disable(struct device *dev, int zpos)
 	win_data->enabled = false;
 }
 
-static struct exynos_drm_overlay_ops fimd_overlay_ops = {
-	.mode_set = fimd_win_mode_set,
-	.commit = fimd_win_commit,
-	.disable = fimd_win_disable,
+static struct exynos_drm_manager_ops fimd_manager_ops = {
+	.dpms = fimd_dpms,
+	.apply = fimd_apply,
+	.commit = fimd_commit,
+	.enable_vblank = fimd_enable_vblank,
+	.disable_vblank = fimd_disable_vblank,
+	.wait_for_vblank = fimd_wait_for_vblank,
+	.win_mode_set = fimd_win_mode_set,
+	.win_commit = fimd_win_commit,
+	.win_disable = fimd_win_disable,
 };
 
 static struct exynos_drm_manager fimd_manager = {
 	.pipe		= -1,
 	.ops		= &fimd_manager_ops,
-	.overlay_ops	= &fimd_overlay_ops,
 	.display_ops	= &fimd_display_ops,
 };
 
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +16 -20
index 8548b97..a1ef3c9 100644
@@ -284,19 +284,7 @@ static void drm_hdmi_apply(struct device *subdrv_dev)
 		hdmi_ops->commit(ctx->hdmi_ctx->ctx);
 }
 
-static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {
-	.dpms = drm_hdmi_dpms,
-	.apply = drm_hdmi_apply,
-	.enable_vblank = drm_hdmi_enable_vblank,
-	.disable_vblank = drm_hdmi_disable_vblank,
-	.wait_for_vblank = drm_hdmi_wait_for_vblank,
-	.mode_fixup = drm_hdmi_mode_fixup,
-	.mode_set = drm_hdmi_mode_set,
-	.get_max_resol = drm_hdmi_get_max_resol,
-	.commit = drm_hdmi_commit,
-};
-
-static void drm_mixer_mode_set(struct device *subdrv_dev,
+static void drm_mixer_win_mode_set(struct device *subdrv_dev,
 		struct exynos_drm_overlay *overlay)
 {
 	struct drm_hdmi_context *ctx = to_context(subdrv_dev);
@@ -305,7 +293,7 @@ static void drm_mixer_mode_set(struct device *subdrv_dev,
 		mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
 }
 
-static void drm_mixer_commit(struct device *subdrv_dev, int zpos)
+static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos)
 {
 	struct drm_hdmi_context *ctx = to_context(subdrv_dev);
 	int win = (zpos == DEFAULT_ZPOS) ? MIXER_DEFAULT_WIN : zpos;
@@ -321,7 +309,7 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos)
 	ctx->enabled[win] = true;
 }
 
-static void drm_mixer_disable(struct device *subdrv_dev, int zpos)
+static void drm_mixer_win_disable(struct device *subdrv_dev, int zpos)
 {
 	struct drm_hdmi_context *ctx = to_context(subdrv_dev);
 	int win = (zpos == DEFAULT_ZPOS) ? MIXER_DEFAULT_WIN : zpos;
@@ -337,16 +325,24 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos)
 	ctx->enabled[win] = false;
 }
 
-static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = {
-	.mode_set = drm_mixer_mode_set,
-	.commit = drm_mixer_commit,
-	.disable = drm_mixer_disable,
+static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {
+	.dpms = drm_hdmi_dpms,
+	.apply = drm_hdmi_apply,
+	.enable_vblank = drm_hdmi_enable_vblank,
+	.disable_vblank = drm_hdmi_disable_vblank,
+	.wait_for_vblank = drm_hdmi_wait_for_vblank,
+	.mode_fixup = drm_hdmi_mode_fixup,
+	.mode_set = drm_hdmi_mode_set,
+	.get_max_resol = drm_hdmi_get_max_resol,
+	.commit = drm_hdmi_commit,
+	.win_mode_set = drm_mixer_win_mode_set,
+	.win_commit = drm_mixer_win_commit,
+	.win_disable = drm_mixer_win_disable,
 };
 
 static struct exynos_drm_manager hdmi_manager = {
 	.pipe		= -1,
 	.ops		= &drm_hdmi_manager_ops,
-	.overlay_ops	= &drm_hdmi_overlay_ops,
 	.display_ops	= &drm_hdmi_display_ops,
 };
 
drivers/gpu/drm/exynos/exynos_drm_vidi.c +12 -17
index ddaaedd..fca7ad5 100644
@@ -180,14 +180,13 @@ static void vidi_apply(struct device *subdrv_dev)
 	struct vidi_context *ctx = get_vidi_context(subdrv_dev);
 	struct exynos_drm_manager *mgr = ctx->subdrv.manager;
 	struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
-	struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;
 	struct vidi_win_data *win_data;
 	int i;
 
 	for (i = 0; i < WINDOWS_NR; i++) {
 		win_data = &ctx->win_data[i];
-		if (win_data->enabled && (ovl_ops && ovl_ops->commit))
-			ovl_ops->commit(subdrv_dev, i);
+		if (win_data->enabled && (mgr_ops && mgr_ops->win_commit))
+			mgr_ops->win_commit(subdrv_dev, i);
 	}
 
 	if (mgr_ops && mgr_ops->commit)
@@ -217,7 +216,7 @@ static int vidi_enable_vblank(struct device *dev)
 	/*
 	 * in case of page flip request, vidi_finish_pageflip function
 	 * will not be called because direct_vblank is true and then
-	 * that function will be called by overlay_ops->commit callback
+	 * that function will be called by manager_ops->win_commit callback
 	 */
 	schedule_work(&ctx->work);
 
@@ -235,14 +234,6 @@ static void vidi_disable_vblank(struct device *dev)
 		ctx->vblank_on = false;
 }
 
-static struct exynos_drm_manager_ops vidi_manager_ops = {
-	.dpms = vidi_dpms,
-	.apply = vidi_apply,
-	.commit = vidi_commit,
-	.enable_vblank = vidi_enable_vblank,
-	.disable_vblank = vidi_disable_vblank,
-};
-
 static void vidi_win_mode_set(struct device *dev,
 			      struct exynos_drm_overlay *overlay)
 {
@@ -339,16 +330,20 @@ static void vidi_win_disable(struct device *dev, int zpos)
 	/* TODO. */
 }
 
-static struct exynos_drm_overlay_ops vidi_overlay_ops = {
-	.mode_set = vidi_win_mode_set,
-	.commit = vidi_win_commit,
-	.disable = vidi_win_disable,
+static struct exynos_drm_manager_ops vidi_manager_ops = {
+	.dpms = vidi_dpms,
+	.apply = vidi_apply,
+	.commit = vidi_commit,
+	.enable_vblank = vidi_enable_vblank,
+	.disable_vblank = vidi_disable_vblank,
+	.win_mode_set = vidi_win_mode_set,
+	.win_commit = vidi_win_commit,
+	.win_disable = vidi_win_disable,
 };
 
 static struct exynos_drm_manager vidi_manager = {
 	.pipe		= -1,
 	.ops		= &vidi_manager_ops,
-	.overlay_ops	= &vidi_overlay_ops,
 	.display_ops	= &vidi_display_ops,
 };
 
drivers/gpu/drm/exynos/exynos_mixer.c +0 -2
index 2dfa48c..53fd076 100644
@@ -975,8 +975,6 @@ static struct exynos_mixer_ops mixer_ops = {
 	.disable_vblank		= mixer_disable_vblank,
 	.wait_for_vblank	= mixer_wait_for_vblank,
 	.dpms			= mixer_dpms,
-
-	/* overlay */
 	.win_mode_set		= mixer_win_mode_set,
 	.win_commit		= mixer_win_commit,
 	.win_disable		= mixer_win_disable,
Signature · 1 line
1.8.5.1
author
#4 lore raw

PATCH v4 4/34 drm/exynos: Add an initialize function to manager and display

In reply to Sean Paul

This patch adds an initialize function to the manager and display operations. This allows them to keep track of drm_device in their local context, as well as adds an initialization hook right after the encoder is created.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_drv.h     |  5 +++++
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_drv.h +5 -0
index 4288d0a..2811486 100644
@@ -123,6 +123,7 @@ struct exynos_drm_overlay {
  *	- this structure is common to analog tv, digital tv and lcd panel.
  *
  * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI.
+ * @initialize: initializes the display with drm_dev
  * @is_connected: check for that display is connected or not.
  * @get_edid: get edid modes from display driver.
  * @get_panel: get panel object from display driver.
@@ -131,6 +132,7 @@ struct exynos_drm_overlay {
  */
 struct exynos_drm_display_ops {
 	enum exynos_drm_output_type type;
+	int (*initialize)(struct device *dev, struct drm_device *drm_dev);
 	bool (*is_connected)(struct device *dev);
 	struct edid *(*get_edid)(struct device *dev,
 			struct drm_connector *connector);
@@ -142,6 +144,7 @@ struct exynos_drm_display_ops {
 /*
  * Exynos drm manager ops
  *
+ * @initialize: initializes the manager with drm_dev
  * @dpms: control device power.
  * @apply: set timing, vblank and overlay data to registers.
  * @mode_fixup: fix mode data comparing to hw specific display mode.
@@ -159,6 +162,8 @@ struct exynos_drm_display_ops {
  * @win_disable: disable hardware specific overlay.
  */
 struct exynos_drm_manager_ops {
+	int (*initialize)(struct device *subdrv_dev,
+			struct drm_device *drm_dev);
 	void (*dpms)(struct device *subdrv_dev, int mode);
 	void (*apply)(struct device *subdrv_dev);
 	void (*mode_fixup)(struct device *subdrv_dev,
drivers/gpu/drm/exynos/exynos_drm_encoder.c +21 -0
index c255341..a9eb2b0 100644
@@ -316,6 +316,7 @@ exynos_drm_encoder_create(struct drm_device *dev,
 {
 	struct drm_encoder *encoder;
 	struct exynos_drm_encoder *exynos_encoder;
+	int ret;
 
 	if (!manager || !possible_crtcs)
 		return NULL;
@@ -339,9 +340,29 @@ exynos_drm_encoder_create(struct drm_device *dev,
 
 	drm_encoder_helper_add(encoder, &exynos_encoder_helper_funcs);
 
+	if (manager->ops && manager->ops->initialize) {
+		ret = manager->ops->initialize(manager->dev, dev);
+		if (ret) {
+			DRM_ERROR("Manager initialize failed %d\n", ret);
+			goto error;
+		}
+	}
+
+	if (manager->display_ops && manager->display_ops->initialize) {
+		ret = manager->display_ops->initialize(manager->dev, dev);
+		if (ret) {
+			DRM_ERROR("Display initialize failed %d\n", ret);
+			goto error;
+		}
+	}
+
 	DRM_DEBUG_KMS("encoder has been created\n");
 
 	return encoder;
+
+error:
+	exynos_drm_encoder_destroy(&exynos_encoder->drm_encoder);
+	return NULL;
 }
 
 struct exynos_drm_manager *exynos_drm_get_manager(struct drm_encoder *encoder)
Signature · 1 line
1.8.5.1
author
#5 lore raw

PATCH v4 5/34 drm/exynos: Use manager_op initialize in fimd

In reply to Sean Paul

This patch implements the intitialize manager op in fimd. This will allow us to keep track of drm_dev in context instead of using subdev, which in turn makes it easier to remove subdev from fimd.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Expanded commit message to be more detailed

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +15 -4
index bc4001e..f06a0a9 100644
@@ -106,6 +106,7 @@ struct fimd_win_data {
 
 struct fimd_context {
 	struct exynos_drm_subdrv	subdrv;
+	struct drm_device		*drm_dev;
 	int				irq;
 	struct drm_crtc			*crtc;
 	struct clk			*bus_clk;
@@ -181,6 +182,16 @@ static struct exynos_drm_display_ops fimd_display_ops = {
 	.power_on = fimd_display_power_on,
 };
 
+static int fimd_mgr_initialize(struct device *subdrv_dev,
+		struct drm_device *drm_dev)
+{
+	struct fimd_context *ctx = get_fimd_context(subdrv_dev);
+
+	ctx->drm_dev = drm_dev;
+
+	return 0;
+}
+
 static void fimd_dpms(struct device *subdrv_dev, int mode)
 {
 	struct fimd_context *ctx = get_fimd_context(subdrv_dev);
@@ -660,6 +671,7 @@ static void fimd_win_disable(struct device *dev, int zpos)
 }
 
 static struct exynos_drm_manager_ops fimd_manager_ops = {
+	.initialize = fimd_mgr_initialize,
 	.dpms = fimd_dpms,
 	.apply = fimd_apply,
 	.commit = fimd_commit,
@@ -681,7 +693,6 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
 {
 	struct fimd_context *ctx = (struct fimd_context *)dev_id;
 	struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-	struct drm_device *drm_dev = subdrv->drm_dev;
 	struct exynos_drm_manager *manager = subdrv->manager;
 	u32 val;
 
@@ -692,11 +703,11 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
 		writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1);
 
 	/* check the crtc is detached already from encoder */
-	if (manager->pipe < 0)
+	if (manager->pipe < 0 || !ctx->drm_dev)
 		goto out;
 
-	drm_handle_vblank(drm_dev, manager->pipe);
-	exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe);
+	drm_handle_vblank(ctx->drm_dev, manager->pipe);
+	exynos_drm_crtc_finish_pageflip(ctx->drm_dev, manager->pipe);
 
 	/* set wait vsync event to zero and wake up queue. */
 	if (atomic_read(&ctx->wait_vsync_event)) {
Signature · 1 line
1.8.5.1
author
#6 lore raw

PATCH v4 6/34 drm/exynos: hdmi: Implement initialize op for hdmi

In reply to Sean Paul

This patch implements the initialize callback in the hdmi and mixer manager. This allows us to get rid of drm_dev in the drm_hdmi level and track it in the mixer and hdmi drivers. This is one of the things holding back the complete removal of the drm_hdmi layer.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Moved hardware initialization after we have a valid drm_device

 drivers/gpu/drm/exynos/exynos_drm_hdmi.c |  35 ++-
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h |   3 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c     |  18 +-
 drivers/gpu/drm/exynos/exynos_mixer.c    | 351 +++++++++++++++----------------
 4 files changed, 219 insertions(+), 188 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +29 -6
index a1ef3c9..aebcc0e 100644
@@ -97,6 +97,18 @@ void exynos_mixer_ops_register(struct exynos_mixer_ops *ops)
 		mixer_ops = ops;
 }
 
+static int drm_hdmi_display_initialize(struct device *dev,
+		struct drm_device *drm_dev)
+{
+	struct drm_hdmi_context *ctx = to_context(dev);
+
+	if (hdmi_ops && hdmi_ops->initialize)
+		return hdmi_ops->initialize(ctx->hdmi_ctx->ctx, drm_dev);
+
+	return 0;
+}
+
+
 static bool drm_hdmi_is_connected(struct device *dev)
 {
 	struct drm_hdmi_context *ctx = to_context(dev);
@@ -153,6 +165,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode)
 
 static struct exynos_drm_display_ops drm_hdmi_display_ops = {
 	.type = EXYNOS_DISPLAY_TYPE_HDMI,
+	.initialize = drm_hdmi_display_initialize,
 	.is_connected = drm_hdmi_is_connected,
 	.get_edid = drm_hdmi_get_edid,
 	.check_mode = drm_hdmi_check_mode,
@@ -257,6 +270,21 @@ static void drm_hdmi_commit(struct device *subdrv_dev)
 		hdmi_ops->commit(ctx->hdmi_ctx->ctx);
 }
 
+static int drm_hdmi_mgr_initialize(struct device *subdrv_dev,
+		struct drm_device *drm_dev)
+{
+	struct drm_hdmi_context *ctx = to_context(subdrv_dev);
+	int ret = 0;
+
+	if (mixer_ops && mixer_ops->initialize)
+		ret = mixer_ops->initialize(ctx->mixer_ctx->ctx, drm_dev);
+
+	if (mixer_ops->iommu_on)
+		mixer_ops->iommu_on(ctx->mixer_ctx->ctx, true);
+
+	return ret;
+}
+
 static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)
 {
 	struct drm_hdmi_context *ctx = to_context(subdrv_dev);
@@ -326,6 +354,7 @@ static void drm_mixer_win_disable(struct device *subdrv_dev, int zpos)
 }
 
 static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {
+	.initialize = drm_hdmi_mgr_initialize,
 	.dpms = drm_hdmi_dpms,
 	.apply = drm_hdmi_apply,
 	.enable_vblank = drm_hdmi_enable_vblank,
@@ -372,12 +401,6 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev,
 	ctx->hdmi_ctx = hdmi_ctx;
 	ctx->mixer_ctx = mixer_ctx;
 
-	ctx->hdmi_ctx->drm_dev = drm_dev;
-	ctx->mixer_ctx->drm_dev = drm_dev;
-
-	if (mixer_ops->iommu_on)
-		mixer_ops->iommu_on(ctx->mixer_ctx->ctx, true);
-
 	return 0;
 }
 
drivers/gpu/drm/exynos/exynos_drm_hdmi.h +2 -1
index 724cab1..cf7b1da 100644
@@ -23,12 +23,12 @@
  *	this context should be hdmi_context or mixer_context.
  */
 struct exynos_drm_hdmi_context {
-	struct drm_device	*drm_dev;
 	void			*ctx;
 };
 
 struct exynos_hdmi_ops {
 	/* display */
+	int (*initialize)(void *ctx, struct drm_device *drm_dev);
 	bool (*is_connected)(void *ctx);
 	struct edid *(*get_edid)(void *ctx,
 			struct drm_connector *connector);
@@ -45,6 +45,7 @@ struct exynos_hdmi_ops {
 
 struct exynos_mixer_ops {
 	/* manager */
+	int (*initialize)(void *ctx, struct drm_device *drm_dev);
 	int (*iommu_on)(void *ctx, bool enable);
 	int (*enable_vblank)(void *ctx, int pipe);
 	void (*disable_vblank)(void *ctx);
drivers/gpu/drm/exynos/exynos_hdmi.c +14 -4
index e1c1bfc..9837926 100644
@@ -742,6 +742,15 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,
 	}
 }
 
+static int hdmi_initialize(void *ctx, struct drm_device *drm_dev)
+{
+	struct hdmi_context *hdata = ctx;
+
+	hdata->drm_dev = drm_dev;
+
+	return 0;
+}
+
 static bool hdmi_is_connected(void *ctx)
 {
 	struct hdmi_context *hdata = ctx;
@@ -1747,6 +1756,7 @@ static void hdmi_dpms(void *ctx, int mode)
 
 static struct exynos_hdmi_ops hdmi_ops = {
 	/* display */
+	.initialize	= hdmi_initialize,
 	.is_connected	= hdmi_is_connected,
 	.get_edid	= hdmi_get_edid,
 	.check_mode	= hdmi_check_mode,
@@ -1767,8 +1777,8 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg)
 	hdata->hpd = gpio_get_value(hdata->hpd_gpio);
 	mutex_unlock(&hdata->hdmi_mutex);
 
-	if (ctx->drm_dev)
-		drm_helper_hpd_irq_event(ctx->drm_dev);
+	if (hdata->drm_dev)
+		drm_helper_hpd_irq_event(hdata->drm_dev);
 
 	return IRQ_HANDLED;
 }
@@ -2026,8 +2036,8 @@ static int hdmi_suspend(struct device *dev)
 	disable_irq(hdata->irq);
 
 	hdata->hpd = false;
-	if (ctx->drm_dev)
-		drm_helper_hpd_irq_event(ctx->drm_dev);
+	if (hdata->drm_dev)
+		drm_helper_hpd_irq_event(hdata->drm_dev);
 
 	if (pm_runtime_suspended(dev)) {
 		DRM_DEBUG_KMS("Already suspended\n");
drivers/gpu/drm/exynos/exynos_mixer.c +174 -177

405 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#7 lore raw

PATCH v4 7/34 drm/exynos: Pass exynos_drm_manager in manager ops instead of dev

In reply to Sean Paul

This patch changes the manager ops callbacks from accepting the subdrv device pointer to taking a pointer to the manager. This will allow us to move closer to decoupling manager/display from subdrv, and subsequently decoupling the crtc/plane from the encoder.

---

Changes in v2:
- Instead of passing context, pass manager
- Properly assign ctx->dev in fimd driver
Changes in v3:
- Added vidi implementation
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_connector.c |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h       |  35 ++++----
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  27 +++---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 114 ++++++++++++++------------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c      |  72 ++++++++--------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      |  83 ++++++++++---------
 6 files changed, 180 insertions(+), 153 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +1 -1
index e082efb..23b69d8 100644
@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
 	 * resolution then get max width and height from that driver.
 	 */
 	if (ops && ops->get_max_resol)
-		ops->get_max_resol(manager->dev, &width, &height);
+		ops->get_max_resol(manager, &width, &height);
 
 	return drm_helper_probe_single_connector_modes(connector, width,
 							height);
drivers/gpu/drm/exynos/exynos_drm_drv.h +19 -16
index 2811486..5e82dc9 100644
@@ -161,27 +161,28 @@ struct exynos_drm_display_ops {
  * @win_enable: enable hardware specific overlay.
  * @win_disable: disable hardware specific overlay.
  */
+struct exynos_drm_manager;
 struct exynos_drm_manager_ops {
-	int (*initialize)(struct device *subdrv_dev,
-			struct drm_device *drm_dev);
-	void (*dpms)(struct device *subdrv_dev, int mode);
-	void (*apply)(struct device *subdrv_dev);
-	void (*mode_fixup)(struct device *subdrv_dev,
+	int (*initialize)(struct exynos_drm_manager *mgr,
+				struct drm_device *drm_dev);
+	void (*dpms)(struct exynos_drm_manager *mgr, int mode);
+	void (*apply)(struct exynos_drm_manager *mgr);
+	void (*mode_fixup)(struct exynos_drm_manager *mgr,
 				struct drm_connector *connector,
 				const struct drm_display_mode *mode,
 				struct drm_display_mode *adjusted_mode);
-	void (*mode_set)(struct device *subdrv_dev, void *mode);
-	void (*get_max_resol)(struct device *subdrv_dev, unsigned int *width,
-				unsigned int *height);
-	void (*commit)(struct device *subdrv_dev);
-	int (*enable_vblank)(struct device *subdrv_dev);
-	void (*disable_vblank)(struct device *subdrv_dev);
-	void (*wait_for_vblank)(struct device *subdrv_dev);
-	void (*win_mode_set)(struct device *subdrv_dev,
+	void (*mode_set)(struct exynos_drm_manager *mgr, void *mode);
+	void (*get_max_resol)(struct exynos_drm_manager *mgr,
+				unsigned int *width, unsigned int *height);
+	void (*commit)(struct exynos_drm_manager *mgr);
+	int (*enable_vblank)(struct exynos_drm_manager *mgr);
+	void (*disable_vblank)(struct exynos_drm_manager *mgr);
+	void (*wait_for_vblank)(struct exynos_drm_manager *mgr);
+	void (*win_mode_set)(struct exynos_drm_manager *mgr,
 				struct exynos_drm_overlay *overlay);
-	void (*win_commit)(struct device *subdrv_dev, int zpos);
-	void (*win_enable)(struct device *subdrv_dev, int zpos);
-	void (*win_disable)(struct device *subdrv_dev, int zpos);
+	void (*win_commit)(struct exynos_drm_manager *mgr, int zpos);
+	void (*win_enable)(struct exynos_drm_manager *mgr, int zpos);
+	void (*win_disable)(struct exynos_drm_manager *mgr, int zpos);
 };
 
 /*
@@ -197,12 +198,14 @@ struct exynos_drm_manager_ops {
  *	these callbacks should be set by specific drivers such fimd
  *	or hdmi driver and are used to control display devices such as
  *	analog tv, digital tv and lcd panel and also get timing data for them.
+ * @ctx: A pointer to the manager's implementation specific context
  */
 struct exynos_drm_manager {
 	struct device *dev;
 	int pipe;
 	struct exynos_drm_manager_ops *ops;
 	struct exynos_drm_display_ops *display_ops;
+	void *ctx;
 };
 
 struct exynos_drm_g2d_private {
drivers/gpu/drm/exynos/exynos_drm_encoder.c +13 -14
index a9eb2b0..ec627fa 100644
@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 	case DRM_MODE_DPMS_ON:
 		if (manager_ops && manager_ops->apply)
 			if (!exynos_encoder->updated)
-				manager_ops->apply(manager->dev);
+				manager_ops->apply(manager);
 
 		exynos_drm_connector_power(encoder, mode);
 		exynos_encoder->dpms = mode;
@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
 		if (connector->encoder == encoder)
 			if (manager_ops && manager_ops->mode_fixup)
-				manager_ops->mode_fixup(manager->dev, connector,
+				manager_ops->mode_fixup(manager, connector,
 							mode, adjusted_mode);
 	}
 
@@ -175,8 +175,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
 			manager_ops = manager->ops;
 
 			if (manager_ops && manager_ops->mode_set)
-				manager_ops->mode_set(manager->dev,
-							adjusted_mode);
+				manager_ops->mode_set(manager, adjusted_mode);
 
 			exynos_encoder->old_crtc = encoder->crtc;
 		}
@@ -195,7 +194,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 
 	if (manager_ops && manager_ops->commit)
-		manager_ops->commit(manager->dev);
+		manager_ops->commit(manager);
 
 	/*
 	 * this will avoid one issue that overlay data is updated to
@@ -233,7 +232,7 @@ void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb)
 		 *	real hardware.
 		 */
 		if (ops->wait_for_vblank)
-			ops->wait_for_vblank(exynos_encoder->manager->dev);
+			ops->wait_for_vblank(exynos_encoder->manager);
 	}
 }
 
@@ -341,7 +340,7 @@ exynos_drm_encoder_create(struct drm_device *dev,
 	drm_encoder_helper_add(encoder, &exynos_encoder_helper_funcs);
 
 	if (manager->ops && manager->ops->initialize) {
-		ret = manager->ops->initialize(manager->dev, dev);
+		ret = manager->ops->initialize(manager, dev);
 		if (ret) {
 			DRM_ERROR("Manager initialize failed %d\n", ret);
 			goto error;
@@ -408,7 +407,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)
 		return;
 
 	if (manager_ops->enable_vblank)
-		manager_ops->enable_vblank(manager->dev);
+		manager_ops->enable_vblank(manager);
 }
 
 void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)
@@ -422,7 +421,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)
 		return;
 
 	if (manager_ops->disable_vblank)
-		manager_ops->disable_vblank(manager->dev);
+		manager_ops->disable_vblank(manager);
 }
 
 void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
@@ -433,7 +432,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
 	int mode = *(int *)data;
 
 	if (manager_ops && manager_ops->dpms)
-		manager_ops->dpms(manager->dev, mode);
+		manager_ops->dpms(manager, mode);
 
 	/*
 	 * if this condition is ok then it means that the crtc is already
@@ -467,7 +466,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)
 	struct exynos_drm_overlay *overlay = data;
 
 	if (manager_ops && manager_ops->win_mode_set)
-		manager_ops->win_mode_set(manager->dev, overlay);
+		manager_ops->win_mode_set(manager, overlay);
 }
 
 void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data)
@@ -481,7 +480,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data)
 		zpos = *(int *)data;
 
 	if (manager_ops && manager_ops->win_commit)
-		manager_ops->win_commit(manager->dev, zpos);
+		manager_ops->win_commit(manager, zpos);
 }
 
 void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data)
@@ -495,7 +494,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data)
 		zpos = *(int *)data;
 
 	if (manager_ops && manager_ops->win_enable)
-		manager_ops->win_enable(manager->dev, zpos);
+		manager_ops->win_enable(manager, zpos);
 }
 
 void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
@@ -509,5 +508,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
 		zpos = *(int *)data;
 
 	if (manager_ops && manager_ops->win_disable)
-		manager_ops->win_disable(manager->dev, zpos);
+		manager_ops->win_disable(manager, zpos);
 }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +61 -53

343 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_hdmi.c +40 -32

192 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_vidi.c +46 -37

222 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#8 lore raw

PATCH v4 8/34 drm/exynos: Remove apply manager callback

In reply to Sean Paul

This patch removes the apply() manager callback in favor of putting the relevant commits in the individual drivers. This will mitigate some of the difference between the suspend/resume path and the dpms path

---

Changes in v2:
- This was previously in another patch, but moved since it warrants its own
Changes in v3:
- Removed apply() from vidi
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_drv.h     |  2 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  6 ------
 drivers/gpu/drm/exynos/exynos_drm_fimd.c    | 22 +++++-----------------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c    | 17 -----------------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c    |  1 -
 drivers/gpu/drm/exynos/exynos_hdmi.c        |  1 +
 drivers/gpu/drm/exynos/exynos_mixer.c       |  2 ++
 7 files changed, 8 insertions(+), 43 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -2
index 5e82dc9..5912841 100644
@@ -146,7 +146,6 @@ struct exynos_drm_display_ops {
  *
  * @initialize: initializes the manager with drm_dev
  * @dpms: control device power.
- * @apply: set timing, vblank and overlay data to registers.
  * @mode_fixup: fix mode data comparing to hw specific display mode.
  * @mode_set: convert drm_display_mode to hw specific display mode and
  *	      would be called by encoder->mode_set().
@@ -166,7 +165,6 @@ struct exynos_drm_manager_ops {
 	int (*initialize)(struct exynos_drm_manager *mgr,
 				struct drm_device *drm_dev);
 	void (*dpms)(struct exynos_drm_manager *mgr, int mode);
-	void (*apply)(struct exynos_drm_manager *mgr);
 	void (*mode_fixup)(struct exynos_drm_manager *mgr,
 				struct drm_connector *connector,
 				const struct drm_display_mode *mode,
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0 -6
index ec627fa..19ee84d 100644
@@ -57,8 +57,6 @@ static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
 static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
-	struct exynos_drm_manager_ops *manager_ops = manager->ops;
 	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
 
 	DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
@@ -72,10 +70,6 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 
 	switch (mode) {
 	case DRM_MODE_DPMS_ON:
-		if (manager_ops && manager_ops->apply)
-			if (!exynos_encoder->updated)
-				manager_ops->apply(manager);
-
 		exynos_drm_connector_power(encoder, mode);
 		exynos_encoder->dpms = mode;
 		break;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -17
index 411e90a..810c61f 100644
@@ -672,7 +672,6 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos)
 static struct exynos_drm_manager_ops fimd_manager_ops = {
 	.initialize = fimd_mgr_initialize,
 	.dpms = fimd_dpms,
-	.apply = fimd_apply,
 	.commit = fimd_commit,
 	.enable_vblank = fimd_enable_vblank,
 	.disable_vblank = fimd_disable_vblank,
@@ -883,6 +882,8 @@ static int fimd_activate(struct exynos_drm_manager *mgr, bool enable)
 			fimd_enable_vblank(mgr);
 
 		fimd_window_resume(dev);
+
+		fimd_apply(mgr);
 	} else {
 		fimd_window_suspend(dev);
 
@@ -1037,23 +1038,10 @@ static int fimd_resume(struct device *dev)
 	 * of pm runtime would still be 1 so in this case, fimd driver
 	 * should be on directly not drawing on pm runtime interface.
 	 */
-	if (!pm_runtime_suspended(dev)) {
-		int ret;
+	if (pm_runtime_suspended(dev))
+		return 0;
 
-		ret = fimd_activate(mgr, true);
-		if (ret < 0)
-			return ret;
-
-		/*
-		 * in case of dpms on(standby), fimd_apply function will
-		 * be called by encoder's dpms callback to update fimd's
-		 * registers but in case of sleep wakeup, it's not.
-		 * so fimd_apply function should be called at here.
-		 */
-		fimd_apply(mgr);
-	}
-
-	return 0;
+	return fimd_activate(mgr, true);
 }
 #endif
 
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +0 -17
index ca0a87f..c5de00a 100644
@@ -302,22 +302,6 @@ static void drm_hdmi_dpms(struct exynos_drm_manager *mgr, int mode)
 		hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
 }
 
-static void drm_hdmi_apply(struct exynos_drm_manager *mgr)
-{
-	struct drm_hdmi_context *ctx = mgr->ctx;
-	int i;
-
-	for (i = 0; i < MIXER_WIN_NR; i++) {
-		if (!ctx->enabled[i])
-			continue;
-		if (mixer_ops && mixer_ops->win_commit)
-			mixer_ops->win_commit(ctx->mixer_ctx->ctx, i);
-	}
-
-	if (hdmi_ops && hdmi_ops->commit)
-		hdmi_ops->commit(ctx->hdmi_ctx->ctx);
-}
-
 static void drm_mixer_win_mode_set(struct exynos_drm_manager *mgr,
 				struct exynos_drm_overlay *overlay)
 {
@@ -362,7 +346,6 @@ static void drm_mixer_win_disable(struct exynos_drm_manager *mgr, int zpos)
 static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {
 	.initialize = drm_hdmi_mgr_initialize,
 	.dpms = drm_hdmi_dpms,
-	.apply = drm_hdmi_apply,
 	.enable_vblank = drm_hdmi_enable_vblank,
 	.disable_vblank = drm_hdmi_disable_vblank,
 	.wait_for_vblank = drm_hdmi_wait_for_vblank,
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0 -1
index e458b26..838edb0 100644
@@ -333,7 +333,6 @@ static void vidi_win_disable(struct exynos_drm_manager *mgr, int zpos)
 
 static struct exynos_drm_manager_ops vidi_manager_ops = {
 	.dpms = vidi_dpms,
-	.apply = vidi_apply,
 	.commit = vidi_commit,
 	.enable_vblank = vidi_enable_vblank,
 	.disable_vblank = vidi_disable_vblank,
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -0
index 9837926..520aafd 100644
@@ -1700,6 +1700,7 @@ static void hdmi_poweron(struct hdmi_context *hdata)
 	clk_prepare_enable(res->sclk_hdmi);
 
 	hdmiphy_poweron(hdata);
+	hdmi_commit(hdata);
 }
 
 static void hdmi_poweroff(struct hdmi_context *hdata)
drivers/gpu/drm/exynos/exynos_mixer.c +2 -0
index 23b9407..25a440a 100644
@@ -1058,6 +1058,8 @@ static void mixer_window_resume(struct mixer_context *ctx)
 		win_data = &ctx->win_data[i];
 		win_data->enabled = win_data->resume;
 		win_data->resume = false;
+		if (win_data->enabled)
+			mixer_win_commit(ctx, i);
 	}
 }
 
Signature · 1 line
1.8.5.1
author
#9 lore raw

PATCH v4 9/34 drm/exynos: Remove dpms link between encoder/connector

In reply to Sean Paul

This patch removes the call from encoder dpms into connector dpms (which will then call back into encoder dpms through the helper function). The callback is likely to keep connector->dpms in the right state when initiating dpms from crtc or encoder, but this isn't the right way to do it. This patch is the first step towards rationalizing power management in the exynos drm driver.

---

Changes in v2:
- Split out the apply change into a new patch
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_connector.c | 42 ++--------------------
 drivers/gpu/drm/exynos/exynos_drm_connector.h |  4 ---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 50 +++------------------------
 3 files changed, 8 insertions(+), 88 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +3 -39
index 23b69d8..ca270e2 100644
@@ -26,7 +26,6 @@ struct exynos_drm_connector {
 	struct drm_connector	drm_connector;
 	uint32_t		encoder_id;
 	struct exynos_drm_manager *manager;
-	uint32_t		dpms;
 };
 
 static int exynos_drm_connector_get_modes(struct drm_connector *connector)
@@ -119,7 +118,8 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
 	return ret;
 }
 
-struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector)
+static struct drm_encoder *exynos_drm_best_encoder(
+		struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 	struct exynos_drm_connector *exynos_connector =
@@ -146,41 +146,6 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = {
 	.best_encoder	= exynos_drm_best_encoder,
 };
 
-void exynos_drm_display_power(struct drm_connector *connector, int mode)
-{
-	struct drm_encoder *encoder = exynos_drm_best_encoder(connector);
-	struct exynos_drm_connector *exynos_connector;
-	struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
-	struct exynos_drm_display_ops *display_ops = manager->display_ops;
-
-	exynos_connector = to_exynos_connector(connector);
-
-	if (exynos_connector->dpms == mode) {
-		DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
-		return;
-	}
-
-	if (display_ops && display_ops->power_on)
-		display_ops->power_on(manager->dev, mode);
-
-	exynos_connector->dpms = mode;
-}
-
-static void exynos_drm_connector_dpms(struct drm_connector *connector,
-					int mode)
-{
-	/*
-	 * in case that drm_crtc_helper_set_mode() is called,
-	 * encoder/crtc->funcs->dpms() will be just returned
-	 * because they already were DRM_MODE_DPMS_ON so only
-	 * exynos_drm_display_power() will be called.
-	 */
-	drm_helper_connector_dpms(connector, mode);
-
-	exynos_drm_display_power(connector, mode);
-
-}
-
 static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
 				unsigned int max_width, unsigned int max_height)
 {
@@ -236,7 +201,7 @@ static void exynos_drm_connector_destroy(struct drm_connector *connector)
 }
 
 static struct drm_connector_funcs exynos_connector_funcs = {
-	.dpms		= exynos_drm_connector_dpms,
+	.dpms		= drm_helper_connector_dpms,
 	.fill_modes	= exynos_drm_connector_fill_modes,
 	.detect		= exynos_drm_connector_detect,
 	.destroy	= exynos_drm_connector_destroy,
@@ -281,7 +246,6 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
 
 	exynos_connector->encoder_id = encoder->base.id;
 	exynos_connector->manager = manager;
-	exynos_connector->dpms = DRM_MODE_DPMS_OFF;
 	connector->dpms = DRM_MODE_DPMS_OFF;
 	connector->encoder = encoder;
 
drivers/gpu/drm/exynos/exynos_drm_connector.h +0 -4
index 547c6b5..4eb20d7 100644
@@ -17,8 +17,4 @@
 struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
 						   struct drm_encoder *encoder);
 
-struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector);
-
-void exynos_drm_display_power(struct drm_connector *connector, int mode);
-
 #endif
drivers/gpu/drm/exynos/exynos_drm_encoder.c +5 -45

80 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#10 lore raw

PATCH v4 10/34 drm/exynos: Rename display_op power_on to dpms

In reply to Sean Paul

This patch renames the display_op power_on to dpms to accurately reflect what the function does.

The side-effect of this patch is that the new hdmi dpms callback is now invoked twice in the dpms path. This is safe and will be dealt with when the exynos_drm shim goes away.

---

Changes in v2: None
Changes in v3:
- Changed vidi to dpms as well
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_drv.h     | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c    | 8 --------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c    | 8 ++++----
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h    | 3 +--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c    | 8 --------
 drivers/gpu/drm/exynos/exynos_hdmi.c        | 2 +-
 7 files changed, 10 insertions(+), 27 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -2
index 5912841..cf65f65 100644
@@ -128,7 +128,7 @@ struct exynos_drm_overlay {
  * @get_edid: get edid modes from display driver.
  * @get_panel: get panel object from display driver.
  * @check_mode: check if mode is valid or not.
- * @power_on: display device on or off.
+ * @dpms: display device on or off.
  */
 struct exynos_drm_display_ops {
 	enum exynos_drm_output_type type;
@@ -138,7 +138,7 @@ struct exynos_drm_display_ops {
 			struct drm_connector *connector);
 	void *(*get_panel)(struct device *dev);
 	int (*check_mode)(struct device *dev, struct drm_display_mode *mode);
-	int (*power_on)(struct device *dev, int mode);
+	int (*dpms)(struct device *dev, int mode);
 };
 
 /*
drivers/gpu/drm/exynos/exynos_drm_encoder.c +2 -2
index df4b2852..5bf1e1e 100644
@@ -50,8 +50,8 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 		return;
 	}
 
-	if (display_ops && display_ops->power_on)
-		display_ops->power_on(manager->ctx, mode);
+	if (display_ops && display_ops->dpms)
+		display_ops->dpms(manager->ctx, mode);
 
 	exynos_encoder->dpms = mode;
 }
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -8
index 810c61f..ff1ba94 100644
@@ -169,19 +169,11 @@ static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode)
 	return 0;
 }
 
-static int fimd_display_power_on(struct device *dev, int mode)
-{
-	/* TODO */
-
-	return 0;
-}
-
 static struct exynos_drm_display_ops fimd_display_ops = {
 	.type = EXYNOS_DISPLAY_TYPE_LCD,
 	.is_connected = fimd_display_is_connected,
 	.get_panel = fimd_get_panel,
 	.check_mode = fimd_check_mode,
-	.power_on = fimd_display_power_on,
 };
 
 static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,
drivers/gpu/drm/exynos/exynos_drm_hdmi.c +4 -4
index c5de00a..f9a9324 100644
@@ -159,12 +159,12 @@ static int drm_hdmi_check_mode(struct device *dev,
 	return drm_hdmi_check_mode_ctx(ctx, mode);
 }
 
-static int drm_hdmi_power_on(struct device *dev, int mode)
+static int drm_hdmi_display_dpms(struct device *dev, int mode)
 {
 	struct drm_hdmi_context *ctx = to_context(dev);
 
-	if (hdmi_ops && hdmi_ops->power_on)
-		return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
+	if (hdmi_ops && hdmi_ops->dpms)
+		hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
 
 	return 0;
 }
@@ -175,7 +175,7 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = {
 	.is_connected = drm_hdmi_is_connected,
 	.get_edid = drm_hdmi_get_edid,
 	.check_mode = drm_hdmi_check_mode,
-	.power_on = drm_hdmi_power_on,
+	.dpms = drm_hdmi_display_dpms,
 };
 
 static int drm_hdmi_enable_vblank(struct exynos_drm_manager *mgr)
drivers/gpu/drm/exynos/exynos_drm_hdmi.h +1 -2
index cf7b1da..923239b 100644
@@ -33,14 +33,13 @@ struct exynos_hdmi_ops {
 	struct edid *(*get_edid)(void *ctx,
 			struct drm_connector *connector);
 	int (*check_mode)(void *ctx, struct drm_display_mode *mode);
-	int (*power_on)(void *ctx, int mode);
+	void (*dpms)(void *ctx, int mode);
 
 	/* manager */
 	void (*mode_set)(void *ctx, struct drm_display_mode *mode);
 	void (*get_max_resol)(void *ctx, unsigned int *width,
 				unsigned int *height);
 	void (*commit)(void *ctx);
-	void (*dpms)(void *ctx, int mode);
 };
 
 struct exynos_mixer_ops {
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0 -8
index 838edb0..8d1fdc4 100644
@@ -136,20 +136,12 @@ static int vidi_check_mode(struct device *dev, struct drm_display_mode *mode)
 	return 0;
 }
 
-static int vidi_display_power_on(struct device *dev, int mode)
-{
-	/* TODO */
-
-	return 0;
-}
-
 static struct exynos_drm_display_ops vidi_display_ops = {
 	.type = EXYNOS_DISPLAY_TYPE_VIDI,
 	.is_connected = vidi_display_is_connected,
 	.get_edid = vidi_get_edid,
 	.get_panel = vidi_get_panel,
 	.check_mode = vidi_check_mode,
-	.power_on = vidi_display_power_on,
 };
 
 static void vidi_dpms(struct exynos_drm_manager *mgr, int mode)
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
index 520aafd..7e70228 100644
@@ -1761,12 +1761,12 @@ static struct exynos_hdmi_ops hdmi_ops = {
 	.is_connected	= hdmi_is_connected,
 	.get_edid	= hdmi_get_edid,
 	.check_mode	= hdmi_check_mode,
+	.dpms		= hdmi_dpms,
 
 	/* manager */
 	.mode_set	= hdmi_mode_set,
 	.get_max_resol	= hdmi_get_max_resol,
 	.commit		= hdmi_commit,
-	.dpms		= hdmi_dpms,
 };
 
 static irqreturn_t hdmi_irq_thread(int irq, void *arg)
Signature · 1 line
1.8.5.1
author
#11 lore raw

PATCH v4 11/34 drm/exynos: Don't keep dpms state in encoder

In reply to Sean Paul

This patch removes the dpms state tracking in encoder. This state is at best confusing and at worst incorrect since the display drivers can turn on and off without propagating the value.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 17 -----------------
 1 file changed, 17 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0 -17
index 5bf1e1e..a823d53 100644
@@ -28,32 +28,22 @@
  * @drm_encoder: encoder object.
  * @manager: specific encoder has its own manager to control a hardware
  *	appropriately and we can access a hardware drawing on this manager.
- * @dpms: store the encoder dpms value.
  */
 struct exynos_drm_encoder {
 	struct drm_crtc			*old_crtc;
 	struct drm_encoder		drm_encoder;
 	struct exynos_drm_manager	*manager;
-	int				dpms;
 };
 
 static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
-	struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
 	struct exynos_drm_display_ops *display_ops = manager->display_ops;
 
 	DRM_DEBUG_KMS("encoder dpms: %d\n", mode);
 
-	if (exynos_encoder->dpms == mode) {
-		DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
-		return;
-	}
-
 	if (display_ops && display_ops->dpms)
 		display_ops->dpms(manager->ctx, mode);
-
-	exynos_encoder->dpms = mode;
 }
 
 static bool
@@ -157,12 +147,6 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
 
 	if (manager_ops && manager_ops->commit)
 		manager_ops->commit(manager);
-
-	/*
-	 * In case of setcrtc, there is no way to update encoder's dpms
-	 * so update it here.
-	 */
-	exynos_encoder->dpms = DRM_MODE_DPMS_ON;
 }
 
 void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb)
@@ -281,7 +265,6 @@ exynos_drm_encoder_create(struct drm_device *dev,
 	if (!exynos_encoder)
 		return NULL;
 
-	exynos_encoder->dpms = DRM_MODE_DPMS_OFF;
 	exynos_encoder->manager = manager;
 	encoder = &exynos_encoder->drm_encoder;
 	encoder->possible_crtcs = possible_crtcs;
Signature · 1 line
1.8.5.1
author
#12 lore raw

PATCH v4 12/34 drm/exynos: Use unsigned long for possible_crtcs

In reply to Sean Paul

Change all instances of possible_crtcs in the exynos drm driver to be unsigned long. This matches the type used in the drm layer.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_drv.c     | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.h | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c   | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.h   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
index 215131a..46e58b2 100644
@@ -86,7 +86,7 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 
 	for (nr = 0; nr < MAX_PLANE; nr++) {
 		struct drm_plane *plane;
-		unsigned int possible_crtcs = (1 << MAX_CRTC) - 1;
+		unsigned long possible_crtcs = (1 << MAX_CRTC) - 1;
 
 		plane = exynos_plane_init(dev, possible_crtcs, false);
 		if (!plane)
drivers/gpu/drm/exynos/exynos_drm_encoder.c +1 -1
index a823d53..efe4e60 100644
@@ -249,7 +249,7 @@ void exynos_drm_encoder_setup(struct drm_device *dev)
 struct drm_encoder *
 exynos_drm_encoder_create(struct drm_device *dev,
 			   struct exynos_drm_manager *manager,
-			   unsigned int possible_crtcs)
+			   unsigned long possible_crtcs)
 {
 	struct drm_encoder *encoder;
 	struct exynos_drm_encoder *exynos_encoder;
drivers/gpu/drm/exynos/exynos_drm_encoder.h +1 -1
index 89e2fb0..0f3e5e2 100644
@@ -19,7 +19,7 @@ struct exynos_drm_manager;
 void exynos_drm_encoder_setup(struct drm_device *dev);
 struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev,
 					       struct exynos_drm_manager *mgr,
-					       unsigned int possible_crtcs);
+					       unsigned long possible_crtcs);
 struct exynos_drm_manager *
 exynos_drm_get_manager(struct drm_encoder *encoder);
 void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,
drivers/gpu/drm/exynos/exynos_drm_plane.c +1 -1
index fcb0652..cff3aed 100644
@@ -259,7 +259,7 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane)
 }
 
 struct drm_plane *exynos_plane_init(struct drm_device *dev,
-				    unsigned int possible_crtcs, bool priv)
+				    unsigned long possible_crtcs, bool priv)
 {
 	struct exynos_plane *exynos_plane;
 	int err;
drivers/gpu/drm/exynos/exynos_drm_plane.h +1 -1
index 8831245..84d464c 100644
@@ -17,4 +17,4 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 void exynos_plane_commit(struct drm_plane *plane);
 void exynos_plane_dpms(struct drm_plane *plane, int mode);
 struct drm_plane *exynos_plane_init(struct drm_device *dev,
-				    unsigned int possible_crtcs, bool priv);
+				    unsigned long possible_crtcs, bool priv);
Signature · 1 line
1.8.5.1
author
#13 lore raw

PATCH v4 13/34 drm/exynos: Split manager/display/subdrv

In reply to Sean Paul

This patch splits display and manager from subdrv. The result is that crtc functions can directly call into manager callbacks and encoder functions can directly call into display callbacks. This will allow us to remove the exynos_drm_hdmi shim and support mixer/hdmi & fimd/dp with common code.

---

Changes in v2:
- Pass display into display_ops instead of context
Changes in v3:
- Changed vidi args to exynos_drm_display instead of void
- Moved exynos_drm_hdmi.c removal into next patch
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_connector.c |  50 ++---
 drivers/gpu/drm/exynos/exynos_drm_core.c      | 181 +++++++++++++-----
 drivers/gpu/drm/exynos/exynos_drm_crtc.c      | 115 +++++++++---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h      |  20 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c       |  29 +--
 drivers/gpu/drm/exynos/exynos_drm_drv.h       | 106 +++++++----
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   | 258 ++++----------------------
 drivers/gpu/drm/exynos/exynos_drm_encoder.h   |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_fb.c        |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 214 ++++++++++-----------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c      | 211 +++++++++------------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h      |   2 +
 drivers/gpu/drm/exynos/exynos_drm_plane.c     |  15 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      | 129 ++++++-------
 14 files changed, 642 insertions(+), 710 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_connector.c +20 -30
index ca270e2..9a16dbe 100644
@@ -23,26 +23,20 @@
 				drm_connector)
 
 struct exynos_drm_connector {
-	struct drm_connector	drm_connector;
-	uint32_t		encoder_id;
-	struct exynos_drm_manager *manager;
+	struct drm_connector		drm_connector;
+	uint32_t			encoder_id;
+	struct exynos_drm_display	*display;
 };
 
 static int exynos_drm_connector_get_modes(struct drm_connector *connector)
 {
 	struct exynos_drm_connector *exynos_connector =
 					to_exynos_connector(connector);
-	struct exynos_drm_manager *manager = exynos_connector->manager;
-	struct exynos_drm_display_ops *display_ops = manager->display_ops;
+	struct exynos_drm_display *display = exynos_connector->display;
 	struct edid *edid = NULL;
 	unsigned int count = 0;
 	int ret;
 
-	if (!display_ops) {
-		DRM_DEBUG_KMS("display_ops is null.\n");
-		return 0;
-	}
-
 	/*
 	 * if get_edid() exists then get_edid() callback of hdmi side
 	 * is called to get edid data through i2c interface else
@@ -51,8 +45,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
 	 * P.S. in case of lcd panel, count is always 1 if success
 	 * because lcd panel has only one mode.
 	 */
-	if (display_ops->get_edid) {
-		edid = display_ops->get_edid(manager->dev, connector);
+	if (display->ops->get_edid) {
+		edid = display->ops->get_edid(display, connector);
 		if (IS_ERR_OR_NULL(edid)) {
 			ret = PTR_ERR(edid);
 			edid = NULL;
@@ -75,8 +69,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
 			return 0;
 		}
 
-		if (display_ops->get_panel)
-			panel = display_ops->get_panel(manager->dev);
+		if (display->ops->get_panel)
+			panel = display->ops->get_panel(display);
 		else {
 			drm_mode_destroy(connector->dev, mode);
 			return 0;
@@ -105,14 +99,13 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
 {
 	struct exynos_drm_connector *exynos_connector =
 					to_exynos_connector(connector);
-	struct exynos_drm_manager *manager = exynos_connector->manager;
-	struct exynos_drm_display_ops *display_ops = manager->display_ops;
+	struct exynos_drm_display *display = exynos_connector->display;
 	int ret = MODE_BAD;
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
-	if (display_ops && display_ops->check_mode)
-		if (!display_ops->check_mode(manager->dev, mode))
+	if (display->ops->check_mode)
+		if (!display->ops->check_mode(display, mode))
 			ret = MODE_OK;
 
 	return ret;
@@ -151,8 +144,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
 {
 	struct exynos_drm_connector *exynos_connector =
 					to_exynos_connector(connector);
-	struct exynos_drm_manager *manager = exynos_connector->manager;
-	struct exynos_drm_manager_ops *ops = manager->ops;
+	struct exynos_drm_display *display = exynos_connector->display;
 	unsigned int width, height;
 
 	width = max_width;
@@ -162,8 +154,8 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
 	 * if specific driver want to find desired_mode using maxmum
 	 * resolution then get max width and height from that driver.
 	 */
-	if (ops && ops->get_max_resol)
-		ops->get_max_resol(manager, &width, &height);
+	if (display->ops->get_max_resol)
+		display->ops->get_max_resol(display, &width, &height);
 
 	return drm_helper_probe_single_connector_modes(connector, width,
 							height);
@@ -175,13 +167,11 @@ exynos_drm_connector_detect(struct drm_connector *connector, bool force)
 {
 	struct exynos_drm_connector *exynos_connector =
 					to_exynos_connector(connector);
-	struct exynos_drm_manager *manager = exynos_connector->manager;
-	struct exynos_drm_display_ops *display_ops =
-					manager->display_ops;
+	struct exynos_drm_display *display = exynos_connector->display;
 	enum drm_connector_status status = connector_status_disconnected;
 
-	if (display_ops && display_ops->is_connected) {
-		if (display_ops->is_connected(manager->dev))
+	if (display->ops->is_connected) {
+		if (display->ops->is_connected(display))
 			status = connector_status_connected;
 		else
 			status = connector_status_disconnected;
@@ -211,7 +201,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
 						   struct drm_encoder *encoder)
 {
 	struct exynos_drm_connector *exynos_connector;
-	struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
+	struct exynos_drm_display *display = exynos_drm_get_display(encoder);
 	struct drm_connector *connector;
 	int type;
 	int err;
@@ -222,7 +212,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
 
 	connector = &exynos_connector->drm_connector;
 
-	switch (manager->display_ops->type) {
+	switch (display->type) {
 	case EXYNOS_DISPLAY_TYPE_HDMI:
 		type = DRM_MODE_CONNECTOR_HDMIA;
 		connector->interlace_allowed = true;
@@ -245,7 +235,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
 		goto err_connector;
 
 	exynos_connector->encoder_id = encoder->base.id;
-	exynos_connector->manager = manager;
+	exynos_connector->display = display;
 	connector->dpms = DRM_MODE_DPMS_OFF;
 	connector->encoder = encoder;
 
drivers/gpu/drm/exynos/exynos_drm_core.c +135 -46

251 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_crtc.c +92 -23

225 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_crtc.h +16 -4
index 3e197e6..c27b66c 100644
@@ -15,9 +15,21 @@
 #ifndef _EXYNOS_DRM_CRTC_H_
 #define _EXYNOS_DRM_CRTC_H_
 
-int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr);
-int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc);
-void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc);
-void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc);
+struct drm_device;
+struct drm_crtc;
+struct exynos_drm_manager;
+struct exynos_drm_overlay;
+
+int exynos_drm_crtc_create(struct exynos_drm_manager *manager);
+int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe);
+void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb);
+
+void exynos_drm_crtc_plane_mode_set(struct drm_crtc *crtc,
+			struct exynos_drm_overlay *overlay);
+void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos);
+void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos);
+void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos);
 
 #endif
drivers/gpu/drm/exynos/exynos_drm_drv.c +17 -12
index 46e58b2..28e2cef 100644
@@ -74,15 +74,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 
 	exynos_drm_mode_config_init(dev);
 
-	/*
-	 * EXYNOS4 is enough to have two CRTCs and each crtc would be used
-	 * without dependency of hardware.
-	 */
-	for (nr = 0; nr < MAX_CRTC; nr++) {
-		ret = exynos_drm_crtc_create(dev, nr);
-		if (ret)
-			goto err_release_iommu_mapping;
-	}
+	ret = exynos_drm_initialize_managers(dev);
+	if (ret)
+		goto err_mode_config_cleanup;
 
 	for (nr = 0; nr < MAX_PLANE; nr++) {
 		struct drm_plane *plane;
@@ -90,12 +84,16 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 
 		plane = exynos_plane_init(dev, possible_crtcs, false);
 		if (!plane)
-			goto err_release_iommu_mapping;
+			goto err_manager_cleanup;
 	}
 
+	ret = exynos_drm_initialize_displays(dev);
+	if (ret)
+		goto err_manager_cleanup;
+
 	ret = drm_vblank_init(dev, MAX_CRTC);
 	if (ret)
-		goto err_release_iommu_mapping;
+		goto err_display_cleanup;
 
 	/*
 	 * probe sub drivers such as display controller and hdmi driver,
@@ -129,7 +127,12 @@ err_drm_device:
 	exynos_drm_device_unregister(dev);
 err_vblank:
 	drm_vblank_cleanup(dev);
-err_release_iommu_mapping:
+err_display_cleanup:
+	exynos_drm_remove_displays(dev);
+err_manager_cleanup:
+	exynos_drm_remove_managers(dev);
+err_mode_config_cleanup:
+	drm_mode_config_cleanup(dev);
 	drm_release_iommu_mapping(dev);
 err_crtc:
 	drm_mode_config_cleanup(dev);
@@ -144,6 +147,8 @@ static int exynos_drm_unload(struct drm_device *dev)
 	exynos_drm_device_unregister(dev);
 	drm_vblank_cleanup(dev);
 	drm_kms_helper_poll_fini(dev);
+	exynos_drm_remove_displays(dev);
+	exynos_drm_remove_managers(dev);
 	drm_mode_config_cleanup(dev);
 
 	drm_release_iommu_mapping(dev);
drivers/gpu/drm/exynos/exynos_drm_drv.h +67 -39

170 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_encoder.c +32 -226

350 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_encoder.h +3 -15
index 0f3e5e2..b7a1620 100644
@@ -18,20 +18,8 @@ struct exynos_drm_manager;
 
 void exynos_drm_encoder_setup(struct drm_device *dev);
 struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev,
-					       struct exynos_drm_manager *mgr,
-					       unsigned long possible_crtcs);
-struct exynos_drm_manager *
-exynos_drm_get_manager(struct drm_encoder *encoder);
-void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,
-			    void (*fn)(struct drm_encoder *, void *));
-void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data);
-void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_crtc_pipe(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data);
-void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb);
+			struct exynos_drm_display *mgr,
+			unsigned long possible_crtcs);
+struct exynos_drm_display *exynos_drm_get_display(struct drm_encoder *encoder);
 
 #endif
drivers/gpu/drm/exynos/exynos_drm_fb.c +2 -2
index ea39e0e..c7c08d0 100644
@@ -22,7 +22,7 @@
 #include "exynos_drm_fb.h"
 #include "exynos_drm_gem.h"
 #include "exynos_drm_iommu.h"
-#include "exynos_drm_encoder.h"
+#include "exynos_drm_crtc.h"
 
 #define to_exynos_fb(x)	container_of(x, struct exynos_drm_fb, fb)
 
@@ -71,7 +71,7 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
 	unsigned int i;
 
 	/* make sure that overlay data are updated before relesing fb. */
-	exynos_drm_encoder_complete_scanout(fb);
+	exynos_drm_crtc_complete_scanout(fb);
 
 	drm_framebuffer_cleanup(fb);
 
drivers/gpu/drm/exynos/exynos_drm_fimd.c +102 -112

361 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_hdmi.c +89 -122

338 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_hdmi.h +2 -0
index 923239b..37059ea 100644
@@ -19,10 +19,12 @@
  * exynos hdmi common context structure.
  *
  * @drm_dev: pointer to drm_device.
+ * @pipe: pipe for mixer
  * @ctx: pointer to the context of specific device driver.
  *	this context should be hdmi_context or mixer_context.
  */
 struct exynos_drm_hdmi_context {
+	int			pipe;
 	void			*ctx;
 };
 
drivers/gpu/drm/exynos/exynos_drm_plane.c +5 -10
index cff3aed..e0db2b3 100644
@@ -13,7 +13,7 @@
 
 #include <drm/exynos_drm.h>
 #include "exynos_drm_drv.h"
-#include "exynos_drm_encoder.h"
+#include "exynos_drm_crtc.h"
 #include "exynos_drm_fb.h"
 #include "exynos_drm_gem.h"
 #include "exynos_drm_plane.h"
@@ -139,7 +139,7 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
 			overlay->crtc_x, overlay->crtc_y,
 			overlay->crtc_width, overlay->crtc_height);
 
-	exynos_drm_fn_encoder(crtc, overlay, exynos_drm_encoder_plane_mode_set);
+	exynos_drm_crtc_plane_mode_set(crtc, overlay);
 
 	return 0;
 }
@@ -149,8 +149,7 @@ void exynos_plane_commit(struct drm_plane *plane)
 	struct exynos_plane *exynos_plane = to_exynos_plane(plane);
 	struct exynos_drm_overlay *overlay = &exynos_plane->overlay;
 
-	exynos_drm_fn_encoder(plane->crtc, &overlay->zpos,
-			exynos_drm_encoder_plane_commit);
+	exynos_drm_crtc_plane_commit(plane->crtc, overlay->zpos);
 }
 
 void exynos_plane_dpms(struct drm_plane *plane, int mode)
@@ -162,17 +161,13 @@ void exynos_plane_dpms(struct drm_plane *plane, int mode)
 		if (exynos_plane->enabled)
 			return;
 
-		exynos_drm_fn_encoder(plane->crtc, &overlay->zpos,
-				exynos_drm_encoder_plane_enable);
-
+		exynos_drm_crtc_plane_enable(plane->crtc, overlay->zpos);
 		exynos_plane->enabled = true;
 	} else {
 		if (!exynos_plane->enabled)
 			return;
 
-		exynos_drm_fn_encoder(plane->crtc, &overlay->zpos,
-				exynos_drm_encoder_plane_disable);
-
+		exynos_drm_crtc_plane_disable(plane->crtc, overlay->zpos);
 		exynos_plane->enabled = false;
 	}
 }
drivers/gpu/drm/exynos/exynos_drm_vidi.c +60 -69

254 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#14 lore raw

PATCH v4 14/34 drm/exynos: hdmi: remove the i2c drivers and use devtree

In reply to Sean Paul

From: Daniel Kurtz <[email protected]>

The i2c client was previously being passed into the hdmi driver via a dedicated i2c driver, and then a global variable. This patch removes all of that and just uses the device tree to get the i2c_client. This patch also properly references the client so we don't lose it before we're done with it.

[seanpaul changed to phandle lookup instead of using of node name]

---

Changes in v2:
- Change include to linux/i2c.h instead of linux/of_i2c.h
Changes in v3: None
Changes in v4:
- Changed to find phy via phandle instead of by name

 .../devicetree/bindings/video/exynos_hdmi.txt      |  5 ++
 drivers/gpu/drm/exynos/Makefile                    |  1 -
 drivers/gpu/drm/exynos/exynos_ddc.c                | 63 ---------------------
 drivers/gpu/drm/exynos/exynos_hdmi.c               | 59 +++++++++-----------
 drivers/gpu/drm/exynos/exynos_hdmi.h               | 23 --------
 drivers/gpu/drm/exynos/exynos_hdmiphy.c            | 65 ----------------------
 6 files changed, 32 insertions(+), 184 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c
Documentation/devicetree/bindings/video/exynos_hdmi.txt +5 -0
index 50decf8..f9187a2 100644
@@ -25,6 +25,9 @@ Required properties:
 		sclk_pixel.
 - clock-names: aliases as per driver requirements for above clock IDs:
 	"hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
+- ddc: phandle to the hdmi ddc node
+- phy: phandle to the hdmi phy node
+
 Example:
 
 	hdmi {
@@ -32,4 +35,6 @@ Example:
 		reg = <0x14530000 0x100000>;
 		interrupts = <0 95 0>;
 		hpd-gpio = <&gpx3 7 1>;
+		ddc = <&hdmi_ddc_node>;
+		phy = <&hdmi_phy_node>;
 	};
drivers/gpu/drm/exynos/Makefile +0 -1
index 639b49e..819961a 100644
@@ -12,7 +12,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)	+= exynos_drm_fimd.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)	+= exynos_hdmi.o exynos_mixer.o \
-					   exynos_ddc.o exynos_hdmiphy.o \
 					   exynos_drm_hdmi.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI)	+= exynos_drm_vidi.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_G2D)	+= exynos_drm_g2d.o
drivers/gpu/drm/exynos/exynos_ddc.c deleted +0 -63

63 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_hdmi.c +27 -32

110 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_hdmi.h deleted +0 -23
deleted file mode 100644
index 0ddf395..0000000
@@ -1,23 +0,0 @@
-/*
- *
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- * Authors:
- *	Inki Dae <[email protected]>
- *	Seung-Woo Kim <[email protected]>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#ifndef _EXYNOS_HDMI_H_
-#define _EXYNOS_HDMI_H_
-
-void hdmi_attach_ddc_client(struct i2c_client *ddc);
-void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy);
-
-extern struct i2c_driver hdmiphy_driver;
-extern struct i2c_driver ddc_driver;
-
-#endif
drivers/gpu/drm/exynos/exynos_hdmiphy.c deleted +0 -65

65 lines not on this page · raw message

Signature · 1 line
1.8.5.1
#15 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

Hi,

Quoted 35 lines · Sean Paul

From: Daniel Kurtz <[email protected]>

The i2c client was previously being passed into the hdmi driver via a dedicated i2c driver, and then a global variable. This patch removes all of that and just uses the device tree to get the i2c_client. This patch also properly references the client so we don't lose it before we're done with it.

[seanpaul changed to phandle lookup instead of using of node name]

---

Changes in v2:
- Change include to linux/i2c.h instead of linux/of_i2c.h
Changes in v3: None
Changes in v4:
- Changed to find phy via phandle instead of by name

  .../devicetree/bindings/video/exynos_hdmi.txt      |  5 ++
  drivers/gpu/drm/exynos/Makefile                    |  1 -
  drivers/gpu/drm/exynos/exynos_ddc.c                | 63 ---------------------
  drivers/gpu/drm/exynos/exynos_hdmi.c               | 59 +++++++++-----------
  drivers/gpu/drm/exynos/exynos_hdmi.h               | 23 --------
  drivers/gpu/drm/exynos/exynos_hdmiphy.c            | 65 ----------------------
  6 files changed, 32 insertions(+), 184 deletions(-)

delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c

Documentation/devicetree/bindings/video/exynos_hdmi.txt +0 -0
index 50decf8..f9187a2 100644

Documentation/devicetree/bindings/video/exynos_hdmi.txt Required properties: · line 30

Quoted 6 lines
Documentation/devicetree/bindings/video/exynos_hdmi.txt +3 -0
@@ -25,6 +25,9 @@ Required properties:
  		sclk_pixel.
  - clock-names: aliases as per driver requirements for above clock IDs:
  	"hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
+- ddc: phandle to the hdmi ddc node
+- phy: phandle to the hdmi phy node
+

Adding new required properties to an already defined binding is breaking backwards compatibility, which is supposed to be preserved, since DT is an ABI.

Now, I'm not really a big fan of DT stability, but if we decide to maintain it for other Exynos drivers as well (e.g. USB), then we probably should do the same here...

Best regards,
Tomasz

maintainer
#16 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

2014-02-08 11:52 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 47 lines

Hi,

Quoted 43 lines · Sean Paul

From: Daniel Kurtz <[email protected]>

The i2c client was previously being passed into the hdmi driver via a dedicated i2c driver, and then a global variable. This patch removes all of that and just uses the device tree to get the i2c_client. This patch also properly references the client so we don't lose it before we're done with it.

[seanpaul changed to phandle lookup instead of using of node name]

---

Changes in v2:
- Change include to linux/i2c.h instead of linux/of_i2c.h
Changes in v3: None
Changes in v4:
- Changed to find phy via phandle instead of by name

  .../devicetree/bindings/video/exynos_hdmi.txt      |  5 ++
  drivers/gpu/drm/exynos/Makefile                    |  1 -
  drivers/gpu/drm/exynos/exynos_ddc.c                | 63
---------------------
  drivers/gpu/drm/exynos/exynos_hdmi.c               | 59
+++++++++-----------
  drivers/gpu/drm/exynos/exynos_hdmi.h               | 23 --------
  drivers/gpu/drm/exynos/exynos_hdmiphy.c            | 65
----------------------
  6 files changed, 32 insertions(+), 184 deletions(-)

delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c

Documentation/devicetree/bindings/video/exynos_hdmi.txt +0 -0
index 50decf8..f9187a2 100644
@@ -25,6 +25,9 @@ Required properties:
                sclk_pixel.
  - clock-names: aliases as per driver requirements for above clock IDs:
        "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
Quoted 8 lines

Documentation/devicetree/bindings/video/exynos_hdmi.txt Required properties: · line 30

Quoted 3 lines
Documentation/devicetree/bindings/video/exynos_hdmi.txt +3 -0
+- ddc: phandle to the hdmi ddc node
+- phy: phandle to the hdmi phy node
+

Adding new required properties to an already defined binding is breaking backwards compatibility, which is supposed to be preserved, since DT is an ABI.

Right, that's a problem. If we use this patch, and we add additional codes for these property to hdmi driver, then the existing dtb will be broken by dt binding fail. However, as long as I know, there is another case that phy property is used like this way; MIPI-CSI device node. And also it seems reasonable to add ddc property in similar reason if we could handle that the existing dt node is deplicated.

So what we could select I think are,
1. to deplicate the existing dt node, and using this patch.
2. or, to separate phy and ddc parts as each module so that each module can bind device tree. However, this way would make hdmi part of exynos drm to be complicated because we should resolve probe ordering issue.

It seems that we need to discuss and make a consensus about this issue.

Tomasz and Sean, please, share your opinion. I tend to proper 1.

Thanks,
Inki Dae

Quoted 12 lines

Now, I'm not really a big fan of DT stability, but if we decide to maintain it for other Exynos drivers as well (e.g. USB), then we probably should do the same here...

Best regards,
Tomasz

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

#17 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

Quoted 71 lines · Inki Dae

2014-02-08 11:52 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 47 lines

Hi,

Quoted 43 lines · Sean Paul

From: Daniel Kurtz <[email protected]>

The i2c client was previously being passed into the hdmi driver via a dedicated i2c driver, and then a global variable. This patch removes all of that and just uses the device tree to get the i2c_client. This patch also properly references the client so we don't lose it before we're done with it.

[seanpaul changed to phandle lookup instead of using of node name]

---

Changes in v2:
- Change include to linux/i2c.h instead of linux/of_i2c.h
Changes in v3: None
Changes in v4:
- Changed to find phy via phandle instead of by name

   .../devicetree/bindings/video/exynos_hdmi.txt      |  5 ++
   drivers/gpu/drm/exynos/Makefile                    |  1 -
   drivers/gpu/drm/exynos/exynos_ddc.c                | 63
---------------------
   drivers/gpu/drm/exynos/exynos_hdmi.c               | 59
+++++++++-----------
   drivers/gpu/drm/exynos/exynos_hdmi.h               | 23 --------
   drivers/gpu/drm/exynos/exynos_hdmiphy.c            | 65
----------------------
   6 files changed, 32 insertions(+), 184 deletions(-)

delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c

Documentation/devicetree/bindings/video/exynos_hdmi.txt +0 -0
index 50decf8..f9187a2 100644
@@ -25,6 +25,9 @@ Required properties:
                 sclk_pixel.
   - clock-names: aliases as per driver requirements for above clock IDs:
         "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
Quoted 8 lines

Documentation/devicetree/bindings/video/exynos_hdmi.txt Required properties: · line 30

Quoted 3 lines
Documentation/devicetree/bindings/video/exynos_hdmi.txt +3 -0
+- ddc: phandle to the hdmi ddc node
+- phy: phandle to the hdmi phy node
+

Adding new required properties to an already defined binding is breaking backwards compatibility, which is supposed to be preserved, since DT is an ABI.

Right, that's a problem. If we use this patch, and we add additional codes for these property to hdmi driver, then the existing dtb will be broken by dt binding fail. However, as long as I know, there is another case that phy property is used like this way; MIPI-CSI device node. And also it seems reasonable to add ddc property in similar reason if we could handle that the existing dt node is deplicated.

So what we could select I think are,
1. to deplicate the existing dt node, and using this patch.
2. or, to separate phy and ddc parts as each module so that each module can bind device tree. However, this way would make hdmi part of exynos drm to be complicated because we should resolve probe ordering issue.

Quoted 3 lines

It seems that we need to discuss and make a consensus about this issue.

Tomasz and Sean, please, share your opinion. I tend to proper 1.

I tend to prefer option 1 too. I don't have anything against this patch itself.

All I'm just worried about is applying different standards to patches changing DT bindings depending on subsystem (and authors?).

Either we declare that we are okay with making Exynos-specific bindings unstable or we keep stability for all of them. I wouldn't be upset if we went with the former, as the whole stability making it impossible to get rid of some fugly broken bindings is getting more and more annoying.

Best regards,
Tomasz

#18 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

In reply to Tomasz Figa
Quoted 7 lines · Tomasz Figa

Adding new required properties to an already defined binding is breaking backwards compatibility, which is supposed to be preserved, since DT is an ABI.

Now, I'm not really a big fan of DT stability, but if we decide to maintain it for other Exynos drivers as well (e.g. USB), then we probably should do the same here...

A binding without users _can_ be changed. If you're sure that there are no users of the old binding, and that any users can and will (without complaint or surprise) update to a newer DT with the newer binding, then you can change it. I'm not sure if the cat is out of the bag w.r.t. users of upstream Exynos kernels that this is true or not.

-Olof

#19 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

Quoted 11 lines · Olof Johansson
Quoted 7 lines · Tomasz Figa

Adding new required properties to an already defined binding is breaking backwards compatibility, which is supposed to be preserved, since DT is an ABI.

Now, I'm not really a big fan of DT stability, but if we decide to maintain it for other Exynos drivers as well (e.g. USB), then we probably should do the same here...

A binding without users _can_ be changed.

Of course it can. However hdmi binding apparently already has users, since git grep hdmi over Exynos dts files shows 4 boards using HDMI, so I'm not sure it's the case here.

Quoted 5 lines

If you're sure that there
are no users of the old binding, and that any users can and will (without complaint or surprise) update to a newer DT with the newer binding, then you can change it. I'm not sure if the cat is out of the bag w.r.t. users of upstream Exynos kernels that this is true or not.

The question is whether there are really users of upstream kernels that would care, i.e. don't always simply use DTB and kernel built from the same tree.

Best regards,
Tomasz

#20 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

In reply to Sean Paul

Hi Daniel,
I think that it would be better to change the semantic of phy and ddc bindings.

Rather than pointing to I2C client it should point to I2C bus instead. The exynos DRM driver can create dummy I2C clients using i2c_new_dummy() function.

There is quite strong rationale for this:
- DDC is always accessible on fixed addresses described in HDMI specification.
- HDMIPHY (including I2C address) is a part of HDMI IP and it is bound to specific version of Exynos SoC
- no need to add virtual nodes in DTS
- NVIDIA already use bindings to DDC bus instead of DDC client. Take a look to arch/arm/boot/dts/tegra*.dts

Regards,
Tomasz Stanislawski

maintainer
#21 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

Hi Tomasz,

2014-02-14 23:13 GMT+09:00 Tomasz Stanislawski <[email protected]>:

Quoted 7 lines

Hi Daniel,
I think that it would be better to change the semantic of phy and ddc bindings.

Rather than pointing to I2C client it should point to I2C bus instead. The exynos DRM driver can create dummy I2C clients using i2c_new_dummy() function.

It seems better way. As of now, all we need for HDMI DDC is i2c_adapter (including i2c phy), not i2c_client.

Quoted 6 lines

There is quite strong rationale for this:
- DDC is always accessible on fixed addresses described in HDMI specification.
- HDMIPHY (including I2C address) is a part of HDMI IP and it is bound to specific version of Exynos SoC
- no need to add virtual nodes in DTS

You mean hdmiddc and hdmiphy nodes? If so, I think they are real nodes, not virtual nodes. Otherwise, plz give me more comments.

Thanks,
Inki Dae

Quoted 10 lines

- NVIDIA already use bindings to DDC bus instead of DDC client. Take a look to arch/arm/boot/dts/tegra*.dts

Regards,
Tomasz Stanislawski

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

#22 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

Hi Inki,
Sorry for a very late reply.

Quoted 22 lines · Inki Dae

Hi Tomasz,

2014-02-14 23:13 GMT+09:00 Tomasz Stanislawski <[email protected]>:

Quoted 7 lines

Hi Daniel,
I think that it would be better to change the semantic of phy and ddc bindings.

Rather than pointing to I2C client it should point to I2C bus instead. The exynos DRM driver can create dummy I2C clients using i2c_new_dummy() function.

It seems better way. As of now, all we need for HDMI DDC is i2c_adapter (including i2c phy), not i2c_client.

Quoted 6 lines

There is quite strong rationale for this:
- DDC is always accessible on fixed addresses described in HDMI specification.
- HDMIPHY (including I2C address) is a part of HDMI IP and it is bound to specific version of Exynos SoC
- no need to add virtual nodes in DTS

Quoted 6 lines

You mean hdmiddc and hdmiphy nodes? If so, I think they are real nodes, not virtual nodes. Otherwise, plz give me more comments.

Thanks,
Inki Dae

The problem is that those nodes have no dedicated driver. Moreover, the I2C address for HDMIPHY is always present on a fixed address dependant on SoC (read HDMI IP) version. Moreover, both devices share HDMI and HDMIPHY share registers from HDMI's pool.
Additionally, the hdmiphy I2C client is currently configured using exynos-hdmi code its DRM driver.
So technically the hdmiphy bus is only a resource used by exynos-drm-hdmi driver.

Regards,
Tomasz Stanislawski

Quoted 10 lines
Quoted 10 lines

- NVIDIA already use bindings to DDC bus instead of DDC client. Take a look to arch/arm/boot/dts/tegra*.dts

Regards,
Tomasz Stanislawski

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

maintainer
#23 lore raw

Re: [PATCH v4 14/34] drm/exynos: hdmi: remove the i2c drivers and use devtree

In reply to Sean Paul

2014-01-31 6:19 GMT+09:00 Sean Paul <[email protected]>:

Quoted 185 lines

From: Daniel Kurtz <[email protected]>

The i2c client was previously being passed into the hdmi driver via a dedicated i2c driver, and then a global variable. This patch removes all of that and just uses the device tree to get the i2c_client. This patch also properly references the client so we don't lose it before we're done with it.

[seanpaul changed to phandle lookup instead of using of node name]

---

Changes in v2:
- Change include to linux/i2c.h instead of linux/of_i2c.h
Changes in v3: None
Changes in v4:
- Changed to find phy via phandle instead of by name

 .../devicetree/bindings/video/exynos_hdmi.txt      |  5 ++
 drivers/gpu/drm/exynos/Makefile                    |  1 -
 drivers/gpu/drm/exynos/exynos_ddc.c                | 63 ---------------------
 drivers/gpu/drm/exynos/exynos_hdmi.c               | 59 +++++++++-----------
 drivers/gpu/drm/exynos/exynos_hdmi.h               | 23 --------
 drivers/gpu/drm/exynos/exynos_hdmiphy.c            | 65 ----------------------
 6 files changed, 32 insertions(+), 184 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c
Documentation/devicetree/bindings/video/exynos_hdmi.txt +5 -0
index 50decf8..f9187a2 100644
@@ -25,6 +25,9 @@ Required properties:
                sclk_pixel.
 - clock-names: aliases as per driver requirements for above clock IDs:
        "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
+- ddc: phandle to the hdmi ddc node
+- phy: phandle to the hdmi phy node
+
 Example:
 
        hdmi {
@@ -32,4 +35,6 @@ Example:
                reg = <0x14530000 0x100000>;
                interrupts = <0 95 0>;
                hpd-gpio = <&gpx3 7 1>;
+               ddc = <&hdmi_ddc_node>;
+               phy = <&hdmi_phy_node>;
        };
drivers/gpu/drm/exynos/Makefile +0 -1
index 639b49e..819961a 100644
@@ -12,7 +12,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)    += exynos_drm_fimd.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)    += exynos_hdmi.o exynos_mixer.o \
-                                          exynos_ddc.o exynos_hdmiphy.o \
                                           exynos_drm_hdmi.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI)    += exynos_drm_vidi.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_G2D)     += exynos_drm_g2d.o
drivers/gpu/drm/exynos/exynos_ddc.c deleted +0 -63
deleted file mode 100644
index 6a8c84e..0000000
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2011 Samsung Electronics Co.Ltd
- * Authors:
- *     Seung-Woo Kim <[email protected]>
- *     Inki Dae <[email protected]>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#include <drm/drmP.h>
-
-#include <linux/kernel.h>
-#include <linux/i2c.h>
-#include <linux/of.h>
-
-#include "exynos_drm_drv.h"
-#include "exynos_hdmi.h"
-
-static int s5p_ddc_probe(struct i2c_client *client,
-                       const struct i2c_device_id *dev_id)
-{
-       hdmi_attach_ddc_client(client);
-
-       dev_info(&client->adapter->dev,
-               "attached %s into i2c adapter successfully\n",
-               client->name);
-
-       return 0;
-}
-
-static int s5p_ddc_remove(struct i2c_client *client)
-{
-       dev_info(&client->adapter->dev,
-               "detached %s from i2c adapter successfully\n",
-               client->name);
-
-       return 0;
-}
-
-static struct of_device_id hdmiddc_match_types[] = {
-       {
-               .compatible = "samsung,exynos5-hdmiddc",
-       }, {
-               .compatible = "samsung,exynos4210-hdmiddc",
-       }, {
-               /* end node */
-       }
-};
-
-struct i2c_driver ddc_driver = {
-       .driver = {
-               .name = "exynos-hdmiddc",
-               .owner = THIS_MODULE,
-               .of_match_table = hdmiddc_match_types,
-       },
-       .probe          = s5p_ddc_probe,
-       .remove         = s5p_ddc_remove,
-       .command                = NULL,
-};
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -16
index 7e70228..97a0e57 100644
@@ -33,6 +33,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/i2c.h>
 #include <linux/of_gpio.h>
 
 #include <drm/exynos_drm.h>
@@ -40,8 +41,6 @@
 #include "exynos_drm_drv.h"
 #include "exynos_drm_hdmi.h"
 
-#include "exynos_hdmi.h"
-
 #include <linux/gpio.h>
 #include <media/s5p_hdmi.h>
 
@@ -1855,20 +1854,6 @@ fail:
        return -ENODEV;
 }
 
-static struct i2c_client *hdmi_ddc, *hdmi_hdmiphy;
-
-void hdmi_attach_ddc_client(struct i2c_client *ddc)
-{
-       if (ddc)
-               hdmi_ddc = ddc;
-}
-
-void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy)
-{
-       if (hdmiphy)
-               hdmi_hdmiphy = hdmiphy;
-}
-
 static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
                                        (struct device *dev)
 {
@@ -1913,6 +1898,7 @@ static int hdmi_probe(struct platform_device *pdev)
        struct s5p_hdmi_platform_data *pdata;
        struct resource *res;
        const struct of_device_id *match;
+       struct device_node *ddc_node, *phy_node;
        int ret;
 
         if (!dev->of_node)
@@ -1963,21 +1949,30 @@ static int hdmi_probe(struct platform_device *pdev)
        }
 

drivers/gpu/drm/exynos/exynos_hdmi.c static int hdmi_probe(struct platform_device *pdev) · line 1957

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +6 -3
        /* DDC i2c driver */
-       if (i2c_add_driver(&ddc_driver)) {
-               DRM_ERROR("failed to register ddc i2c driver\n");
-               return -ENOENT;
+       ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
+       if (!ddc_node) {
+               DRM_ERROR("Failed to find ddc node in device tree\n");
+               return -ENODEV;
+       }
+       hdata->ddc_port = of_find_i2c_device_by_node(ddc_node);

As Tomasz commented, it would better to get i2c_adapter instead of i2c_client.

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +3 -2
+       if (!hdata->ddc_port) {
+               DRM_ERROR("Failed to get ddc i2c client by node\n");
+               return -ENODEV;
        }
-
-       hdata->ddc_port = hdmi_ddc;
 
        /* hdmiphy i2c driver */

drivers/gpu/drm/exynos/exynos_hdmi.c static int hdmi_probe(struct platform_device *pdev) · line 1970

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +7 -3
-       if (i2c_add_driver(&hdmiphy_driver)) {
-               DRM_ERROR("failed to register hdmiphy i2c driver\n");
-               ret = -ENOENT;
+       phy_node = of_parse_phandle(dev->of_node, "phy", 0);
+       if (!phy_node) {
+               DRM_ERROR("Failed to find hdmiphy node in device tree\n");
+               ret = -ENODEV;
+               goto err_ddc;
+       }
+       hdata->hdmiphy_port = of_find_i2c_device_by_node(phy_node);

You should also consider other SoCs having APB PHY, not I2C PHY. Actually, Exynos5420 SoC has APB PHY.

Thanks,
Inki Dae

Quoted 146 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +9 -8
+       if (!hdata->hdmiphy_port) {
+               DRM_ERROR("Failed to get hdmi phy i2c client from node\n");
+               ret = -ENODEV;
                goto err_ddc;
        }
-
-       hdata->hdmiphy_port = hdmi_hdmiphy;
 
        hdata->irq = gpio_to_irq(hdata->hpd_gpio);
        if (hdata->irq < 0) {
@@ -2008,22 +2003,22 @@ static int hdmi_probe(struct platform_device *pdev)
        return 0;
 
 err_hdmiphy:
-       i2c_del_driver(&hdmiphy_driver);
+       put_device(&hdata->hdmiphy_port->dev);
 err_ddc:
-       i2c_del_driver(&ddc_driver);
+       put_device(&hdata->ddc_port->dev);
        return ret;
 }
 
 static int hdmi_remove(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
+       struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
+       struct hdmi_context *hdata = ctx->ctx;
 
        pm_runtime_disable(dev);
 
-       /* hdmiphy i2c driver */
-       i2c_del_driver(&hdmiphy_driver);
-       /* DDC i2c driver */
-       i2c_del_driver(&ddc_driver);
+       put_device(&hdata->hdmiphy_port->dev);
+       put_device(&hdata->ddc_port->dev);
 
        return 0;
 }
drivers/gpu/drm/exynos/exynos_hdmi.h deleted +0 -23
deleted file mode 100644
index 0ddf395..0000000
@@ -1,23 +0,0 @@
-/*
- *
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- * Authors:
- *     Inki Dae <[email protected]>
- *     Seung-Woo Kim <[email protected]>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#ifndef _EXYNOS_HDMI_H_
-#define _EXYNOS_HDMI_H_
-
-void hdmi_attach_ddc_client(struct i2c_client *ddc);
-void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy);
-
-extern struct i2c_driver hdmiphy_driver;
-extern struct i2c_driver ddc_driver;
-
-#endif
drivers/gpu/drm/exynos/exynos_hdmiphy.c deleted +0 -66
deleted file mode 100644
index 59abb14..0000000
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2011 Samsung Electronics Co.Ltd
- * Authors:
- *     Seung-Woo Kim <[email protected]>
- *     Inki Dae <[email protected]>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#include <drm/drmP.h>
-
-#include <linux/kernel.h>
-#include <linux/i2c.h>
-#include <linux/of.h>
-
-#include "exynos_drm_drv.h"
-#include "exynos_hdmi.h"
-
-
-static int hdmiphy_probe(struct i2c_client *client,
-       const struct i2c_device_id *id)
-{
-       hdmi_attach_hdmiphy_client(client);
-
-       dev_info(&client->adapter->dev, "attached s5p_hdmiphy "
-               "into i2c adapter successfully\n");
-
-       return 0;
-}
-
-static int hdmiphy_remove(struct i2c_client *client)
-{
-       dev_info(&client->adapter->dev, "detached s5p_hdmiphy "
-               "from i2c adapter successfully\n");
-
-       return 0;
-}
-
-static struct of_device_id hdmiphy_match_types[] = {
-       {
-               .compatible = "samsung,exynos5-hdmiphy",
-       }, {
-               .compatible = "samsung,exynos4210-hdmiphy",
-       }, {
-               .compatible = "samsung,exynos4212-hdmiphy",
-       }, {
-               /* end node */
-       }
-};
-
-struct i2c_driver hdmiphy_driver = {
-       .driver = {
-               .name   = "exynos-hdmiphy",
-               .owner  = THIS_MODULE,
-               .of_match_table = hdmiphy_match_types,
-       },
-       .probe          = hdmiphy_probe,
-       .remove         = hdmiphy_remove,
-       .command                = NULL,
-};
-EXPORT_SYMBOL(hdmiphy_driver);
--

1.8.5.1

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

author
#24 lore raw

PATCH v4 15/34 ARM: dts: exynos: Add i2c phandles to hdmi node

In reply to Sean Paul

This patch references the hdmi ddc and phy i2c nodes directly in the hdmi node to match the updated bindings.

---

Changes in v4:
- Added patch

 arch/arm/boot/dts/cros5250-common.dtsi    | 6 ++++--
 arch/arm/boot/dts/exynos5250-smdk5250.dts | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/boot/dts/cros5250-common.dtsi +4 -2
index 9b186ac..ada9d99 100644
@@ -201,7 +201,7 @@
 		samsung,i2c-sda-delay = <100>;
 		samsung,i2c-max-bus-freq = <66000>;
 
-		hdmiddc@50 {
+		hdmi_ddc_node: hdmiddc@50 {
 			compatible = "samsung,exynos4210-hdmiddc";
 			reg = <0x50>;
 		};
@@ -235,7 +235,7 @@
 		samsung,i2c-sda-delay = <100>;
 		samsung,i2c-max-bus-freq = <378000>;
 
-		hdmiphy@38 {
+		hdmi_phy_node: hdmiphy@38 {
 			compatible = "samsung,exynos4212-hdmiphy";
 			reg = <0x38>;
 		};
@@ -313,6 +313,8 @@
 
 	hdmi {
 		hpd-gpio = <&gpx3 7 0>;
+		ddc = <&hdmi_ddc_node>;
+		phy = <&hdmi_phy_node>;
 	};
 
 	gpio-keys {
arch/arm/boot/dts/exynos5250-smdk5250.dts +4 -2
index f86d567..b14985a 100644
@@ -104,7 +104,7 @@
 		samsung,i2c-sda-delay = <100>;
 		samsung,i2c-max-bus-freq = <66000>;
 
-		hdmiddc@50 {
+		hdmi_ddc_node: hdmiddc@50 {
 			compatible = "samsung,exynos4210-hdmiddc";
 			reg = <0x50>;
 		};
@@ -134,7 +134,7 @@
 		samsung,i2c-sda-delay = <100>;
 		samsung,i2c-max-bus-freq = <66000>;
 
-		hdmiphy@38 {
+		hdmi_phy_node: hdmiphy@38 {
 			compatible = "samsung,exynos4212-hdmiphy";
 			reg = <0x38>;
 		};
@@ -220,6 +220,8 @@
 
 	hdmi {
 		hpd-gpio = <&gpx3 7 0>;
+		ddc = <&hdmi_ddc_node>;
+		phy = <&hdmi_phy_node>;
 	};
 
 	codec@11000000 {
Signature · 1 line
1.8.5.1
author
#25 lore raw

PATCH v4 16/34 drm/exynos: Remove exynos_drm_hdmi shim

In reply to Sean Paul

This patch trims exynos_drm_hdmi out of the driver. The reason it existed in the first place was to make up for the mixture of display/overlay/manager ops being spread across hdmi and mixer. With that code now rationalized, mixer and hdmi map directly to exynos_drm_crtc and exynos_drm_encoder, respectively. Since there is a 1:1 mapping, we no longer need this layer.

---

Changes in v2:
- hdmi/mixer ops now take display/manager instead of context
Changes in v3:
- Moved removal of exynos_drm_hdmi.c file here
Changes in v4: None

 drivers/gpu/drm/exynos/Makefile          |   3 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |  13 -
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 416 -------------------------------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h |  69 -----
 drivers/gpu/drm/exynos/exynos_hdmi.c     | 162 +++++++-----
 drivers/gpu/drm/exynos/exynos_mixer.c    | 192 +++++++-------
 drivers/gpu/drm/exynos/exynos_mixer.h    |  20 ++
 7 files changed, 217 insertions(+), 658 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.h
 create mode 100644 drivers/gpu/drm/exynos/exynos_mixer.h
drivers/gpu/drm/exynos/Makefile +1 -2
index 819961a..afbe499 100644
@@ -11,8 +11,7 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \
 exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)	+= exynos_drm_fimd.o
-exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)	+= exynos_hdmi.o exynos_mixer.o \
-					   exynos_drm_hdmi.o
+exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)	+= exynos_hdmi.o exynos_mixer.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI)	+= exynos_drm_vidi.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_G2D)	+= exynos_drm_g2d.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_IPP)	+= exynos_drm_ipp.o
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -13
index 28e2cef..6143742 100644
@@ -366,13 +366,6 @@ static int __init exynos_drm_init(void)
 	ret = platform_driver_register(&mixer_driver);
 	if (ret < 0)
 		goto out_mixer;
-	ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
-	if (ret < 0)
-		goto out_common_hdmi;
-
-	ret = exynos_platform_device_hdmi_register();
-	if (ret < 0)
-		goto out_common_hdmi_dev;
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_VIDI
@@ -465,10 +458,6 @@ out_vidi:
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_HDMI
-	exynos_platform_device_hdmi_unregister();
-out_common_hdmi_dev:
-	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
-out_common_hdmi:
 	platform_driver_unregister(&mixer_driver);
 out_mixer:
 	platform_driver_unregister(&hdmi_driver);
@@ -510,8 +499,6 @@ static void __exit exynos_drm_exit(void)
 #endif
 
 #ifdef CONFIG_DRM_EXYNOS_HDMI
-	exynos_platform_device_hdmi_unregister();
-	platform_driver_unregister(&exynos_drm_common_hdmi_driver);
 	platform_driver_unregister(&mixer_driver);
 	platform_driver_unregister(&hdmi_driver);
 #endif
drivers/gpu/drm/exynos/exynos_drm_hdmi.c deleted +0 -416

416 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_hdmi.h deleted +0 -69

69 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_hdmi.c +103 -59

350 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_mixer.c +93 -99

391 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_mixer.h new file +20 -0
new file mode 100644
index 0000000..3811e41
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2013 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#ifndef _EXYNOS_MIXER_H_
+#define _EXYNOS_MIXER_H_
+
+/* This function returns 0 if the given timing is valid for the mixer */
+int mixer_check_mode(struct drm_display_mode *mode);
+
+#endif
Signature · 1 line
1.8.5.1
author
#26 lore raw

PATCH v4 17/34 drm/exynos: Use drm_mode_copy to copy modes

In reply to Sean Paul

This patch changes the manual copying of mode to adjusted_mode in mode_fixup to use drm_mode_copy instead of handling things manually.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_hdmi.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -9
index 051aa76..3faea8f 100644
@@ -847,21 +847,13 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display,
 		mode_ok = hdmi_check_mode(display, m);
 
 		if (mode_ok == 0) {
-			struct drm_mode_object base;
-			struct list_head head;
-
 			DRM_INFO("desired mode doesn't exist so\n");
 			DRM_INFO("use the most suitable mode among modes.\n");
 
 			DRM_DEBUG_KMS("Adjusted Mode: [%d]x[%d] [%d]Hz\n",
 				m->hdisplay, m->vdisplay, m->vrefresh);
 
-			/* preserve display mode header while copying. */
-			head = adjusted_mode->head;
-			base = adjusted_mode->base;
-			memcpy(adjusted_mode, m, sizeof(*m));
-			adjusted_mode->head = head;
-			adjusted_mode->base = base;
+			drm_mode_copy(adjusted_mode, m);
 			break;
 		}
 	}
Signature · 1 line
1.8.5.1
author
#27 lore raw

PATCH v4 18/34 drm/exynos: Disable unused crtc planes from crtc

In reply to Sean Paul

This patch moves the code which disables unused crtc planes from the encoder to the crtc. Since there is a 1:1 encoder/crtc mapping in exynos, the only valid crtc change the pre-existing code could catch is disconnecting an active crtc from the encoder. Thus it is functionally equivalent to just disable all planes attached to a crtc when the crtc is disabled.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_crtc.c    | 13 +++++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 65 ++---------------------------
 2 files changed, 15 insertions(+), 63 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +11 -2
index 347d62d..d019385 100644
@@ -176,10 +176,19 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
-	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	struct drm_plane *plane;
+	int ret;
 
-	exynos_plane_dpms(exynos_crtc->plane, DRM_MODE_DPMS_OFF);
 	exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
+
+	list_for_each_entry(plane, &crtc->dev->mode_config.plane_list, head) {
+		if (plane->crtc != crtc)
+			continue;
+
+		ret = plane->funcs->disable_plane(plane);
+		if (ret)
+			DRM_ERROR("Failed to disable plane %d\n", ret);
+	}
 }
 
 static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
drivers/gpu/drm/exynos/exynos_drm_encoder.c +4 -61

82 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#28 lore raw

PATCH v4 19/34 drm/exynos: Add mode_set manager operation

In reply to Sean Paul

This patch adds a mode_set callback to the manager operations which sets the crtc's current mode to the manager driver. This will allow the fimd driver to set its mode using values from drm, instead of the dt.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Added a bit more explanation to commit msg

 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 ++++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 3 +++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -0
index d019385..a5cb104 100644
@@ -115,6 +115,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 			  struct drm_framebuffer *old_fb)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	struct exynos_drm_manager *manager = exynos_crtc->manager;
 	struct drm_plane *plane = exynos_crtc->plane;
 	unsigned int crtc_w;
 	unsigned int crtc_h;
@@ -129,6 +130,9 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	crtc_w = crtc->fb->width - x;
 	crtc_h = crtc->fb->height - y;
 
+	if (manager->ops->mode_set)
+		manager->ops->mode_set(manager, &crtc->mode);
+
 	ret = exynos_plane_mode_set(plane, crtc, crtc->fb, 0, 0, crtc_w, crtc_h,
 				    x, y, crtc_w, crtc_h);
 	if (ret)
drivers/gpu/drm/exynos/exynos_drm_drv.h +3 -0
index 4f03242..caba299 100644
@@ -184,6 +184,7 @@ struct exynos_drm_display {
  * @initialize: initializes the manager with drm_dev
  * @remove: cleans up the manager for removal
  * @dpms: control device power.
+ * @mode_set: set the given mode to the manager
  * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
@@ -200,6 +201,8 @@ struct exynos_drm_manager_ops {
 				struct drm_device *drm_dev, int pipe);
 	void (*remove)(struct exynos_drm_manager *mgr);
 	void (*dpms)(struct exynos_drm_manager *mgr, int mode);
+	void (*mode_set)(struct exynos_drm_manager *mgr,
+				const struct drm_display_mode *mode);
 	void (*commit)(struct exynos_drm_manager *mgr);
 	int (*enable_vblank)(struct exynos_drm_manager *mgr);
 	void (*disable_vblank)(struct exynos_drm_manager *mgr);
Signature · 1 line
1.8.5.1
author
#29 lore raw

PATCH v4 20/34 drm/exynos: Implement mode_fixup manager operation

In reply to Sean Paul

This patch adds a new manager callback for mode_fixup and pipes it through exynos_drm_crtc. This will allow the manager drivers to alter the mode during modeset.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Added more detail to the commit msg

 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 ++++++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +6 -1
index a5cb104..100a561 100644
@@ -105,7 +105,12 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
 			    const struct drm_display_mode *mode,
 			    struct drm_display_mode *adjusted_mode)
 {
-	/* drm framework doesn't check NULL */
+	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+	struct exynos_drm_manager *manager = exynos_crtc->manager;
+
+	if (manager->ops->mode_fixup)
+		return manager->ops->mode_fixup(manager, mode, adjusted_mode);
+
 	return true;
 }
 
drivers/gpu/drm/exynos/exynos_drm_drv.h +4 -0
index caba299..81f7de4 100644
@@ -184,6 +184,7 @@ struct exynos_drm_display {
  * @initialize: initializes the manager with drm_dev
  * @remove: cleans up the manager for removal
  * @dpms: control device power.
+ * @mode_fixup: fix mode data before applying it
  * @mode_set: set the given mode to the manager
  * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
@@ -201,6 +202,9 @@ struct exynos_drm_manager_ops {
 				struct drm_device *drm_dev, int pipe);
 	void (*remove)(struct exynos_drm_manager *mgr);
 	void (*dpms)(struct exynos_drm_manager *mgr, int mode);
+	bool (*mode_fixup)(struct exynos_drm_manager *mgr,
+				const struct drm_display_mode *mode,
+				struct drm_display_mode *adjusted_mode);
 	void (*mode_set)(struct exynos_drm_manager *mgr,
 				const struct drm_display_mode *mode);
 	void (*commit)(struct exynos_drm_manager *mgr);
Signature · 1 line
1.8.5.1
author
#30 lore raw

PATCH v4 21/34 drm/exynos: Use mode_set to configure fimd

In reply to Sean Paul

This patch uses the mode passed into mode_set to configure fimd instead of directly using the panel from context. This will allow us to move the exynos_drm_display implementation out of fimd, where it doesn't belong.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Use mode supplied via mode_set directly when persisting to HW

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 143 ++++++++++++++++---------------
 1 file changed, 74 insertions(+), 69 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +74 -69
index dc8c5e4..53d92fe 100644
@@ -112,8 +112,8 @@ struct fimd_context {
 	struct clk			*bus_clk;
 	struct clk			*lcd_clk;
 	void __iomem			*regs;
+	struct drm_display_mode		mode;
 	struct fimd_win_data		win_data[WINDOWS_NR];
-	unsigned int			clkdiv;
 	unsigned int			default_win;
 	unsigned long			irq_flags;
 	u32				vidcon0;
@@ -221,38 +221,82 @@ static void fimd_mgr_remove(struct exynos_drm_manager *mgr)
 		drm_iommu_detach_device(ctx->drm_dev, ctx->dev);
 }
 
+static u32 fimd_calc_clkdiv(struct fimd_context *ctx,
+		const struct drm_display_mode *mode)
+{
+	unsigned long ideal_clk = mode->htotal * mode->vtotal * mode->vrefresh;
+	u32 clkdiv;
+
+	/* Find the clock divider value that gets us closest to ideal_clk */
+	clkdiv = DIV_ROUND_UP(clk_get_rate(ctx->lcd_clk), ideal_clk);
+
+	return (clkdiv < 0x100) ? clkdiv : 0xff;
+}
+
+static bool fimd_mode_fixup(struct exynos_drm_manager *mgr,
+		const struct drm_display_mode *mode,
+		struct drm_display_mode *adjusted_mode)
+{
+	if (adjusted_mode->vrefresh == 0)
+		adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE;
+
+	return true;
+}
+
+static void fimd_mode_set(struct exynos_drm_manager *mgr,
+		const struct drm_display_mode *in_mode)
+{
+	struct fimd_context *ctx = mgr->ctx;
+
+	drm_mode_copy(&ctx->mode, in_mode);
+}
+
 static void fimd_commit(struct exynos_drm_manager *mgr)
 {
 	struct fimd_context *ctx = mgr->ctx;
-	struct exynos_drm_panel_info *panel = &ctx->panel;
-	struct videomode *vm = &panel->vm;
+	struct drm_display_mode *mode = &ctx->mode;
 	struct fimd_driver_data *driver_data;
-	u32 val;
+	u32 val, clkdiv;
+	int hblank, vblank, vsync_len, vbpd, vfpd, hsync_len, hbpd, hfpd;
 
 	driver_data = ctx->driver_data;
 	if (ctx->suspended)
 		return;
 
+	/* nothing to do if we haven't set the mode yet */
+	if (mode->htotal == 0 || mode->vtotal == 0)
+		return;
+
 	/* setup polarity values from machine code. */
 	writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);
 
 	/* setup vertical timing values. */
-	val = VIDTCON0_VBPD(vm->vback_porch - 1) |
-	       VIDTCON0_VFPD(vm->vfront_porch - 1) |
-	       VIDTCON0_VSPW(vm->vsync_len - 1);
+	vblank = mode->crtc_vblank_end - mode->crtc_vblank_start;
+	vsync_len = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbpd = (vblank - vsync_len) / 2;
+	vfpd = vblank - vsync_len - vbpd;
+
+	val = VIDTCON0_VBPD(vbpd - 1) |
+		VIDTCON0_VFPD(vfpd - 1) |
+		VIDTCON0_VSPW(vsync_len - 1);
 	writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);
 
 	/* setup horizontal timing values.  */
-	val = VIDTCON1_HBPD(vm->hback_porch - 1) |
-	       VIDTCON1_HFPD(vm->hfront_porch - 1) |
-	       VIDTCON1_HSPW(vm->hsync_len - 1);
+	hblank = mode->crtc_hblank_end - mode->crtc_hblank_start;
+	hsync_len = mode->crtc_hsync_end - mode->crtc_hsync_start;
+	hbpd = (hblank - hsync_len) / 2;
+	hfpd = hblank - hsync_len - hbpd;
+
+	val = VIDTCON1_HBPD(hbpd - 1) |
+		VIDTCON1_HFPD(hfpd - 1) |
+		VIDTCON1_HSPW(hsync_len - 1);
 	writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);
 
 	/* setup horizontal and vertical display size. */
-	val = VIDTCON2_LINEVAL(vm->vactive - 1) |
-	       VIDTCON2_HOZVAL(vm->hactive - 1) |
-	       VIDTCON2_LINEVAL_E(vm->vactive - 1) |
-	       VIDTCON2_HOZVAL_E(vm->hactive - 1);
+	val = VIDTCON2_LINEVAL(mode->vdisplay - 1) |
+	       VIDTCON2_HOZVAL(mode->hdisplay - 1) |
+	       VIDTCON2_LINEVAL_E(mode->vdisplay - 1) |
+	       VIDTCON2_HOZVAL_E(mode->hdisplay - 1);
 	writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);
 
 	/* setup clock source, clock divider, enable dma. */
@@ -264,8 +308,9 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
 		val |= VIDCON0_CLKSEL_LCD;
 	}
 
-	if (ctx->clkdiv > 1)
-		val |= VIDCON0_CLKVAL_F(ctx->clkdiv - 1) | VIDCON0_CLKDIR;
+	clkdiv = fimd_calc_clkdiv(ctx, mode);
+	if (clkdiv > 1)
+		val |= VIDCON0_CLKVAL_F(clkdiv - 1) | VIDCON0_CLKDIR;
 	else
 		val &= ~VIDCON0_CLKDIR;	/* 1:1 clock */
 
@@ -683,6 +728,8 @@ static struct exynos_drm_manager_ops fimd_manager_ops = {
 	.initialize = fimd_mgr_initialize,
 	.remove = fimd_mgr_remove,
 	.dpms = fimd_dpms,
+	.mode_fixup = fimd_mode_fixup,
+	.mode_set = fimd_mode_set,
 	.commit = fimd_commit,
 	.enable_vblank = fimd_enable_vblank,
 	.disable_vblank = fimd_disable_vblank,
@@ -724,56 +771,6 @@ out:
 	return IRQ_HANDLED;
 }
 
-static int fimd_configure_clocks(struct fimd_context *ctx, struct device *dev)
-{
-	struct videomode *vm = &ctx->panel.vm;
-	unsigned long clk;
-
-	ctx->bus_clk = devm_clk_get(dev, "fimd");
-	if (IS_ERR(ctx->bus_clk)) {
-		dev_err(dev, "failed to get bus clock\n");
-		return PTR_ERR(ctx->bus_clk);
-	}
-
-	ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
-	if (IS_ERR(ctx->lcd_clk)) {
-		dev_err(dev, "failed to get lcd clock\n");
-		return PTR_ERR(ctx->lcd_clk);
-	}
-
-	clk = clk_get_rate(ctx->lcd_clk);
-	if (clk == 0) {
-		dev_err(dev, "error getting sclk_fimd clock rate\n");
-		return -EINVAL;
-	}
-
-	if (vm->pixelclock == 0) {
-		unsigned long c;
-		c = vm->hactive + vm->hback_porch + vm->hfront_porch +
-		    vm->hsync_len;
-		c *= vm->vactive + vm->vback_porch + vm->vfront_porch +
-		     vm->vsync_len;
-		vm->pixelclock = c * FIMD_DEFAULT_FRAMERATE;
-		if (vm->pixelclock == 0) {
-			dev_err(dev, "incorrect display timings\n");
-			return -EINVAL;
-		}
-		dev_warn(dev, "pixel clock recalculated to %luHz (%dHz frame rate)\n",
-			 vm->pixelclock, FIMD_DEFAULT_FRAMERATE);
-	}
-	ctx->clkdiv = DIV_ROUND_UP(clk, vm->pixelclock);
-	if (ctx->clkdiv > 256) {
-		dev_warn(dev, "calculated pixel clock divider too high (%u), lowered to 256\n",
-			 ctx->clkdiv);
-		ctx->clkdiv = 256;
-	}
-	vm->pixelclock = clk / ctx->clkdiv;
-	DRM_DEBUG_KMS("pixel clock = %lu, clkdiv = %d\n", vm->pixelclock,
-		      ctx->clkdiv);
-
-	return 0;
-}
-
 static void fimd_clear_win(struct fimd_context *ctx, int win)
 {
 	writel(0, ctx->regs + WINCON(win));
@@ -926,9 +923,17 @@ static int fimd_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = fimd_configure_clocks(ctx, dev);
-	if (ret)
-		return ret;
+	ctx->bus_clk = devm_clk_get(dev, "fimd");
+	if (IS_ERR(ctx->bus_clk)) {
+		dev_err(dev, "failed to get bus clock\n");
+		return PTR_ERR(ctx->bus_clk);
+	}
+
+	ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
+	if (IS_ERR(ctx->lcd_clk)) {
+		dev_err(dev, "failed to get lcd clock\n");
+		return PTR_ERR(ctx->lcd_clk);
+	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
Signature · 1 line
1.8.5.1
#31 lore raw

Re: [PATCH v4 21/34] drm/exynos: Use mode_set to configure fimd

Hi Sean,

Quoted 6 lines · Sean Paul

This patch uses the mode passed into mode_set to configure fimd instead of directly using the panel from context. This will allow us to move the exynos_drm_display implementation out of fimd, where it doesn't belong.

(...)

drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_mgr_remove(struct exynos_drm_manager *mgr) · line 277

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+	vblank = mode->crtc_vblank_end - mode->crtc_vblank_start;
+	vsync_len = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	vbpd = (vblank - vsync_len) / 2;
+	vfpd = vblank - vsync_len - vbpd;

It should be rather:

	vbpd = mode->crtc_vtotal - mode->crtc_vsync_end;
	vfpd = mode->crtc_vsync_start - mode->crtc_vdisplay;
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+
+	val = VIDTCON0_VBPD(vbpd - 1) |
+		VIDTCON0_VFPD(vfpd - 1) |
+		VIDTCON0_VSPW(vsync_len - 1);

drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_mgr_remove(struct exynos_drm_manager *mgr) · line 288

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -3
 	writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);
 
 	/* setup horizontal timing values.  */
-	val = VIDTCON1_HBPD(vm->hback_porch - 1) |
-	       VIDTCON1_HFPD(vm->hfront_porch - 1) |
-	       VIDTCON1_HSPW(vm->hsync_len - 1);
+	hblank = mode->crtc_hblank_end - mode->crtc_hblank_start;
+	hsync_len = mode->crtc_hsync_end - mode->crtc_hsync_start;
+	hbpd = (hblank - hsync_len) / 2;
+	hfpd = hblank - hsync_len - hbpd;
	hbpd = mode->crtc_htotal - mode->crtc_hsync_end;
	hfpd = mode->crtc_hsync_start - mode->crtc_hdisplay;

I have pointed it out already in my exynos/dsi patches[1](they were based on v3 of your patches), but I forgot to cc it to you.

[1] http://permalink.gmane.org/gmane.comp.video.dri.devel/98737

Regards
Andrzej

author
#32 lore raw

PATCH v4 22/34 drm/exynos: Remove unused/useless fimd_context members

In reply to Sean Paul

This patch removes a few fimd_context members which are either entirely unused or unneeded.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -12
index 53d92fe..9419513 100644
@@ -107,8 +107,6 @@ struct fimd_win_data {
 struct fimd_context {
 	struct device			*dev;
 	struct drm_device		*drm_dev;
-	int				irq;
-	struct drm_crtc			*crtc;
 	struct clk			*bus_clk;
 	struct clk			*lcd_clk;
 	void __iomem			*regs;
@@ -120,7 +118,6 @@ struct fimd_context {
 	u32				vidcon1;
 	bool				suspended;
 	int				pipe;
-	struct mutex			lock;
 	wait_queue_head_t		wait_vsync_queue;
 	atomic_t			wait_vsync_event;
 
@@ -697,8 +694,6 @@ static void fimd_dpms(struct exynos_drm_manager *mgr, int mode)
 
 	DRM_DEBUG_KMS("%d\n", mode);
 
-	mutex_lock(&ctx->lock);
-
 	switch (mode) {
 	case DRM_MODE_DPMS_ON:
 		/*
@@ -720,8 +715,6 @@ static void fimd_dpms(struct exynos_drm_manager *mgr, int mode)
 		DRM_DEBUG_KMS("unspecified mode %d\n", mode);
 		break;
 	}
-
-	mutex_unlock(&ctx->lock);
 }
 
 static struct exynos_drm_manager_ops fimd_manager_ops = {
@@ -947,9 +940,7 @@ static int fimd_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	ctx->irq = res->start;
-
-	ret = devm_request_irq(dev, ctx->irq, fimd_irq_handler,
+	ret = devm_request_irq(dev, res->start, fimd_irq_handler,
 							0, "drm_fimd", ctx);
 	if (ret) {
 		dev_err(dev, "irq request failed.\n");
@@ -960,8 +951,6 @@ static int fimd_probe(struct platform_device *pdev)
 	init_waitqueue_head(&ctx->wait_vsync_queue);
 	atomic_set(&ctx->wait_vsync_event, 0);
 
-	mutex_init(&ctx->lock);
-
 	platform_set_drvdata(pdev, &fimd_manager);
 
 	fimd_manager.ctx = ctx;
Signature · 1 line
1.8.5.1
author
#33 lore raw

PATCH v4 23/34 drm/exynos: Move dp driver from video/ to drm/

In reply to Sean Paul

This patch moves the code from video/ to drm/. This is required the DP driver needs to power on/off in the correct order in relation to fimd. This will also allow the DP driver to participate in drm modeset as well as provide accurate connection detection and edid.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Added MAINTAINERS change
- Made DP config value default with DRM_EXYNOS

 MAINTAINERS                             |    7 -
 drivers/gpu/drm/exynos/Kconfig          |    7 +
 drivers/gpu/drm/exynos/Makefile         |    1 +
 drivers/gpu/drm/exynos/exynos_dp_core.c | 1155 ++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_core.h |  320 ++++++++
 drivers/gpu/drm/exynos/exynos_dp_reg.c  | 1243 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_reg.h  |  366 +++++++++
 drivers/video/exynos/Kconfig            |    7 -
 drivers/video/exynos/Makefile           |    1 -
 drivers/video/exynos/exynos_dp_core.c   | 1155 ----------------------------
 drivers/video/exynos/exynos_dp_core.h   |  320 --------
 drivers/video/exynos/exynos_dp_reg.c    | 1243 -------------------------------
 drivers/video/exynos/exynos_dp_reg.h    |  366 ---------
 13 files changed, 3092 insertions(+), 3099 deletions(-)
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.h
 delete mode 100644 drivers/video/exynos/exynos_dp_core.c
 delete mode 100644 drivers/video/exynos/exynos_dp_core.h
 delete mode 100644 drivers/video/exynos/exynos_dp_reg.c
 delete mode 100644 drivers/video/exynos/exynos_dp_reg.h
MAINTAINERS +0 -7
index 31a0462..c04bc3f 100644
@@ -3339,13 +3339,6 @@ S:	Maintained
 F:	drivers/extcon/
 F:	Documentation/extcon/
 
-EXYNOS DP DRIVER
-M:	Jingoo Han <[email protected]>
-L:	[email protected]
-S:	Maintained
-F:	drivers/video/exynos/exynos_dp*
-F:	include/video/exynos_dp*
-
 EXYNOS MIPI DISPLAY DRIVERS
 M:	Inki Dae <[email protected]>
 M:	Donghwa Lee <[email protected]>
drivers/gpu/drm/exynos/Kconfig +7 -0
index 6e1a1a2..7eea698 100644
@@ -31,6 +31,13 @@ config DRM_EXYNOS_FIMD
 	help
 	  Choose this option if you want to use Exynos FIMD for DRM.
 
+config DRM_EXYNOS_DP
+	bool "EXYNOS DRM DP driver support"
+	depends on DRM_EXYNOS && ARCH_EXYNOS
+	default DRM_EXYNOS
+	help
+	  This enables support for DP device.
+
 config DRM_EXYNOS_HDMI
 	bool "Exynos DRM HDMI"
 	depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_TV
drivers/gpu/drm/exynos/Makefile +1 -0
index afbe499..fc8555c 100644
@@ -11,6 +11,7 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \
 exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)	+= exynos_drm_fimd.o
+exynosdrm-$(CONFIG_DRM_EXYNOS_DP)	+= exynos_dp_core.o exynos_dp_reg.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)	+= exynos_hdmi.o exynos_mixer.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI)	+= exynos_drm_vidi.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_G2D)	+= exynos_drm_g2d.o
drivers/gpu/drm/exynos/exynos_dp_core.c new file +1155 -0

1,155 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_dp_core.h new file +320 -0

320 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_dp_reg.c new file +1243 -0

1,243 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_dp_reg.h new file +366 -0

249 lines not on this page · raw message

drivers/video/exynos/Kconfig +0 -7
index 1129d0e..5ef645e 100644

Lines of this file are not shown. View the raw message.

drivers/video/exynos/Makefile +0 -1
index ec7772e..b5b1bd2 100644

Lines of this file are not shown. View the raw message.

drivers/video/exynos/exynos_dp_core.c deleted +0 -1155

1,155 lines not on this page · raw message

drivers/video/exynos/exynos_dp_core.h deleted +0 -320

320 lines not on this page · raw message

drivers/video/exynos/exynos_dp_reg.c deleted +0 -1243

1,243 lines not on this page · raw message

drivers/video/exynos/exynos_dp_reg.h deleted +0 -366

366 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.5.1

Part of the diff is not shown here. View the raw message.

author
#34 lore raw

PATCH v4 24/34 drm/exynos: Move display implementation into dp

In reply to Sean Paul

This patch moves the exynos_drm_display implementation from fimd into the dp driver. This will allow for tighter integration of the dp driver into the exynos drm driver.

---

Changes in v2: None
Changes in v3: None
Changes in v4:
- Changed _ to - in dts documentation

 .../devicetree/bindings/video/exynos_dp.txt        |  17 ++++
 .../devicetree/bindings/video/samsung-fimd.txt     |   2 +
 drivers/gpu/drm/exynos/exynos_dp_core.c            | 100 +++++++++++++++++----
 drivers/gpu/drm/exynos/exynos_dp_core.h            |   4 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c            |  14 +++
 drivers/gpu/drm/exynos/exynos_drm_drv.h            |   1 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c           |  79 +++-------------
 7 files changed, 131 insertions(+), 86 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +17 -0
index 3289d76..57ccdde 100644
@@ -49,6 +49,8 @@ Required properties for dp-controller:
 	-samsung,lane-count:
 		number of lanes supported by the panel.
 			LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
+	- display-timings: timings for the connected panel as described by
+		Documentation/devicetree/bindings/video/display-timing.txt
 
 Optional properties for dp-controller:
 	-interlaced:
@@ -84,4 +86,19 @@ Board Specific portion:
 		samsung,color-depth = <1>;
 		samsung,link-rate = <0x0a>;
 		samsung,lane-count = <4>;
+
+		display-timings {
+			native-mode = <&lcd_timing>;
+			lcd_timing: 1366x768 {
+				clock-frequency = <70589280>;
+				hactive = <1366>;
+				vactive = <768>;
+				hfront-porch = <40>;
+				hback-porch = <40>;
+				hsync-len = <32>;
+				vback-porch = <10>;
+				vfront-porch = <12>;
+				vsync-len = <6>;
+			};
+		};
 	};
Documentation/devicetree/bindings/video/samsung-fimd.txt +2 -0
index 778838a..36b7895 100644
@@ -39,6 +39,8 @@ Required properties:
 
 Optional Properties:
 - samsung,power-domain: a phandle to FIMD power domain node.
+- samsung,invert-vden: video enable signal is inverted
+- samsung,invert-vclk: video clock signal is inverted
 
 Example:
 
drivers/gpu/drm/exynos/exynos_dp_core.c +81 -19

167 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_dp_core.h +4 -0
index 607e36d..4f14141 100644
@@ -13,6 +13,8 @@
 #ifndef _EXYNOS_DP_CORE_H
 #define _EXYNOS_DP_CORE_H
 
+#include <drm/exynos_drm.h>
+
 #define DP_TIMEOUT_LOOP_COUNT 100
 #define MAX_CR_LOOP 5
 #define MAX_EQ_LOOP 5
@@ -152,6 +154,8 @@ struct exynos_dp_device {
 	struct link_train	link_train;
 	struct work_struct	hotplug_work;
 	struct phy		*phy;
+
+	struct exynos_drm_panel_info panel;
 };
 
 /* exynos_dp_reg.c */
drivers/gpu/drm/exynos/exynos_drm_drv.c +14 -0
index 6143742..87ac369 100644
@@ -353,6 +353,12 @@ static int __init exynos_drm_init(void)
 {
 	int ret;
 
+#ifdef CONFIG_DRM_EXYNOS_DP
+	ret = platform_driver_register(&dp_driver);
+	if (ret < 0)
+		goto out_dp;
+#endif
+
 #ifdef CONFIG_DRM_EXYNOS_FIMD
 	ret = platform_driver_register(&fimd_driver);
 	if (ret < 0)
@@ -468,6 +474,10 @@ out_hdmi:
 	platform_driver_unregister(&fimd_driver);
 out_fimd:
 #endif
+#ifdef CONFIG_DRM_EXYNOS_DP
+	platform_driver_unregister(&dp_driver);
+out_dp:
+#endif
 	return ret;
 }
 
@@ -510,6 +520,10 @@ static void __exit exynos_drm_exit(void)
 #ifdef CONFIG_DRM_EXYNOS_FIMD
 	platform_driver_unregister(&fimd_driver);
 #endif
+
+#ifdef CONFIG_DRM_EXYNOS_DP
+	platform_driver_unregister(&dp_driver);
+#endif
 }
 
 module_init(exynos_drm_init);
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -0
index 81f7de4..09c158a 100644
@@ -370,6 +370,7 @@ int exynos_platform_device_ipp_register(void);
  */
 void exynos_platform_device_ipp_unregister(void);
 
+extern struct platform_driver dp_driver;
 extern struct platform_driver fimd_driver;
 extern struct platform_driver hdmi_driver;
 extern struct platform_driver mixer_driver;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +12 -67

121 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#35 lore raw

PATCH v4 25/34 ARM: dts: Move display-timings node from fimd to dp

In reply to Sean Paul

This patch moves the display-timings node from fimd to dp to reflect the device tree bindings change.

---

Changes in v2: None
Changes in v3: None
Changes in v4: None

 arch/arm/boot/dts/exynos5250-arndale.dts  | 7 ++++---
 arch/arm/boot/dts/exynos5250-smdk5250.dts | 7 ++++---
 arch/arm/boot/dts/exynos5250-snow.dts     | 7 ++++---
 arch/arm/boot/dts/exynos5420-smdk5420.dts | 7 ++++---
 4 files changed, 16 insertions(+), 12 deletions(-)
arch/arm/boot/dts/exynos5250-arndale.dts +4 -3
index 6845270..8aa8d8c 100644
@@ -542,10 +542,7 @@
 		samsung,link-rate = <0x0a>;
 		samsung,lane-count = <4>;
 		status = "okay";
-	};
 
-	fimd: fimd@14400000 {
-		status = "okay";
 		display-timings {
 			native-mode = <&timing0>;
 			timing0: timing@0 {
@@ -563,6 +560,10 @@
 		};
 	};
 
+	fimd: fimd@14400000 {
+		status = "okay";
+	};
+
 	usb_hub_bus {
 		compatible = "simple-bus";
 		#address-cells = <1>;
arch/arm/boot/dts/exynos5250-smdk5250.dts +4 -3
index b14985a..460ec90 100644
@@ -255,10 +255,7 @@
 		pinctrl-names = "default";
 		pinctrl-0 = <&dp_hpd>;
 		status = "okay";
-	};
 
-	fimd@14400000 {
-		status = "okay";
 		display-timings {
 			native-mode = <&timing0>;
 			timing0: timing@0 {
@@ -276,6 +273,10 @@
 		};
 	};
 
+	fimd@14400000 {
+		status = "okay";
+	};
+
 	fixed-rate-clocks {
 		xxti {
 			compatible = "samsung,clock-xxti";
arch/arm/boot/dts/exynos5250-snow.dts +4 -3
index 8c92df8..b2783d8 100644
@@ -216,10 +216,7 @@
 		pinctrl-names = "default";
 		pinctrl-0 = <&dp_hpd>;
 		status = "okay";
-	};
 
-	fimd: fimd@14400000 {
-		status = "okay";
 		display-timings {
 			native-mode = <&lcd_timing>;
 			lcd_timing: 1366x768 {
@@ -236,6 +233,10 @@
 		};
 	};
 
+	fimd: fimd@14400000 {
+		status = "okay";
+	};
+
 	fixed-rate-clocks {
 		xxti {
 			compatible = "samsung,clock-xxti";
arch/arm/boot/dts/exynos5420-smdk5420.dts +4 -3
index 79524c7..b477f76 100644
@@ -41,10 +41,7 @@
 		samsung,link-rate = <0x0a>;
 		samsung,lane-count = <4>;
 		status = "okay";
-	};
 
-	fimd@14400000 {
-		status = "okay";
 		display-timings {
 			native-mode = <&timing0>;
 			timing0: timing@0 {
@@ -87,4 +84,8 @@
 			reg = <0x50>;
 		};
 	};
+
+	fimd@14400000 {
+		status = "okay";
+	};
 };
Signature · 1 line
1.8.5.1
author
#36 lore raw

PATCH v4 26/34 drm/exynos: Implement dpms display callback in DP

In reply to Sean Paul

This patch implements the dpms display callback for the DP driver.

---

Changes in v2:
- Added to the patchset
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_dp_core.c | 142 ++++++++++++++++++--------------
 drivers/gpu/drm/exynos/exynos_dp_core.h |   1 +
 2 files changed, 81 insertions(+), 62 deletions(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +80 -62
index 5c26161..05ce947 100644
@@ -915,10 +915,78 @@ static int exynos_dp_check_mode(struct exynos_drm_display *display,
 	return 0;
 }
 
+static void exynos_dp_phy_init(struct exynos_dp_device *dp)
+{
+	if (dp->phy) {
+		phy_power_on(dp->phy);
+	} else if (dp->phy_addr) {
+		u32 reg;
+
+		reg = __raw_readl(dp->phy_addr);
+		reg |= dp->enable_mask;
+		__raw_writel(reg, dp->phy_addr);
+	}
+}
+
+static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
+{
+	if (dp->phy) {
+		phy_power_off(dp->phy);
+	} else if (dp->phy_addr) {
+		u32 reg;
+
+		reg = __raw_readl(dp->phy_addr);
+		reg &= ~(dp->enable_mask);
+		__raw_writel(reg, dp->phy_addr);
+	}
+}
+
+static void exynos_dp_poweron(struct exynos_dp_device *dp)
+{
+	if (dp->dpms_mode == DRM_MODE_DPMS_ON)
+		return;
+
+	clk_prepare_enable(dp->clock);
+	exynos_dp_phy_init(dp);
+	exynos_dp_init_dp(dp);
+	enable_irq(dp->irq);
+}
+
+static void exynos_dp_poweroff(struct exynos_dp_device *dp)
+{
+	if (dp->dpms_mode != DRM_MODE_DPMS_ON)
+		return;
+
+	disable_irq(dp->irq);
+	flush_work(&dp->hotplug_work);
+	exynos_dp_phy_exit(dp);
+	clk_disable_unprepare(dp->clock);
+}
+
+static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
+{
+	struct exynos_dp_device *dp = display->ctx;
+
+	switch (mode) {
+	case DRM_MODE_DPMS_ON:
+		exynos_dp_poweron(dp);
+		break;
+	case DRM_MODE_DPMS_STANDBY:
+	case DRM_MODE_DPMS_SUSPEND:
+	case DRM_MODE_DPMS_OFF:
+		exynos_dp_poweroff(dp);
+		break;
+	default:
+		break;
+	};
+	dp->dpms_mode = mode;
+}
+
 static struct exynos_drm_display_ops exynos_dp_display_ops = {
 	.is_connected = exynos_dp_display_is_connected,
 	.get_panel = exynos_dp_get_panel,
 	.check_mode = exynos_dp_check_mode,
+	.dpms = exynos_dp_dpms,
 };
 
 static struct exynos_drm_display exynos_dp_display = {
@@ -1040,54 +1108,6 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
 	return 0;
 }
 
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-	if (dp->phy) {
-		phy_power_on(dp->phy);
-	} else if (dp->phy_addr) {
-		u32 reg;
-
-		reg = __raw_readl(dp->phy_addr);
-		reg |= dp->enable_mask;
-		__raw_writel(reg, dp->phy_addr);
-	}
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-	if (dp->phy) {
-		phy_power_off(dp->phy);
-	} else if (dp->phy_addr) {
-		u32 reg;
-
-		reg = __raw_readl(dp->phy_addr);
-		reg &= ~(dp->enable_mask);
-		__raw_writel(reg, dp->phy_addr);
-	}
-}
-
-void exynos_dp_poweron(struct exynos_dp_device *dp)
-{
-	exynos_dp_phy_init(dp);
-
-	clk_prepare_enable(dp->clock);
-
-	exynos_dp_init_dp(dp);
-
-	enable_irq(dp->irq);
-}
-
-void exynos_dp_poweroff(struct exynos_dp_device *dp)
-{
-	disable_irq(dp->irq);
-
-	flush_work(&dp->hotplug_work);
-
-	exynos_dp_phy_exit(dp);
-
-	clk_disable_unprepare(dp->clock);
-}
-
 static int exynos_dp_probe(struct platform_device *pdev)
 {
 	struct resource *res;
@@ -1103,6 +1123,7 @@ static int exynos_dp_probe(struct platform_device *pdev)
 	}
 
 	dp->dev = &pdev->dev;
+	dp->dpms_mode = DRM_MODE_DPMS_OFF;
 
 	dp->video_info = exynos_dp_dt_parse_pdata(&pdev->dev);
 	if (IS_ERR(dp->video_info))
@@ -1148,10 +1169,11 @@ static int exynos_dp_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to request irq\n");
 		return ret;
 	}
-
-	platform_set_drvdata(pdev, dp);
+	disable_irq(dp->irq);
 
 	exynos_dp_display.ctx = dp;
+
+	platform_set_drvdata(pdev, &exynos_dp_display);
 	exynos_drm_display_register(&exynos_dp_display);
 
 	return 0;
@@ -1159,34 +1181,30 @@ static int exynos_dp_probe(struct platform_device *pdev)
 
 static int exynos_dp_remove(struct platform_device *pdev)
 {
-	struct exynos_dp_device *dp = platform_get_drvdata(pdev);
+	struct exynos_drm_display *display = platform_get_drvdata(pdev);
 
+	exynos_dp_dpms(display, DRM_MODE_DPMS_OFF);
 	exynos_drm_display_unregister(&exynos_dp_display);
 
-	flush_work(&dp->hotplug_work);
-
-	exynos_dp_phy_exit(dp);
-
-	clk_disable_unprepare(dp->clock);
-
-
 	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
 static int exynos_dp_suspend(struct device *dev)
 {
-	struct exynos_dp_device *dp = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct exynos_drm_display *display = platform_get_drvdata(pdev);
 
-	exynos_dp_poweroff(dp);
+	exynos_dp_dpms(display, DRM_MODE_DPMS_OFF);
 	return 0;
 }
 
 static int exynos_dp_resume(struct device *dev)
 {
-	struct exynos_dp_device *dp = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct exynos_drm_display *display = platform_get_drvdata(pdev);
 
-	exynos_dp_poweron(dp);
+	exynos_dp_dpms(display, DRM_MODE_DPMS_ON);
 	return 0;
 }
 #endif
drivers/gpu/drm/exynos/exynos_dp_core.h +1 -0
index 4f14141..ccaeadc 100644
@@ -154,6 +154,7 @@ struct exynos_dp_device {
 	struct link_train	link_train;
 	struct work_struct	hotplug_work;
 	struct phy		*phy;
+	int			dpms_mode;
 
 	struct exynos_drm_panel_info panel;
 };
Signature · 1 line
1.8.5.1
author
#37 lore raw

PATCH v4 27/34 drm/exynos: Clean up FIMD power on/off routines

In reply to Sean Paul

This patch separates the fimd_activate function into poweron/poweroff functions to be more consistent with the other drivers in exynos drm. It also properly cleans up after failures in poweron. The functions have also been shuffled around such that they are all in the same spot in the file and poweron/poweroff can be called from the dpms function.

---

Changes in v2:
- Added to the patchset
Changes in v3: None
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 245 +++++++++++++++++--------------
 1 file changed, 134 insertions(+), 111 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +134 -111
index 6eb0008..1efdcac 100644
@@ -519,6 +519,12 @@ static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos)
 
 	win_data = &ctx->win_data[win];
 
+	/* If suspended, enable this on resume */
+	if (ctx->suspended) {
+		win_data->resume = true;
+		return;
+	}
+
 	/*
 	 * SHADOWCON/PRTCON register is used for enabling timing.
 	 *
@@ -660,6 +666,129 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos)
 	win_data->enabled = false;
 }
 
+static void fimd_clear_win(struct fimd_context *ctx, int win)
+{
+	writel(0, ctx->regs + WINCON(win));
+	writel(0, ctx->regs + VIDOSD_A(win));
+	writel(0, ctx->regs + VIDOSD_B(win));
+	writel(0, ctx->regs + VIDOSD_C(win));
+
+	if (win == 1 || win == 2)
+		writel(0, ctx->regs + VIDOSD_D(win));
+
+	fimd_shadow_protect_win(ctx, win, false);
+}
+
+static void fimd_window_suspend(struct exynos_drm_manager *mgr)
+{
+	struct fimd_context *ctx = mgr->ctx;
+	struct fimd_win_data *win_data;
+	int i;
+
+	for (i = 0; i < WINDOWS_NR; i++) {
+		win_data = &ctx->win_data[i];
+		win_data->resume = win_data->enabled;
+		if (win_data->enabled)
+			fimd_win_disable(mgr, i);
+	}
+	fimd_wait_for_vblank(mgr);
+}
+
+static void fimd_window_resume(struct exynos_drm_manager *mgr)
+{
+	struct fimd_context *ctx = mgr->ctx;
+	struct fimd_win_data *win_data;
+	int i;
+
+	for (i = 0; i < WINDOWS_NR; i++) {
+		win_data = &ctx->win_data[i];
+		win_data->enabled = win_data->resume;
+		win_data->resume = false;
+	}
+}
+
+static void fimd_apply(struct exynos_drm_manager *mgr)
+{
+	struct fimd_context *ctx = mgr->ctx;
+	struct fimd_win_data *win_data;
+	int i;
+
+	for (i = 0; i < WINDOWS_NR; i++) {
+		win_data = &ctx->win_data[i];
+		if (win_data->enabled)
+			fimd_win_commit(mgr, i);
+	}
+
+	fimd_commit(mgr);
+}
+
+static int fimd_poweron(struct exynos_drm_manager *mgr)
+{
+	struct fimd_context *ctx = mgr->ctx;
+	int ret;
+
+	if (!ctx->suspended)
+		return 0;
+
+	ctx->suspended = false;
+
+	ret = clk_prepare_enable(ctx->bus_clk);
+	if (ret < 0) {
+		DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret);
+		goto bus_clk_err;
+	}
+
+	ret = clk_prepare_enable(ctx->lcd_clk);
+	if  (ret < 0) {
+		DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret);
+		goto lcd_clk_err;
+	}
+
+	/* if vblank was enabled status, enable it again. */
+	if (test_and_clear_bit(0, &ctx->irq_flags)) {
+		ret = fimd_enable_vblank(mgr);
+		if (ret) {
+			DRM_ERROR("Failed to re-enable vblank [%d]\n", ret);
+			goto enable_vblank_err;
+		}
+	}
+
+	fimd_window_resume(mgr);
+
+	fimd_apply(mgr);
+
+	return 0;
+
+enable_vblank_err:
+	clk_disable_unprepare(ctx->lcd_clk);
+lcd_clk_err:
+	clk_disable_unprepare(ctx->bus_clk);
+bus_clk_err:
+	ctx->suspended = true;
+	return ret;
+}
+
+static int fimd_poweroff(struct exynos_drm_manager *mgr)
+{
+	struct fimd_context *ctx = mgr->ctx;
+
+	if (ctx->suspended)
+		return 0;
+
+	/*
+	 * We need to make sure that all windows are disabled before we
+	 * suspend that connector. Otherwise we might try to scan from
+	 * a destroyed buffer later.
+	 */
+	fimd_window_suspend(mgr);
+
+	clk_disable_unprepare(ctx->lcd_clk);
+	clk_disable_unprepare(ctx->bus_clk);
+
+	ctx->suspended = true;
+	return 0;
+}
+
 static void fimd_dpms(struct exynos_drm_manager *mgr, int mode)
 {
 	struct fimd_context *ctx = mgr->ctx;
@@ -736,113 +865,6 @@ out:
 	return IRQ_HANDLED;
 }
 
-static void fimd_clear_win(struct fimd_context *ctx, int win)
-{
-	writel(0, ctx->regs + WINCON(win));
-	writel(0, ctx->regs + VIDOSD_A(win));
-	writel(0, ctx->regs + VIDOSD_B(win));
-	writel(0, ctx->regs + VIDOSD_C(win));
-
-	if (win == 1 || win == 2)
-		writel(0, ctx->regs + VIDOSD_D(win));
-
-	fimd_shadow_protect_win(ctx, win, false);
-}
-
-static int fimd_clock(struct fimd_context *ctx, bool enable)
-{
-	if (enable) {
-		int ret;
-
-		ret = clk_prepare_enable(ctx->bus_clk);
-		if (ret < 0)
-			return ret;
-
-		ret = clk_prepare_enable(ctx->lcd_clk);
-		if  (ret < 0) {
-			clk_disable_unprepare(ctx->bus_clk);
-			return ret;
-		}
-	} else {
-		clk_disable_unprepare(ctx->lcd_clk);
-		clk_disable_unprepare(ctx->bus_clk);
-	}
-
-	return 0;
-}
-
-static void fimd_window_suspend(struct exynos_drm_manager *mgr)
-{
-	struct fimd_context *ctx = mgr->ctx;
-	struct fimd_win_data *win_data;
-	int i;
-
-	for (i = 0; i < WINDOWS_NR; i++) {
-		win_data = &ctx->win_data[i];
-		win_data->resume = win_data->enabled;
-		fimd_win_disable(mgr, i);
-	}
-	fimd_wait_for_vblank(mgr);
-}
-
-static void fimd_window_resume(struct exynos_drm_manager *mgr)
-{
-	struct fimd_context *ctx = mgr->ctx;
-	struct fimd_win_data *win_data;
-	int i;
-
-	for (i = 0; i < WINDOWS_NR; i++) {
-		win_data = &ctx->win_data[i];
-		win_data->enabled = win_data->resume;
-		win_data->resume = false;
-	}
-}
-
-static void fimd_apply(struct exynos_drm_manager *mgr)
-{
-	struct fimd_context *ctx = mgr->ctx;
-	struct fimd_win_data *win_data;
-	int i;
-
-	for (i = 0; i < WINDOWS_NR; i++) {
-		win_data = &ctx->win_data[i];
-		if (win_data->enabled)
-			fimd_win_commit(mgr, i);
-	}
-
-	fimd_commit(mgr);
-}
-
-static int fimd_activate(struct exynos_drm_manager *mgr, bool enable)
-{
-	struct fimd_context *ctx = mgr->ctx;
-
-	if (enable) {
-		int ret;
-
-		ret = fimd_clock(ctx, true);
-		if (ret < 0)
-			return ret;
-
-		ctx->suspended = false;
-
-		/* if vblank was enabled status, enable it again. */
-		if (test_and_clear_bit(0, &ctx->irq_flags))
-			fimd_enable_vblank(mgr);
-
-		fimd_window_resume(mgr);
-
-		fimd_apply(mgr);
-	} else {
-		fimd_window_suspend(mgr);
-
-		fimd_clock(ctx, false);
-		ctx->suspended = true;
-	}
-
-	return 0;
-}
-
 static int fimd_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -859,6 +881,7 @@ static int fimd_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	ctx->dev = dev;
+	ctx->suspended = true;
 
 	if (of_property_read_bool(dev->of_node, "samsung,invert-vden"))
 		ctx->vidcon1 |= VIDCON1_INV_VDEN;
@@ -945,7 +968,7 @@ static int fimd_suspend(struct device *dev)
 	 * because the usage_count of pm runtime is more than 1.
 	 */
 	if (!pm_runtime_suspended(dev))
-		return fimd_activate(mgr, false);
+		return fimd_poweroff(mgr);
 
 	return 0;
 }
@@ -962,7 +985,7 @@ static int fimd_resume(struct device *dev)
 	if (pm_runtime_suspended(dev))
 		return 0;
 
-	return fimd_activate(mgr, true);
+	return fimd_poweron(mgr);
 }
 #endif
 
@@ -971,14 +994,14 @@ static int fimd_runtime_suspend(struct device *dev)
 {
 	struct exynos_drm_manager *mgr = get_fimd_manager(dev);
 
-	return fimd_activate(mgr, false);
+	return fimd_poweroff(mgr);
 }
 
 static int fimd_runtime_resume(struct device *dev)
 {
 	struct exynos_drm_manager *mgr = get_fimd_manager(dev);
 
-	return fimd_activate(mgr, true);
+	return fimd_poweron(mgr);
 }
 #endif
 
Signature · 1 line
1.8.5.1
author
#38 lore raw

PATCH v4 28/34 drm/exynos: Consolidate suspend/resume in drm_drv

In reply to Sean Paul

This patch removes all of the suspend/resume logic from the individual drivers and consolidates it in drm_drv. This consolidation reduces the number of functions which enable/disable the hardware to just one -- the dpms callback. This ensures that we always power up/down in a consistent manner.

---

Changes in v2:
- Added to the patchset
Changes in v3:
- Made appropriate changes to vidi as well (removed pm_ops)
Changes in v4:
- Added pm_runtime_get/put back into the dpms handlers for hdmi

 drivers/gpu/drm/exynos/exynos_drm_drv.c  |  97 +++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |  86 +++-------------------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 119 +++++++++++++------------------
 drivers/gpu/drm/exynos/exynos_hdmi.c     |  88 +++--------------------
 drivers/gpu/drm/exynos/exynos_mixer.c    |  68 ++----------------
 5 files changed, 170 insertions(+), 288 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +97 -0
index 87ac369..c8869de 100644
@@ -11,6 +11,7 @@
  * option) any later version.
  */
 
+#include <linux/pm_runtime.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 
@@ -53,6 +54,7 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&private->pageflip_event_list);
+	dev_set_drvdata(dev->dev, dev);
 	dev->dev_private = (void *)private;
 
 	/*
@@ -163,6 +165,41 @@ static const struct file_operations exynos_drm_gem_fops = {
 	.mmap = exynos_drm_gem_mmap_buffer,
 };
 
+static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state)
+{
+	struct drm_connector *connector;
+
+	drm_modeset_lock_all(dev);
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+		int old_dpms = connector->dpms;
+
+		if (connector->funcs->dpms)
+			connector->funcs->dpms(connector, DRM_MODE_DPMS_OFF);
+
+		/* Set the old mode back to the connector for resume */
+		connector->dpms = old_dpms;
+	}
+	drm_modeset_unlock_all(dev);
+
+	return 0;
+}
+
+static int exynos_drm_resume(struct drm_device *dev)
+{
+	struct drm_connector *connector;
+
+	drm_modeset_lock_all(dev);
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+		if (connector->funcs->dpms)
+			connector->funcs->dpms(connector, connector->dpms);
+	}
+
+	drm_helper_resume_force_mode(dev);
+	drm_modeset_unlock_all(dev);
+
+	return 0;
+}
+
 static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
 {
 	struct drm_exynos_file_private *file_priv;
@@ -296,6 +333,8 @@ static struct drm_driver exynos_drm_driver = {
 					DRIVER_GEM | DRIVER_PRIME,
 	.load			= exynos_drm_load,
 	.unload			= exynos_drm_unload,
+	.suspend		= exynos_drm_suspend,
+	.resume			= exynos_drm_resume,
 	.open			= exynos_drm_open,
 	.preclose		= exynos_drm_preclose,
 	.lastclose		= exynos_drm_lastclose,
@@ -330,6 +369,9 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
+
 	return drm_platform_init(&exynos_drm_driver, pdev);
 }
 
@@ -340,12 +382,67 @@ static int exynos_drm_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int exynos_drm_sys_suspend(struct device *dev)
+{
+	struct drm_device *drm_dev = dev_get_drvdata(dev);
+	pm_message_t message;
+
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	message.event = PM_EVENT_SUSPEND;
+	return exynos_drm_suspend(drm_dev, message);
+}
+
+static int exynos_drm_sys_resume(struct device *dev)
+{
+	struct drm_device *drm_dev = dev_get_drvdata(dev);
+
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	return exynos_drm_resume(drm_dev);
+}
+#endif
+
+#ifdef CONFIG_PM_RUNTIME
+static int exynos_drm_runtime_suspend(struct device *dev)
+{
+	struct drm_device *drm_dev = dev_get_drvdata(dev);
+	pm_message_t message;
+
+	if (pm_runtime_suspended(dev))
+		return 0;
+
+	message.event = PM_EVENT_SUSPEND;
+	return exynos_drm_suspend(drm_dev, message);
+}
+
+static int exynos_drm_runtime_resume(struct device *dev)
+{
+	struct drm_device *drm_dev = dev_get_drvdata(dev);
+
+	if (!pm_runtime_suspended(dev))
+		return 0;
+
+	return exynos_drm_resume(drm_dev);
+}
+#endif
+
+static const struct dev_pm_ops exynos_drm_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(exynos_drm_sys_suspend, exynos_drm_sys_resume)
+	SET_RUNTIME_PM_OPS(exynos_drm_runtime_suspend,
+			exynos_drm_runtime_resume, NULL)
+};
+
 static struct platform_driver exynos_drm_platform_driver = {
 	.probe		= exynos_drm_platform_probe,
 	.remove		= exynos_drm_platform_remove,
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= "exynos-drm",
+		.pm	= &exynos_drm_pm_ops,
 	},
 };
 
drivers/gpu/drm/exynos/exynos_drm_fimd.c +9 -77

138 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_vidi.c +49 -70

148 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_hdmi.c +9 -79

142 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_mixer.c +6 -62

102 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#39 lore raw

PATCH v4 29/34 drm/exynos: Add create_connector callback

In reply to Sean Paul

This creates a new display hook called create_connector. The purpose is to allow the display driver to create its own drm_connector instead of using the exynos_drm_connector. This moves things closer to completely removing the exynos_drm_connector abstraction.

---

Changes in v3:
- Added to the patchset
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_core.c | 3 +++
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 2 ++
 2 files changed, 5 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_core.c +3 -0
index e76098d..1a60f5a 100644
@@ -87,6 +87,9 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev,
 			return 0;
 	}
 
+	if (display->ops->create_connector)
+		return display->ops->create_connector(display, encoder);
+
 	/*
 	 * create and initialize a connector for this sub driver and
 	 * attach the encoder created above to the connector.
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -0
index 09c158a..b1b02d0 100644
@@ -139,6 +139,8 @@ struct exynos_drm_display;
 struct exynos_drm_display_ops {
 	int (*initialize)(struct exynos_drm_display *display,
 				struct drm_device *drm_dev);
+	int (*create_connector)(struct exynos_drm_display *display,
+				struct drm_encoder *encoder);
 	void (*remove)(struct exynos_drm_display *display);
 	bool (*is_connected)(struct exynos_drm_display *display);
 	void (*get_max_resol)(struct exynos_drm_display *display,
Signature · 1 line
1.8.5.1
author
#40 lore raw

PATCH v4 30/34 drm/exynos: Implement drm_connector in hdmi directly

In reply to Sean Paul

This patch implements drm_connector in the hdmi driver directly, instead of using exynos_drm_connector.

---

Changes in v3:
- Added to the patchset
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_hdmi.c | 126 +++++++++++++++++++++++------------
 1 file changed, 85 insertions(+), 41 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +85 -41
index 3313743..925b2a2 100644
@@ -44,9 +44,8 @@
 #include <linux/gpio.h>
 #include <media/s5p_hdmi.h>
 
-#define MAX_WIDTH		1920
-#define MAX_HEIGHT		1080
 #define get_hdmi_display(dev)	platform_get_drvdata(to_platform_device(dev))
+#define ctx_from_connector(c)	container_of(c, struct hdmi_context, connector)
 
 /* AVI header and aspect ratio */
 #define HDMI_AVI_VERSION		0x02
@@ -182,6 +181,8 @@ struct hdmi_conf_regs {
 struct hdmi_context {
 	struct device			*dev;
 	struct drm_device		*drm_dev;
+	struct drm_connector		connector;
+	struct drm_encoder		*encoder;
 	bool				hpd;
 	bool				powered;
 	bool				dvi_mode;
@@ -740,42 +741,46 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,
 	}
 }
 
-static int hdmi_initialize(struct exynos_drm_display *display,
-			struct drm_device *drm_dev)
+static enum drm_connector_status hdmi_detect(struct drm_connector *connector,
+				bool force)
 {
-	struct hdmi_context *hdata = display->ctx;
+	struct hdmi_context *hdata = ctx_from_connector(connector);
 
-	hdata->drm_dev = drm_dev;
-
-	return 0;
+	return hdata->hpd ? connector_status_connected :
+			connector_status_disconnected;
 }
 
-static bool hdmi_is_connected(struct exynos_drm_display *display)
+static void hdmi_connector_destroy(struct drm_connector *connector)
 {
-	struct hdmi_context *hdata = display->ctx;
-
-	return hdata->hpd;
 }
 
-static struct edid *hdmi_get_edid(struct exynos_drm_display *display,
-			struct drm_connector *connector)
+static struct drm_connector_funcs hdmi_connector_funcs = {
+	.dpms = drm_helper_connector_dpms,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.detect = hdmi_detect,
+	.destroy = hdmi_connector_destroy,
+};
+
+static int hdmi_get_modes(struct drm_connector *connector)
 {
-	struct edid *raw_edid;
-	struct hdmi_context *hdata = display->ctx;
+	struct hdmi_context *hdata = ctx_from_connector(connector);
+	struct edid *edid;
 
 	if (!hdata->ddc_port)
-		return ERR_PTR(-ENODEV);
+		return -ENODEV;
 
-	raw_edid = drm_get_edid(connector, hdata->ddc_port->adapter);
-	if (!raw_edid)
-		return ERR_PTR(-ENODEV);
+	edid = drm_get_edid(connector, hdata->ddc_port->adapter);
+	if (!edid)
+		return -ENODEV;
 
-	hdata->dvi_mode = !drm_detect_hdmi_monitor(raw_edid);
+	hdata->dvi_mode = !drm_detect_hdmi_monitor(edid);
 	DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n",
 		(hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
-		raw_edid->width_cm, raw_edid->height_cm);
+		edid->width_cm, edid->height_cm);
+
+	drm_mode_connector_update_edid_property(connector, edid);
 
-	return raw_edid;
+	return drm_add_edid_modes(connector, edid);
 }
 
 static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
@@ -800,10 +805,10 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
 	return -EINVAL;
 }
 
-static int hdmi_check_mode(struct exynos_drm_display *display,
+static int hdmi_mode_valid(struct drm_connector *connector,
 			struct drm_display_mode *mode)
 {
-	struct hdmi_context *hdata = display->ctx;
+	struct hdmi_context *hdata = ctx_from_connector(connector);
 	int ret;
 
 	DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n",
@@ -813,11 +818,60 @@ static int hdmi_check_mode(struct exynos_drm_display *display,
 
 	ret = mixer_check_mode(mode);
 	if (ret)
-		return ret;
+		return MODE_BAD;
 
 	ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
 	if (ret < 0)
+		return MODE_BAD;
+
+	return MODE_OK;
+}
+
+static struct drm_encoder *hdmi_best_encoder(struct drm_connector *connector)
+{
+	struct hdmi_context *hdata = ctx_from_connector(connector);
+
+	return hdata->encoder;
+}
+
+static struct drm_connector_helper_funcs hdmi_connector_helper_funcs = {
+	.get_modes = hdmi_get_modes,
+	.mode_valid = hdmi_mode_valid,
+	.best_encoder = hdmi_best_encoder,
+};
+
+static int hdmi_create_connector(struct exynos_drm_display *display,
+			struct drm_encoder *encoder)
+{
+	struct hdmi_context *hdata = display->ctx;
+	struct drm_connector *connector = &hdata->connector;
+	int ret;
+
+	hdata->encoder = encoder;
+	connector->interlace_allowed = true;
+	connector->polled = DRM_CONNECTOR_POLL_HPD;
+
+	ret = drm_connector_init(hdata->drm_dev, connector,
+			&hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA);
+	if (ret) {
+		DRM_ERROR("Failed to initialize connector with drm\n");
 		return ret;
+	}
+
+	drm_connector_helper_add(connector, &hdmi_connector_helper_funcs);
+	drm_sysfs_connector_add(connector);
+	drm_mode_connector_attach_encoder(connector, encoder);
+
+	return 0;
+}
+
+static int hdmi_initialize(struct exynos_drm_display *display,
+			struct drm_device *drm_dev)
+{
+	struct hdmi_context *hdata = display->ctx;
+
+	hdata->drm_dev = drm_dev;
+
 	return 0;
 }
 
@@ -833,10 +887,10 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display,
 
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
 
-	mode_ok = hdmi_check_mode(display, adjusted_mode);
+	mode_ok = hdmi_mode_valid(connector, adjusted_mode);
 
 	/* just return if user desired mode exists. */
-	if (mode_ok == 0)
+	if (mode_ok == MODE_OK)
 		return;
 
 	/*
@@ -844,9 +898,9 @@ static void hdmi_mode_fixup(struct exynos_drm_display *display,
 	 * to adjusted_mode.
 	 */
 	list_for_each_entry(m, &connector->modes, head) {
-		mode_ok = hdmi_check_mode(display, m);
+		mode_ok = hdmi_mode_valid(connector, m);
 
-		if (mode_ok == 0) {
+		if (mode_ok == MODE_OK) {
 			DRM_INFO("desired mode doesn't exist so\n");
 			DRM_INFO("use the most suitable mode among modes.\n");
 
@@ -1701,13 +1755,6 @@ static void hdmi_mode_set(struct exynos_drm_display *display,
 		hdmi_v14_mode_set(hdata, mode);
 }
 
-static void hdmi_get_max_resol(struct exynos_drm_display *display,
-			unsigned int *width, unsigned int *height)
-{
-	*width = MAX_WIDTH;
-	*height = MAX_HEIGHT;
-}
-
 static void hdmi_commit(struct exynos_drm_display *display)
 {
 	struct hdmi_context *hdata = display->ctx;
@@ -1802,10 +1849,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
 
 static struct exynos_drm_display_ops hdmi_display_ops = {
 	.initialize	= hdmi_initialize,
-	.is_connected	= hdmi_is_connected,
-	.get_max_resol	= hdmi_get_max_resol,
-	.get_edid	= hdmi_get_edid,
-	.check_mode	= hdmi_check_mode,
+	.create_connector = hdmi_create_connector,
 	.mode_fixup	= hdmi_mode_fixup,
 	.mode_set	= hdmi_mode_set,
 	.dpms		= hdmi_dpms,
Signature · 1 line
1.8.5.1
author
#41 lore raw

PATCH v4 31/34 drm/exynos: Implement drm_connector directly in dp driver

In reply to Sean Paul

This patch implements drm_connector directly in the dp driver, this will allow us to move away from the exynos_drm_connector layer.

---

Changes in v3:
- Added to the patchset
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_dp_core.c | 99 ++++++++++++++++++++++++++++++---
 drivers/gpu/drm/exynos/exynos_dp_core.h |  4 ++
 2 files changed, 94 insertions(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +90 -9
index 05ce947..af2c9d2 100644
@@ -23,10 +23,15 @@
 #include <video/of_videomode.h>
 
 #include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_crtc_helper.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"
 
+#define ctx_from_connector(c)	container_of(c, struct exynos_dp_device, \
+					connector)
+
 static int exynos_dp_init_dp(struct exynos_dp_device *dp)
 {
 	exynos_dp_reset(dp);
@@ -897,21 +902,98 @@ static void exynos_dp_hotplug(struct work_struct *work)
 		dev_err(dp->dev, "unable to config video\n");
 }
 
-static bool exynos_dp_display_is_connected(struct exynos_drm_display *display)
+static enum drm_connector_status exynos_dp_detect(
+				struct drm_connector *connector, bool force)
 {
-	return true;
+	return connector_status_connected;
 }
 
-static void *exynos_dp_get_panel(struct exynos_drm_display *display)
+static void exynos_dp_connector_destroy(struct drm_connector *connector)
 {
-	struct exynos_dp_device *dp = display->ctx;
+}
+
+static struct drm_connector_funcs exynos_dp_connector_funcs = {
+	.dpms = drm_helper_connector_dpms,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.detect = exynos_dp_detect,
+	.destroy = exynos_dp_connector_destroy,
+};
+
+static int exynos_dp_get_modes(struct drm_connector *connector)
+{
+	struct exynos_dp_device *dp = ctx_from_connector(connector);
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_create(connector->dev);
+	if (!mode) {
+		DRM_ERROR("failed to create a new display mode.\n");
+		return 0;
+	}
 
-	return &dp->panel;
+	drm_display_mode_from_videomode(&dp->panel.vm, mode);
+	mode->width_mm = dp->panel.width_mm;
+	mode->height_mm = dp->panel.height_mm;
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
+
+	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+	drm_mode_set_name(mode);
+	drm_mode_probed_add(connector, mode);
+
+	return 1;
 }
 
-static int exynos_dp_check_mode(struct exynos_drm_display *display,
+static int exynos_dp_mode_valid(struct drm_connector *connector,
 			struct drm_display_mode *mode)
 {
+	return MODE_OK;
+}
+
+static struct drm_encoder *exynos_dp_best_encoder(
+			struct drm_connector *connector)
+{
+	struct exynos_dp_device *dp = ctx_from_connector(connector);
+
+	return dp->encoder;
+}
+
+static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = {
+	.get_modes = exynos_dp_get_modes,
+	.mode_valid = exynos_dp_mode_valid,
+	.best_encoder = exynos_dp_best_encoder,
+};
+
+static int exynos_dp_initialize(struct exynos_drm_display *display,
+				struct drm_device *drm_dev)
+{
+	struct exynos_dp_device *dp = display->ctx;
+
+	dp->drm_dev = drm_dev;
+
+	return 0;
+}
+
+static int exynos_dp_create_connector(struct exynos_drm_display *display,
+				struct drm_encoder *encoder)
+{
+	struct exynos_dp_device *dp = display->ctx;
+	struct drm_connector *connector = &dp->connector;
+	int ret;
+
+	dp->encoder = encoder;
+	connector->polled = DRM_CONNECTOR_POLL_HPD;
+
+	ret = drm_connector_init(dp->drm_dev, connector,
+			&exynos_dp_connector_funcs, DRM_MODE_CONNECTOR_eDP);
+	if (ret) {
+		DRM_ERROR("Failed to initialize connector with drm\n");
+		return ret;
+	}
+
+	drm_connector_helper_add(connector, &exynos_dp_connector_helper_funcs);
+	drm_sysfs_connector_add(connector);
+	drm_mode_connector_attach_encoder(connector, encoder);
+
 	return 0;
 }
 
@@ -983,9 +1065,8 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
 }
 
 static struct exynos_drm_display_ops exynos_dp_display_ops = {
-	.is_connected = exynos_dp_display_is_connected,
-	.get_panel = exynos_dp_get_panel,
-	.check_mode = exynos_dp_check_mode,
+	.initialize = exynos_dp_initialize,
+	.create_connector = exynos_dp_create_connector,
 	.dpms = exynos_dp_dpms,
 };
 
drivers/gpu/drm/exynos/exynos_dp_core.h +4 -0
index ccaeadc..d6a900d 100644
@@ -13,6 +13,7 @@
 #ifndef _EXYNOS_DP_CORE_H
 #define _EXYNOS_DP_CORE_H
 
+#include <drm/drm_crtc.h>
 #include <drm/exynos_drm.h>
 
 #define DP_TIMEOUT_LOOP_COUNT 100
@@ -144,6 +145,9 @@ struct link_train {
 
 struct exynos_dp_device {
 	struct device		*dev;
+	struct drm_device	*drm_dev;
+	struct drm_connector	connector;
+	struct drm_encoder	*encoder;
 	struct clk		*clock;
 	unsigned int		irq;
 	void __iomem		*reg_base;
Signature · 1 line
1.8.5.1
author
#42 lore raw

PATCH v4 32/34 drm/exynos: Implement drm_connector directly in vidi driver

In reply to Sean Paul

This patch implements drm_connector directly in the vidi driver, this will allow us to move away from the exynos_drm_connector layer.

---

Changes in v3:
- Added to the patchset
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 122 ++++++++++++++++++++++++++++---
 1 file changed, 111 insertions(+), 11 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +111 -11
index 5d0b5cd..b914513 100644
@@ -29,6 +29,8 @@
 #define WINDOWS_NR		3
 
 #define get_vidi_mgr(dev)	platform_get_drvdata(to_platform_device(dev))
+#define ctx_from_connector(c)	container_of(c, struct vidi_context, \
+					connector)
 
 struct vidi_win_data {
 	unsigned int		offset_x;
@@ -47,6 +49,8 @@ struct vidi_win_data {
 struct vidi_context {
 	struct drm_device		*drm_dev;
 	struct drm_crtc			*crtc;
+	struct drm_encoder		*encoder;
+	struct drm_connector		connector;
 	struct vidi_win_data		win_data[WINDOWS_NR];
 	struct edid			*raw_edid;
 	unsigned int			clkdiv;
@@ -129,17 +133,6 @@ static int vidi_check_mode(struct exynos_drm_display *display,
 	return 0;
 }
 
-static struct exynos_drm_display_ops vidi_display_ops = {
-	.is_connected = vidi_display_is_connected,
-	.get_edid = vidi_get_edid,
-	.check_mode = vidi_check_mode,
-};
-
-static struct exynos_drm_display vidi_display = {
-	.type = EXYNOS_DISPLAY_TYPE_VIDI,
-	.ops = &vidi_display_ops,
-};
-
 static void vidi_apply(struct exynos_drm_manager *mgr)
 {
 	struct vidi_context *ctx = mgr->ctx;
@@ -532,6 +525,113 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
 	return 0;
 }
 
+static enum drm_connector_status vidi_detect(struct drm_connector *connector,
+			bool force)
+{
+	struct vidi_context *ctx = ctx_from_connector(connector);
+
+	/*
+	 * connection request would come from user side
+	 * to do hotplug through specific ioctl.
+	 */
+	return ctx->connected ? connector_status_connected :
+			connector_status_disconnected;
+}
+
+static void vidi_connector_destroy(struct drm_connector *connector)
+{
+}
+
+static struct drm_connector_funcs vidi_connector_funcs = {
+	.dpms = drm_helper_connector_dpms,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.detect = vidi_detect,
+	.destroy = vidi_connector_destroy,
+};
+
+static int vidi_get_modes(struct drm_connector *connector)
+{
+	struct vidi_context *ctx = ctx_from_connector(connector);
+	struct edid *edid;
+	int edid_len;
+
+	/*
+	 * the edid data comes from user side and it would be set
+	 * to ctx->raw_edid through specific ioctl.
+	 */
+	if (!ctx->raw_edid) {
+		DRM_DEBUG_KMS("raw_edid is null.\n");
+		return -EFAULT;
+	}
+
+	edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH;
+	edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL);
+	if (!edid) {
+		DRM_DEBUG_KMS("failed to allocate edid\n");
+		return -ENOMEM;
+	}
+
+	drm_mode_connector_update_edid_property(connector, edid);
+
+	return drm_add_edid_modes(connector, edid);
+}
+
+static int vidi_mode_valid(struct drm_connector *connector,
+			struct drm_display_mode *mode)
+{
+	return MODE_OK;
+}
+
+static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector)
+{
+	struct vidi_context *ctx = ctx_from_connector(connector);
+
+	return ctx->encoder;
+}
+
+static struct drm_connector_helper_funcs vidi_connector_helper_funcs = {
+	.get_modes = vidi_get_modes,
+	.mode_valid = vidi_mode_valid,
+	.best_encoder = vidi_best_encoder,
+};
+
+static int vidi_create_connector(struct exynos_drm_display *display,
+				struct drm_encoder *encoder)
+{
+	struct vidi_context *ctx = display->ctx;
+	struct drm_connector *connector = &ctx->connector;
+	int ret;
+
+	ctx->encoder = encoder;
+	connector->polled = DRM_CONNECTOR_POLL_HPD;
+
+	ret = drm_connector_init(ctx->drm_dev, connector,
+			&vidi_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL);
+	if (ret) {
+		DRM_ERROR("Failed to initialize connector with drm\n");
+		return ret;
+	}
+
+	drm_connector_helper_add(connector, &vidi_connector_helper_funcs);
+	drm_sysfs_connector_add(connector);
+	drm_mode_connector_attach_encoder(connector, encoder);
+
+	return 0;
+}
+
+
+static struct exynos_drm_display_ops vidi_display_ops = {
+	.is_connected = vidi_display_is_connected,
+	.get_edid = vidi_get_edid,
+	.check_mode = vidi_check_mode,
+	.create_connector = vidi_create_connector,
+};
+
+static struct exynos_drm_display vidi_display = {
+	.type = EXYNOS_DISPLAY_TYPE_VIDI,
+	.ops = &vidi_display_ops,
+};
+
 static int vidi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
Signature · 1 line
1.8.5.1
author
#43 lore raw

PATCH v5 32/34 drm/exynos: Implement drm_connector directly in vidi driver

This patch implements drm_connector directly in the vidi driver, this will allow us to move away from the exynos_drm_connector layer.

---

Changes in v3:
- Added to the patchset
Changes in v4: None
Changes in v5:
- Resolved merge conflict kruft

 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 162 ++++++++++++++++++++-----------
 1 file changed, 108 insertions(+), 54 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +108 -54
index 5d0b5cd..7afead9 100644
@@ -29,6 +29,8 @@
 #define WINDOWS_NR		3
 
 #define get_vidi_mgr(dev)	platform_get_drvdata(to_platform_device(dev))
+#define ctx_from_connector(c)	container_of(c, struct vidi_context, \
+					connector)
 
 struct vidi_win_data {
 	unsigned int		offset_x;
@@ -47,6 +49,8 @@ struct vidi_win_data {
 struct vidi_context {
 	struct drm_device		*drm_dev;
 	struct drm_crtc			*crtc;
+	struct drm_encoder		*encoder;
+	struct drm_connector		connector;
 	struct vidi_win_data		win_data[WINDOWS_NR];
 	struct edid			*raw_edid;
 	unsigned int			clkdiv;
@@ -86,60 +90,6 @@ static const char fake_edid_info[] = {
 	0x00, 0x00, 0x00, 0x06
 };
 
-static bool vidi_display_is_connected(struct exynos_drm_display *display)
-{
-	struct vidi_context *ctx = display->ctx;
-
-	/*
-	 * connection request would come from user side
-	 * to do hotplug through specific ioctl.
-	 */
-	return ctx->connected ? true : false;
-}
-
-static struct edid *vidi_get_edid(struct exynos_drm_display *display,
-			struct drm_connector *connector)
-{
-	struct vidi_context *ctx = display->ctx;
-	struct edid *edid;
-
-	/*
-	 * the edid data comes from user side and it would be set
-	 * to ctx->raw_edid through specific ioctl.
-	 */
-	if (!ctx->raw_edid) {
-		DRM_DEBUG_KMS("raw_edid is null.\n");
-		return ERR_PTR(-EFAULT);
-	}
-
-	edid = drm_edid_duplicate(ctx->raw_edid);
-	if (!edid) {
-		DRM_DEBUG_KMS("failed to allocate edid\n");
-		return ERR_PTR(-ENOMEM);
-	}
-
-	return edid;
-}
-
-static int vidi_check_mode(struct exynos_drm_display *display,
-			struct drm_display_mode *mode)
-{
-	/* TODO. */
-
-	return 0;
-}
-
-static struct exynos_drm_display_ops vidi_display_ops = {
-	.is_connected = vidi_display_is_connected,
-	.get_edid = vidi_get_edid,
-	.check_mode = vidi_check_mode,
-};
-
-static struct exynos_drm_display vidi_display = {
-	.type = EXYNOS_DISPLAY_TYPE_VIDI,
-	.ops = &vidi_display_ops,
-};
-
 static void vidi_apply(struct exynos_drm_manager *mgr)
 {
 	struct vidi_context *ctx = mgr->ctx;
@@ -532,6 +482,110 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
 	return 0;
 }
 
+static enum drm_connector_status vidi_detect(struct drm_connector *connector,
+			bool force)
+{
+	struct vidi_context *ctx = ctx_from_connector(connector);
+
+	/*
+	 * connection request would come from user side
+	 * to do hotplug through specific ioctl.
+	 */
+	return ctx->connected ? connector_status_connected :
+			connector_status_disconnected;
+}
+
+static void vidi_connector_destroy(struct drm_connector *connector)
+{
+}
+
+static struct drm_connector_funcs vidi_connector_funcs = {
+	.dpms = drm_helper_connector_dpms,
+	.fill_modes = drm_helper_probe_single_connector_modes,
+	.detect = vidi_detect,
+	.destroy = vidi_connector_destroy,
+};
+
+static int vidi_get_modes(struct drm_connector *connector)
+{
+	struct vidi_context *ctx = ctx_from_connector(connector);
+	struct edid *edid;
+	int edid_len;
+
+	/*
+	 * the edid data comes from user side and it would be set
+	 * to ctx->raw_edid through specific ioctl.
+	 */
+	if (!ctx->raw_edid) {
+		DRM_DEBUG_KMS("raw_edid is null.\n");
+		return -EFAULT;
+	}
+
+	edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH;
+	edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL);
+	if (!edid) {
+		DRM_DEBUG_KMS("failed to allocate edid\n");
+		return -ENOMEM;
+	}
+
+	drm_mode_connector_update_edid_property(connector, edid);
+
+	return drm_add_edid_modes(connector, edid);
+}
+
+static int vidi_mode_valid(struct drm_connector *connector,
+			struct drm_display_mode *mode)
+{
+	return MODE_OK;
+}
+
+static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector)
+{
+	struct vidi_context *ctx = ctx_from_connector(connector);
+
+	return ctx->encoder;
+}
+
+static struct drm_connector_helper_funcs vidi_connector_helper_funcs = {
+	.get_modes = vidi_get_modes,
+	.mode_valid = vidi_mode_valid,
+	.best_encoder = vidi_best_encoder,
+};
+
+static int vidi_create_connector(struct exynos_drm_display *display,
+				struct drm_encoder *encoder)
+{
+	struct vidi_context *ctx = display->ctx;
+	struct drm_connector *connector = &ctx->connector;
+	int ret;
+
+	ctx->encoder = encoder;
+	connector->polled = DRM_CONNECTOR_POLL_HPD;
+
+	ret = drm_connector_init(ctx->drm_dev, connector,
+			&vidi_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL);
+	if (ret) {
+		DRM_ERROR("Failed to initialize connector with drm\n");
+		return ret;
+	}
+
+	drm_connector_helper_add(connector, &vidi_connector_helper_funcs);
+	drm_sysfs_connector_add(connector);
+	drm_mode_connector_attach_encoder(connector, encoder);
+
+	return 0;
+}
+
+
+static struct exynos_drm_display_ops vidi_display_ops = {
+	.create_connector = vidi_create_connector,
+};
+
+static struct exynos_drm_display vidi_display = {
+	.type = EXYNOS_DISPLAY_TYPE_VIDI,
+	.ops = &vidi_display_ops,
+};
+
 static int vidi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
Signature · 1 line
1.8.5.1
author
#44 lore raw

PATCH v4 33/34 drm/exynos: Move lvds bridge discovery into DP driver

In reply to Sean Paul

This patch moves the lvds bridge discovery and connector pre-emption code from exynos common code into the dp driver (since the bridge is only applicable for dp).

---

Changes in v3:
- Added to the patchset
Changes in v4: None

 drivers/gpu/drm/exynos/exynos_dp_core.c  | 41 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_core.c | 41 --------------------------------
 2 files changed, 41 insertions(+), 41 deletions(-)
drivers/gpu/drm/exynos/exynos_dp_core.c +41 -0
index af2c9d2..a59bca9 100644
@@ -25,6 +25,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/bridge/ptn3460.h>
 
 #include "exynos_drm_drv.h"
 #include "exynos_dp_core.h"
@@ -32,6 +33,11 @@
 #define ctx_from_connector(c)	container_of(c, struct exynos_dp_device, \
 					connector)
 
+struct bridge_init {
+	struct i2c_client *client;
+	struct device_node *node;
+};
+
 static int exynos_dp_init_dp(struct exynos_dp_device *dp)
 {
 	exynos_dp_reset(dp);
@@ -973,6 +979,35 @@ static int exynos_dp_initialize(struct exynos_drm_display *display,
 	return 0;
 }
 
+static bool find_bridge(const char *compat, struct bridge_init *bridge)
+{
+	bridge->client = NULL;
+	bridge->node = of_find_compatible_node(NULL, NULL, compat);
+	if (!bridge->node)
+		return false;
+
+	bridge->client = of_find_i2c_device_by_node(bridge->node);
+	if (!bridge->client)
+		return false;
+
+	return true;
+}
+
+/* returns the number of bridges attached */
+static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
+		struct drm_encoder *encoder)
+{
+	struct bridge_init bridge;
+	int ret;
+
+	if (find_bridge("nxp,ptn3460", &bridge)) {
+		ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);
+		if (!ret)
+			return 1;
+	}
+	return 0;
+}
+
 static int exynos_dp_create_connector(struct exynos_drm_display *display,
 				struct drm_encoder *encoder)
 {
@@ -981,6 +1016,12 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,
 	int ret;
 
 	dp->encoder = encoder;
+
+	/* Pre-empt DP connector creation if there's a bridge */
+	ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder);
+	if (ret)
+		return 0;
+
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
 
 	ret = drm_connector_init(dp->drm_dev, connector,
drivers/gpu/drm/exynos/exynos_drm_core.c +0 -41

59 lines not on this page · raw message

Signature · 1 line
1.8.5.1
author
#45 lore raw

PATCH v4 34/34 drm/exynos: Remove the exynos_drm_connector shim

In reply to Sean Paul

This path removes the exynos_drm_connector code since it was just passing hooks through display_ops. The individual device drivers are now responsible for implementing drm_connector directly.

---

Changes in v3:
- Added to the patchset
Changes in v4: None

 drivers/gpu/drm/exynos/Makefile               |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_connector.c | 258 --------------------------
 drivers/gpu/drm/exynos/exynos_drm_connector.h |  20 --
 drivers/gpu/drm/exynos/exynos_drm_core.c      |  18 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h       |  11 --
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   |   1 -
 6 files changed, 4 insertions(+), 306 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.h
drivers/gpu/drm/exynos/Makefile +1 -1
index fc8555c..b1839e8 100644
@@ -3,7 +3,7 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos
-exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \
+exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
 		exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \
 		exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \
 		exynos_drm_plane.o
drivers/gpu/drm/exynos/exynos_drm_connector.c deleted +0 -258

258 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_drm_connector.h deleted +0 -20
deleted file mode 100644
index 4eb20d7..0000000
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- * Authors:
- *	Inki Dae <[email protected]>
- *	Joonyoung Shim <[email protected]>
- *	Seung-Woo Kim <[email protected]>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#ifndef _EXYNOS_DRM_CONNECTOR_H_
-#define _EXYNOS_DRM_CONNECTOR_H_
-
-struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
-						   struct drm_encoder *encoder);
-
-#endif
drivers/gpu/drm/exynos/exynos_drm_core.c +3 -15
index 2446352..4ab10ca 100644
@@ -17,7 +17,6 @@
 #include "exynos_drm_drv.h"
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_encoder.h"
-#include "exynos_drm_connector.h"
 #include "exynos_drm_fbdev.h"
 
 static LIST_HEAD(exynos_drm_subdrv_list);
@@ -28,7 +27,6 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev,
 					struct exynos_drm_display *display)
 {
 	struct drm_encoder *encoder;
-	struct drm_connector *connector;
 	struct exynos_drm_manager *manager;
 	int ret;
 	unsigned long possible_crtcs = 0;
@@ -46,22 +44,12 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev,
 	}
 	display->encoder = encoder;
 
-	if (display->ops->create_connector)
-		return display->ops->create_connector(display, encoder);
-
-	/*
-	 * create and initialize a connector for this sub driver and
-	 * attach the encoder created above to the connector.
-	 */
-	connector = exynos_drm_connector_create(dev, encoder);
-	if (!connector) {
-		DRM_ERROR("failed to create connector\n");
-		ret = -EFAULT;
+	ret = display->ops->create_connector(display, encoder);
+	if (ret) {
+		DRM_ERROR("failed to create connector ret=%d\n", ret);
 		goto err_destroy_encoder;
 	}
 
-	display->connector = connector;
-
 	return 0;
 
 err_destroy_encoder:
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -11
index b1b02d0..1c78806 100644
@@ -124,10 +124,6 @@ struct exynos_drm_overlay {
  *
  * @initialize: initializes the display with drm_dev
  * @remove: cleans up the display for removal
- * @is_connected: check for that display is connected or not.
- * @get_max_resol: get maximum resolution to specific hardware.
- * @get_edid: get edid modes from display driver.
- * @get_panel: get panel object from display driver.
  * @mode_fixup: fix mode data comparing to hw specific display mode.
  * @mode_set: convert drm_display_mode to hw specific display mode and
  *	      would be called by encoder->mode_set().
@@ -142,13 +138,6 @@ struct exynos_drm_display_ops {
 	int (*create_connector)(struct exynos_drm_display *display,
 				struct drm_encoder *encoder);
 	void (*remove)(struct exynos_drm_display *display);
-	bool (*is_connected)(struct exynos_drm_display *display);
-	void (*get_max_resol)(struct exynos_drm_display *display,
-				unsigned int *width,
-				unsigned int *height);
-	struct edid *(*get_edid)(struct exynos_drm_display *display,
-				struct drm_connector *connector);
-	void *(*get_panel)(struct exynos_drm_display *display);
 	void (*mode_fixup)(struct exynos_drm_display *display,
 				struct drm_connector *connector,
 				const struct drm_display_mode *mode,
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0 -1
index bfa2f17..835c0f1 100644
@@ -17,7 +17,6 @@
 
 #include "exynos_drm_drv.h"
 #include "exynos_drm_encoder.h"
-#include "exynos_drm_connector.h"
 
 #define to_exynos_encoder(x)	container_of(x, struct exynos_drm_encoder,\
 				drm_encoder)
Signature · 1 line
1.8.5.1
Acked-by on the v4 series
#46 lore raw
In reply to Sean Paul
Quoted 23 lines · Sean Paul

This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle suspend/resume through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

Quoted 5 lines

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Sean

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this merged for 3.15 so that we can make progress with the rest of the platform!

Series:

-Olof

maintainer
#47 lore raw

2014-02-07 Olof Johansson <[email protected]>:

Quoted 28 lines · Sean Paul
Quoted 27 lines

This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle suspend/resume through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Quoted 5 lines
Quoted 1 line

Sean

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this

Agree. Will merge all of them to exynos-drm-next soon because there are other patch sets (should go on top of this) being delayed by this patch series, and it doesn't seem that this patch series has critical issue. Some minor issues could be fixed up by other later.

Well, shouldn't the ptn3460 lvds bridge patch series also be re-based?
Now, this patch series is conflicted.

Thanks,
Inki Dae

Quoted 14 lines

merged for 3.15 so that we can make progress with the rest of the platform!

Series:

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

#48 lore raw
In reply to Olof Johansson
Quoted 28 lines · Olof Johansson
Quoted 27 lines · Sean Paul

This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle suspend/resume through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Quoted 7 lines
Quoted 1 line

Sean

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this merged for 3.15 so that we can make progress with the rest of the platform!

I wouldn't be overly excited about merging this series yet...

If I have applied it correctly (and I believe so, as reading the code tells me the same), it introduces a regression due to removal of support of standard parallel displays from FIMD driver.

I had mentioned this in my review comments for previous version, but apparently I got ignored. Please fix this.

Best regards,
Tomasz

maintainer
#49 lore raw

Hi Tomasz,

2014-02-08 11:48 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 45 lines · Olof Johansson
Quoted 34 lines · Sean Paul
Quoted 32 lines

This patchset refactors parts of the exynos driver to move it closer to a proper
drm driver (rather than just implementing a drm layer on top of the hardware
drivers). The hope is to get to a point where the dp/hdmi drivers can implement
drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle
suspend/resume
through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Quoted 8 lines
Quoted 1 line

Sean

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this merged for 3.15 so that we can make progress with the rest of the platform!

Quoted 9 lines

I wouldn't be overly excited about merging this series yet...

If I have applied it correctly (and I believe so, as reading the code tells me the same), it introduces a regression due to removal of support of standard parallel displays from FIMD driver.

I had mentioned this in my review comments for previous version, but apparently I got ignored. Please fix this.

Right, and also some my comments. Sean should have commented his opinions even if our comments aren't reasonable to him.

I sent a email about the progress of this refactoring patch series to Sean and Olof personally because there was no any follow-up action for about two months since v3 had been posted, and I found out that Sean was busy with other works.

And there are no any his comments until now so I'd like to believe Sean would still be busy. So I already started to clean up and enhance Exynos drm framework using the component framework for super device posted by Russell like below,

        https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2a41e6070dd7ef539d0f3b1652b4839d04378e11

Last month, Russell had posted this framework, and it has been merged to mainline. This provides a generic way to gather up the individual sub devices together using super node?? (not sure if it's a proper expression) of device tree.
With this, we could remove existing exynos_drm_core.c and I guess we could also resolve your concern about dt broken this time.

The patch series I'm preparing will go to on top of Sean's refactoring patch series.

Thanks,
Inki Dae

Quoted 7 lines

Best regards,
Tomasz

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

#50 lore raw

Hi Inki,

Quoted 80 lines · Inki Dae

Hi Tomasz,

2014-02-08 11:48 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 45 lines · Olof Johansson
Quoted 34 lines · Sean Paul
Quoted 32 lines

This patchset refactors parts of the exynos driver to move it closer to a proper
drm driver (rather than just implementing a drm layer on top of the hardware
drivers). The hope is to get to a point where the dp/hdmi drivers can implement
drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle
suspend/resume
through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Quoted 8 lines
Quoted 1 line

Sean

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this merged for 3.15 so that we can make progress with the rest of the platform!

Quoted 9 lines

I wouldn't be overly excited about merging this series yet...

If I have applied it correctly (and I believe so, as reading the code tells me the same), it introduces a regression due to removal of support of standard parallel displays from FIMD driver.

I had mentioned this in my review comments for previous version, but apparently I got ignored. Please fix this.

Right, and also some my comments. Sean should have commented his opinions even if our comments aren't reasonable to him.

I sent a email about the progress of this refactoring patch series to Sean and Olof personally because there was no any follow-up action for about two months since v3 had been posted, and I found out that Sean was busy with other works.

And there are no any his comments until now so I'd like to believe Sean would still be busy. So I already started to clean up and enhance Exynos drm framework using the component framework for super device posted by Russell like below,

         https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2a41e6070dd7ef539d0f3b1652b4839d04378e11

Last month, Russell had posted this framework, and it has been merged to mainline. This provides a generic way to gather up the individual sub devices together using super node?? (not sure if it's a proper expression) of device tree.
With this, we could remove existing exynos_drm_core.c and I guess we could also resolve your concern about dt broken this time.

Quoted 2 lines

The patch series I'm preparing will go to on top of Sean's refactoring patch series.

Andrzej Hajda from our team is already working on addressing remaining issues with Sean's series, including fixing removed parallel display support. Earlier this month he sent a series restoring support for DSI panels: http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27044 . Now he's also trying to make the design more modular. He will give you more information on Monday, as he's on holiday for next two days.

Also Tomasz Stanislawski will have some patches to enable HDMI support using Exynos DRM on Exynos 4 SoCs on top of this series, along with reworking Sean's and Daniel's patch for HDMI driver's DT bindings as he mentioned in reply to other message of this thread.

Best regards,
Tomasz

maintainer
#51 lore raw

2014년 2월 27일 목요일, Tomasz Figa<[email protected]>님이 작성한 메시지:

Quoted 95 lines

Hi Inki,

Quoted 91 lines · Inki Dae

Hi Tomasz,

2014-02-08 11:48 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 55 lines · Olof Johansson
Quoted 44 lines
Quoted 31 lines · Sean Paul

This patchset refactors parts of the exynos driver to move it closer to a
proper
drm driver (rather than just implementing a drm layer on top of the hardware
drivers). The hope is to get to a point where the dp/hdmi drivers can implement
drm_connector/drm_encoder directly, and fimd/mixer can directly implement
drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic
manager/display
handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle
suspend/resume
through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

Quoted 6 lines

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Sean

Quoted 6 lines

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this merged for 3.15 so that we can make progress with the rest of the platform!

I wouldn't be overly excited about merging this series yet...

Quoted 9 lines

If I have applied it correctly (and I believe so, as reading the code tells
me the same), it introduces a regression due to removal of support of standard parallel displays from FIMD driver.

I had mentioned this in my review comments for previous version, but apparently I got ignored. Please fix this.

Right, and also some my comments. Sean should have commented his opinions even if our comments aren't reasonable to him.

I sent a email about the progress of this refactoring patch series to Sean and Olof personally because there was no any follow-up action for about two months since v3 had been posted, and I found out that Sean was busy with other works.

And there are no any his comments until now so I'd like to believe Sean would still be busy. So I already started to clean up and enhance Exynos drm framework using the component framework for super device posted by Russell like below,
https://git.kernel.org/cgit/linux/kernel/git/torvalds/
linux.git/commit/?id=2a41e6070dd7ef539d0f3b1652b4839d04378e11

Last month, Russell had posted this framework, and it has been merged to mainline. This provides a generic way to gather up the individual sub devices together using super node?? (not sure if it's a proper expression) of device tree.
With this, we could remove existing exynos_drm_core.c and I guess we could also resolve your concern about dt broken this time.

Quoted 8 lines
Quoted 3 lines

The patch series I'm preparing will go to on top of Sean's refactoring patch series.

Andrzej Hajda from our team is already working on addressing remaining
issues with Sean's series, including fixing removed parallel display
support. Earlier this month he sent a series restoring support for DSI
panels: http://thread.gmane.org/gmane.<http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27044>

<http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27044>

Already merged to internal kernel for test.

Quoted 9 lines

linux.kernel.samsung-soc/27044<http://thread.gmane.org/gmane.linux.kernel.samsung-soc/27044>. Now he's also trying to make the design more modular. He will give you more information on Monday, as he's on holiday for next two days.

Also Tomasz Stanislawski will have some patches to enable HDMI support using Exynos DRM on Exynos 4 SoCs on top of this series, along with reworking Sean's and Daniel's patch for HDMI driver's DT bindings as he mentioned in reply to other message of this thread.

Ok, I'll wait for above patch sets. I have already implemented the component patch series for supporting super device so I planned to post it at end of this week. Will rebase it on top of above patch sets if posted.

Thanks,
Inki Dae

Quoted 7 lines

Best regards,
Tomasz
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

maintainer
#52 lore raw

Oops, sorry for non text message. Just FW. My email client of IPAD air sent non text email.

2014-02-28 2:09 GMT+09:00 Inki Dae <[email protected]>:

2014년 2월 27일 목요일, Tomasz Figa<[email protected]>님이 작성한 메시지:

Quoted 95 lines

Hi Inki,

Quoted 92 lines · Inki Dae

Hi Tomasz,

2014-02-08 11:48 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 56 lines · Olof Johansson
Quoted 44 lines
Quoted 32 lines · Sean Paul

This patchset refactors parts of the exynos driver to move it closer to a
proper
drm driver (rather than just implementing a drm layer on top of the hardware
drivers). The hope is to get to a point where the dp/hdmi drivers can implement
drm_connector/drm_encoder directly, and fimd/mixer can directly implement
drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic
manager/display
handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle
suspend/resume
through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

Quoted 5 lines

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Sean

Quoted 5 lines

Even if there is room for even more cleanups and refactorings on top of this, it's good enough as a base and keeping it out of tree is hurting productivity and usefulness for everybody. Let's get this merged for 3.15 so that we can make progress with the rest of the platform!

I wouldn't be overly excited about merging this series yet...

Quoted 8 lines

If I have applied it correctly (and I believe so, as reading the code tells
me the same), it introduces a regression due to removal of support of standard parallel displays from FIMD driver.

I had mentioned this in my review comments for previous version, but apparently I got ignored. Please fix this.

Right, and also some my comments. Sean should have commented his opinions even if our comments aren't reasonable to him.

I sent a email about the progress of this refactoring patch series to Sean and Olof personally because there was no any follow-up action for about two months since v3 had been posted, and I found out that Sean was busy with other works.

And there are no any his comments until now so I'd like to believe Sean would still be busy. So I already started to clean up and enhance Exynos drm framework using the component framework for super device posted by Russell like below,

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2a41e6070dd7ef539d0f3b1652b4839d04378e11

Last month, Russell had posted this framework, and it has been merged to mainline. This provides a generic way to gather up the individual sub devices together using super node?? (not sure if it's a proper expression) of device tree.
With this, we could remove existing exynos_drm_core.c and I guess we could also resolve your concern about dt broken this time.

Quoted 8 lines
Quoted 2 lines

The patch series I'm preparing will go to on top of Sean's refactoring patch series.

Andrzej Hajda from our team is already working on addressing remaining issues with Sean's series, including fixing removed parallel display support. Earlier this month he sent a series restoring support for DSI
panels: http://thread.gmane.org/gmane.

Already merged to internal kernel for test.

Quoted 10 lines

linux.kernel.samsung-soc/27044 . Now he's also trying to make the design more modular. He will give you more information on Monday, as he's on holiday for next two days.

Also Tomasz Stanislawski will have some patches to enable HDMI support using Exynos DRM on Exynos 4 SoCs on top of this series, along with reworking Sean's and Daniel's patch for HDMI driver's DT bindings as he mentioned in reply to other message of this thread.

Ok, I'll wait for above patch sets. I have already implemented the component patch series for supporting super device so I planned to post it at end of this week. Will rebase it on top of above patch sets if posted.

Thanks,
Inki Dae

Quoted 7 lines

Best regards,
Tomasz
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

#53 lore raw

Hi Inki,

On 02/28/2014 03:28 AM, Inki Dae wrote:
(...)

Quoted 11 lines

Andrzej Hajda from our team is already working on addressing remaining issues with Sean's series, including fixing removed parallel display support. Earlier this month he sent a series restoring support for DSI
panels: http://thread.gmane.org/gmane.

Already merged to internal kernel for test.

Quoted 3 lines

linux.kernel.samsung-soc/27044 . Now he's also trying to make the design more modular. He will give you more information on Monday, as he's on holiday for next two days.

Thanks Tomasz for pointing it out. I try to properly restore parallel panel support.
I have come to the conclusion that the most natural way is to implement crtc/encoder/connector in FIMD, as the FIMD directly produces parallel RGB stream (or I80 in command mode).
I think implementing crtc/encoder/connector in FIMD in case of DSI and eDP panel
is also more natural. In such case I would convert DSIM, eDP and ptn3460 to drm_panel
framework similarly as I already did for TC358764 DSI/LVDS bridge.

Here are different scenarios of HW pipelines:
1. Parallel panel:

    FIMD ---> Parallel Panel
2. DSI panel:
    FIMD ---> DSIM ---> DSI Panel
3. Arndale:
    FIMD ---> DSIM ---> DSI/LVDS bridge ---> LVDS panel
4. Snow:
    FIMD ---> eDP ---> eDP/LVDS bridge ---> LVDS panel
5. In case mobile image enhancer(MIE) will be used pipeline can be
extended to:
    FIMD ---> MIE ---> DSIM ---> .....
    or
    FIMD ---> MIE ---> eDP ---> .....

Pros of implementing all drm components (crtc,encoder,connector) in FIMD, and using
drm_panel framework for panels, DSIM, eDP and external bridges:
- it is natural, FIMD produces already encoded stream, DSIM and eDP are just optional
converters,
- easy to extend, adding/removing image processors or bridges will require only changing
video paths in DTS (in addition to adding device nodes),
- consistency.

What do you think about it?

Anyway the patch adding parallel support with current design should be ready soon.

Regards
Andrzej

maintainer
#54 lore raw

Hi Andrzej,

2014-03-04 20:03 GMT+09:00 Andrzej Hajda <[email protected]>:

Quoted 15 lines

Hi Inki,

On 02/28/2014 03:28 AM, Inki Dae wrote:
(...)

Quoted 11 lines

Andrzej Hajda from our team is already working on addressing remaining issues with Sean's series, including fixing removed parallel display support. Earlier this month he sent a series restoring support for DSI
panels: http://thread.gmane.org/gmane.

Already merged to internal kernel for test.

Quoted 3 lines

linux.kernel.samsung-soc/27044 . Now he's also trying to make the design more modular. He will give you more information on Monday, as he's on holiday for next two days.

Quoted 10 lines

Thanks Tomasz for pointing it out. I try to properly restore parallel panel support.
I have come to the conclusion that the most natural way is to implement crtc/encoder/connector in FIMD, as the FIMD directly produces parallel RGB stream (or I80 in command mode).
I think implementing crtc/encoder/connector in FIMD in case of DSI and eDP panel
is also more natural. In such case I would convert DSIM, eDP and ptn3460 to drm_panel
framework similarly as I already did for TC358764 DSI/LVDS bridge.

In case of some machines without MIPI-DSI like below,

        FIMD------>Parallel Panel

There wouldn't be proper place for implementing a connector and a encoder. I guess your conclusion results from such cases.

But how should we handle eDP if connector and encoder are implemented only in FIMD driver?
eDP can be hot-plugged and the hot-plug function will be handled by interrupt handler of eDP driver. This would mean that the hardware resource to the hot-plug belongs to eDP ip, and also its own connector should be implemented in eDP driver to detect the connection.

Quoted 16 lines

Here are different scenarios of HW pipelines:
1. Parallel panel:

    FIMD ---> Parallel Panel
2. DSI panel:
    FIMD ---> DSIM ---> DSI Panel
3. Arndale:
    FIMD ---> DSIM ---> DSI/LVDS bridge ---> LVDS panel
4. Snow:
    FIMD ---> eDP ---> eDP/LVDS bridge ---> LVDS panel
5. In case mobile image enhancer(MIE) will be used pipeline can be
extended to:
    FIMD ---> MIE ---> DSIM ---> .....
    or
    FIMD ---> MIE ---> eDP ---> .....

Other scenarios,

      FIMD----->LVDS bridge----->LVDS panel

Actually, I had used above machine, Geminus.

And in case of Exynos4 series, it's more complicated,

      FIMD----->mDNIe------>FIMD-Lite------>Parallel Panel
      FIMD----->mDNIe------>FIMD-Lite------>MIPI-DSI------>DSI Panel
      ...

However, mDNIe ip isn't opened in public and also maybe continue so I think Exynos drm driver doesn't need to cover such cases.

Quoted 11 lines

Pros of implementing all drm components (crtc,encoder,connector) in FIMD, and using
drm_panel framework for panels, DSIM, eDP and external bridges:
- it is natural, FIMD produces already encoded stream, DSIM and eDP are just optional
converters,
- easy to extend, adding/removing image processors or bridges will require only changing
video paths in DTS (in addition to adding device nodes),
- consistency.

Quoted 2 lines

What do you think about it?

I think it's a good idea but corner case still exists as mentioned earlier. How about implementing connector and encoder in panel driver in case of machines not using MIPI-DSI and eDP? And in case of machines using MIPI-DSI and eDP, connector and encoder are implemented in their drivers as now.

In case of using parallel panel, we could declare super device node for Exynos drm like below,

        exynos-drm {
                compatible = "samsung,exynos-drm";
                crtcs = <&fimd>;
                connectors = <&panel>;
        };

connectors could be Panel, eDP, HDMI, and MIPI-DSI.

Current Exynos drm driver would assume that parallel panel is always on so we could find a good way somehow.

Thanks,
Inki Dae

Quoted 11 lines

Anyway the patch adding parallel support with current design should be ready soon.

Regards
Andrzej

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

#55 lore raw
Quoted 28 lines · Inki Dae

Hi Andrzej,

2014-03-04 20:03 GMT+09:00 Andrzej Hajda <[email protected]>:

Quoted 14 lines

Hi Inki,

On 02/28/2014 03:28 AM, Inki Dae wrote:
(...)

Quoted 10 lines

Andrzej Hajda from our team is already working on addressing remaining issues with Sean's series, including fixing removed parallel display support. Earlier this month he sent a series restoring support for DSI
panels: http://thread.gmane.org/gmane.

Already merged to internal kernel for test.

Quoted 3 lines

linux.kernel.samsung-soc/27044 . Now he's also trying to make the design more modular. He will give you more information on Monday, as he's on holiday for next two days.

Quoted 10 lines

Thanks Tomasz for pointing it out. I try to properly restore parallel panel support.
I have come to the conclusion that the most natural way is to implement crtc/encoder/connector in FIMD, as the FIMD directly produces parallel RGB stream (or I80 in command mode).
I think implementing crtc/encoder/connector in FIMD in case of DSI and eDP panel
is also more natural. In such case I would convert DSIM, eDP and ptn3460 to drm_panel
framework similarly as I already did for TC358764 DSI/LVDS bridge.

Quoted 5 lines

In case of some machines without MIPI-DSI like below,

        FIMD------>Parallel Panel

There wouldn't be proper place for implementing a connector and a encoder. I guess your conclusion results from such cases.

Yes, this case has inspired me to re-think about proper placement for drm_encoder and drm_connector in case of different HW pipelines.

Problem is that we can have arbitrary number of hw components in the pipeline and we have only three drm components:
drm_crtc, drm_encoder, drm_connector. I skip drm_bridge as it is in fact optional extra encoder, so it can be helpful in specific cases but in
general it just complicates things IMHO.

The solution I see is to represent all encoders/bridges/image processors present in the pipeline as a single drm_encoder, which encodes from format provided to the
first element and produces format provided by the last one. The last element of the pipeline
can be treated as drm_connector.

Additionally it would be nice to make possible to create all drm components from video pipeline description provided by device tree.
If we start such pipeline creation from FIMD node, if code finds there is any outgoing
video link from FIMD node it should create drm_encoder/drm_connector pair, and attach device pointed by this link to that pair. Next attached device should attach
devices pointed by its outgoing links and so on till there are no out links. This is my rough idea, what do you think about it?

Quoted 7 lines

But how should we handle eDP if connector and encoder are implemented only in FIMD driver?
eDP can be hot-plugged and the hot-plug function will be handled by interrupt handler of eDP driver. This would mean that the hardware resource to the hot-plug belongs to eDP ip, and also its own connector should be implemented in eDP driver to detect the connection.

drm_panel has access to its connector and drm_dev, so after extending drm_panel_funcs with 'detect' callback it should work.

Quoted 21 lines
Quoted 15 lines

Here are different scenarios of HW pipelines:
1. Parallel panel:

    FIMD ---> Parallel Panel
2. DSI panel:
    FIMD ---> DSIM ---> DSI Panel
3. Arndale:
    FIMD ---> DSIM ---> DSI/LVDS bridge ---> LVDS panel
4. Snow:
    FIMD ---> eDP ---> eDP/LVDS bridge ---> LVDS panel
5. In case mobile image enhancer(MIE) will be used pipeline can be
extended to:
    FIMD ---> MIE ---> DSIM ---> .....
    or
    FIMD ---> MIE ---> eDP ---> .....

Other scenarios,

      FIMD----->LVDS bridge----->LVDS panel

Actually, I had used above machine, Geminus.

Quoted 8 lines

And in case of Exynos4 series, it's more complicated,

      FIMD----->mDNIe------>FIMD-Lite------>Parallel Panel
      FIMD----->mDNIe------>FIMD-Lite------>MIPI-DSI------>DSI Panel
      ...

However, mDNIe ip isn't opened in public and also maybe continue so I think Exynos drm driver doesn't need to cover such cases.

It is available on some cyanogen repos, so theoretically it is possible someone can try to implement it in mainline :)

Quoted 12 lines
Quoted 12 lines

Pros of implementing all drm components (crtc,encoder,connector) in FIMD, and using
drm_panel framework for panels, DSIM, eDP and external bridges:
- it is natural, FIMD produces already encoded stream, DSIM and eDP are just optional
converters,
- easy to extend, adding/removing image processors or bridges will require only changing
video paths in DTS (in addition to adding device nodes),
- consistency.

Quoted 7 lines
Quoted 2 lines

What do you think about it?

I think it's a good idea but corner case still exists as mentioned earlier. How about implementing connector and encoder in panel driver in case of machines not using MIPI-DSI and eDP? And in case of machines using MIPI-DSI and eDP, connector and encoder are implemented in their drivers as now.

For now it is OK for me, but I prefer to put the encoder/connector into fimd, as drm_panel framework assumes connector is already created when panel is attached to the drm.

Quoted 11 lines

In case of using parallel panel, we could declare super device node for Exynos drm like below,

        exynos-drm {
                compatible = "samsung,exynos-drm";
                crtcs = <&fimd>;
                connectors = <&panel>;
        };

connectors could be Panel, eDP, HDMI, and MIPI-DSI.

OK, it will allow avoid deferred probing.

Regards
Andrzej

#56 lore raw
In reply to Sean Paul

Hi Sean,

Quoted 5 lines · Sean Paul

This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

This series does not apply on exynos-drm-next. It seems to still depend on the DRM bridge series posted long time ago.

Do you have a tree with this series and all its dependencies applied, so I could test it on my boards?

Best regards,
Tomasz

maintainer
#57 lore raw
In reply to Sean Paul

Hi Sean,

Merged your all patch series except for dt binding patches - it needs more cleanups about ddc and phy - and I had a little change just for cleanup.
And some more cleanups and enhanced feature set on top of your patch series would be merged, and then they will go to -next.

Thanks,
Inki Dae

2014-01-31 6:18 GMT+09:00 Sean Paul <[email protected]>:

Quoted 139 lines

This patchset refactors parts of the exynos driver to move it closer to a proper drm driver (rather than just implementing a drm layer on top of the hardware drivers). The hope is to get to a point where the dp/hdmi drivers can implement drm_connector/drm_encoder directly, and fimd/mixer can directly implement drm_crtc.

The notable changes in this set:
- drm_encoder funcs no longer route through the crtc
- DP driver has been moved from video into the drm driver
- fimd no longer implements encoder callbacks
- exynos_drm_hdmi is removed in favor of generic manager/display handling

At a glance, differences between v1 and v2:
- Passing manager/display in callbacks instead of ctx
- Tacked on some dpms patches on the end to handle suspend/resume through the dpms path

At a glance, differences between v2 and v3:
- Fixed vidi issues
- Moved exynos_drm_hdmi.c removal to the right place
- Added the exynos_drm_connector removal patches on the end

At a glance, differences between v3 and v4:
- Rebased on top of exynos-drm-next
- Addressed review comments, no major functional changes

Sean

Daniel Kurtz (1):
drm/exynos: hdmi: remove the i2c drivers and use devtree

Sean Paul (32):
drm/exynos: Rename hdmi_infoframe to avoid collision drm/exynos: Merge overlay_ops into manager_ops drm/exynos: Add an initialize function to manager and display drm/exynos: Use manager_op initialize in fimd drm/exynos: hdmi: Implement initialize op for hdmi drm/exynos: Pass exynos_drm_manager in manager ops instead of dev drm/exynos: Remove apply manager callback
drm/exynos: Remove dpms link between encoder/connector drm/exynos: Rename display_op power_on to dpms drm/exynos: Don't keep dpms state in encoder drm/exynos: Use unsigned long for possible_crtcs drm/exynos: Split manager/display/subdrv
ARM: dts: exynos: Add i2c phandles to hdmi node drm/exynos: Remove exynos_drm_hdmi shim
drm/exynos: Use drm_mode_copy to copy modes drm/exynos: Disable unused crtc planes from crtc drm/exynos: Add mode_set manager operation
drm/exynos: Implement mode_fixup manager operation drm/exynos: Use mode_set to configure fimd
drm/exynos: Remove unused/useless fimd_context members drm/exynos: Move dp driver from video/ to drm/ drm/exynos: Move display implementation into dp
ARM: dts: Move display-timings node from fimd to dp drm/exynos: Implement dpms display callback in DP drm/exynos: Clean up FIMD power on/off routines drm/exynos: Consolidate suspend/resume in drm_drv drm/exynos: Add create_connector callback
drm/exynos: Implement drm_connector in hdmi directly drm/exynos: Implement drm_connector directly in dp driver drm/exynos: Implement drm_connector directly in vidi driver drm/exynos: Move lvds bridge discovery into DP driver drm/exynos: Remove the exynos_drm_connector shim

Stéphane Marchesin (1):
drm/exynos: Remove useless slab.h include

 .../devicetree/bindings/video/exynos_dp.txt        |   17 +
 .../devicetree/bindings/video/exynos_hdmi.txt      |    5 +
 .../devicetree/bindings/video/samsung-fimd.txt     |    2 +
 MAINTAINERS                                        |    7 -
 arch/arm/boot/dts/cros5250-common.dtsi             |    6 +-
 arch/arm/boot/dts/exynos5250-arndale.dts           |    7 +-
 arch/arm/boot/dts/exynos5250-smdk5250.dts          |   13 +-
 arch/arm/boot/dts/exynos5250-snow.dts              |    7 +-
 arch/arm/boot/dts/exynos5420-smdk5420.dts          |    7 +-
 drivers/gpu/drm/exynos/Kconfig                     |    7 +
 drivers/gpu/drm/exynos/Makefile                    |    7 +-
 drivers/gpu/drm/exynos/exynos_ddc.c                |   63 -
 drivers/gpu/drm/exynos/exynos_dp_core.c            | 1357 ++++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_core.h            |  329 +++++
 drivers/gpu/drm/exynos/exynos_dp_reg.c             | 1243 ++++++++++++++++++
 drivers/gpu/drm/exynos/exynos_dp_reg.h             |  366 ++++++
 drivers/gpu/drm/exynos/exynos_drm_connector.c      |  304 -----
 drivers/gpu/drm/exynos/exynos_drm_connector.h      |   24 -
 drivers/gpu/drm/exynos/exynos_drm_core.c           |  233 ++--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c           |  139 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h           |   20 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c            |  155 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h            |  154 ++-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c        |  357 +----
 drivers/gpu/drm/exynos/exynos_drm_encoder.h        |   18 +-
 drivers/gpu/drm/exynos/exynos_drm_fb.c             |    4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c           |  682 ++++------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c           |  439 -------
 drivers/gpu/drm/exynos/exynos_drm_hdmi.h           |   67 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c          |   17 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.h          |    2 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c           |  413 +++---
 drivers/gpu/drm/exynos/exynos_hdmi.c               |  370 +++---
 drivers/gpu/drm/exynos/exynos_hdmi.h               |   23 -
 drivers/gpu/drm/exynos/exynos_hdmiphy.c            |   65 -
 drivers/gpu/drm/exynos/exynos_mixer.c              |  573 ++++-----
 drivers/gpu/drm/exynos/exynos_mixer.h              |   20 +
 drivers/video/exynos/Kconfig                       |    7 -
 drivers/video/exynos/Makefile                      |    1 -
 drivers/video/exynos/exynos_dp_core.c              | 1156 -----------------
 drivers/video/exynos/exynos_dp_core.h              |  320 -----
 drivers/video/exynos/exynos_dp_reg.c               | 1243 ------------------
 drivers/video/exynos/exynos_dp_reg.h               |  366 ------
 43 files changed, 4864 insertions(+), 5751 deletions(-)
 delete mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_core.h
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_dp_reg.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.c
 delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h
 delete mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c
 create mode 100644 drivers/gpu/drm/exynos/exynos_mixer.h
 delete mode 100644 drivers/video/exynos/exynos_dp_core.c
 delete mode 100644 drivers/video/exynos/exynos_dp_core.h
 delete mode 100644 drivers/video/exynos/exynos_dp_reg.c
 delete mode 100644 drivers/video/exynos/exynos_dp_reg.h

--
1.8.5.1

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

#58 lore raw

Hi Inki,

Quoted 7 lines · Inki Dae

Hi Sean,

Merged your all patch series except for dt binding patches - it needs more cleanups about ddc and phy - and I had a little change just for cleanup.
And some more cleanups and enhanced feature set on top of your patch series would be merged, and then they will go to -next.

I assume you just applied this series to your tree to a temporary branch and it won't be merged until are regressions introduced by it are fixed, right?

Best regards,
Tomasz

maintainer
#59 lore raw

Hi Tomasz,

2014-03-13 23:05 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 14 lines

Hi Inki,

Quoted 8 lines · Inki Dae

Hi Sean,

Merged your all patch series except for dt binding patches - it needs more cleanups about ddc and phy - and I had a little change just for cleanup.
And some more cleanups and enhanced feature set on top of your patch series would be merged, and then they will go to -next.

Quoted 2 lines

I assume you just applied this series to your tree to a temporary branch and it won't be merged until are regressions introduced by it are fixed, right?

Generally right. These has been merged to exynos-drm-next so that other people can clean up and enhance our driver on top of the refactoring patch series.
And I'm planning to have pull request if ddc and hdmi phy cleanups are posted from Tomasz Stanislawski. The only critical thing we should fix would be hdmi dt broken issue.

Give me more comments if there is any critical issue we should fix for this cycle.

Thanks,
Inki Dae

Quoted 8 lines

Best regards,
Tomasz

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

#60 lore raw
Quoted 27 lines · Inki Dae

Hi Tomasz,

2014-03-13 23:05 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 14 lines

Hi Inki,

Quoted 8 lines · Inki Dae

Hi Sean,

Merged your all patch series except for dt binding patches - it needs more cleanups about ddc and phy - and I had a little change just for cleanup.
And some more cleanups and enhanced feature set on top of your patch series would be merged, and then they will go to -next.

Quoted 2 lines

I assume you just applied this series to your tree to a temporary branch and it won't be merged until are regressions introduced by it are fixed, right?

Generally right. These has been merged to exynos-drm-next so that other people can clean up and enhance our driver on top of the refactoring patch series.
And I'm planning to have pull request if ddc and hdmi phy cleanups are posted from Tomasz Stanislawski. The only critical thing we should fix would be hdmi dt broken issue.

Quoted 2 lines

Give me more comments if there is any critical issue we should fix for this cycle.

As I have already mentioned in another reply to this thread (and also quite a long time ago in my review comments for previous version of this series), refactoring of FIMD driver removes support for parallel displays that seems to be used by exynos4210-origen, exynos4412-origen, smdk5250 and smdk5420 boards, which is a regression.

Best regards,
Tomasz

maintainer
#61 lore raw

2014-03-14 3:10 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 39 lines · Inki Dae
Quoted 34 lines

Hi Tomasz,

2014-03-13 23:05 GMT+09:00 Tomasz Figa <[email protected]>:

Quoted 17 lines

Hi Inki,

Quoted 9 lines · Inki Dae

Hi Sean,

Merged your all patch series except for dt binding patches - it needs more cleanups about ddc and phy - and I had a little change just for cleanup.
And some more cleanups and enhanced feature set on top of your patch series would be merged, and then they will go to -next.

Quoted 4 lines

I assume you just applied this series to your tree to a temporary branch and
it won't be merged until are regressions introduced by it are fixed, right?

Generally right. These has been merged to exynos-drm-next so that other people can clean up and enhance our driver on top of the refactoring patch series.
And I'm planning to have pull request if ddc and hdmi phy cleanups are posted from Tomasz Stanislawski. The only critical thing we should fix would be hdmi dt broken issue.

Quoted 2 lines

Give me more comments if there is any critical issue we should fix for this cycle.

Quoted 6 lines

As I have already mentioned in another reply to this thread (and also quite a long time ago in my review comments for previous version of this series), refactoring of FIMD driver removes support for parallel displays that seems to be used by exynos4210-origen, exynos4412-origen, smdk5250 and smdk5420 boards, which is a regression.

When it comes to parallel display support, I expect Andrzej would post it. And if not posted for this cycle, I will make a fixup patch and post it.

Thanks,
Inki Dae

Quoted 7 lines

Best regards,
Tomasz
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel