From patchwork Tue Jul 16 21:09:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthoine Bourgeois X-Patchwork-Id: 2828476 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 27EBE9F967 for ; Wed, 17 Jul 2013 08:01:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D6EC20145 for ; Wed, 17 Jul 2013 08:01:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 594B52013D for ; Wed, 17 Jul 2013 08:01:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 45B8AE6D3B for ; Wed, 17 Jul 2013 01:01:50 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by gabe.freedesktop.org (Postfix) with ESMTP id 54AC4E663B for ; Tue, 16 Jul 2013 14:06:42 -0700 (PDT) Received: by mail-wg0-f52.google.com with SMTP id b12so1085507wgh.7 for ; Tue, 16 Jul 2013 14:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=EdK2As89uRsuXqOiRGe0ZjMnXdl7OtyV5ykEBqZaBBI=; b=MnkbcWe9ZRhHYhqYsCSpJhZHPerVmvvk2A/Jsp3FSPXmFVHrN9KbRZv+7waNUSrmUH w5pHejggFVfD4y/K7steA/Tt2DQ5Cd7LYH4kGmj1U5gkmVICW5q50WwOkZc0FAVivJbm IgZRs8MCmEVEI5swH3JkImAesY1t65kwZvHBDPQVkymlNByozRKKGy24MAo3t0kxusKy Yith0+zotg0WUhMkr619MDpfVz29tX5gF42fStaf/w8E9Cn1JTxMr8TiPxKtIW4+1LZo 4QBSNe9ZwXxlgEwzXJMOqKm4YZCwADEErLVQ+ANLmnatmqOy3r8aj4+fXhqxu6OlskTh bNjA== X-Received: by 10.194.7.137 with SMTP id j9mr2688398wja.11.1374008801611; Tue, 16 Jul 2013 14:06:41 -0700 (PDT) Received: from gmail.com (cvl92-3-82-247-219-120.fbx.proxad.net. [82.247.219.120]) by mx.google.com with ESMTPSA id nb12sm30548270wic.7.2013.07.16.14.06.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Jul 2013 14:06:40 -0700 (PDT) Date: Tue, 16 Jul 2013 23:09:09 +0200 From: Anthoine Bourgeois To: Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , Jerome Glisse , Anthoine Bourgeois Subject: [PATCH] drm/radeon/dpm: add debugfs support for rs780 Message-ID: <20130716210903.GA4478@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Wed, 17 Jul 2013 00:58:04 -0700 Cc: dri-devel@lists.freedesktop.org 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: , 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=-4.5 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 This allows you to look at the current DPM state via debugfs. Signed-off-by: Anthoine Bourgeois --- drivers/gpu/drm/radeon/radeon_asic.c | 1 + drivers/gpu/drm/radeon/radeon_asic.h | 2 ++ drivers/gpu/drm/radeon/rs780_dpm.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index fea997e..78bec1a 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c @@ -1270,6 +1270,7 @@ static struct radeon_asic rs780_asic = { .get_sclk = &rs780_dpm_get_sclk, .get_mclk = &rs780_dpm_get_mclk, .print_power_state = &rs780_dpm_print_power_state, + .debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level, }, .pflip = { .pre_page_flip = &rs600_pre_page_flip, diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index b04b578..ca18957 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h @@ -433,6 +433,8 @@ u32 rs780_dpm_get_sclk(struct radeon_device *rdev, bool low); u32 rs780_dpm_get_mclk(struct radeon_device *rdev, bool low); void rs780_dpm_print_power_state(struct radeon_device *rdev, struct radeon_ps *ps); +void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, + struct seq_file *m); /* uvd */ int r600_uvd_init(struct radeon_device *rdev); diff --git a/drivers/gpu/drm/radeon/rs780_dpm.c b/drivers/gpu/drm/radeon/rs780_dpm.c index bef832a..ef5a28e 100644 --- a/drivers/gpu/drm/radeon/rs780_dpm.c +++ b/drivers/gpu/drm/radeon/rs780_dpm.c @@ -961,3 +961,31 @@ u32 rs780_dpm_get_mclk(struct radeon_device *rdev, bool low) return pi->bootup_uma_clk; } + +void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, + struct seq_file *m) +{ + struct radeon_ps *rps = rdev->pm.dpm.current_ps; + struct igp_ps *ps = rs780_get_ps(rps); + u32 sclk; + enum rs780_vddc_level vddc; + u32 current_index = r600_power_level_get_current_index(rdev); + + if (current_index > 1) { + seq_printf(m, "invalid dpm profile %d\n", current_index); + } else { + if (current_index == 0) { + sclk = ps->sclk_low; + vddc = rs780_get_voltage_for_vddc_level(rdev, + ps->min_voltage); + } else { /* current_index == 1 */ + sclk = ps->sclk_high; + vddc = rs780_get_voltage_for_vddc_level(rdev, + ps->max_voltage); + } + seq_printf(m, "uvd vclk: %d dclk: %d\n", rps->vclk, rps->dclk); + seq_printf(m, "power level %d sclk: %u mclk: %u vddc: %u\n", + current_index, sclk, + rs780_dpm_get_mclk(rdev, false), vddc); + } +}