From patchwork Wed Jun 1 20:53:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9148111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 07E5660757 for ; Wed, 1 Jun 2016 20:53:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFECC200F4 for ; Wed, 1 Jun 2016 20:53:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4CF7268AE; Wed, 1 Jun 2016 20:53:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F6AE200F4 for ; Wed, 1 Jun 2016 20:53:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF7776E28B; Wed, 1 Jun 2016 20:53:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4E3DE6E25E for ; Wed, 1 Jun 2016 20:53:35 +0000 (UTC) Received: by mail-it0-x241.google.com with SMTP id i127so339010ita.3 for ; Wed, 01 Jun 2016 13:53:35 -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:in-reply-to:references; bh=VCu98zIzWKEu+TP6Xb5zNc82G0LOpHac+DY9beJs248=; b=CTbZCIggcADaTGaCFcrJ/kpz5213/Wl1U15OMFhl6N3Ion/e/MIWiMZl+jFKaHPvI0 HfD2zLIDAecGvNpYi+B+6NIcYZT3P9ZXeNxBlw0nhv6phLlCegdQOjizRjen74xnDhao /Ug2dHk9GgtZeRzBZu1gY67um4dqEnI8sS0jI0MLSTAh/uAIkmfnCAiUgO2fdcOcpWsD flk/S7rxkQRcQlFtFon3S3+uJA53LaAkqWLdJWVUgSsbSvjJwCRswjmv9VzgMCzrWBB9 ZtzH1lyEEBuYDha33Ny55EsLOfweTtc0e/O+2oJCLAKyajNWC3eM9PYNAhEdUX0DCYD/ vYyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VCu98zIzWKEu+TP6Xb5zNc82G0LOpHac+DY9beJs248=; b=Oqn1pPTyeN/a5eWFhFBuY5bhO5k0wsCKFSvTH9uhEfZfAjNXIMaQbDUDVp/i3TVAv6 Vezneenr/YmkWxgzwKT+D7Hylv6GRmeYwvST4Bym7Z6jxwk4OZIOX8hb1hCI0YJ2dN88 QWlTUsMYI7ysFkRxNkenLLr/UdBv88zFRsCKkl4KCT3d5OEffijfurRtf/qwb16B/SvH XnAukxXtFk81u06z3lCkffEs6cnPNnA5aHOqtS47DduGHLEdvlNMsj4G6JZuUYNVEna5 ZgQlsnFk34F9dK8Aytcjp8Hw5eGK3JbQimq93o+GVBZQiItj7EhodV91KKzkEdyoH6Ry KOmA== X-Gm-Message-State: ALyK8tKIEQSSd92VRU35xwKMFdsvm3Yc/dV8XddTczc4vHKo/HKW+rACoNobONxjB3UvaA== X-Received: by 10.36.92.199 with SMTP id q190mr8384162itb.25.1464814414336; Wed, 01 Jun 2016 13:53:34 -0700 (PDT) Received: from cm.amd.com ([165.204.55.251]) by smtp.gmail.com with ESMTPSA id x83sm12983532itf.2.2016.06.01.13.53.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2016 13:53:33 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 02/12] drm/amdgpu: clean up atpx power control handling Date: Wed, 1 Jun 2016 16:53:15 -0400 Message-Id: <1464814405-19729-3-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464814405-19729-1-git-send-email-alexander.deucher@amd.com> References: <1464814405-19729-1-git-send-email-alexander.deucher@amd.com> Cc: Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The presence of the power control method should be determined via the presence of the method in function 0. However, some sbioses only set the appropriate bits in function 1 so use then to override a missing power control function. Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 51 ++++++++++++++---------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 3af1c3a..1be2ce4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c @@ -142,18 +142,12 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas */ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) { - /* make sure required functions are enabled */ - /* dGPU power control is required */ - if (atpx->functions.power_cntl == false) { - printk("ATPX dGPU power cntl not present, forcing\n"); - atpx->functions.power_cntl = true; - } + u32 valid_bits = 0; if (atpx->functions.px_params) { union acpi_object *info; struct atpx_px_params output; size_t size; - u32 valid_bits; info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); if (!info) @@ -172,24 +166,37 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) memcpy(&output, info->buffer.pointer, size); valid_bits = output.flags & output.valid_flags; - /* if separate mux flag is set, mux controls are required */ - if (valid_bits & ATPX_SEPARATE_MUX_FOR_I2C) { - atpx->functions.i2c_mux_cntl = true; - atpx->functions.disp_mux_cntl = true; - } - /* if any outputs are muxed, mux controls are required */ - if (valid_bits & (ATPX_CRT1_RGB_SIGNAL_MUXED | - ATPX_TV_SIGNAL_MUXED | - ATPX_DFP_SIGNAL_MUXED)) - atpx->functions.disp_mux_cntl = true; - - if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { - printk("Hybrid Graphics, ATPX dGPU power cntl disabled\n"); - atpx->functions.power_cntl = false; - } kfree(info); } + + /* if separate mux flag is set, mux controls are required */ + if (valid_bits & ATPX_SEPARATE_MUX_FOR_I2C) { + atpx->functions.i2c_mux_cntl = true; + atpx->functions.disp_mux_cntl = true; + } + /* if any outputs are muxed, mux controls are required */ + if (valid_bits & (ATPX_CRT1_RGB_SIGNAL_MUXED | + ATPX_TV_SIGNAL_MUXED | + ATPX_DFP_SIGNAL_MUXED)) + atpx->functions.disp_mux_cntl = true; + + + /* some bioses set these bits rather than flagging power_cntl as supported */ + if (valid_bits & (ATPX_DYNAMIC_PX_SUPPORTED | + ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED)) + atpx->functions.power_cntl = true; + + if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { + printk("Hybrid Graphics, ATPX dGPU power cntl disabled\n"); + atpx->functions.power_cntl = false; + } else if (atpx->functions.power_cntl == false) { + /* make sure required functions are enabled */ + /* dGPU power control is required */ + printk("ATPX dGPU power cntl not present, forcing\n"); + atpx->functions.power_cntl = true; + } + return 0; }