From patchwork Wed Jun 26 13:22:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 2786221 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E11F9F245 for ; Wed, 26 Jun 2013 15:10:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 580B4205A5 for ; Wed, 26 Jun 2013 15:10:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 29FE12059F for ; Wed, 26 Jun 2013 15:10:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 17E68E5C33 for ; Wed, 26 Jun 2013 08:10:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180]) by gabe.freedesktop.org (Postfix) with ESMTP id 09CCCE6365 for ; Wed, 26 Jun 2013 06:25:16 -0700 (PDT) Received: by mail-qc0-f180.google.com with SMTP id a1so8087479qcx.25 for ; Wed, 26 Jun 2013 06:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=Jz2XifiYvpQ2N5j64dLLW5kVsFaigAYFoHyudxCGQfs=; b=bqSzqW3cLEf1XEoW+UtpOqe+KXKEbRz6Du4iOm7aMk4x0CyBQ3VlzmffWS/CQWlDeK b+IGiKT7C2gFKsgFPf6n2O/zYK/dYA63xAh6gemzBGEeu26GANsNzMs1dvxsNfx+WkNp Z3C5hR5wpt0MC7hOONLQa17KJUuWdTie7Ro1jn8fjR1wBuNKO6tCEmbT2rCHqdIFkjjg HkB8js+gJ0kCCHoaZhj6uPDN+v8S4R/6gv7uYcsahqdzF9r4nTqsDhze8hycxnQ6BsvF vtWZ6dHIv6q/oNzh3CdUO8yjCWSew8kI/7H7cCno7SjTgqD/wgUWCbxIfnZ2+lO2YRiK eI4w== X-Received: by 10.49.5.133 with SMTP id s5mr4328890qes.96.1372253116547; Wed, 26 Jun 2013 06:25:16 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by mx.google.com with ESMTPSA id r10sm32665096qeu.4.2013.06.26.06.25.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 06:25:16 -0700 (PDT) From: alexdeucher@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 090/165] drm/radeon/dpm: fixup dynamic state adjust for sumo Date: Wed, 26 Jun 2013 09:22:50 -0400 Message-Id: <1372253045-17042-91-git-send-email-alexdeucher@gmail.com> X-Mailer: git-send-email 1.7.7.5 In-Reply-To: <1372253045-17042-1-git-send-email-alexdeucher@gmail.com> References: <1372253045-17042-1-git-send-email-alexdeucher@gmail.com> Cc: Alex Deucher 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 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alex Deucher Use a dedicated copy of the current power state since we may have to adjust it on the fly. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_pm.c | 13 ++++++++++++- drivers/gpu/drm/radeon/sumo_dpm.c | 5 +++++ drivers/gpu/drm/radeon/sumo_dpm.h | 1 + 4 files changed, 19 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 53aba4f..a4d8d97 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -1294,6 +1294,7 @@ struct radeon_dpm { struct radeon_ps *boot_ps; /* default uvd power state */ struct radeon_ps *uvd_ps; + struct radeon_ps hw_ps; enum radeon_pm_state_type state; enum radeon_pm_state_type user_state; u32 platform_caps; diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 9ac261f..7ee8cf6 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -687,6 +687,17 @@ restart_search: return NULL; } +static void radeon_dpm_update_requested_ps(struct radeon_device *rdev, + struct radeon_ps *ps) +{ + /* copy the ps to the hw ps and point the requested ps + * at the hw state in case the driver wants to modify + * the state dynamically. + */ + rdev->pm.dpm.hw_ps = *ps; + rdev->pm.dpm.requested_ps = &rdev->pm.dpm.hw_ps; +} + static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) { int i; @@ -707,7 +718,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) ps = radeon_dpm_pick_power_state(rdev, dpm_state); if (ps) - rdev->pm.dpm.requested_ps = ps; + radeon_dpm_update_requested_ps(rdev, ps); else return; diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c index cef25c4..3805302 100644 --- a/drivers/gpu/drm/radeon/sumo_dpm.c +++ b/drivers/gpu/drm/radeon/sumo_dpm.c @@ -1072,6 +1072,11 @@ static void sumo_apply_state_adjust_rules(struct radeon_device *rdev) u32 sclk_in_sr = pi->sys_info.min_sclk; /* ??? */ u32 i; + /* point to the hw copy since this function will modify the ps */ + pi->hw_ps = *ps; + rdev->pm.dpm.hw_ps.ps_priv = &pi->hw_ps; + ps = &pi->hw_ps; + if (rps->class & ATOM_PPLIB_CLASSIFICATION_THERMAL) return sumo_patch_thermal_state(rdev, ps, current_ps); diff --git a/drivers/gpu/drm/radeon/sumo_dpm.h b/drivers/gpu/drm/radeon/sumo_dpm.h index d041a6c..a40b62a 100644 --- a/drivers/gpu/drm/radeon/sumo_dpm.h +++ b/drivers/gpu/drm/radeon/sumo_dpm.h @@ -129,6 +129,7 @@ struct sumo_power_info { bool enable_dynamic_patch_ps; bool enable_dpm; bool enable_boost; + struct sumo_ps hw_ps; }; #define SUMO_UTC_DFLT_00 0x48