Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3823105rwb; Sun, 25 Sep 2022 13:48:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RYCLByevgef7PD73hFEW8zn9M8JF4BodyXBKH8C96Zra9lzhsQbkzWYAIGEiyVF4IBBVI X-Received: by 2002:a17:907:842:b0:731:3310:4187 with SMTP id ww2-20020a170907084200b0073133104187mr14729638ejb.578.1664138930894; Sun, 25 Sep 2022 13:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664138930; cv=none; d=google.com; s=arc-20160816; b=Q0IJUyJM39lBIkYqEmh6QEABcH3YoqKBQlo3rDFlDQsX2Q4ueiKgz8e1yM/9ISCt5D abvDUYzFPyqhMA/j5t2z1eOAC1/aHqjCfpuTbHsDb5aRCUMDBLiBFrSOITUO8kuR33qX QPS9KAB1XRs+vRqtF/B7rHUyx4db9l9AJ4sYi4iqK53y5AT2251rE5Cy/MIVp1zuabZx TVSEEJtQmQNMNPn3cmPN6L2Z0CWTcaAP+0uo7XWRhgQbNx7SWHdHMqC5xho5a5Y3sUd2 QpUtZIbvRhpsHv1V9PyByw6P10E7cXCC7jwn9kbMdaqW0jtI3Es32vYWAbWAKa8KJ0w1 zwbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=IRPOpbRztdIWfoMEyOR5FNdNwTAfeqMezmdLBhrI1Y8=; b=C95taJO4/84u7r7sy4Z3pMRprRCa2j+WoKb7RqJHxHVpBYzOW6DuHZq4GA3FKt+feQ pYUOAABx0InHZpjw9g+OzfxLuXlyq6wQJQq4SvCC+RFnu1D/qFXQZf6WQ9G7TfgLe6yD Micm+qrkTyKiEDsb4lT+l3hik/6QVnA6I9TWRUuSvRYA/hdon3sP6sw7zujuHNGpwOXW zGtFpV/rNvSsyIHohnMX/BZcd5hQfYLx+PfwWNNFIzsKYJl9epQlRJFqEERb0Ma3rPEN xJvsap8Yd8GJNFINyhF3RUZT/GkMhPvZeZF8wSe8SwhGvoSsGQhllBKvY8KZAWZqvAoF B5hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=oTO93ojZ; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020aa7d713000000b0045744c3c3d8si1251724edq.515.2022.09.25.13.48.25; Sun, 25 Sep 2022 13:48:50 -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=fail header.i=@gmail.com header.s=20210112 header.b=oTO93ojZ; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232086AbiIYUnu (ORCPT + 99 others); Sun, 25 Sep 2022 16:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231218AbiIYUnq (ORCPT ); Sun, 25 Sep 2022 16:43:46 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF8929809; Sun, 25 Sep 2022 13:43:45 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id dv25so10259543ejb.12; Sun, 25 Sep 2022 13:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=IRPOpbRztdIWfoMEyOR5FNdNwTAfeqMezmdLBhrI1Y8=; b=oTO93ojZumu65icQuERJ+8LSy3jHGye4u5gcIEciPZolS5siDD0rmq7AzSUi5vBR5t Gh/wHx/TQIWgkjVSbx4VvrAcwXWALY7CmBoniRuWSwOUfB0PmKg4xLk7jV9pyQ/ZGbOR ltwL7OYwhDnu4AKWC9OxvL95A3D6r1TQAZ8AwkqW959qPEyMeHHghB5sVYOFRW9xAT8z NwNsO0E4byzpL9gmBTD7LFlIIXul/fxAiAw1kFR7jlnx7PORzPvZWmXBLl+3/LG8vQT8 fplX8OILLeuwjIKK1pCVmOZFJuqna9MDBce7u2XMBoSqUJM+GlWtcSBv6c5j6WHatZQ6 /XYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=IRPOpbRztdIWfoMEyOR5FNdNwTAfeqMezmdLBhrI1Y8=; b=smG8kn2W7tcrwjQ3Eio1k9igSTYJt/O8PzvxprDM0roiCLa8NoZgnklmlkX4meFi8F LbpAa7ghbsXsXOqNUfwyWS2hxcFPANacSXzEepVSNN/kV2P5jjFniRRr5brAikhvUsb7 /exadXl4Aok/fXhe+RXHQrI3Y5gGI7Wm7Ul1wB1U9kPqc9t0zbH3wOpltefVNhRhmqZP NSWJZIoOGr6vI9NoXy5iqS53zbGzhaiLgB8FcziHHpAG4t7HBEkeGj//RZ6dC7AiWNy1 UrtUzDe9Wcr+9S5xCzAxNaSkMWqsEeWffAVyc5RYO0KpM6RX1FLQ+riwsJ8771JbXPfU swhA== X-Gm-Message-State: ACrzQf2OT9futU76AUFzwvbYNau7h7mm+oNBDncrK81lRC8/phAYjoKF 8fzdTXdG3iVvvRiCNwGnO94IdRzsbxU= X-Received: by 2002:a17:907:1b0e:b0:72f:9b43:b98c with SMTP id mp14-20020a1709071b0e00b0072f9b43b98cmr15550202ejc.710.1664138624180; Sun, 25 Sep 2022 13:43:44 -0700 (PDT) Received: from spectre.. (host-82-61-191-175.retail.telecomitalia.it. [82.61.191.175]) by smtp.gmail.com with ESMTPSA id r10-20020a17090609ca00b0073cb0801104sm7283889eje.147.2022.09.25.13.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 13:43:43 -0700 (PDT) From: Elia Devito Cc: Elia Devito , Philippe Rouquier , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: hp-wmi: add support for quiet thermal profile Date: Sun, 25 Sep 2022 22:42:45 +0200 Message-Id: <20220925204244.53506-1-eliadevito@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The quiet profile is available only on models without dGPU, so we enable it when the device has only one GPU onboard. Signed-off-by: Elia Devito Tested-by: Philippe Rouquier --- drivers/platform/x86/hp-wmi.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index bc7020e9df9e..3e0e67be8001 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; } @@ -1230,6 +1237,8 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof, static int thermal_profile_setup(void) { int err, tp; + unsigned int n_gpu = 0; + const struct dmi_device *dev = NULL; if (is_omen_thermal_profile()) { tp = omen_thermal_profile_get(); @@ -1263,6 +1272,16 @@ 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; + + /* + * The quiet profile is available only on models without dGPU, + * so we enable it when the device has only one GPU onboard. + */ + while ((dev = dmi_find_device(DMI_DEV_TYPE_VIDEO, NULL, dev))) + n_gpu++; + + if (n_gpu == 1) + set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); -- 2.37.2