From patchwork Wed Jun 26 21:55:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 2788921 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 9E067C0AB1 for ; Wed, 26 Jun 2013 22:05:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADD312021F for ; Wed, 26 Jun 2013 22:05:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A069420200 for ; Wed, 26 Jun 2013 22:05:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83C79E6262 for ; Wed, 26 Jun 2013 15:05:53 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yh0-f48.google.com (mail-yh0-f48.google.com [209.85.213.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 586ACE5DF4; Wed, 26 Jun 2013 14:55:46 -0700 (PDT) Received: by mail-yh0-f48.google.com with SMTP id z12so6770770yhz.35 for ; Wed, 26 Jun 2013 14:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=2hn6gHfADQOiaX+sswCEsN92KbJE0m95KyuVOQ4KVus=; b=Qtg4sOyE37mYzpOKBFf8EgfpN24pA+YmujOmovPsCiYnKinwTL7QJgHDsQI/SPeOBi hxPayUKL/0Udm3fiLb8UH4QX3OBywbPXobPhQAmfIyq5oiJUlmmt70RrnLdzhYfd1pqw QOnLNUlZy7OLSN4bL217iTWdKBLYc979EzU6y4y1EHFIIUpu2JLTOpnVBXF3GLP0nnA5 fwWgIwevsGuJWxwW6mg5fAHUitwkVE9KZK3M9SwOJVz2Z3ilqrCvlsLpiOrfqV3WzZAJ qInH3mLaXYaFkStqsIcKytUc/scl6cS1JXDOE7+DeLSJ6njbqooe1s7BLqkF4dodI9ap wAKA== X-Received: by 10.236.164.9 with SMTP id b9mr3101598yhl.151.1372283745925; Wed, 26 Jun 2013 14:55:45 -0700 (PDT) Received: from localhost.localdomain ([186.204.164.107]) by mx.google.com with ESMTPSA id d91sm47861367yhq.16.2013.06.26.14.55.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 14:55:45 -0700 (PDT) From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Subject: [PATCH 07/11] drm/i915: add update function to disable/enable-back PSR Date: Wed, 26 Jun 2013 18:55:18 -0300 Message-Id: <1372283722-12988-7-git-send-email-rodrigo.vivi@gmail.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372283722-12988-1-git-send-email-rodrigo.vivi@gmail.com> References: <1372283722-12988-1-git-send-email-rodrigo.vivi@gmail.com> Cc: dri-devel@lists.freedesktop.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=-5.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 Required function to disable PSR when going to console mode. But also can be used whenever PSR mode entry conditions changed. v2: Add it before PSR Hook. Update function not really been called yet. --- drivers/gpu/drm/i915/intel_dp.c | 37 ++++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 13b0155..91ba018 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1536,14 +1536,8 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) return true; } -void intel_edp_psr_enable(struct intel_dp* intel_dp) +void intel_edp_psr_do_enable(struct intel_dp* intel_dp) { - struct drm_device *dev = intel_dp_to_dev(intel_dp); - - if (!intel_edp_psr_match_conditions(intel_dp) || - intel_edp_is_psr_enabled(dev)) - return; - /* Enable PSR on the panel */ intel_edp_psr_enable_sink(intel_dp); @@ -1551,6 +1545,15 @@ void intel_edp_psr_enable(struct intel_dp* intel_dp) intel_edp_psr_enable_source(intel_dp); } +void intel_edp_psr_enable(struct intel_dp* intel_dp) +{ + struct drm_device *dev = intel_dp_to_dev(intel_dp); + + if (intel_edp_psr_match_conditions(intel_dp) && + !intel_edp_is_psr_enabled(dev)) + intel_edp_psr_do_enable(intel_dp); +} + void intel_edp_psr_disable(struct intel_dp* intel_dp) { struct drm_device *dev = intel_dp_to_dev(intel_dp); @@ -1573,6 +1576,26 @@ void intel_edp_psr_disable(struct intel_dp* intel_dp) intel_wait_for_vblank(dev, intel_crtc->pipe); } +void intel_edp_psr_update(struct drm_device *dev) +{ + struct intel_encoder *encoder; + struct intel_dp *intel_dp = NULL; + + list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) + if (encoder->type == INTEL_OUTPUT_EDP) { + intel_dp = enc_to_intel_dp(&encoder->base); + + if (!is_edp_psr(intel_dp)) + return; + + if (!intel_edp_psr_match_conditions(intel_dp)) + intel_edp_psr_disable(intel_dp); + else + if (!intel_edp_is_psr_enabled(dev)) + intel_edp_psr_do_enable(intel_dp); + } +} + static void intel_disable_dp(struct intel_encoder *encoder) { struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index f86d9c5..69224d2 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -842,5 +842,6 @@ extern bool intel_set_pch_fifo_underrun_reporting(struct drm_device *dev, extern void intel_edp_psr_enable(struct intel_dp* intel_dp); extern void intel_edp_psr_disable(struct intel_dp* intel_dp); +extern void intel_edp_psr_update(struct drm_device *dev); #endif /* __INTEL_DRV_H__ */