Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2967955rdh; Mon, 27 Nov 2023 03:43:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFovVxCbASdk6LUKr6wO67Q5HD/aulivm51RnyfL20ROVOxU6FUdr7Kk2qNPz2r6v0sqKu1 X-Received: by 2002:a05:6a20:8e1f:b0:18b:e5f7:25c5 with SMTP id y31-20020a056a208e1f00b0018be5f725c5mr12581700pzj.11.1701085434624; Mon, 27 Nov 2023 03:43:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701085434; cv=none; d=google.com; s=arc-20160816; b=Jy90+xcTv5zy0kqrJ1Tb7W8LVGt2hJfdt7Bqh/JW6UsEDKqfw33uPT/xMSAS7VcFKq rqFYxcMU1dWUCPL0c4tr5PwX0JoBMSEIQLHGlJG1n/WUmbspmV/+u0oWZkdSIxtVOdBN Mfyo5idDXCspcp35x7eBPZXk7Kg017mgjLhv53G/bHyl5IYrEP10Kb5p1vaMArOX728Y 6OV+mK7kEQ9deoVeO0kueRanWQa8f/blrjZ97lfsB9cNnSxeLH2fyq1Yngdgx6UKwHo1 73wQt1grK5uWU0tow5bIJM/uGjDJxHetpirslY5vtu/IzzAkP3CAXa12KfkvnoXxWASa gTfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=CkOpbKWU2mA/hyWylJke4xZIKkSX936DZIZ1I7bnNmk=; fh=Y/fWb5RPQ76n7a+sjMSmO7321GAV6eLreFXjiR0dwJI=; b=klx7CtPZ0aYF0pFvnsQmiwpCrZjFej5IYeWU+KwPNWYx1tUNLwQh+mF6AevzVHxNMr TemT8WK24EwKb2ex1HA7nQAoVxPthyBeCjIvU1XtB7kSFRlbMg4nOIfC2770Ro94uepk jb2df0xNtzcLbaOxkUAP7CLoLd6sW6ANuTbZWHOEqSgRFmMQ3M+8l70hkmxQn9wtm8XL OABmPUIVfklVKxjYbedqlpj1iUFRmr5jYN13BhvLrPGyQSyDrpMcusHPUPVQ8SpmCrCJ DK7IWgZjbUBCH3sMYyQH/eG/ZACUMRs4zvhgq2wX6aw/OaEQwnVqAkgHxLEBQKcvtLQo 0EfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xc4+zMby; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f22-20020a056a0022d600b006bca1246564si9584957pfj.271.2023.11.27.03.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:43:54 -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=@redhat.com header.s=mimecast20190719 header.b=Xc4+zMby; 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=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 49D82806A42C; Mon, 27 Nov 2023 03:43:53 -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 S233297AbjK0Lnd (ORCPT + 99 others); Mon, 27 Nov 2023 06:43:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233274AbjK0Lnc (ORCPT ); Mon, 27 Nov 2023 06:43:32 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC75A133 for ; Mon, 27 Nov 2023 03:43:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701085418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CkOpbKWU2mA/hyWylJke4xZIKkSX936DZIZ1I7bnNmk=; b=Xc4+zMbylf9zcRMu6cdWjCvRlwcIoqUT0KcNDqzf9q5rdnqvB7hW+49GZQGBq1nuxQybno ttDFGo726DgLqONzauFXP4f4rC8yMNy+s0SxdGBVud7Ss2vQexDRbpZkYN5UndbzxjErj1 xX05X1QQ8zkfzYHxsn4eQsXhG2k12yg= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-uYY2QvfTNv2XhiR2tgrCWw-1; Mon, 27 Nov 2023 06:43:36 -0500 X-MC-Unique: uYY2QvfTNv2XhiR2tgrCWw-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a00dd93a5f1so330930966b.2 for ; Mon, 27 Nov 2023 03:43:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701085415; x=1701690215; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CkOpbKWU2mA/hyWylJke4xZIKkSX936DZIZ1I7bnNmk=; b=hx2gHuEzdsscfvM1SHEq2af1OA+PlTCQhPeJ7v5tc1idJry+hEpOM8HWMB+1rBOryg wvGlXQX+5kA6Lx5nBvtrBmtohpZukofiGUCG+I8s7eJHGQsI0un2j0nyrfzuJUxzfY+R vhvf+6rMj3UCuq1bbOO33CgTeBrj2Wdl/Qci61aM23p/FfzThunJvUX7JZJJNK9ENa2h JK1Qku0pcgq2YqMu4n1Okwc25LApPA+Ez28agYVdEvmVafF/m7hv8Tm2IPlBbWvS2RdV kDY9WG+ZFDWbfVdziDGdVcmEi8BujMgDbI8piMW2KlAKOWURtwsxoqXqPfHqkL5egzQL cpDA== X-Gm-Message-State: AOJu0YyP0h4nT+esqQJ/P/u0cbkcj28q8URvJhB3jgBrP7yFvCynQPuk ci7x41S/rvfvf+I8BKsmbVaPFBCDdY/1pjEUI5tiV1ESLA0dY/xzYZjS8HC4KKZcoW0MSzX9AvN NjkCUcYlfIc0cmN45YUzLqRbw X-Received: by 2002:a17:906:2201:b0:9de:32bb:fa96 with SMTP id s1-20020a170906220100b009de32bbfa96mr7127946ejs.9.1701085415418; Mon, 27 Nov 2023 03:43:35 -0800 (PST) X-Received: by 2002:a17:906:2201:b0:9de:32bb:fa96 with SMTP id s1-20020a170906220100b009de32bbfa96mr7127928ejs.9.1701085415024; Mon, 27 Nov 2023 03:43:35 -0800 (PST) Received: from [10.40.98.142] ([78.108.130.194]) by smtp.gmail.com with ESMTPSA id y22-20020a17090668d600b00a029145bbb9sm5581623ejr.3.2023.11.27.03.43.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Nov 2023 03:43:34 -0800 (PST) Message-ID: Date: Mon, 27 Nov 2023 12:43:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/3] platform/x86: acer-wmi: Add platform profile and mode key support for Predator PHN16-71 Content-Language: en-US To: SungHwan Jung , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , "Lee, Chun-Yi" , Jean Delvare , Guenter Roeck Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org References: <20231124094122.100707-1-onenowy@gmail.com> <20231124094122.100707-2-onenowy@gmail.com> From: Hans de Goede In-Reply-To: <20231124094122.100707-2-onenowy@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,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 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]); Mon, 27 Nov 2023 03:43:53 -0800 (PST) Hi, Thank you for your patch. On 11/24/23 10:41, SungHwan Jung wrote: > 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) When Ilpo set to use tabs for indent here, he meant to do this in this patch too, I have fixed this up while merging the patch. I have also found several places where you separate blocks by multiple empty lines instead of just 1 empty line, I have also fixed this (reducing things to 1 empty line) while applying this. > @@ -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: The error handling here is wrong, on error you need to undo all previous steps, so your error handling needs to add a label above the first (error_rfkill) label and then undo the last step before the platform-profile-setup, specifically call acer_rfkill_exit(); from the new label. IOW the code here should look like this: if (has_cap(ACER_CAP_PLATFORM_PROFILE)) { err = acer_platform_profile_setup(); if (err) goto error_platform_profile; } return err; error_platform_profile: acer_rfkill_exit(); error_rfkill: if (has_cap(ACER_CAP_BRIGHTNESS)) acer_backlight_exit(); ... I have also fixed this up while merging this patch: Thank you for your patch, I've applied this patch to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while. Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window. Regards, Hans