From patchwork Tue Oct 29 16:12:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 3109111 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8796EBF924 for ; Tue, 29 Oct 2013 16:17:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 514C12035D for ; Tue, 29 Oct 2013 16:17:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 24C9320304 for ; Tue, 29 Oct 2013 16:17:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B5C8EEC1B; Tue, 29 Oct 2013 09:14:17 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f44.google.com (mail-qe0-f44.google.com [209.85.128.44]) by gabe.freedesktop.org (Postfix) with ESMTP id A9D04EEBBB for ; Tue, 29 Oct 2013 09:13:43 -0700 (PDT) Received: by mail-qe0-f44.google.com with SMTP id 6so45200qeb.31 for ; Tue, 29 Oct 2013 09:13:43 -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=zUrdovDQyGMgXyjvXiGnbCxUT5IzVtIMhCvvLXnl5JA=; b=ZrHOAkOPKqWVZdw7BrKCVaCIYEwD549tYSXwzzDQ06tPuHd49qgOb6SkWJtqPf+ktp jygb0wv5le069bBe+nQ6cNbU5C2Uza95WzzrICbe2BelhgCmBgZ+AwKgJvAj/l3+FSmf e9hR2HEnFi/dp9AW3Ixq2770ZlWeIyh8D0QXY= 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=zUrdovDQyGMgXyjvXiGnbCxUT5IzVtIMhCvvLXnl5JA=; b=AU8lVydgf42oPSmKL8/XL1/aoE/7gQa8Pb9JaJiYP6nYXC3qz3uvH+8zIa5/ooF/Qx ikqWOTqQ8K0k4eSH1rE9sCEyCoTMQ68n9alC07Ub6eei9yIr5rXHBUUnhL22nAuPG8aQ npV6UqOBtrpmTb3ts5/goirohdT455F09qCQca1rtiSeKezVap39HQsicARK/vVncG1Q rdnNcF7KZg02Tl/+p5OuphRn6cCURRXGtYIgOCObYVTP+bsITywEfS7hKbGZL7hATzC/ /CwYvdJYV99XgDfC1ZditPy5PERijoWuX7Ck85gnWq3PwKPFSFLInrUUZz6z0aexJi2b 7iRw== X-Gm-Message-State: ALoCoQnSgfRvCU0JqAffEjRXbyiwXskye4l9KHUEwVRh0P87XBwvHfAoMQpJxFLFoj2YyJvNHVd9 X-Received: by 10.229.34.134 with SMTP id l6mr664798qcd.22.1383063223156; Tue, 29 Oct 2013 09:13:43 -0700 (PDT) Received: from seanpaul-glaptop.roam.corp.google.com (cpe-173-095-180-236.nc.res.rr.com. [173.95.180.236]) by mx.google.com with ESMTPSA id h9sm66581946qaq.9.2013.10.29.09.13.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 09:13:42 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH v3 03/32] drm/exynos: Add an initialize function to manager and display Date: Tue, 29 Oct 2013 12:12:49 -0400 Message-Id: <1383063198-10526-4-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1383063198-10526-1-git-send-email-seanpaul@chromium.org> References: <1383063198-10526-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@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 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 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. Signed-off-by: Sean Paul Reviewed-by: Tomasz Figa --- Changes in v2: None Changes in v3: None drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 +++++ drivers/gpu/drm/exynos/exynos_drm_encoder.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 6f31839..09bfe60 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -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, diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index c255341..a9eb2b0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -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)