From patchwork Fri Oct 11 00:30:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 3019751 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D0809F1E1 for ; Fri, 11 Oct 2013 00:41:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18D8520253 for ; Fri, 11 Oct 2013 00:41:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DD9212024C for ; Fri, 11 Oct 2013 00:41:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D04CBE5F36 for ; Thu, 10 Oct 2013 17:41:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com [209.85.223.170]) by gabe.freedesktop.org (Postfix) with ESMTP id 70C04E6235 for ; Thu, 10 Oct 2013 17:31:01 -0700 (PDT) Received: by mail-ie0-f170.google.com with SMTP id x13so6957256ief.29 for ; Thu, 10 Oct 2013 17:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TojBuEWckkyf7EGMii7J2MGD3kR6mk+HEHrZNbzVNrs=; b=c0TN3J7+cZktNVc70teh+Uo2YzB7Km91foQU+syKBMYiMxOxIaaUUfsSl32e0Pk/9F cskaZFYCygiEuYuRiBhW81bbDopF81iIEq0WR66WrSYhDAu9zisO+vMVSbPeX6fkD91U JYsutYeqj2AQ/RxgyP9flh122Y9JHRO6rs2bs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TojBuEWckkyf7EGMii7J2MGD3kR6mk+HEHrZNbzVNrs=; b=XlrlWGME5iJwPvMU2nfZ/J+2jdEWbUN/M9FhyFyzZFAbkGo134J+t0K0v4L8h9bNeD As9thzuv2CrwKsnu531ciWJmyJHdTGN2yVS8yXLZIS5huk6Hg6HLC8ccnLADPpWEzmXZ nbI2E3YkQbYV1YfoM2taCVB5b6eYJTnWvD328pVQKMRPIcW63TyiFL3JsL3mLovIsMEi dxFaKmMEyrhvDK6qYQFfYQN6/ejlyUoEW1sjKmygfiXw34uJG6EOLBj1708z5Rn3CCtQ dnBTJFbLTKUXf57pKbWYyuTwABBsYiBzHZoGwcPgcNcolFLQwgZAfsRfYPkgq6DLHtfN 456w== X-Gm-Message-State: ALoCoQljHKwxJ+OuB6Q40H9orDFlUvm4uqpBlKDN/TQyX/MPszl6RREs3AOPvpBCbnBTlgju1KuK X-Received: by 10.43.137.9 with SMTP id im9mr25538icc.97.1381451461036; Thu, 10 Oct 2013 17:31:01 -0700 (PDT) Received: from seanpaul-glaptop.corp.google.com (dhcp-172-19-29-233.mtv.corp.google.com [172.19.29.233]) by mx.google.com with ESMTPSA id p7sm420421iga.3.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Oct 2013 17:31:00 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH 07/23] drm/exynos: Pass context in display_ops instead of dev Date: Thu, 10 Oct 2013 20:30:20 -0400 Message-Id: <1381451436-10089-8-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1381451436-10089-1-git-send-email-seanpaul@chromium.org> References: <1381451436-10089-1-git-send-email-seanpaul@chromium.org> Cc: marcheu@chromium.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 --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 */