From patchwork Wed Jul 11 14:28:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1183871 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 023C8DF25A for ; Wed, 11 Jul 2012 16:06:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C72EFA0EA5 for ; Wed, 11 Jul 2012 09:06:34 -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 37DDF9E747 for ; Wed, 11 Jul 2012 08:35:59 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id hm11so928073wib.12 for ; Wed, 11 Jul 2012 08:35:59 -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=jmKEVuxPFVFXp0lELQ7fMvUmS2Ahbo5ItZ3WxiY04+M=; b=NpzZYeqCfoUbKwud0xI2QZbs7CgPRs5xniAp9ULL0vtsedXuzv1K2R7xLdeWw0bSza y1hK//NEAyLuostujbrRoKKgSPh1KxgEeCCUYX6h/TpGRZ+Gcq1ZnX7paaDHrPjxrMZ6 /RHWlCeYiEDuwKJFlHvvgdC1cazVI8dAM+vSM= 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=jmKEVuxPFVFXp0lELQ7fMvUmS2Ahbo5ItZ3WxiY04+M=; b=Rypfa97zUwqGt5mdjwwXRfqJzAdRv8P3xBN30nIbp5FMrLk8HqkpRN/f5CMQPkNfNj OwIxVW91IC8mU2AeN8pa5XAu9uTGFuYBpWTCQD9CLVl6CZydc6aJ8Q38YKZsSmOimKCv 6Ec2YnpbOFuiOKn9aqSY0zYy6IpE3FSqM0vhARJr75U+bf9muHAhz6ic0e6mosUMmfgP Ql5VMWBfJo8Fur6Gc+aR3MYtCXL4WMDl6Z9qtQ5tI9+iHJu5g1zdma3gZC09cgVZRisz /qWqpvdPY2O5WG3VXrOZdLsWW1xXJQO0HSpY+LZsHBGd50FMtlw3jsOm5GQV03MvIeq0 qFCw== Received: by 10.180.94.163 with SMTP id dd3mr4947860wib.10.1342020959823; Wed, 11 Jul 2012 08:35:59 -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 bc2sm5777080wib.0.2012.07.11.08.35.58 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 08:35:59 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 11 Jul 2012 16:28:21 +0200 Message-Id: <1342016944-23395-39-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1342016944-23395-1-git-send-email-daniel.vetter@ffwll.ch> References: <1342016944-23395-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQka5WPAT9+Zaoh4QYrR+GokJT8gI1rz4qkHeZG4AuisHXiwQ00ge4T3axMcrEbCwXdzeiu4 Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 38/81] drm/i915/lvds: 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 Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_lvds.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index e3dd7b3..af78502 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -65,6 +65,32 @@ static struct intel_lvds *intel_attached_lvds(struct drm_connector *connector) struct intel_lvds, base); } +static bool intel_lvds_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; + u32 lvds_reg, tmp; + + if (HAS_PCH_SPLIT(dev)) { + lvds_reg = PCH_LVDS; + } else { + lvds_reg = LVDS; + } + + tmp = I915_READ(lvds_reg); + + if (!(tmp & LVDS_PORT_EN)) + return false; + + if (HAS_PCH_CPT(dev)) + *pipe = PORT_TO_PIPE_CPT(tmp); + else + *pipe = PORT_TO_PIPE(tmp); + + return true; +} + /** * Sets the power state for the panel. */ @@ -938,6 +964,8 @@ bool intel_lvds_init(struct drm_device *dev) intel_encoder->enable = intel_enable_lvds; intel_encoder->disable = intel_disable_lvds; + intel_encoder->get_hw_state = intel_lvds_get_hw_state; + intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector_attach_encoder(intel_connector, intel_encoder); intel_encoder->type = INTEL_OUTPUT_LVDS;