From patchwork Wed Jun 26 13:23:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 2786561 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 2CE7D9F245 for ; Wed, 26 Jun 2013 15:24:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E2AF2053B for ; Wed, 26 Jun 2013 15:23:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DD70020504 for ; Wed, 26 Jun 2013 15:23:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D3C53E5C33 for ; Wed, 26 Jun 2013 08:23:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f178.google.com (mail-qc0-f178.google.com [209.85.216.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 61B6DE6378 for ; Wed, 26 Jun 2013 06:25:26 -0700 (PDT) Received: by mail-qc0-f178.google.com with SMTP id c11so8238512qcv.9 for ; Wed, 26 Jun 2013 06:25:26 -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=YydWsqQhC6fC2RcEsBFvcTKv23Cgw9cptTgErOkIATY=; b=SqvWdRKzo5cJR0vDS/+W387kI5J97nmU1BFAS9p21kToT3puYB9Jy+cg86/BNQIu4c uPCwTXFaEg/YmGCFa4nbZTP91CNBzVGcCtt05vA5/0HPsQwNZmlaDMifgz4zf4PBFvgM YA0ZUIubcEkbUvH0Pm5ugo0rbfROsgDuhR/apS75OQrz2oGFZ6S2ZSPr3vOUHl7YKI6o 38rHmrNscNNuv4KZodT4LxJPOwDhbuQ5Uy0OGf/bizV1bkOupr7cgDY2G7EGwaGizsYr x0wczFJwzcwPa+zyHgOp4O0mRxWnz0SPssXKnQJ6WgrQfnELfPwMRg4fR/SnQAw2Tgib 7W6A== X-Received: by 10.49.104.180 with SMTP id gf20mr4410353qeb.59.1372253125956; Wed, 26 Jun 2013 06:25:25 -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.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 06:25:25 -0700 (PDT) From: alexdeucher@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 103/165] drm/radeon/dpm: add new pre/post_set_power_state callbacks Date: Wed, 26 Jun 2013 09:23:03 -0400 Message-Id: <1372253045-17042-104-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 Needed to properly handle dynamic state adjustment. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon.h | 4 ++++ drivers/gpu/drm/radeon/radeon_pm.c | 11 +++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 16c7d52..657d224 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -1616,7 +1616,9 @@ struct radeon_asic { void (*setup_asic)(struct radeon_device *rdev); int (*enable)(struct radeon_device *rdev); void (*disable)(struct radeon_device *rdev); + int (*pre_set_power_state)(struct radeon_device *rdev); int (*set_power_state)(struct radeon_device *rdev); + void (*post_set_power_state)(struct radeon_device *rdev); void (*display_configuration_changed)(struct radeon_device *rdev); void (*fini)(struct radeon_device *rdev); u32 (*get_sclk)(struct radeon_device *rdev, bool low); @@ -2326,7 +2328,9 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); #define radeon_dpm_setup_asic(rdev) rdev->asic->dpm.setup_asic((rdev)) #define radeon_dpm_enable(rdev) rdev->asic->dpm.enable((rdev)) #define radeon_dpm_disable(rdev) rdev->asic->dpm.disable((rdev)) +#define radeon_dpm_pre_set_power_state(rdev) rdev->asic->dpm.pre_set_power_state((rdev)) #define radeon_dpm_set_power_state(rdev) rdev->asic->dpm.set_power_state((rdev)) +#define radeon_dpm_post_set_power_state(rdev) rdev->asic->dpm.post_set_power_state((rdev)) #define radeon_dpm_display_configuration_changed(rdev) rdev->asic->dpm.display_configuration_changed((rdev)) #define radeon_dpm_fini(rdev) rdev->asic->dpm.fini((rdev)) #define radeon_dpm_get_sclk(rdev, l) rdev->asic->dpm.get_sclk((rdev), (l)) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 01ff18b..a50efb0 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -703,6 +703,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) int i; struct radeon_ps *ps; enum radeon_pm_state_type dpm_state; + int ret; /* if dpm init failed */ if (!rdev->pm.dpm_enabled) @@ -769,6 +770,12 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) down_write(&rdev->pm.mclk_lock); mutex_lock(&rdev->ring_lock); + if (rdev->asic->dpm.pre_set_power_state) { + ret = radeon_dpm_pre_set_power_state(rdev); + if (ret) + goto done; + } + /* update display watermarks based on new power state */ radeon_bandwidth_update(rdev); /* update displays */ @@ -790,6 +797,10 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) /* update current power state */ rdev->pm.dpm.current_ps = rdev->pm.dpm.requested_ps; + if (rdev->asic->dpm.post_set_power_state) + radeon_dpm_post_set_power_state(rdev); + +done: mutex_unlock(&rdev->ring_lock); up_write(&rdev->pm.mclk_lock); mutex_unlock(&rdev->ddev->struct_mutex);