From patchwork Sun Aug 19 19:12:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1345001 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 6156F3FC33 for ; Sun, 19 Aug 2012 20:39:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C68AA1038 for ; Sun, 19 Aug 2012 13:39:00 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BB2BA102C for ; Sun, 19 Aug 2012 13:20:50 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id hn17so2755791wib.12 for ; Sun, 19 Aug 2012 13:20:50 -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=f7GBWahVbVN+5F5NYOz8KybIXmUpPgNPJQHQUTfi2gU=; b=hI/572Cb12V7fw88WWt/zsDUx0ESSTbrlVxmsCyIXGV7lGej8RqojhVR465dVd1hUt mMZkkYSa+TKZTLkLCukKpTq9M0pqkuzk8cKwMXFpmQDfJnK3GfGFQltjUxBgxp1nkA/B emf55PPl2eDu3spYr4L9Y8V3+O9h4qAMUxoSQ= 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=f7GBWahVbVN+5F5NYOz8KybIXmUpPgNPJQHQUTfi2gU=; b=Pmu2x5cV+KT1qWqwtE2xVqAtxekVNfqs4MuXbzZPnErhLBTK1G2wkTiMyPTrP4VTml JbugLzNqB+9++HxiSt7jGjiiMTK4eCb3M53bBYBvUGG9u4yHVVXRpq/6WfE+Dhu4lfn1 Ir4Vc5atpyU7M0U4UtjP3z+aG+GOJeVDS8jrVUA0lHGpzH7t7WQ2AkXkkNscF7V3fDol 750rn++rYNGp8ah9QDsY8Ly6I+3omlhlDB4HhYB2UhG0Uy6J8NS/0OgWDqNCgatE0GYJ UO5SZxIY+8cQl5dLvkhAlgCf/bTKJ/fGdPpxqL2/IGJPPIj7wpQHmbbN/q3eRQcI97th vykw== Received: by 10.180.84.164 with SMTP id a4mr22707915wiz.12.1345407650144; Sun, 19 Aug 2012 13:20:50 -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 fu8sm24194367wib.5.2012.08.19.13.20.48 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Aug 2012 13:20:49 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sun, 19 Aug 2012 21:12:44 +0200 Message-Id: <1345403595-9678-28-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> References: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQlbaUjCf1LAd17GYkLyO467NgItEBfOQT7O/Wy7GmTxlbHUaogVi5ov16cuozynTDQ3Cx9u Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 27/58] 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 Reviewed-by: Jesse Barnes --- 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 4ce0b46..fab54ed 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; @@ -710,6 +731,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);