Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7151327ybi; Mon, 8 Jul 2019 15:40:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcSU0TvpGp8iLdRWbLTm+BJdbZ00F8sp2TrKSK7mrkq95TChqRhSC+hlhKHO3p9S1G892k X-Received: by 2002:a17:90a:8591:: with SMTP id m17mr21696847pjn.100.1562625647774; Mon, 08 Jul 2019 15:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625647; cv=none; d=google.com; s=arc-20160816; b=b78rUweSMOz12niPYIIMhbfLHZfaDcWRp3vE4PqIr6NMI6UlhBVltsIxcvw+ZgILdp 1vS0MyC5Vfo+UzUXnjloWnc1M8uKIswAjnsXTupWbaoQw2EbBSm7dmOzJX+ootqPPNiX HKXw8mFk5bKG9IijEcU5BBtCuZ0ub4DLXvqWrjOce7quuQEzMxoG3E9389rl40fmC0J8 ogIm1rHM5HAtyVtCAR2GLMZz6ybGg1KK+3oEenu5VkM30ySFzoYgg4Ythr0he+7z4lOw d+3e0j5DC1cjWWPymnkWvI0b4LchPASFG0euIpWD2gIFNVzaCCX9anwOujod8Q5X+74g KfZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ipi74YrWxvJdxFwa2oeDnaGpUcwtm6IAg/yrgV8hrTM=; b=q08kAUjpb9bEcgcF4ov7qVMehJ2y/jWJM/d6EPOOwc5xf0MFUXNeRIflO9CwB/bBuE ryMQsmuROnAIN2UTi4hjku2hN6bl1SyMsxp0zDeN6AnoR8QJcx+SFqBpZ+g2eaLcHeGf X5Idwo0Tev5GY4+7pR3zTOTutWmJEcfqxHVULOtjlcSuMprjxyJ2lmrrZV5Ii7HzhyCH 5sQEL8HtIB9CRg7jwws+EPD3ZhTod262mMNNkOskFnMGBWVsEQk1sHD6wB8Gjvm8PSp+ 0VmlCeneaMRN19R13S6Bo7dDGmJswEPDq2HV+MlyoqQoVycOIpyaV8roMI61lMQvvtqx odkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="x+NdS/49"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si18853654plb.317.2019.07.08.15.40.33; Mon, 08 Jul 2019 15:40:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="x+NdS/49"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390478AbfGHPeL (ORCPT + 99 others); Mon, 8 Jul 2019 11:34:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:36156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732904AbfGHPd7 (ORCPT ); Mon, 8 Jul 2019 11:33:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 898ED20651; Mon, 8 Jul 2019 15:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562600039; bh=CHO/JtLrHSUF6zrWQpzQrrCaKs2c1Yb/LPO0XVE+yO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x+NdS/49S4iSPJYU2t8zvt6CkFvGChvtF4wIfhWRCV66+hgeE5AGZH4Hww1QDzfIM 36tp3f79zxBIZhgSL02X/rIHhQKvARbqaCkIbnV2ySheiNcY8qNEvLtllGcCwR6bUC L+wcfjV73hQ8zxBNZw6kkCvOAHwreNEFixusj2Ok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher , Slava Abramov Subject: [PATCH 5.1 73/96] drm/amd/powerplay: use hardware fan control if no powerplay fan table Date: Mon, 8 Jul 2019 17:13:45 +0200 Message-Id: <20190708150530.399773745@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Evan Quan commit f78c581e22d4b33359ac3462e8d0504735df01f4 upstream. Otherwise, you may get divided-by-zero error or corrput the SMU fan control feature. Signed-off-by: Evan Quan Reviewed-by: Alex Deucher Tested-by: Slava Abramov Acked-by: Slava Abramov Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c | 4 +++- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c @@ -916,8 +916,10 @@ static int init_thermal_controller( PHM_PlatformCaps_ThermalController ); - if (0 == powerplay_table->usFanTableOffset) + if (0 == powerplay_table->usFanTableOffset) { + hwmgr->thermal_controller.use_hw_fan_control = 1; return 0; + } fan_table = (const PPTable_Generic_SubTable_Header *) (((unsigned long)powerplay_table) + --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h @@ -694,6 +694,7 @@ struct pp_thermal_controller_info { uint8_t ucType; uint8_t ucI2cLine; uint8_t ucI2cAddress; + uint8_t use_hw_fan_control; struct pp_fan_info fanInfo; struct pp_advance_fan_control_parameters advanceFanControlParameters; }; --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c @@ -2092,6 +2092,10 @@ static int polaris10_thermal_setup_fan_t return 0; } + /* use hardware fan control */ + if (hwmgr->thermal_controller.use_hw_fan_control) + return 0; + tmp64 = hwmgr->thermal_controller.advanceFanControlParameters. usPWMMin * duty100; do_div(tmp64, 10000);