From patchwork Thu Jul 26 18:49:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1245031 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id DF213DFFCE for ; Thu, 26 Jul 2012 20:27:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A39919E9FE for ; Thu, 26 Jul 2012 13:27:40 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 99F8F9EC4F for ; Thu, 26 Jul 2012 12:56:55 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id dr1so1724773wgb.12 for ; Thu, 26 Jul 2012 12:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=jtsf+pZY1/Jiobw9PklwUDa/ArgGq5Q5RcnU+DSuySs=; b=c4A80UUPydnnsyTg4+z1gYxQ2Oez+X6RO2/hMmsxmTzDJOkPRRxR4KVWry/BMyNyTX jergIHq6QjXsw+rSIsv6jfCm1tQfAxLs304Kb29ffAEIxxWqXeHfBFaFtINV9eeQvFzc rFA3PDSalpCnrSSi4TNW7NePjMukcEvmzZEd0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=jtsf+pZY1/Jiobw9PklwUDa/ArgGq5Q5RcnU+DSuySs=; b=cvVkwusl/xh2x0snCoWocjb8Yp191IoarG813nAg1ddxNS+qsP/MB2EkktsG9VM4nT NOaqaRldplsR3KF3UyaHHlhM7YhGWJU//SR/mP2G9hUmY6qpNSZn2z58NVz31CG0GMXT Ma3P7jbO78qRRQi6Ff3iVYFNxcgAd4/AHven91BS6wDByL+/z8FYXlSAx7xh/IMO3cuA pBTh3qYsHMm/aU2M+SElO7yA4jHNjCX8vLHU+EZwbvQ5zki1k9pwcuhEw/POMRHXC/QR Fm1wA3RtKflleWbyiy9lfyO/tKn3OfnYsx+rjFCCrgy/ZDtwmpxs55eBVlR7GS3gwRVc actQ== Received: by 10.180.78.135 with SMTP id b7mr124318wix.11.1343332615257; Thu, 26 Jul 2012 12:56:55 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id fr4sm391403wib.8.2012.07.26.12.56.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 12:56:54 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 26 Jul 2012 20:49:00 +0200 Message-Id: <1343328581-2324-36-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> References: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQnREFAJWKt+r6nlZq4fRCKYfsHp7Wtmd25aeVcYBdguXP5jiNir9/zEdjGYNLfRs25/hPeK Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 35/76] drm/i915/crt: implement get_hw_state X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Note that even though this connector is cloneable we still can use the exact same test to check whether the connector is on or whether the encoder is enabled - both the dpms code and the encoder disable/enable frob the exact same hw state. For dvo/sdvo outputs, this will be different. Signed-Off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_crt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 8b95cef..10704d5 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c @@ -61,6 +61,27 @@ static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder) return container_of(encoder, struct intel_crt, base); } +static bool intel_crt_get_hw_state(struct intel_encoder *encoder, + enum pipe *pipe) +{ + struct drm_device *dev = encoder->base.dev; + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_crt *crt = intel_encoder_to_crt(encoder); + u32 tmp; + + tmp = I915_READ(crt->adpa_reg); + + if (!(tmp & ADPA_DAC_ENABLE)) + return false; + + if (HAS_PCH_CPT(dev)) + *pipe = PORT_TO_PIPE_CPT(tmp); + else + *pipe = PORT_TO_PIPE(tmp); + + return true; +} + static void intel_disable_crt(struct intel_encoder *encoder) { struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; @@ -712,6 +733,8 @@ void intel_crt_init(struct drm_device *dev) crt->base.disable = intel_disable_crt; crt->base.enable = intel_enable_crt; + crt->base.get_hw_state = intel_crt_get_hw_state; + intel_connector->get_hw_state = intel_connector_get_hw_state; drm_encoder_helper_add(&crt->base.base, &crt_encoder_funcs); drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);