Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1155329rdh; Fri, 27 Oct 2023 06:23:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJ6fb7NdozR2Tm7lgFoAVaFlZFW2W6fXmep/cSR7VqL/jpCALW5uJiGTOWfFbBOrnZGX6/ X-Received: by 2002:a05:6870:2184:b0:1e9:c2bd:f2e9 with SMTP id l4-20020a056870218400b001e9c2bdf2e9mr3211779oae.25.1698413001829; Fri, 27 Oct 2023 06:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698413001; cv=none; d=google.com; s=arc-20160816; b=U9SKp+s2+obze/CgnVZKWKwEa5+k75ZR6Vbo1DQOzjt67ZKHolr1Zy4H8LkfvGUDfd BOmuksCFuQLAQIISa+SwB+/rx7024LEwkTrN+FMBCPXA2L64Y0BpxDP+cc7CNZsSFHsP j99LljLtb5CpuKQ+NSa0aHejkDR+kWd342VyE8tVPIVcJPrH/hkBFRolkMMVX9OoCeI/ shA21oJlZxIEBJDIhvAV/Mp6i4PizwsNI7rY9hDB1Lpcjb0EGH6mvSS74CRcocBhn7IE k6RqBzdW0JcBKq8a+82H8RUNSMzc2arq4WlSAJfGjrAQyTSHnnc16Fthg9bJklEeVmPQ QwLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=RaNU6Ucp3A43pcBCfOtWy0XMgUHNJpaPQqHH3KnQAb0=; fh=pMhTlgBXLM6e4An/848tI8yks88nviZsG02mkkQWyDk=; b=GDw59gxCwCSIV+7Eu67Hbg5Ug5+/fxJpOnz7By196WkWN536sR/3kZOHc6N9Uz00mV HYDCQYTWPCak8qDKWJxSr3tPgazxEp9wzAWQK5mTFmTcM7hMcaUq4cpyzWvJbnlkL8JQ ksQzdpWlPY/dpgNpf4GXJBAgZrQ1OqoxkzQxPZUF5z0fbXEUtIwKSLq/FCyfsDpNoZcp m6L2mIaNyHt0vGrNMmwcu2+ftlctyUbQn9yQ3YaxuSQCawS2+SNowoi9CmWQC21DyyQn 7ffgVs6Bg10Vc/sC9JoOLAI5qe0tMvhQMIHCW96i0HApjxOGmIasHP35qZYILKuLv4V4 Nf1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="IfRV4Fs/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e9-20020a81e949000000b005a7fbac35c5si2729615ywm.451.2023.10.27.06.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 06:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="IfRV4Fs/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E8462832FDBF; Fri, 27 Oct 2023 06:23:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345458AbjJ0NW7 (ORCPT + 99 others); Fri, 27 Oct 2023 09:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjJ0NW5 (ORCPT ); Fri, 27 Oct 2023 09:22:57 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4EF018A; Fri, 27 Oct 2023 06:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698412974; x=1729948974; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=q8RbtznGdq3XlcFBNcvALLjajiJQ2HwAxFk8qehsygo=; b=IfRV4Fs/Sy0Y5al1t5SFe2sfQUeefQg7pLhAW5xk6tfPRemC1c3YpLee VJ4tCMZa7mABt9zyQZ5HEe4OMMOFEdSeYSGbhTdYhIGGMMyGHbmDZKTFe Vpno6b0Z/fTduLlav5QKpfutQSbs7505F5oJ6d9RjOhi2Xy8vsGfeM+yy sgC0+zWvCUybIKlD9T2gDvFE6uFQhjKw0TKj1p6a2cHwQ8fNGIriYMJW9 chx4SmfZWBMP9zAD+JJSkoa6DkEwqiQuaWcue6WjSgKZV1OPgMvT3YS17 A70uZc91z03l4pSLT/lOPh8ODVGQunY/LrP0mxp39CHMvrmA0v+jrxzab g==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="418883580" X-IronPort-AV: E=Sophos;i="6.03,256,1694761200"; d="scan'208";a="418883580" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 06:22:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,256,1694761200"; d="scan'208";a="7228162" Received: from scoltan-mobl.ger.corp.intel.com ([10.252.33.159]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 06:21:22 -0700 Date: Fri, 27 Oct 2023 16:22:42 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Ai Chao cc: Hans de Goede , markgross@kernel.org, LKML , platform-driver-x86@vger.kernel.org Subject: Re: [PATCH v5] platform/x86: inspur-platform-profile: Add platform profile support In-Reply-To: <20231020024007.1677962-1-aichao@kylinos.cn> Message-ID: References: <20231020024007.1677962-1-aichao@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 06:23:09 -0700 (PDT) On Fri, 20 Oct 2023, Ai Chao wrote: > Add support for Inspur platforms to used the platform profile feature. > > This will allow users to determine and control the platform modes > between low-power, balanced and performance modes. > > Signed-off-by: Ai Chao > --- > > v5: Rename inspur-wmi to inspur_platform_profile > v4: Add select ACPI_PLATFORM_PROFILE > v3: Remove input device, using the platform profile interface > v2: Remove Event GUID, remove inspur_wmi_notify and inspur_wmi_notify. > > drivers/platform/x86/Kconfig | 11 + > drivers/platform/x86/Makefile | 3 + > .../platform/x86/inspur_platform_profile.c | 216 ++++++++++++++++++ > 3 files changed, 230 insertions(+) > create mode 100644 drivers/platform/x86/inspur_platform_profile.c > > diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig > index 2a1070543391..7e69fdaccdd5 100644 > --- a/drivers/platform/x86/Kconfig > +++ b/drivers/platform/x86/Kconfig > @@ -988,6 +988,17 @@ config TOUCHSCREEN_DMI > the OS-image for the device. This option supplies the missing info. > Enable this for x86 tablets with Silead or Chipone touchscreens. > > +config INSPUR_PLATFORM_PROFILE > + tristate "Inspur WMI platform profile driver" > + depends on ACPI_WMI > + select ACPI_PLATFORM_PROFILE > + help > + This will allow users to determine and control the platform modes > + between low-power, balanced and performance modes. > + > + To compile this driver as a module, choose M here: the module > + will be called inspur-platform-profile. > + > source "drivers/platform/x86/x86-android-tablets/Kconfig" > > config FW_ATTR_CLASS > diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile > index b457de5abf7d..c7a18e95ad8c 100644 > --- a/drivers/platform/x86/Makefile > +++ b/drivers/platform/x86/Makefile > @@ -98,6 +98,9 @@ obj-$(CONFIG_TOSHIBA_WMI) += toshiba-wmi.o > # before toshiba_acpi initializes > obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o > > +# Inspur > +obj-$(CONFIG_INSPUR_PLATFORM_PROFILE) += inspur_platform_profile.o > + > # Laptop drivers > obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o > obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o > diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c > new file mode 100644 > index 000000000000..6e376cb6d47e > --- /dev/null > +++ b/drivers/platform/x86/inspur_platform_profile.c > +/** > + * Power Mode: > + * 0x0: Balance Mode > + * 0x1: Performance Mode > + * 0x2: Power Saver Mode > + */ > +enum inspur_tmp_profile { > + INSPUR_TMP_PROFILE_BALANCE = 0, > + INSPUR_TMP_PROFILE_PERFORMANCE = 1, > + INSPUR_TMP_PROFILE_POWERSAVE = 2, > +}; > +/** > + * Set Power Mode to EC RAM. If Power Mode value greater than 0x3, > + * return error > + * Method ID: 0x3 > + * Arg: 4 Bytes > + * Byte [0]: Power Mode: > + * 0x0: Balance Mode > + * 0x1: Performance Mode > + * 0x2: Power Saver Mode > + * Return Value: 4 Bytes > + * Byte [0]: Return Code > + * 0x0: No Error > + * 0x1: Error > + */ > +static int inspur_platform_profile_set(struct platform_profile_handler *pprof, > + enum platform_profile_option profile) > +{ > +/** > + * Get Power Mode from EC RAM, If Power Mode value greater than 0x3, > + * return error > + * Method ID: 0x2 > + * Return Value: 4 Bytes > + * Byte [0]: Return Code > + * 0x0: No Error > + * 0x1: Error > + * Byte [1]: Power Mode > + * 0x0: Balance Mode > + * 0x1: Performance Mode > + * 0x2: Power Saver Mode > + */ > +static int inspur_platform_profile_get(struct platform_profile_handler *pprof, > + enum platform_profile_option *profile) > +{ Applied to review-ilpo. I had to remove the kerneldoc markers as the comments above are not consistent with what kerneldoc expects and it triggered a warning. -- i.