From patchwork Wed Oct 16 19:26:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 3057351 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 01465BF924 for ; Wed, 16 Oct 2013 20:44:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8AB4220489 for ; Wed, 16 Oct 2013 20:43:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C50F2204B9 for ; Wed, 16 Oct 2013 20:43:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC96FE7788 for ; Wed, 16 Oct 2013 13:43:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f53.google.com (mail-qe0-f53.google.com [209.85.128.53]) by gabe.freedesktop.org (Postfix) with ESMTP id A3F70E779B for ; Wed, 16 Oct 2013 12:27:21 -0700 (PDT) Received: by mail-qe0-f53.google.com with SMTP id cy11so1033759qeb.26 for ; Wed, 16 Oct 2013 12:27:20 -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=S0TC7AOhK15w33MxWIwbl2N9VVHy5c3+Fez3rfyQC8c=; b=hULvPf2uous4vgyhoPTzi5uPGOIwgO1JiRfd6jwB80h/Jgw7f3eYQKJ28Hzg6743VC HlnK2P6xRlZt15gsS3fBy4JAuh29ddeg6Qc5vzXGtoszlCAYiJnycvyeNYDQJfIysVvF xgPhdoRLBU2QeUGUHHvPVlkx+wrw5suzSGftw= 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=S0TC7AOhK15w33MxWIwbl2N9VVHy5c3+Fez3rfyQC8c=; b=HDptz9ir8TrpBECqewu+s01/5ClUiWqIGpu1Mb4NLvXFJq4YugjvnIXIb+OxUlrT3H LPjto4MjWup087clffi45/90LixC+rjBOmKapgbiGFTcGmXiAl+ywRudZQGRpYBab9aF s8hQ09IwVA1N7VF6Tq9bRujboVPgCTChQmp1IAdUoCRw48AUCm7Rol8unvhu8yfLIpIF jFH5ecrqp2En61hVflf/vFeEaNjYRngHyd7jcWbxHu3SymuqPPmehb0WocCmbL2Ts4Zi yBMFIvsWlwopAu35RkraHqU2tgieOj+UoLEp9CLYWCuw0ZkFTmiwSRWCgMG/YKj45iQC Jz+Q== X-Gm-Message-State: ALoCoQkPFf8k9Chb4xhSVJV672kPHvXEfNxooH+n6DC31OwikdoOYCfsaoWpLswLO5Fc8x2Y3xyv X-Received: by 10.224.125.138 with SMTP id y10mr6979244qar.40.1381951640631; Wed, 16 Oct 2013 12:27:20 -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 4sm167771575qak.11.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Oct 2013 12:27:20 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH v2 08/26] drm/exynos: Remove dpms link between encoder/connector Date: Wed, 16 Oct 2013 15:26:38 -0400 Message-Id: <1381951616-12548-9-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1381951616-12548-1-git-send-email-seanpaul@chromium.org> References: <1381951616-12548-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.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 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. Signed-off-by: Sean Paul --- Changes in v2: - Split out the apply change into a new patch 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(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 23b69d8..ca270e2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -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; diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.h b/drivers/gpu/drm/exynos/exynos_drm_connector.h index 547c6b5..4eb20d7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.h +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.h @@ -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 diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 19ee84d..df4b2852 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -29,35 +29,19 @@ * @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. - * @updated: indicate whether overlay data updating is needed or not. */ struct exynos_drm_encoder { struct drm_crtc *old_crtc; struct drm_encoder drm_encoder; struct exynos_drm_manager *manager; int dpms; - bool updated; }; -static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) -{ - struct drm_device *dev = encoder->dev; - struct drm_connector *connector; - - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (exynos_drm_best_encoder(connector) == encoder) { - DRM_DEBUG_KMS("connector[%d] dpms[%d]\n", - connector->base.id, mode); - - exynos_drm_display_power(connector, 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_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); @@ -66,26 +50,10 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) return; } - mutex_lock(&dev->struct_mutex); - - switch (mode) { - case DRM_MODE_DPMS_ON: - exynos_drm_connector_power(encoder, mode); - exynos_encoder->dpms = mode; - break; - case DRM_MODE_DPMS_STANDBY: - case DRM_MODE_DPMS_SUSPEND: - case DRM_MODE_DPMS_OFF: - exynos_drm_connector_power(encoder, mode); - exynos_encoder->dpms = mode; - exynos_encoder->updated = false; - break; - default: - DRM_ERROR("unspecified mode %d\n", mode); - break; - } + if (display_ops && display_ops->power_on) + display_ops->power_on(manager->ctx, mode); - mutex_unlock(&dev->struct_mutex); + exynos_encoder->dpms = mode; } static bool @@ -191,14 +159,6 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) manager_ops->commit(manager); /* - * this will avoid one issue that overlay data is updated to - * real hardware two times. - * And this variable will be used to check if the data was - * already updated or not by exynos_drm_encoder_dpms function. - */ - exynos_encoder->updated = true; - - /* * In case of setcrtc, there is no way to update encoder's dpms * so update it here. */