diff mbox

[07/23] drm/exynos: Pass context in display_ops instead of dev

Message ID 1381451436-10089-8-git-send-email-seanpaul@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Paul Oct. 11, 2013, 12:30 a.m. UTC
This patch changes the argument of the display_ops from subdrv device to
context. This will allow us to decouple manager and display from subdrv,
as well as decouple crtc from encoder.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/exynos/exynos_drm_connector.c |  8 +++----
 drivers/gpu/drm/exynos/exynos_drm_drv.h       | 13 +++++-----
 drivers/gpu/drm/exynos/exynos_drm_encoder.c   |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 10 ++++----
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c      | 34 ++++++++++-----------------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c      | 15 ++++++------
 6 files changed, 36 insertions(+), 46 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index b70b123..830fa3d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -53,7 +53,7 @@  static int exynos_drm_connector_get_modes(struct drm_connector *connector)
 	 * because lcd panel has only one mode.
 	 */
 	if (display_ops->get_edid) {
-		edid = display_ops->get_edid(manager->dev, connector);
+		edid = display_ops->get_edid(manager->ctx, connector);
 		if (IS_ERR_OR_NULL(edid)) {
 			ret = PTR_ERR(edid);
 			edid = NULL;
@@ -77,7 +77,7 @@  static int exynos_drm_connector_get_modes(struct drm_connector *connector)
 		}
 
 		if (display_ops->get_panel)
-			panel = display_ops->get_panel(manager->dev);
+			panel = display_ops->get_panel(manager->ctx);
 		else {
 			drm_mode_destroy(connector->dev, mode);
 			return 0;
@@ -113,7 +113,7 @@  static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
 	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(manager->ctx, mode))
 			ret = MODE_OK;
 
 	return ret;
@@ -216,7 +216,7 @@  exynos_drm_connector_detect(struct drm_connector *connector, bool force)
 	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(manager->ctx))
 			status = connector_status_connected;
 		else
 			status = connector_status_disconnected;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 0bd444f..cbf8fcf 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -132,13 +132,12 @@  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);
-	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 (*initialize)(void *ctx, struct drm_device *drm_dev);
+	bool (*is_connected)(void *ctx);
+	struct edid *(*get_edid)(void *ctx, struct drm_connector *connector);
+	void *(*get_panel)(void *ctx);
+	int (*check_mode)(void *ctx, struct drm_display_mode *mode);
+	int (*power_on)(void *ctx, int mode);
 };
 
 /*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 24484ae..e0c50a8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -349,7 +349,7 @@  exynos_drm_encoder_create(struct drm_device *dev,
 	}
 
 	if (manager->display_ops && manager->display_ops->initialize) {
-		ret = manager->display_ops->initialize(manager->dev, dev);
+		ret = manager->display_ops->initialize(manager->ctx, dev);
 		if (ret) {
 			DRM_ERROR("Display initialize failed %d\n", ret);
 			goto error;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9c2720a..a8f9772 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -147,28 +147,28 @@  static inline struct fimd_driver_data *drm_fimd_get_driver_data(
 	return (struct fimd_driver_data *)of_id->data;
 }
 
-static bool fimd_display_is_connected(struct device *dev)
+static bool fimd_display_is_connected(void *in_ctx)
 {
 	/* TODO. */
 
 	return true;
 }
 
-static void *fimd_get_panel(struct device *dev)
+static void *fimd_get_panel(void *in_ctx)
 {
-	struct fimd_context *ctx = get_fimd_context(dev);
+	struct fimd_context *ctx = in_ctx;
 
 	return &ctx->panel;
 }
 
-static int fimd_check_mode(struct device *dev, struct drm_display_mode *mode)
+static int fimd_check_mode(void *in_ctx, struct drm_display_mode *mode)
 {
 	/* TODO. */
 
 	return 0;
 }
 
-static int fimd_display_power_on(struct device *dev, int mode)
+static int fimd_display_power_on(void *in_ctx, int mode)
 {
 	/* TODO */
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index cddb0c8..689758d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -97,10 +97,9 @@  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)
+static int drm_hdmi_display_initialize(void *in_ctx, struct drm_device *drm_dev)
 {
-	struct drm_hdmi_context *ctx = to_context(dev);
+	struct drm_hdmi_context *ctx = in_ctx;
 
 	if (hdmi_ops && hdmi_ops->initialize)
 		return hdmi_ops->initialize(ctx->hdmi_ctx->ctx, drm_dev);
@@ -109,9 +108,9 @@  static int drm_hdmi_display_initialize(struct device *dev,
 }
 
 
-static bool drm_hdmi_is_connected(struct device *dev)
+static bool drm_hdmi_is_connected(void *in_ctx)
 {
-	struct drm_hdmi_context *ctx = to_context(dev);
+	struct drm_hdmi_context *ctx = in_ctx;
 
 	if (hdmi_ops && hdmi_ops->is_connected)
 		return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);
@@ -119,19 +118,20 @@  static bool drm_hdmi_is_connected(struct device *dev)
 	return false;
 }
 
-static struct edid *drm_hdmi_get_edid(struct device *dev,
+static struct edid *drm_hdmi_get_edid(void *in_ctx,
 			struct drm_connector *connector)
 {
-	struct drm_hdmi_context *ctx = to_context(dev);
+	struct drm_hdmi_context *ctx = in_ctx;
 
 	if (hdmi_ops && hdmi_ops->get_edid)
 		return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector);
 
 	return NULL;
 }
-static int drm_hdmi_check_mode_ctx(struct drm_hdmi_context *ctx,
-		struct drm_display_mode *mode)
+
+static int drm_hdmi_check_mode(void *in_ctx, struct drm_display_mode *mode)
 {
+	struct drm_hdmi_context *ctx = in_ctx;
 	int ret = 0;
 
 	/*
@@ -151,17 +151,9 @@  static int drm_hdmi_check_mode_ctx(struct drm_hdmi_context *ctx,
 	return 0;
 }
 
-static int drm_hdmi_check_mode(struct device *dev,
-		struct drm_display_mode *mode)
+static int drm_hdmi_power_on(void *in_ctx, int mode)
 {
-	struct drm_hdmi_context *ctx = to_context(dev);
-
-	return drm_hdmi_check_mode_ctx(ctx, mode);
-}
-
-static int drm_hdmi_power_on(struct device *dev, int mode)
-{
-	struct drm_hdmi_context *ctx = to_context(dev);
+	struct drm_hdmi_context *ctx = in_ctx;
 
 	if (hdmi_ops && hdmi_ops->power_on)
 		return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);
@@ -217,7 +209,7 @@  static void drm_hdmi_mode_fixup(void *in_ctx, struct drm_connector *connector,
 
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
 
-	mode_ok = drm_hdmi_check_mode_ctx(ctx, adjusted_mode);
+	mode_ok = drm_hdmi_check_mode(ctx, adjusted_mode);
 
 	/* just return if user desired mode exists. */
 	if (mode_ok == 0)
@@ -228,7 +220,7 @@  static void drm_hdmi_mode_fixup(void *in_ctx, struct drm_connector *connector,
 	 * to adjusted_mode.
 	 */
 	list_for_each_entry(m, &connector->modes, head) {
-		mode_ok = drm_hdmi_check_mode_ctx(ctx, m);
+		mode_ok = drm_hdmi_check_mode(ctx, m);
 
 		if (mode_ok == 0) {
 			struct drm_mode_object base;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index a583a74..1220937 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -85,9 +85,9 @@  static const char fake_edid_info[] = {
 	0x00, 0x00, 0x00, 0x06
 };
 
-static bool vidi_display_is_connected(struct device *dev)
+static bool vidi_display_is_connected(void *in_ctx)
 {
-	struct vidi_context *ctx = get_vidi_context(dev);
+	struct vidi_context *ctx = in_ctx;
 
 	/*
 	 * connection request would come from user side
@@ -96,10 +96,9 @@  static bool vidi_display_is_connected(struct device *dev)
 	return ctx->connected ? true : false;
 }
 
-static struct edid *vidi_get_edid(struct device *dev,
-			struct drm_connector *connector)
+static struct edid *vidi_get_edid(void *in_ctx, struct drm_connector *connector)
 {
-	struct vidi_context *ctx = get_vidi_context(dev);
+	struct vidi_context *ctx = in_ctx;
 	struct edid *edid;
 	int edid_len;
 
@@ -122,21 +121,21 @@  static struct edid *vidi_get_edid(struct device *dev,
 	return edid;
 }
 
-static void *vidi_get_panel(struct device *dev)
+static void *vidi_get_panel(void *in_ctx)
 {
 	/* TODO. */
 
 	return NULL;
 }
 
-static int vidi_check_mode(struct device *dev, struct drm_display_mode *mode)
+static int vidi_check_mode(void *in_ctx, struct drm_display_mode *mode)
 {
 	/* TODO. */
 
 	return 0;
 }
 
-static int vidi_display_power_on(struct device *dev, int mode)
+static int vidi_display_power_on(void *in_ctx, int mode)
 {
 	/* TODO */