From patchwork Sat Oct 22 07:28:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108730wrr; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ayBMd9CsyhN914TZq9d0JhN+aqU/kX/nGipxlMbpH1ZpOJCuCRHzrc3ser908o+LJi6re X-Received: by 2002:aa7:db01:0:b0:461:4dc9:74e with SMTP id t1-20020aa7db01000000b004614dc9074emr6332231eds.139.1666428354150; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428354; cv=none; d=google.com; s=arc-20160816; b=Bef/qKr9tthcqDwTYG7kHVCz1Fp7pdzt+iWeKBiwkIDCaj+Dp9i2vjTHUzd76VTyZa o6HEVoT8Ntl7j5Zsy5dSdWTd+9k9m9A7q0XseDwUjSOH8IDNt2mWbvWXuzBejbonP3tZ 3ldMuF4ExzaFGzaxgghprRqod9W+oTe97jqfFdFkGsMggv+9CKBVUXwEc3m4CcJpoo0z kAJgyxqMzvttLToyjl13n9FYq3byZe8NMS2Of6xun6dI8QdlWv4Hl4X9QhOEGoHGAp0e oMtmz4R27eMrdMKfN+WPpdTo11iLslVC63ZXQXNr+K24eCeXA4HO9pN1pWj8fH7zDdPo I2Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U3i6e5mz9lTrz0/598WA8qjJGMH8CDQktUCuLIpeUqw=; b=rqwRsU7qDrT2PeH6zoqLQWvYXbFTL9Qz2YFsBNmbj912fGY1rbBoGdiik+K2MV55Sy XB9cdm6IOSCCfPwoHhzzbQSLlgDNnpkSZt1wFmLkCadLZ0q72UAav/Oz5DxyQCzuuBLA Ylkcn8MvchzDI0IZR2/2za8TyVPeKn5FSOaZe/cvMDh4Ydz0stgwrli7Blmy41eBkQm1 5slZq3mp0wwzi4gq978bA2MpKldzS2li+o1kIevjSb0Xh3yi14tlyK7T7bLdWNJfeLGr 0SphoDcWk7U9y7lVknNdFb2gtBJqz46Xh7HJW8KdBt7Xfpae9NtcaAzQKr8Fi2qHzemv f87Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nam186ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a1709060e5400b007835e4733cbsi16891773eji.201.2022.10.22.01.45.29; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nam186ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234623AbiJVInO (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbiJVIlu (ORCPT ); Sat, 22 Oct 2022 04:41:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471982E86F2; Sat, 22 Oct 2022 01:06:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD85660B94; Sat, 22 Oct 2022 08:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3C9AC433C1; Sat, 22 Oct 2022 08:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425782; bh=wLs1MRVkbxT3b8aKqZEYPEL1jHZDMLOF9qfa9pKqlWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nam186kubsL1tYQwvXO9enRMUSP2DdwYyavlVc+JnhraC+fptcdCId0AeqNtNX2LA 1xEvcktzelu0Z5df/RdIUWdmTQtgBXQK/nejBSB95S8m1DsQ9MjbnKOmsWC148w4P/ SQAV2zp2XhPZr93fyKNm5NQxfj2rmc4RIHU3yRpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Lopez , Hans de Goede , Sasha Levin Subject: [PATCH 5.19 614/717] platform/x86: hp-wmi: Setting thermal profile fails with 0x06 Date: Sat, 22 Oct 2022 09:28:13 +0200 Message-Id: <20221022072525.622695236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376778237440529?= X-GMAIL-MSGID: =?utf-8?q?1747376778237440529?= From: Jorge Lopez [ Upstream commit 00b1829294b7c88ecba92c661fbe6fe347b364d2 ] Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module. This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks. Signed-off-by: Jorge Lopez Link: https://lore.kernel.org/r/20220912192603.4001-1-jorge.lopez2@hp.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index bc7020e9df9e..fc8dbbd6fc7c 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 { enum hp_thermal_profile { HP_THERMAL_PROFILE_PERFORMANCE = 0x00, HP_THERMAL_PROFILE_DEFAULT = 0x01, - HP_THERMAL_PROFILE_COOL = 0x02 + HP_THERMAL_PROFILE_COOL = 0x02, + HP_THERMAL_PROFILE_QUIET = 0x03, }; #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW) @@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof, case HP_THERMAL_PROFILE_COOL: *profile = PLATFORM_PROFILE_COOL; break; + case HP_THERMAL_PROFILE_QUIET: + *profile = PLATFORM_PROFILE_QUIET; + break; default: return -EINVAL; } @@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof, case PLATFORM_PROFILE_COOL: tp = HP_THERMAL_PROFILE_COOL; break; + case PLATFORM_PROFILE_QUIET: + tp = HP_THERMAL_PROFILE_QUIET; + break; default: return -EOPNOTSUPP; } @@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void) platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + + set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);