From patchwork Wed Jun 26 13:22:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 2786211 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 503B7C0AB1 for ; Wed, 26 Jun 2013 15:09:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36B5A2059F for ; Wed, 26 Jun 2013 15:09:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 019F0205A5 for ; Wed, 26 Jun 2013 15:09:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30C17E6351 for ; Wed, 26 Jun 2013 08:09:54 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f51.google.com (mail-qa0-f51.google.com [209.85.216.51]) by gabe.freedesktop.org (Postfix) with ESMTP id B6CC3E6355 for ; Wed, 26 Jun 2013 06:25:16 -0700 (PDT) Received: by mail-qa0-f51.google.com with SMTP id f11so1499672qae.3 for ; Wed, 26 Jun 2013 06:25:15 -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=MQtMZV1BZNRMVGZZ+d6L1O2Ho1NALXDvS+OCZNuMYWk=; b=O/mzTbsHlzdnn/D/dw4qDrTM4qHx09zNfysxjDfnmF5ceykn7IeYdhyNFi8fbMOhb3 mahnCgbxN8tyzF01oQX1+vt9jlyqkcLW03WFCN08kuFULEJ9pwbKS88MtZBqzGilNDSE U8nmhgdHnDCgmRjCFmoeo86uWWwxRpNoDbFjeU61eqAbScJdN/EX+PT/Awh2ULblM7aX sR17LucqzBf4QIKWbkNGsxx5sH1UvGKHjPWsEbltNN8YTTSmYPAKO8a27udiNP9IMEPo gXY6piiireD81NaQl5Y3nuSJ0CH89WV4uQMA4wAIg8coYLCUya/8NJPT6qyWD3Mm2WSJ Aaow== X-Received: by 10.224.126.196 with SMTP id d4mr5416430qas.57.1372253115925; Wed, 26 Jun 2013 06:25:15 -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:15 -0700 (PDT) From: alexdeucher@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 089/165] drm/radeon/dpm: track whether we are on AC or battery Date: Wed, 26 Jun 2013 09:22:49 -0400 Message-Id: <1372253045-17042-90-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 Driver needs this information to validate power states. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_pm.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5bdb0bd..53aba4f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -1314,6 +1314,7 @@ struct radeon_dpm { u32 tdp_adjustment; u16 load_line_slope; bool power_control; + bool ac_power; /* special states active */ bool thermal_active; bool uvd_active; diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 5987580..9ac261f 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -1218,6 +1218,7 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) mutex_lock(&rdev->pm.mutex); + /* update active crtc counts */ rdev->pm.dpm.new_active_crtcs = 0; rdev->pm.dpm.new_active_crtc_count = 0; list_for_each_entry(crtc, @@ -1229,6 +1230,12 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) } } + /* update battery/ac status */ + if (power_supply_is_system_supplied() > 0) + rdev->pm.dpm.ac_power = true; + else + rdev->pm.dpm.ac_power = false; + radeon_dpm_change_power_state_locked(rdev); mutex_unlock(&rdev->pm.mutex);