From patchwork Wed Jun 26 13:22:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 2786081 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 439AAC0AB1 for ; Wed, 26 Jun 2013 15:06:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82FA92059F for ; Wed, 26 Jun 2013 15:05:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A2037205A3 for ; Wed, 26 Jun 2013 15:05:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90683E636F for ; Wed, 26 Jun 2013 08:05:56 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f53.google.com (mail-qa0-f53.google.com [209.85.216.53]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E0A1E636B for ; Wed, 26 Jun 2013 06:25:11 -0700 (PDT) Received: by mail-qa0-f53.google.com with SMTP id g10so1517272qah.12 for ; Wed, 26 Jun 2013 06:25:11 -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=VpT7yyGFgsj5J4lMntZEwffJfLI2xVq9X/wNHfsHy9A=; b=HR2L74ZAmrkB+D9znDCJFxB9xHkRNADNzUgVUFUCpLVo1gONuN6oKHVEXKrix8Aqf9 u103VcXZHSWW7BPdTd0AdN6avNHyw6mDR6J3/W2QN0kVUT5lHsWUXPp5Q40BFGEoUyz8 aZ0x7xfF6j+ZfSFfW+mz9L+e4hJmt2VVrQNAK7psf1Edtd4hgREtregsfWzMI+GdNhS4 NIhmONdFuD8CE6MT2oZxgae/ovLcoIXv47F5Q09Mp6NLzCazw8ApvJZi2nfx5rxRPFIG 2lwuUhmewu+VQTTTaXpcSq84YgSR+F1vutg0ywVbnbCrdmo5dfMWi4oYSCsao0dpol18 UPng== X-Received: by 10.49.6.6 with SMTP id w6mr4469697qew.44.1372253111604; Wed, 26 Jun 2013 06:25:11 -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.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 06:25:11 -0700 (PDT) From: alexdeucher@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 083/165] drm/radeon: add dpm UVD handling for r7xx asics Date: Wed, 26 Jun 2013 09:22:43 -0400 Message-Id: <1372253045-17042-84-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 Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/rv770_dpm.c | 34 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/rv770_dpm.h | 2 ++ 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 8ea6d69..42f559a 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c @@ -1427,6 +1427,38 @@ int rv770_set_boot_state(struct radeon_device *rdev) return 0; } +void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev) +{ + struct rv7xx_ps *new_state = rv770_get_ps(rdev->pm.dpm.requested_ps); + struct rv7xx_ps *current_state = rv770_get_ps(rdev->pm.dpm.current_ps); + + if ((rdev->pm.dpm.requested_ps->vclk == rdev->pm.dpm.current_ps->vclk) && + (rdev->pm.dpm.requested_ps->dclk == rdev->pm.dpm.current_ps->dclk)) + return; + + if (new_state->high.sclk >= current_state->high.sclk) + return; + + radeon_set_uvd_clocks(rdev, rdev->pm.dpm.requested_ps->vclk, + rdev->pm.dpm.requested_ps->dclk); +} + +void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev) +{ + struct rv7xx_ps *new_state = rv770_get_ps(rdev->pm.dpm.requested_ps); + struct rv7xx_ps *current_state = rv770_get_ps(rdev->pm.dpm.current_ps); + + if ((rdev->pm.dpm.requested_ps->vclk == rdev->pm.dpm.current_ps->vclk) && + (rdev->pm.dpm.requested_ps->dclk == rdev->pm.dpm.current_ps->dclk)) + return; + + if (new_state->high.sclk < current_state->high.sclk) + return; + + radeon_set_uvd_clocks(rdev, rdev->pm.dpm.requested_ps->vclk, + rdev->pm.dpm.requested_ps->dclk); +} + int rv770_restrict_performance_levels_before_switch(struct radeon_device *rdev) { if (rv770_send_msg_to_smc(rdev, (PPSMC_Msg)(PPSMC_MSG_NoForcedLevel)) != PPSMC_Result_OK) @@ -1950,6 +1982,7 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev) struct rv7xx_power_info *pi = rv770_get_pi(rdev); rv770_restrict_performance_levels_before_switch(rdev); + rv770_set_uvd_clock_before_set_eng_clock(rdev); rv770_halt_smc(rdev); rv770_upload_sw_state(rdev); r7xx_program_memory_timing_parameters(rdev); @@ -1959,6 +1992,7 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev) rv770_set_sw_state(rdev); if (pi->dcodt) rv770_program_dcodt_after_state_switch(rdev); + rv770_set_uvd_clock_after_set_eng_clock(rdev); return 0; } diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h index bd6ea7b..e42c064 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.h +++ b/drivers/gpu/drm/radeon/rv770_dpm.h @@ -262,6 +262,8 @@ int rv770_resume_smc(struct radeon_device *rdev); int rv770_set_sw_state(struct radeon_device *rdev); int rv770_set_boot_state(struct radeon_device *rdev); int rv7xx_parse_power_table(struct radeon_device *rdev); +void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev); +void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev); /* smc */ int rv770_read_smc_soft_register(struct radeon_device *rdev,