From patchwork Wed Apr 10 17:49:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrik Jakobsson X-Patchwork-Id: 2422691 Return-Path: X-Original-To: patchwork-dri-devel@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 6ED813FD8C for ; Wed, 10 Apr 2013 18:03:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DAF9E62B4 for ; Wed, 10 Apr 2013 11:03:15 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by gabe.freedesktop.org (Postfix) with ESMTP id 58688E6468 for ; Wed, 10 Apr 2013 10:51:06 -0700 (PDT) Received: by mail-lb0-f173.google.com with SMTP id w20so814758lbh.32 for ; Wed, 10 Apr 2013 10:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=ckr7nETpwYcrFxHE+vcsH7VNSDtTgZmrJsBURj8t7D0=; b=Bo5Vc1OaKe3MfomCAJA58JdD0y7CMxcUON1QF4nDQshYBWrwWIKEM/Ob8/wmi4a6RT C3fZnb8bsU7oOGEsXrh88hFYMxVWp0ppMLUuq3LjwfwMhDLjDXoCtw+ReEejKxUlqQ71 9Gw3uIGPjXFWdB2ycWx7ycW7PJ9syccbKEaZ320vbb7ODW8zo/DV1OsMJz+ql01XfM/5 FGhB+mXamlDZTX9WkqBetg5Kcx6akRBy8iAYHXNk0H8wvdS88kZDzPbtR+OhhVZFUGiz S6uc7hXWb3B09FRF7eCyTQcKEul73s9G+26CXUQh4Ejlpx6ten7CD4GJTFlHTR8GsPFj APzQ== X-Received: by 10.112.173.70 with SMTP id bi6mr1676778lbc.116.1365616265434; Wed, 10 Apr 2013 10:51:05 -0700 (PDT) Received: from patrik-desktop.lan (h138n8-oer-a32.ias.bredband.telia.com. [2.248.103.138]) by mx.google.com with ESMTPS id iq6sm309626lab.10.2013.04.10.10.51.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Apr 2013 10:51:04 -0700 (PDT) From: Patrik Jakobsson To: dri-devel@lists.freedesktop.org Subject: [PATCH 14/15] drm/gma500: Fix hibernation problems on sdvo encoders Date: Wed, 10 Apr 2013 19:49:59 +0200 Message-Id: <1365616200-26312-15-git-send-email-patrik.r.jakobsson@gmail.com> X-Mailer: git-send-email 1.7.10.4 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 The state of the SDVO chip is more difficult to save than the LVDS so we do a full mode set on the crtc to get SDVO operational again. The SDVOB/C register is also stored just in case we have special bits set in the future. Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c index a4cc777a..cd1b407 100644 --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c @@ -134,6 +134,9 @@ struct psb_intel_sdvo { /* Input timings for adjusted_mode */ struct psb_intel_sdvo_dtd input_dtd; + + /* Saved SDVO output states */ + uint32_t saveSDVO; /* Can be SDVOB or SDVOC depending on sdvo_reg */ }; struct psb_intel_sdvo_connector { @@ -1830,6 +1833,35 @@ done: #undef CHECK_PROPERTY } +static void psb_intel_sdvo_save(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); + struct psb_intel_sdvo *sdvo = + to_psb_intel_sdvo(&psb_intel_encoder->base); + + sdvo->saveSDVO = REG_READ(sdvo->sdvo_reg); +} + +static void psb_intel_sdvo_restore(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_encoder *encoder = + &psb_intel_attached_encoder(connector)->base; + struct psb_intel_sdvo *sdvo = to_psb_intel_sdvo(encoder); + struct drm_crtc *crtc = encoder->crtc; + + REG_WRITE(sdvo->sdvo_reg, sdvo->saveSDVO); + + /* Force dpms on upon resume */ + psb_intel_sdvo_dpms(encoder, DRM_MODE_DPMS_ON); + + /* Force a full mode set on the crtc. We're supposed to have the + mode_config lock already. */ + drm_crtc_helper_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, NULL); +} + static const struct drm_encoder_helper_funcs psb_intel_sdvo_helper_funcs = { .dpms = psb_intel_sdvo_dpms, .mode_fixup = psb_intel_sdvo_mode_fixup, @@ -1840,6 +1872,8 @@ static const struct drm_encoder_helper_funcs psb_intel_sdvo_helper_funcs = { static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = { .dpms = drm_helper_connector_dpms, + .save = psb_intel_sdvo_save, + .restore = psb_intel_sdvo_restore, .detect = psb_intel_sdvo_detect, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = psb_intel_sdvo_set_property,