From patchwork Fri Nov 24 09:41:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SungHwan Jung X-Patchwork-Id: 169340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1037761vqx; Fri, 24 Nov 2023 01:42:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHh4JoyMAQnUJwa6sByhvawUx+O8iGE+Mj9PVs1JEh09NQ2MbKZRvykV2cqYKdUg/6hKlwS X-Received: by 2002:a05:6808:309e:b0:3b8:43b6:1e34 with SMTP id bl30-20020a056808309e00b003b843b61e34mr2881600oib.30.1700818979393; Fri, 24 Nov 2023 01:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700818979; cv=none; d=google.com; s=arc-20160816; b=JP9bcUTWBmunMBb9LOA5hSJ2/U2YRcYmbiSihORe99oYtk58eFAbOxZ/jRegxhYsZu U7mUVUDwtHmpbLMmXnVJJsK8hrAf43q9CFmp1g9pT4DIJTLtz2ybBUqnhFD6eBX2YHXs KHeQ20kHTmjCP+uZuG7eoMZAukUPrM2fcD+DLO9QEOS5VTbolYfIduSJVWT70hO1B0EQ imHidbunOxCl+9msmVm6u/qxSipXiGNl/SN7EOY3Z/oMzi9Z29DrsBMAYqPctfu3Outq YkmBHtyqSgy4giQCwsysR1iF/SOUYMKJg1ZU8BzwTeqtsQWDMprGJfxJWdQSyL77WgL6 lMdg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XrmeMWw1USORDmUFPvtwFbLaQiZXCrXNlk5T2YIWwKM=; fh=xHl243xDiT23q9hyTiKsftvq+8y9UCpwfKZetSycd/s=; b=xlXjZbej44jFkT/JlKtAUXlyND32kkzGYpNOJD42aODcbvBkRskLe+DoGiVPX8u+Tm G0bu5cXA948XO5sKk/n8BP2BzVIYElGJG7ymdJs/wGZuhSrOI4nM8wHd6NWJOKyjzAbP CJnCWPjxxYOijoE+wxOzbD9+zSMF5Lo+DyP9XQWbccRxjS2x45YqKKTxgGngYID2NWUk VGClTYJiV/TGPTutUZ7jpByEqT+7s1DFIKp/ctcbuob14S6vXprZXdVavCNZ96yKhgUM wt0E6z6OJF2EzKxXUGhMqjimBjTZ7NlO5dVTK4az7FEvug/uTIfD/1jTSQCt0wf7rjKs VkEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="dN/QIuNk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ca10-20020a056a02068a00b005bdbe26500fsi3369183pgb.550.2023.11.24.01.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:42:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="dN/QIuNk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AFF6F80DD842; Fri, 24 Nov 2023 01:42:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345199AbjKXJmS (ORCPT + 99 others); Fri, 24 Nov 2023 04:42:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235218AbjKXJmM (ORCPT ); Fri, 24 Nov 2023 04:42:12 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD658EA; Fri, 24 Nov 2023 01:42:17 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so1378042b3a.3; Fri, 24 Nov 2023 01:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700818937; x=1701423737; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XrmeMWw1USORDmUFPvtwFbLaQiZXCrXNlk5T2YIWwKM=; b=dN/QIuNkx7iD+gpXnDjr38HtoxogMnUYQIZWq0oclVWLvL6MbceIMmuMrGKW3cGrLc cpMMCp2IJUP6YWfMVQbaM/R8I7lZ66a4jz/p7vxgtOriGPPgkK1tmY46Z0YnhbYOVTPQ kPKBVX85qNLRRZGGT2qvC+LlkjfDQz8QbtiC7Q4xgetNdZY7pXh0s90lHvdmKWv35NXe Bc9ptg7H9zqhBzMCMVLdZSaESY0lGRp77UNFhCPdpug8YvA3YFB5MO9ZNLDSBdRjQN1h ttKqYa4LnxZQw8YbLGhgbyFpkNW/ZmrvGu4GvEsuY6tnT6Mq1EhY3keMFbX7AhCmCyK7 w4fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700818937; x=1701423737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XrmeMWw1USORDmUFPvtwFbLaQiZXCrXNlk5T2YIWwKM=; b=wZvs4IPTfK8UwHlUJ4jQQXQQd766LC4AALscvU2jB4mAStB+nwr8xbq5sCbYuhUcM+ LbYmd0ZL7E3nT9ihNLA1Zcwb+kgToUSbQSHCiP2itxaq9+Loeu0/rN/nYPo2HGxN1aNx TFxs5sOJOI9A4J9iRfOlSyFiAacolXI6WQhVI61nXTSyE1JRr6JeMPSu0yWoJ2NRjTa1 pxO2zuVY5WWx2rUKZDdfNCrW3hEM5lZMVbUojeqeID9X3dSlTEqKZu4FOxQ3Rj6FpFJL dtQ4HbZgcOmQypIzJ7rmxn+vMURiXYZeMKs8O6mrnfJaivaqoNkq2i1U4hahYFE1NyAs GocQ== X-Gm-Message-State: AOJu0Yz1e8iBRq6GnALTz7C74qjlMEq1brg67TKLY8/QlEDS8YQInN1W L7+yTty818OQV4H8ugCUXdU= X-Received: by 2002:a05:6a00:2a09:b0:6cb:d24b:3568 with SMTP id ce9-20020a056a002a0900b006cbd24b3568mr1886667pfb.30.1700818937036; Fri, 24 Nov 2023 01:42:17 -0800 (PST) Received: from localhost.localdomain ([110.46.146.116]) by smtp.gmail.com with ESMTPSA id d10-20020aa7868a000000b006cb8c92a8acsm2489956pfo.113.2023.11.24.01.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:42:16 -0800 (PST) From: SungHwan Jung To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Lee, Chun-Yi" , Jean Delvare , Guenter Roeck Cc: SungHwan Jung , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v4 1/3] platform/x86: acer-wmi: Add platform profile and mode key support for Predator PHN16-71 Date: Fri, 24 Nov 2023 18:41:18 +0900 Message-ID: <20231124094122.100707-2-onenowy@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231124094122.100707-1-onenowy@gmail.com> References: <20231124094122.100707-1-onenowy@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 24 Nov 2023 01:42:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783437962139675944 X-GMAIL-MSGID: 1783437962139675944 The Acer Predator PHN16-71 has the mode key that is used to rotate thermal modes or toggle turbo mode with predator sense app (ver. 4) on windows. This patch includes platform profile and the mode key support for the device and also includes a small fix for "WMI_gaming_execute_u64" function. Signed-off-by: SungHwan Jung --- drivers/platform/x86/acer-wmi.c | 268 +++++++++++++++++++++++++++++++- 1 file changed, 267 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 0e472aa9b..e3650dce0 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -62,9 +63,12 @@ MODULE_LICENSE("GPL"); #define ACER_WMID_SET_GAMING_LED_METHODID 2 #define ACER_WMID_GET_GAMING_LED_METHODID 4 +#define ACER_WMID_GET_GAMING_SYS_INFO_METHODID 5 #define ACER_WMID_SET_GAMING_FAN_BEHAVIOR 14 #define ACER_WMID_SET_GAMING_MISC_SETTING_METHODID 22 +#define ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET 0x54 + /* * Acer ACPI method GUIDs */ @@ -90,6 +94,10 @@ enum acer_wmi_event_ids { WMID_GAMING_TURBO_KEY_EVENT = 0x7, }; +enum acer_wmi_predator_v4_sys_info_command { + ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS = 0x02, +}; + static const struct key_entry acer_wmi_keymap[] __initconst = { {KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */ {KE_KEY, 0x03, {KEY_WLAN} }, /* WiFi */ @@ -232,6 +240,7 @@ struct hotkey_function_type_aa { #define ACER_CAP_TURBO_OC BIT(7) #define ACER_CAP_TURBO_LED BIT(8) #define ACER_CAP_TURBO_FAN BIT(9) +#define ACER_CAP_PLATFORM_PROFILE BIT(10) /* * Interface type flags @@ -259,6 +268,7 @@ static bool ec_raw_mode; static bool has_type_aa; static u16 commun_func_bitmap; static u8 commun_fn_key_number; +static bool cycle_gaming_thermal_profile = true; module_param(mailled, int, 0444); module_param(brightness, int, 0444); @@ -266,12 +276,16 @@ module_param(threeg, int, 0444); module_param(force_series, int, 0444); module_param(force_caps, int, 0444); module_param(ec_raw_mode, bool, 0444); +module_param(cycle_gaming_thermal_profile, bool, 0644); MODULE_PARM_DESC(mailled, "Set initial state of Mail LED"); MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness"); MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware"); MODULE_PARM_DESC(force_series, "Force a different laptop series"); MODULE_PARM_DESC(force_caps, "Force the capability bitmask to this value"); MODULE_PARM_DESC(ec_raw_mode, "Enable EC raw mode"); +MODULE_PARM_DESC( + cycle_gaming_thermal_profile, + "Set thermal mode key in cycle mode. Disabling it sets the mode key in turbo toggle mode"); struct acer_data { int mailled; @@ -321,6 +335,7 @@ struct quirk_entry { u8 turbo; u8 cpu_fans; u8 gpu_fans; + u8 predator_v4; }; static struct quirk_entry *quirks; @@ -336,6 +351,9 @@ static void __init set_quirks(void) if (quirks->turbo) interface->capability |= ACER_CAP_TURBO_OC | ACER_CAP_TURBO_LED | ACER_CAP_TURBO_FAN; + + if (quirks->predator_v4) + interface->capability |= ACER_CAP_PLATFORM_PROFILE; } static int __init dmi_matched(const struct dmi_system_id *dmi) @@ -370,6 +388,11 @@ static struct quirk_entry quirk_acer_predator_ph315_53 = { .gpu_fans = 1, }; +static struct quirk_entry quirk_acer_predator_v4 = { + .predator_v4 = 1, +}; + + /* This AMW0 laptop has no bluetooth */ static struct quirk_entry quirk_medion_md_98300 = { .wireless = 1, @@ -546,6 +569,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = { }, .driver_data = &quirk_acer_predator_ph315_53, }, + { + .callback = dmi_matched, + .ident = "Acer Predator PHN16-71", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Predator PHN16-71"), + }, + .driver_data = &quirk_acer_predator_v4, + }, { .callback = set_force_caps, .ident = "Acer Aspire Switch 10E SW3-016", @@ -659,6 +691,33 @@ static const struct dmi_system_id non_acer_quirks[] __initconst = { {} }; +static struct platform_profile_handler platform_profile_handler; +static bool platform_profile_support; + +/* + * The profile used before turbo mode. This variable is needed for + * returning from turbo mode when the mode key is in toggle mode. + */ +static int last_non_turbo_profile; + +enum acer_predator_v4_thermal_profile_ec { + ACER_PREDATOR_V4_THERMAL_PROFILE_ECO = 0x04, + ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO = 0x03, + ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE = 0x02, + ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x01, + ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x00, +}; + +enum acer_predator_v4_thermal_profile_wmi { + ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI = 0x060B, + ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI = 0x050B, + ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI = 0x040B, + ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI = 0x0B, + ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI = 0x010B, +}; + + + /* Find which quirks are needed for a particular vendor/ model pair */ static void __init find_quirks(void) { @@ -1339,7 +1398,7 @@ WMI_gaming_execute_u64(u32 method_id, u64 in, u64 *out) struct acpi_buffer input = { (acpi_size) sizeof(u64), (void *)(&in) }; struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; - u32 tmp = 0; + u64 tmp = 0; acpi_status status; status = wmi_evaluate_method(WMID_GUID4, 0, method_id, &input, &result); @@ -1698,6 +1757,199 @@ static int acer_toggle_turbo(void) return turbo_led_state; } +static int +acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof, + enum platform_profile_option *profile) +{ + u8 tp; + int err; + + err = ec_read(ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET, &tp); + + if (err < 0) + return err; + + switch (tp) { + case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO: + *profile = PLATFORM_PROFILE_PERFORMANCE; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE: + *profile = PLATFORM_PROFILE_BALANCED_PERFORMANCE; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED: + *profile = PLATFORM_PROFILE_BALANCED; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET: + *profile = PLATFORM_PROFILE_QUIET; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_ECO: + *profile = PLATFORM_PROFILE_LOW_POWER; + break; + default: + return -EOPNOTSUPP; + } + + return 0; +} + +static int +acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, + enum platform_profile_option profile) +{ + int tp; + acpi_status status; + + switch (profile) { + case PLATFORM_PROFILE_PERFORMANCE: + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI; + break; + case PLATFORM_PROFILE_BALANCED_PERFORMANCE: + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI; + break; + case PLATFORM_PROFILE_BALANCED: + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + break; + case PLATFORM_PROFILE_QUIET: + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI; + break; + case PLATFORM_PROFILE_LOW_POWER: + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI; + break; + default: + return -EOPNOTSUPP; + } + + status = WMI_gaming_execute_u64( + ACER_WMID_SET_GAMING_MISC_SETTING_METHODID, tp, NULL); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI) + last_non_turbo_profile = tp; + + return 0; +} + +static int acer_platform_profile_setup(void) +{ + if (quirks->predator_v4) { + int err; + + platform_profile_handler.profile_get = + acer_predator_v4_platform_profile_get; + platform_profile_handler.profile_set = + acer_predator_v4_platform_profile_set; + + set_bit(PLATFORM_PROFILE_PERFORMANCE, + platform_profile_handler.choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, + platform_profile_handler.choices); + set_bit(PLATFORM_PROFILE_BALANCED, + platform_profile_handler.choices); + set_bit(PLATFORM_PROFILE_QUIET, + platform_profile_handler.choices); + set_bit(PLATFORM_PROFILE_LOW_POWER, + platform_profile_handler.choices); + + err = platform_profile_register(&platform_profile_handler); + if (err) + return err; + + platform_profile_support = true; + + /* Set default non-turbo profile */ + last_non_turbo_profile = + ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + } + return 0; +} + +static int acer_thermal_profile_change(void) +{ + /* + * This mode key can rotate each mode or toggle turbo mode. + * On battery, only ECO and BALANCED mode are available. + */ + if (quirks->predator_v4) { + u8 current_tp; + int tp, err; + u64 on_AC; + acpi_status status; + + err = ec_read(ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET, + ¤t_tp); + + if (err < 0) + return err; + + /* Check power source */ + status = WMI_gaming_execute_u64( + ACER_WMID_GET_GAMING_SYS_INFO_METHODID, + ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC); + + if (ACPI_FAILURE(status)) + return -EIO; + + switch (current_tp) { + case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO: + if (!on_AC) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + else if (cycle_gaming_thermal_profile) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI; + else + tp = last_non_turbo_profile; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE: + if (!on_AC) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + else + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED: + if (!on_AC) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI; + else if (cycle_gaming_thermal_profile) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI; + else + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET: + if (!on_AC) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + else if (cycle_gaming_thermal_profile) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + else + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI; + break; + case ACER_PREDATOR_V4_THERMAL_PROFILE_ECO: + if (!on_AC) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI; + else if (cycle_gaming_thermal_profile) + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI; + else + tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI; + break; + default: + return -EOPNOTSUPP; + } + + status = WMI_gaming_execute_u64( + ACER_WMID_SET_GAMING_MISC_SETTING_METHODID, tp, NULL); + + if (ACPI_FAILURE(status)) + return -EIO; + + /* Store non-turbo profile for turbo mode toggle*/ + if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI) + last_non_turbo_profile = tp; + + platform_profile_notify(); + } + + return 0; +} + /* * Switch series keyboard dock status */ @@ -1997,6 +2249,8 @@ static void acer_wmi_notify(u32 value, void *context) case WMID_GAMING_TURBO_KEY_EVENT: if (return_value.key_num == 0x4) acer_toggle_turbo(); + if (return_value.key_num == 0x5 && has_cap(ACER_CAP_PLATFORM_PROFILE)) + acer_thermal_profile_change(); break; default: pr_warn("Unknown function number - %d - %d\n", @@ -2245,6 +2499,12 @@ static int acer_platform_probe(struct platform_device *device) if (err) goto error_rfkill; + if (has_cap(ACER_CAP_PLATFORM_PROFILE)) { + err = acer_platform_profile_setup(); + if (err) + goto error_platform_profile; + } + return err; error_rfkill: @@ -2253,6 +2513,9 @@ static int acer_platform_probe(struct platform_device *device) error_brightness: if (has_cap(ACER_CAP_MAILLED)) acer_led_exit(); +error_platform_profile: + if (platform_profile_support) + platform_profile_remove(); error_mailled: return err; } @@ -2265,6 +2528,9 @@ static void acer_platform_remove(struct platform_device *device) acer_backlight_exit(); acer_rfkill_exit(); + + if (platform_profile_support) + platform_profile_remove(); } #ifdef CONFIG_PM_SLEEP From patchwork Fri Nov 24 09:41:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SungHwan Jung X-Patchwork-Id: 169339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1037645vqx; Fri, 24 Nov 2023 01:42:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEebUDJLfGdmq/dpvd/qQrjVSnVnduo127hSHsIi3tDMpnWOvrVMScE7gcx43pyUS4VCIaa X-Received: by 2002:a17:90b:1e4c:b0:285:262e:6660 with SMTP id pi12-20020a17090b1e4c00b00285262e6660mr2148821pjb.23.1700818967558; Fri, 24 Nov 2023 01:42:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700818967; cv=none; d=google.com; s=arc-20160816; b=JWCfrTzhtkTswLDskkt03ot8kKlKylYPs2KE3DPbtKN5s63eKT8QbP0JRh/+t+IGjy wWOoEBWPZMvisbzKPjfa56aYq8uJR778AjCTbr3YGJGIP8UA6sOaJGeG1ItCuXDS4dia Qo4WXLC5oN462Nyok+K9RwlMoYMRjcHWWvExybqmqShMT0CzM+rAFwdx6rdkQ/eZvBv8 J02sEEWEKvhfH7ln87RSrkCXXSQTOeNoocc6v5tu9zMW13zf4JoDCkP/2nng7HjTP7d7 9nI70PFDEXbO8liLLNGgg+0F4tblWNlfwH0T1zFll9KCvb3wU6N4+7F40wMKLhGps5Qm I8Xg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JF9QdMXKGxlJo/tlvdS6nf0ZE/rvd7pmC2onSppTCRo=; fh=xHl243xDiT23q9hyTiKsftvq+8y9UCpwfKZetSycd/s=; b=Qg4U0XF3zqMGn+NtuPA4ir5E3nPI1i49CtFHdJuRp0rpen49FjNobBjh9x4/KFncpi o/9OQULlYvQaZo1feGRKHBNGhnzPORWK33vcdnGbgXYSje35zB9zjJ4ix4TKzt5Kn7sb 74HD+2DzF2BjgsFa7p5BOrYHNjSeljhP2PbPswtHXUlVm71IbWR+McpXxLEgU1csNgb/ bVFUFkib3K8IVa6Cr5QuNPHADD/duWd3weRnoYJzQkB/F1TcGzxnQQea2K0SQQ5CKQXN tnIj9C0WnZbhQqJpJoOeBhgZTvZmt59GB8NJrCRhCsHyrnJwPqcHQATtE6OG/Ueahnbl doqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bTTONaRb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bj12-20020a17090b088c00b002803c4a0684si3170741pjb.189.2023.11.24.01.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:42:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bTTONaRb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DDB318342FE1; Fri, 24 Nov 2023 01:42:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345276AbjKXJmW (ORCPT + 99 others); Fri, 24 Nov 2023 04:42:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235098AbjKXJmQ (ORCPT ); Fri, 24 Nov 2023 04:42:16 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D69DD7E; Fri, 24 Nov 2023 01:42:22 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6c4d06b6ddaso1459018b3a.3; Fri, 24 Nov 2023 01:42:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700818942; x=1701423742; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JF9QdMXKGxlJo/tlvdS6nf0ZE/rvd7pmC2onSppTCRo=; b=bTTONaRb3SCAhL/CSqFxvvjtX/fuKKtdSs6Ei+Y+FCqUM6Za2YijDlZTwMKmhGVYu/ L5DjLBW4qr+2OdImyqrGIyfpWW3vEZaiWF/qEbti9Ktu25IQ/z9UVDgcSFpwrZ76wylB 1/ExQkrDA1wGHf6Km691s1XlQ2fg7rSBITIdw8MeuK8bhnqVNgpExy6GrVwa8j0mAhLK gvWPiKrr8tLbGuh5lY2boPoZMpw3vqmI1WhOI1NJudIyhoj58UCeO9Yj2e9Gl0iAWmDN 66NgcNd7vAPiRXfF9DhKoPS8PFitbLi5ezace6xoguo0vo4LkyTrv4HWTfea3nxomOX9 d4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700818942; x=1701423742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JF9QdMXKGxlJo/tlvdS6nf0ZE/rvd7pmC2onSppTCRo=; b=mummuGtJA491OZrmbOj6KEHSBT/JtYpqtEe7zlCeiptGS50o+Tp21EdJx0YdqvBSEi rMni4MdBGsQSxui5BiEU6hPUu3IT00iM/Lr0QnOOJDT52VPodPtfCDcsBg+WVaweTfpH ndLNN08JdejGIA0giO+7KpiyppMJIGjtx9wprWkwlo4rw7ZIOCBKvdIUS4yhSKmqm/JK +s9pbNCUw9aytuJqXW6pDJ06hcOivL33excdJVOCn8YJaDwCFAzSpN+Uv0uGd1V2KQLi MfF5CS9zbB23ZXZl+fSJzqmOstfD8W7LCiS0jZbb9Oi5DEFLDyohhlY6RTQuSfaJHH6O X/aQ== X-Gm-Message-State: AOJu0YzGQg9nTbBOrhyzTwwkrswrImLnkqosFq6pd7sH/ZDl3kxrDHYa BjEsiaBYKIepezJv4XJnQhY= X-Received: by 2002:a05:6a00:88f:b0:6b3:f29c:dde1 with SMTP id q15-20020a056a00088f00b006b3f29cdde1mr2075641pfj.21.1700818941687; Fri, 24 Nov 2023 01:42:21 -0800 (PST) Received: from localhost.localdomain ([110.46.146.116]) by smtp.gmail.com with ESMTPSA id d10-20020aa7868a000000b006cb8c92a8acsm2489956pfo.113.2023.11.24.01.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:42:21 -0800 (PST) From: SungHwan Jung To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Lee, Chun-Yi" , Jean Delvare , Guenter Roeck Cc: SungHwan Jung , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v4 2/3] platform/x86: acer-wmi: add fan speed monitoring for Predator PHN16-71 Date: Fri, 24 Nov 2023 18:41:19 +0900 Message-ID: <20231124094122.100707-3-onenowy@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231124094122.100707-1-onenowy@gmail.com> References: <20231124094122.100707-1-onenowy@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 24 Nov 2023 01:42:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783437949401097640 X-GMAIL-MSGID: 1783437949401097640 Support CPU and GPU fan speed monitoring through WMI for Predator PHN16-71. This patch depends on patch "platform/x86: acer-wmi: Add platform profile and mode key support for Predator PHN16-71" Signed-off-by: SungHwan Jung --- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/acer-wmi.c | 104 +++++++++++++++++++++++++++++++- 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 7e69fdacc..caf3f4c6b 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -177,6 +177,7 @@ config ACER_WMI depends on INPUT depends on RFKILL || RFKILL = n depends on ACPI_WMI + depends on HWMON select ACPI_VIDEO select INPUT_SPARSEKMAP select LEDS_CLASS diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index e3650dce0..5e7b9f5d5 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include MODULE_AUTHOR("Carlos Corbacho"); MODULE_DESCRIPTION("Acer Laptop WMI Extras Driver"); @@ -69,6 +71,8 @@ MODULE_LICENSE("GPL"); #define ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET 0x54 +#define ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK GENMASK(20, 8) + /* * Acer ACPI method GUIDs */ @@ -96,6 +100,8 @@ enum acer_wmi_event_ids { enum acer_wmi_predator_v4_sys_info_command { ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS = 0x02, + ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED = 0x0201, + ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED = 0x0601, }; static const struct key_entry acer_wmi_keymap[] __initconst = { @@ -240,7 +246,8 @@ struct hotkey_function_type_aa { #define ACER_CAP_TURBO_OC BIT(7) #define ACER_CAP_TURBO_LED BIT(8) #define ACER_CAP_TURBO_FAN BIT(9) -#define ACER_CAP_PLATFORM_PROFILE BIT(10) +#define ACER_CAP_PLATFORM_PROFILE BIT(10) +#define ACER_CAP_FAN_SPEED_READ BIT(11) /* * Interface type flags @@ -353,7 +360,8 @@ static void __init set_quirks(void) | ACER_CAP_TURBO_FAN; if (quirks->predator_v4) - interface->capability |= ACER_CAP_PLATFORM_PROFILE; + interface->capability |= ACER_CAP_PLATFORM_PROFILE | + ACER_CAP_FAN_SPEED_READ; } static int __init dmi_matched(const struct dmi_system_id *dmi) @@ -1722,6 +1730,26 @@ static int acer_gsensor_event(void) return 0; } +static int acer_get_fan_speed(int fan) +{ + if (quirks->predator_v4) { + acpi_status status; + u64 fanspeed; + + status = WMI_gaming_execute_u64( + ACER_WMID_GET_GAMING_SYS_INFO_METHODID, + fan == 0 ? ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED : + ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED, + &fanspeed); + + if (ACPI_FAILURE(status)) + return -EIO; + + return FIELD_GET(ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK, fanspeed); + } + return -EOPNOTSUPP; +} + /* * Predator series turbo button */ @@ -2476,6 +2504,8 @@ static u32 get_wmid_devices(void) return devices; } +static int acer_wmi_hwmon_init(void); + /* * Platform device */ @@ -2505,6 +2535,9 @@ static int acer_platform_probe(struct platform_device *device) goto error_platform_profile; } + if (has_cap(ACER_CAP_FAN_SPEED_READ)) + err = acer_wmi_hwmon_init(); + return err; error_rfkill: @@ -2617,6 +2650,73 @@ static void __init create_debugfs(void) &interface->debug.wmid_devices); } +static umode_t acer_wmi_hwmon_is_visible(const void *data, + enum hwmon_sensor_types type, u32 attr, + int channel) +{ + switch (type) { + case hwmon_fan: + if (acer_get_fan_speed(channel) >= 0) + return 0444; + break; + default: + return 0; + } + + return 0; +} + +static int acer_wmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + int ret; + + switch (type) { + case hwmon_fan: + ret = acer_get_fan_speed(channel); + if (ret < 0) + return ret; + *val = ret; + break; + default: + return -EOPNOTSUPP; + } + + return 0; +} + +static const struct hwmon_channel_info *const acer_wmi_hwmon_info[] = { + HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT, HWMON_F_INPUT), NULL +}; + +static const struct hwmon_ops acer_wmi_hwmon_ops = { + .read = acer_wmi_hwmon_read, + .is_visible = acer_wmi_hwmon_is_visible, +}; + +static const struct hwmon_chip_info acer_wmi_hwmon_chip_info = { + .ops = &acer_wmi_hwmon_ops, + .info = acer_wmi_hwmon_info, +}; + +static int acer_wmi_hwmon_init(void) +{ + struct device *dev = &acer_platform_device->dev; + struct device *hwmon; + + hwmon = devm_hwmon_device_register_with_info(dev, "acer", + &acer_platform_driver, + &acer_wmi_hwmon_chip_info, + NULL); + + if (IS_ERR(hwmon)) { + dev_err(dev, "Could not register acer hwmon device\n"); + return PTR_ERR(hwmon); + } + + return 0; +} + static int __init acer_wmi_init(void) { int err; From patchwork Fri Nov 24 09:41:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SungHwan Jung X-Patchwork-Id: 169342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp1038655vqx; Fri, 24 Nov 2023 01:44:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFoosBD9Wy8JQ8QGItZqiAxfSyLG4F7PhmWJRvOmwF2uQ7HOYQgZf5zIu2yUB87tL7J9xj X-Received: by 2002:a17:90a:1a:b0:280:5e8:58b1 with SMTP id 26-20020a17090a001a00b0028005e858b1mr2150802pja.33.1700819093720; Fri, 24 Nov 2023 01:44:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700819093; cv=none; d=google.com; s=arc-20160816; b=aFLoA3/6GndyjoYE6CyrcgMfilCMoBz8OrJabpfP/nIkRv7y//NK0D5MH/hW+PNzgF sHaAFMfPKH+k49FWfVvl3YJq614L47kHoL48/I3yQlhaeOAp5BQfrsmo6yWCU6hhFbnC uC7z/0qYzCKlXroVJ5DVCMQdi4lmdCysJTr2AzT8zM9TfgD5IiCi5Rhj40seD71/Lhzh GHqHP80TanpkfFL95WWIHtcza3Csj9inxpIgWtJofG/z12Qn/jTXZd85jYsYkCZaTMwe 0ELWgrGRV7vNEWEzClKHb8TD6WmwtRYGzLnMP4mraLtQCDk0r5s91XVo1tA3HIzbJ5fR GmxQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r+OUSMYnGn8BFclJrDW+f+Az/ps4wVBevgRt7Fipl0c=; fh=xHl243xDiT23q9hyTiKsftvq+8y9UCpwfKZetSycd/s=; b=Ap+Ik+5tsmWE1LwufpbnjAOYqW6W0MN8bmFcOUL66Gt7eHEDlPobsIpkY/1Q5LTmU3 5+xHq+lD4tV7zEUwWEk+TJt7Jf7Ewn3g02Xp1Y/yGRxmqe0qz03jFPx7m6oVU14Zrbp5 qsicavX5vSEJwtDwcbHUu52gJTmF9J71PfqAbSM8b6IoeiNjug+K0NH4fwQwKve9Wdx0 xh0EZPDgkrG6asLzZe5c0R6z8i5JhsjGqIL9dXx8/W9ePRmLQVtnu9MzOdX5Qp/iZLmn n1Qn2iqvGSzcezwFyDxqlrT3W0en+XLtTBpmGuhLbipT4ZyBkM6r6ppZwq8CHgiqIK/K YSKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K8gOyGZB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o21-20020a634e55000000b005b9600b9f4asi3217978pgl.228.2023.11.24.01.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:44:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K8gOyGZB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BE08F8045960; Fri, 24 Nov 2023 01:42:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345326AbjKXJmi (ORCPT + 99 others); Fri, 24 Nov 2023 04:42:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345327AbjKXJmZ (ORCPT ); Fri, 24 Nov 2023 04:42:25 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD4310FF; Fri, 24 Nov 2023 01:42:30 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6c4d06b6ddaso1459103b3a.3; Fri, 24 Nov 2023 01:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700818950; x=1701423750; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r+OUSMYnGn8BFclJrDW+f+Az/ps4wVBevgRt7Fipl0c=; b=K8gOyGZBAVqzbaBdYLxNdBeyDW7MoyCV2nZZ0VV0mCmFrnYBWya5wKEyAv1P9YfERm qKI3SokyIGG0h0mMeFnFChuZuctiUpIP5ilM9fqhzUaPAhx+/AhcEqlblBRJ6bEjoh4C Hwf2YtXzOFO9pfZWCWgY/v7srt7DtQemiarfDM+S7vQ5yayp56QL9BkJhczJe2SYq5RQ 3kYt0966ni1v3g/O/XlpJSLEQLKLd+K11b6C7GvkOYPeYXHi6Mlq9HFP8JuR8GsxcJbk B9jASHghxZbWBp470/Kxa4a2FGl6ODX0QT+mo+TL85YLNglVr99P2Z/suSgimtbFT5+z mBEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700818950; x=1701423750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r+OUSMYnGn8BFclJrDW+f+Az/ps4wVBevgRt7Fipl0c=; b=RBJ78V4HMCit6qcVw2pYbLRE7pXiLF37Q+4hXi9I5RGKHqXTy5y5LzEa42O7jdEiUF cZGcu6l744lt3kLGgR6VHMwB3DOWNoRhRwUiglY4n1EtrhYtQKC38OTW6ZjEj++l7kL6 L4VWQ0P0F7knaRDbqKmbdOz6OWLOvtDulXqWmBUARFd2NK2qnElMpL8LknSet40b3G2E Om0gkjKqPExSPBJ9nHoxYuxhV1din24DyKHmQBfW+gBiwiHrRW5gSjyjJwi3NyGda5ZL 7c9RucWdL/ZkHSC3/p7LbSrHC6kaXWeUY29ktORPgvgDynsIpQQWQx37mu8x7Thtw7e4 +5GA== X-Gm-Message-State: AOJu0YzSQGBkGaUSKncgbaP9JcSbWKm+KYYZ9PuDpzyvNWNgx9sMuZ4P 181HudXF7tEY5BiX9ZJ0GTc= X-Received: by 2002:a05:6a00:88f:b0:6b3:f29c:dde1 with SMTP id q15-20020a056a00088f00b006b3f29cdde1mr2075925pfj.21.1700818950126; Fri, 24 Nov 2023 01:42:30 -0800 (PST) Received: from localhost.localdomain ([110.46.146.116]) by smtp.gmail.com with ESMTPSA id d10-20020aa7868a000000b006cb8c92a8acsm2489956pfo.113.2023.11.24.01.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:42:29 -0800 (PST) From: SungHwan Jung To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Lee, Chun-Yi" , Jean Delvare , Guenter Roeck Cc: SungHwan Jung , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH v4 3/3] platform/x86: acer-wmi: Fix recursive dependency for acer-wmi Date: Fri, 24 Nov 2023 18:41:20 +0900 Message-ID: <20231124094122.100707-4-onenowy@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231124094122.100707-1-onenowy@gmail.com> References: <20231124094122.100707-1-onenowy@gmail.com> MIME-Version: 1.0 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 24 Nov 2023 01:42:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783438082187590274 X-GMAIL-MSGID: 1783438082187590274 "select ACPI_VIDEO" cause recursive dependency when "depends on HWMON" is added. ---build log drivers/hwmon/Kconfig:6:error: recursive dependency detected! drivers/hwmon/Kconfig:6: symbol HWMON is selected by EEEPC_LAPTOP drivers/platform/x86/Kconfig:326: symbol EEEPC_LAPTOP depends on ACPI_VIDEO drivers/acpi/Kconfig:208: symbol ACPI_VIDEO is selected by ACER_WMI drivers/platform/x86/Kconfig:173: symbol ACER_WMI depends on HWMON --- It is not recommended to use "select" for visible symbol, "select" has changed to "depends on". This patch depends on "platform/x86: acer-wmi: add fan speed monitoring for Predator PHN16-71" Signed-off-by: SungHwan Jung --- drivers/platform/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index caf3f4c6b..33ddb644e 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -178,7 +178,7 @@ config ACER_WMI depends on RFKILL || RFKILL = n depends on ACPI_WMI depends on HWMON - select ACPI_VIDEO + depends on ACPI_VIDEO select INPUT_SPARSEKMAP select LEDS_CLASS select NEW_LEDS