From patchwork Sun Aug 19 19:12:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1344991 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 D66FA3FC33 for ; Sun, 19 Aug 2012 20:38:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE69FA1030 for ; Sun, 19 Aug 2012 13:38:20 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 06851A1017 for ; Sun, 19 Aug 2012 13:20:48 -0700 (PDT) Received: by mail-wi0-f171.google.com with SMTP id hq4so2753404wib.12 for ; Sun, 19 Aug 2012 13:20:48 -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=LVsYQ8FeSywu2RK8EWz5KeuzyLkfD93jY/nxOE6uOLk=; b=EFdfRMWtKrJ6sidnEKC28VtU/aECxnPCraR9ZKi562AwscE9Db/73zejzXziZkZ4Y0 Mkrmvld6eby0dbEzzf3C/20nUNqFMXJJ4E3wve1W7LOHnkVrOPyzREv1pFODWtfNed0l ckw5B+YRw1QZi2dwCGRUDC1kYUEFwipsXmiPw= 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=LVsYQ8FeSywu2RK8EWz5KeuzyLkfD93jY/nxOE6uOLk=; b=dqAPpNG9y/CpC6q3kw9KCTKazHDs+3bc1O4uyo3RbLuJbV742OU5HUqc/Sr/E0zBfH bhZvVA+wolItiJOxkEm4D3fboZ98fLGBJaLs+xByolmiIxdAlcSrl5N5haAsIcaiUH/T wNLVwI6Bvk9sWrt2Q7rcZFM7FWav5+8KR8EXC0poh3SC/d1Yp4glGRvnLnivBxIavcrR F9MCo8RLLYsDguYAw2Q4wgvv5wo4w7Z1SNa1uW6ziLybAIqI5lVSzZc1Lvql/+hHKA94 G/tROzeoeE6BxzfDTAZxQaKT75Jo0ElmHleEaNOr7+mBmo/l5T3ryTKwycnoUTKVcxt2 maqA== Received: by 10.180.107.2 with SMTP id gy2mr22059366wib.2.1345407648712; Sun, 19 Aug 2012 13:20:48 -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.47 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Aug 2012 13:20:48 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sun, 19 Aug 2012 21:12:43 +0200 Message-Id: <1345403595-9678-27-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: ALoCoQk9ic8GPdEZkclF6MWfLF69Mf9lqUpeTeM88KrzEN2z9/TcQJiU0T7QvBe0f/lo3l75tK9f Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 26/58] 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 Reviewed-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_lvds.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 5fc7abc..52f9e7f 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. */ @@ -937,6 +963,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;