[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a6dc9391-26c9-cb25-44ed-3aab4d528f0@linux.intel.com>
Date: Fri, 27 Oct 2023 16:22:42 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Ai Chao <aichao@...inos.cn>
cc: Hans de Goede <hdegoede@...hat.com>, markgross@...nel.org,
LKML <linux-kernel@...r.kernel.org>,
platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH v5] platform/x86: inspur-platform-profile: Add platform
profile support
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 <aichao@...inos.cn>
> ---
>
> 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.
Powered by blists - more mailing lists