drm/exynos: vidi: fix build error

Inki Dae inki.dae at samsung.com
Mon Oct 28 14:35:31 CET 2013


This patch fixes build error incurred by the re-factoring patch applying.

The re-factoring patch set from Sean missed to apply the update to vidi
module so this patch applies the update so that vidi module is also built
correctly.

Signed-off-by: Inki Dae <inki.dae at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |  265 ++++++++++++++----------------
 1 file changed, 119 insertions(+), 146 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index d734098..669eba5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -45,7 +45,8 @@ struct vidi_win_data {
 };
 
 struct vidi_context {
-	struct exynos_drm_subdrv	subdrv;
+	struct device			*dev;
+	struct drm_device		*drm_dev;
 	struct drm_crtc			*crtc;
 	struct vidi_win_data		win_data[WINDOWS_NR];
 	struct edid			*raw_edid;
@@ -55,6 +56,7 @@ struct vidi_context {
 	unsigned int			connected;
 	bool				vblank_on;
 	bool				suspended;
+	int				pipe;
 	bool				direct_vblank;
 	struct work_struct		work;
 	struct mutex			lock;
@@ -137,67 +139,28 @@ static int vidi_check_mode(struct device *dev, struct drm_display_mode *mode)
 }
 
 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,
 };
 
-static void vidi_dpms(void *in_ctx, int mode)
-{
-	struct vidi_context *ctx = in_ctx;
-
-	DRM_DEBUG_KMS("%d\n", mode);
-
-	mutex_lock(&ctx->lock);
-
-	switch (mode) {
-	case DRM_MODE_DPMS_ON:
-		/* TODO. */
-		break;
-	case DRM_MODE_DPMS_STANDBY:
-	case DRM_MODE_DPMS_SUSPEND:
-	case DRM_MODE_DPMS_OFF:
-		/* TODO. */
-		break;
-	default:
-		DRM_DEBUG_KMS("unspecified mode %d\n", mode);
-		break;
-	}
-
-	mutex_unlock(&ctx->lock);
-}
-
-static void vidi_apply(void *in_ctx)
-{
-	struct vidi_context *ctx = in_ctx;
-	struct exynos_drm_manager *mgr = ctx->subdrv.manager;
-	struct exynos_drm_manager_ops *mgr_ops = mgr->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 && (mgr_ops && mgr_ops->win_commit))
-			mgr_ops->win_commit(ctx, i);
-	}
-
-	if (mgr_ops && mgr_ops->commit)
-		mgr_ops->commit(ctx);
-}
+static struct exynos_drm_display vidi_display = {
+	.type = EXYNOS_DISPLAY_TYPE_VIDI,
+	.ops = &vidi_display_ops,
+};
 
-static void vidi_commit(void *in_ctx)
+static void vidi_commit(struct device *dev)
 {
-	struct vidi_context *ctx = in_ctx;
+	struct vidi_context *ctx = get_vidi_context(dev);
 
 	if (ctx->suspended)
 		return;
 }
 
-static int vidi_enable_vblank(void *in_ctx)
+static int vidi_enable_vblank(struct device *dev)
 {
-	struct vidi_context *ctx = in_ctx;
+	struct vidi_context *ctx = get_vidi_context(dev);
 
 	if (ctx->suspended)
 		return -EPERM;
@@ -217,9 +180,9 @@ static int vidi_enable_vblank(void *in_ctx)
 	return 0;
 }
 
-static void vidi_disable_vblank(void *in_ctx)
+static void vidi_disable_vblank(struct device *dev)
 {
-	struct vidi_context *ctx = in_ctx;
+	struct vidi_context *ctx = get_vidi_context(dev);
 
 	if (ctx->suspended)
 		return;
@@ -228,9 +191,10 @@ static void vidi_disable_vblank(void *in_ctx)
 		ctx->vblank_on = false;
 }
 
-static void vidi_win_mode_set(void *in_ctx, struct exynos_drm_overlay *overlay)
+static void vidi_win_mode_set(struct device *dev,
+				struct exynos_drm_overlay *overlay)
 {
-	struct vidi_context *ctx = in_ctx;
+	struct vidi_context *ctx = get_vidi_context(dev);
 	struct vidi_win_data *win_data;
 	int win;
 	unsigned long offset;
@@ -280,9 +244,9 @@ static void vidi_win_mode_set(void *in_ctx, struct exynos_drm_overlay *overlay)
 			overlay->fb_width, overlay->crtc_width);
 }
 
-static void vidi_win_commit(void *in_ctx, int zpos)
+static void vidi_win_commit(struct device *dev, int zpos)
 {
-	struct vidi_context *ctx = in_ctx;
+	struct vidi_context *ctx = get_vidi_context(dev);
 	struct vidi_win_data *win_data;
 	int win = zpos;
 
@@ -305,9 +269,9 @@ static void vidi_win_commit(void *in_ctx, int zpos)
 		schedule_work(&ctx->work);
 }
 
-static void vidi_win_disable(void *in_ctx, int zpos)
+static void vidi_win_disable(struct device *dev, int zpos)
 {
-	struct vidi_context *ctx = in_ctx;
+	struct vidi_context *ctx = get_vidi_context(dev);
 	struct vidi_win_data *win_data;
 	int win = zpos;
 
@@ -323,31 +287,75 @@ static void vidi_win_disable(void *in_ctx, int zpos)
 	/* TODO. */
 }
 
-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 void vidi_apply(struct device *dev)
+{
+	struct vidi_context *ctx = get_vidi_context(dev);
+	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)
+			vidi_win_commit(dev, i);
+	}
+
+	vidi_commit(dev);
+}
+
+static int vidi_power_on(struct vidi_context *ctx, bool enable)
+{
+	DRM_DEBUG_KMS("%s\n", __FILE__);
+
+	if (enable != false && enable != true)
+		return -EINVAL;
+
+	if (enable) {
+		ctx->suspended = false;
+
+		/* if vblank was enabled status, enable it again. */
+		if (test_and_clear_bit(0, &ctx->irq_flags))
+			vidi_enable_vblank(ctx->dev);
+
+		vidi_apply(ctx->dev);
+	} else {
+		ctx->suspended = true;
+	}
+
+	return 0;
+}
+
+static void vidi_dpms(struct device *dev, int mode)
+{
+	struct vidi_context *ctx = get_vidi_context(dev);
+
+	DRM_DEBUG_KMS("%d\n", mode);
+
+	mutex_lock(&ctx->lock);
+
+	switch (mode) {
+	case DRM_MODE_DPMS_ON:
+		vidi_power_on(ctx, true);
+		break;
+	case DRM_MODE_DPMS_STANDBY:
+	case DRM_MODE_DPMS_SUSPEND:
+	case DRM_MODE_DPMS_OFF:
+		vidi_power_on(ctx, false);
+		break;
+	default:
+		DRM_DEBUG_KMS("unspecified mode %d\n", mode);
+		break;
+	}
+
+	mutex_unlock(&ctx->lock);
+}
 
-static struct exynos_drm_manager vidi_manager = {
-	.pipe		= -1,
-	.ops		= &vidi_manager_ops,
-	.display_ops	= &vidi_display_ops,
-};
 
 static void vidi_fake_vblank_handler(struct work_struct *work)
 {
 	struct vidi_context *ctx = container_of(work, struct vidi_context,
 					work);
-	struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-	struct exynos_drm_manager *manager = subdrv->manager;
 
-	if (manager->pipe < 0)
+	if (ctx->pipe < 0 || !ctx->drm_dev)
 		return;
 
 	/* refresh rate is about 50Hz. */
@@ -356,7 +364,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
 	mutex_lock(&ctx->lock);
 
 	if (ctx->direct_vblank) {
-		drm_handle_vblank(subdrv->drm_dev, manager->pipe);
+		drm_handle_vblank(ctx->drm_dev, ctx->pipe);
 		ctx->direct_vblank = false;
 		mutex_unlock(&ctx->lock);
 		return;
@@ -364,11 +372,17 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
 
 	mutex_unlock(&ctx->lock);
 
-	exynos_drm_crtc_finish_pageflip(subdrv->drm_dev, manager->pipe);
+	exynos_drm_crtc_finish_pageflip(ctx->drm_dev, ctx->pipe);
 }
 
-static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
+static int vidi_mgr_initialize(struct device *dev, struct drm_device *drm_dev,
+				int pipe)
 {
+	struct vidi_context *ctx = get_vidi_context(dev);
+
+	ctx->drm_dev = drm_dev;
+	ctx->pipe = pipe;
+
 	/*
 	 * enable drm irq mode.
 	 * - with irq_enabled = 1, we can use the vblank feature.
@@ -389,32 +403,27 @@ static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
 	return 0;
 }
 
-static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
+static void vidi_mgr_remove(struct device *dev)
 {
 	/* TODO. */
 }
 
-static int vidi_power_on(struct vidi_context *ctx, bool enable)
-{
-	DRM_DEBUG_KMS("%s\n", __FILE__);
-
-	if (enable != false && enable != true)
-		return -EINVAL;
-
-	if (enable) {
-		ctx->suspended = false;
-
-		/* if vblank was enabled status, enable it again. */
-		if (test_and_clear_bit(0, &ctx->irq_flags))
-			vidi_enable_vblank(ctx);
-
-		vidi_apply(ctx);
-	} else {
-		ctx->suspended = true;
-	}
+static struct exynos_drm_manager_ops vidi_manager_ops = {
+	.initialize = vidi_mgr_initialize,
+	.remove = vidi_mgr_remove,
+	.dpms = vidi_dpms,
+	.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,
+};
 
-	return 0;
-}
+static struct exynos_drm_manager vidi_manager = {
+	.type		= EXYNOS_DISPLAY_TYPE_VIDI,
+	.ops		= &vidi_manager_ops,
+};
 
 static int vidi_show_connection(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -457,7 +466,7 @@ static int vidi_store_connection(struct device *dev,
 
 	DRM_DEBUG_KMS("requested connection.\n");
 
-	drm_helper_hpd_irq_event(ctx->subdrv.drm_dev);
+	drm_helper_hpd_irq_event(ctx->drm_dev);
 
 	return len;
 }
@@ -468,10 +477,7 @@ static DEVICE_ATTR(connection, 0644, vidi_show_connection,
 int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
 				struct drm_file *file_priv)
 {
-	struct vidi_context *ctx = NULL;
-	struct drm_encoder *encoder;
-	struct exynos_drm_manager *manager;
-	struct exynos_drm_display_ops *display_ops;
+	struct vidi_context *ctx;
 	struct drm_exynos_vidi_connection *vidi = data;
 	int edid_len;
 
@@ -485,17 +491,7 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
 		return -EINVAL;
 	}
 
-	list_for_each_entry(encoder, &drm_dev->mode_config.encoder_list,
-								head) {
-		manager = exynos_drm_get_manager(encoder);
-		display_ops = manager->display_ops;
-
-		if (display_ops->type == EXYNOS_DISPLAY_TYPE_VIDI) {
-			ctx = get_vidi_context(manager->dev);
-			break;
-		}
-	}
-
+	ctx = get_vidi_context(vidi_manager.dev);
 	if (!ctx) {
 		DRM_DEBUG_KMS("not found virtual device type encoder.\n");
 		return -EINVAL;
@@ -531,7 +527,7 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
 	}
 
 	ctx->connected = vidi->connection;
-	drm_helper_hpd_irq_event(ctx->subdrv.drm_dev);
+	drm_helper_hpd_irq_event(ctx->drm_dev);
 
 	return 0;
 }
@@ -540,7 +536,6 @@ static int vidi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct vidi_context *ctx;
-	struct exynos_drm_subdrv *subdrv;
 	int ret;
 
 	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
@@ -551,22 +546,20 @@ static int vidi_probe(struct platform_device *pdev)
 
 	INIT_WORK(&ctx->work, vidi_fake_vblank_handler);
 
-	subdrv = &ctx->subdrv;
-	subdrv->dev = dev;
-	subdrv->manager = &vidi_manager;
-	subdrv->probe = vidi_subdrv_probe;
-	subdrv->remove = vidi_subdrv_remove;
-
 	mutex_init(&ctx->lock);
 
 	platform_set_drvdata(pdev, ctx);
 
+	vidi_manager.dev = dev;
+	exynos_drm_manager_register(&vidi_manager);
+
+	vidi_display.dev = dev;
+	exynos_drm_display_register(&vidi_display);
+
 	ret = device_create_file(dev, &dev_attr_connection);
 	if (ret < 0)
 		DRM_INFO("failed to create connection sysfs.\n");
 
-	exynos_drm_subdrv_register(subdrv);
-
 	return 0;
 }
 
@@ -574,7 +567,8 @@ static int vidi_remove(struct platform_device *pdev)
 {
 	struct vidi_context *ctx = platform_get_drvdata(pdev);
 
-	exynos_drm_subdrv_unregister(&ctx->subdrv);
+	exynos_drm_display_unregister(&vidi_display);
+	exynos_drm_manager_unregister(&vidi_manager);
 
 	if (ctx->raw_edid != (struct edid *)fake_edid_info) {
 		kfree(ctx->raw_edid);
@@ -584,32 +578,11 @@ static int vidi_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int vidi_suspend(struct device *dev)
-{
-	struct vidi_context *ctx = get_vidi_context(dev);
-
-	return vidi_power_on(ctx, false);
-}
-
-static int vidi_resume(struct device *dev)
-{
-	struct vidi_context *ctx = get_vidi_context(dev);
-
-	return vidi_power_on(ctx, true);
-}
-#endif
-
-static const struct dev_pm_ops vidi_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(vidi_suspend, vidi_resume)
-};
-
 struct platform_driver vidi_driver = {
 	.probe		= vidi_probe,
 	.remove		= vidi_remove,
 	.driver		= {
 		.name	= "exynos-drm-vidi",
 		.owner	= THIS_MODULE,
-		.pm	= &vidi_pm_ops,
 	},
 };
-- 
1.7.9.5



More information about the dri-devel mailing list