From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org, mario.limonciello@amd.com,
Yijun.Shen@Dell.com, Sanket.Goswami@amd.com
Subject: Re: [PATCH v3 4/7] platform/x86/amd/pmf: Store commonly used enums in the header file
Date: Wed, 25 Mar 2026 15:34:14 +0200 (EET) [thread overview]
Message-ID: <8d9ffaa0-ea3c-b685-95f5-1533bf3e3c2b@linux.intel.com> (raw)
In-Reply-To: <20260301131124.1370565-5-Shyam-sundar.S-k@amd.com>
On Sun, 1 Mar 2026, Shyam Sundar S K wrote:
> Relocate commonly used enums from multiple source files into a shared
> header file to simplify code structure, improve readability, and
> enhance maintainability. Also, remove the initialization of the first
> enum member, since it is not needed.
>
> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
> .../amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 1 +
> drivers/platform/x86/amd/pmf/pmf.h | 22 ------
> drivers/platform/x86/amd/pmf/spc.c | 1 +
> include/linux/amd-pmf-io.h | 9 ---
> include/uapi/linux/amd-pmf.h | 74 +++++++++++++++++++
> 5 files changed, 76 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c
> index 837d59e7a661..d9751c9ebfe8 100644
> --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c
> +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c
> @@ -7,6 +7,7 @@
> *
> * Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> */
> +#include <linux/amd-pmf.h>
> #include <linux/amd-pmf-io.h>
> #include <linux/io-64-nonatomic-lo-hi.h>
> #include <linux/iopoll.h>
> diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
> index 0d879f0fd8e2..f668c0450457 100644
> --- a/drivers/platform/x86/amd/pmf/pmf.h
> +++ b/drivers/platform/x86/amd/pmf/pmf.h
> @@ -681,14 +681,6 @@ enum system_state {
> SYSTEM_STATE_MAX,
> };
>
> -enum ta_slider {
> - TA_BEST_BATTERY,
> - TA_BETTER_BATTERY,
> - TA_BETTER_PERFORMANCE,
> - TA_BEST_PERFORMANCE,
> - TA_MAX,
> -};
> -
> struct amd_pmf_pb_bitmap {
> const char *name;
> u32 bit_mask;
> @@ -720,20 +712,6 @@ static const struct amd_pmf_pb_bitmap custom_bios_inputs_v1[] __used = {
> {"NOTIFY_CUSTOM_BIOS_INPUT10", BIT(16)},
> };
>
> -enum platform_type {
> - PTYPE_UNKNOWN = 0,
> - LID_CLOSE,
> - CLAMSHELL,
> - FLAT,
> - TENT,
> - STAND,
> - TABLET,
> - BOOK,
> - PRESENTATION,
> - PULL_FWD,
> - PTYPE_INVALID = 0xf,
> -};
> -
> /* Command ids for TA communication */
> enum ta_pmf_command {
> TA_PMF_COMMAND_POLICY_BUILDER_INITIALIZE,
> diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c
> index f48678a23cc7..a40419b5e1b7 100644
> --- a/drivers/platform/x86/amd/pmf/spc.c
> +++ b/drivers/platform/x86/amd/pmf/spc.c
> @@ -10,6 +10,7 @@
> */
>
> #include <acpi/button.h>
> +#include <linux/amd-pmf.h>
> #include <linux/amd-pmf-io.h>
> #include <linux/cleanup.h>
> #include <linux/power_supply.h>
> diff --git a/include/linux/amd-pmf-io.h b/include/linux/amd-pmf-io.h
> index 55198d2875cc..e014d4ce5a20 100644
> --- a/include/linux/amd-pmf-io.h
> +++ b/include/linux/amd-pmf-io.h
> @@ -52,15 +52,6 @@ struct amd_sfh_info {
> u32 laptop_placement;
> };
>
> -enum laptop_placement {
> - LP_UNKNOWN = 0,
> - ON_TABLE,
> - ON_LAP_MOTION,
> - IN_BAG,
> - OUT_OF_BAG,
> - LP_UNDEFINED,
> -};
> -
> /**
> * struct amd_pmf_npu_metrics: Get NPU metrics data from PMF driver
> * @npuclk_freq: NPU clock frequency [MHz]
> diff --git a/include/uapi/linux/amd-pmf.h b/include/uapi/linux/amd-pmf.h
> index f34c5d744039..00fab9269238 100644
> --- a/include/uapi/linux/amd-pmf.h
> +++ b/include/uapi/linux/amd-pmf.h
> @@ -32,6 +32,80 @@
> */
> #define IOCTL_PMF_POPULATE_DATA _IOWR(AMD_PMF_IOC_MAGIC, 0x00, struct amd_pmf_ioctl_info)
>
> +/**
> + * enum laptop_placement - Describes the physical placement of the laptop
> + * @LP_UNKNOWN: Placement cannot be determined
> + * @ON_TABLE: Laptop is placed on a stable surface like a table or desk
> + * @ON_LAP_MOTION: Laptop is on a lap with detected motion
> + * @IN_BAG: Laptop is detected to be inside a bag or case
> + * @OUT_OF_BAG: Laptop has been removed from bag or case
> + * @LP_UNDEFINED: Placement state is undefined
> + *
> + * This enumeration represents the physical placement state of the laptop
> + * as detected by platform sensors. Used for adaptive power management
> + * and thermal policies.
> + */
> +enum laptop_placement {
> + LP_UNKNOWN,
> + ON_TABLE,
> + ON_LAP_MOTION,
> + IN_BAG,
> + OUT_OF_BAG,
> + LP_UNDEFINED,
These look way too generic names to be used in an uapi header, so you'll
also need to add a prefix.
> +};
> +
> +/**
> + * enum ta_slider - Trusted Application power slider positions
> + * @TA_BEST_BATTERY: Maximum battery savings, minimal performance
> + * @TA_BETTER_BATTERY: Balanced towards battery life
> + * @TA_BETTER_PERFORMANCE: Balanced towards performance
> + * @TA_BEST_PERFORMANCE: Maximum performance, higher power consumption
> + * @TA_MAX: Sentinel value indicating maximum enum value
> + *
> + * This enumeration defines the power slider positions used by the
> + * AMD PMF Trusted Application for dynamic power management decisions.
> + * These correspond to the Windows power slider UI positions.
> + */
> +enum ta_slider {
> + TA_BEST_BATTERY,
> + TA_BETTER_BATTERY,
> + TA_BETTER_PERFORMANCE,
> + TA_BEST_PERFORMANCE,
> + TA_MAX,
> +};
> +
> +/**
> + * enum platform_type - Describes the physical form factor orientation
> + * @PTYPE_UNKNOWN: Platform type cannot be determined
> + * @LID_CLOSE: Laptop lid is closed
> + * @CLAMSHELL: Traditional laptop mode with keyboard and screen
> + * @FLAT: Device is lying flat on a surface
> + * @TENT: Device is in tent mode (keyboard folded back, standing)
> + * @STAND: Device is propped up in stand orientation
> + * @TABLET: Device is in tablet mode with keyboard hidden
> + * @BOOK: Device is in book reading orientation
> + * @PRESENTATION: Device is in presentation mode
> + * @PULL_FWD: Screen is pulled forward towards user
> + * @PTYPE_INVALID: Invalid platform type marker
> + *
> + * This enumeration describes the current physical orientation or form
> + * factor of convertible/2-in-1 devices. Used for optimizing power and
> + * thermal management based on device posture.
> + */
> +enum platform_type {
> + PTYPE_UNKNOWN,
> + LID_CLOSE,
> + CLAMSHELL,
> + FLAT,
> + TENT,
> + STAND,
> + TABLET,
> + BOOK,
> + PRESENTATION,
> + PULL_FWD,
> + PTYPE_INVALID = 0xf,
These too are too generic names.
> +};
> +
> /**
> * enum pmf_ioctl_id - Control codes for PMF ioctl operations
> * @IOCTL_POWER_SOURCE: Query current power source (AC/DC)
>
--
i.
next prev parent reply other threads:[~2026-03-25 13:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 13:11 [PATCH v3 0/7] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface Shyam Sundar S K
2026-03-01 13:11 ` [PATCH v3 1/7] platform/x86/amd/pmf: Add util layer and userspace misc device interface Shyam Sundar S K
2026-03-01 18:45 ` Randy Dunlap
2026-03-03 15:22 ` Shyam Sundar S K
2026-03-25 13:16 ` Ilpo Järvinen
2026-03-25 13:18 ` Ilpo Järvinen
2026-03-25 14:05 ` Ilpo Järvinen
2026-03-30 12:12 ` Shyam Sundar S K
2026-03-30 15:10 ` Ilpo Järvinen
2026-03-01 13:11 ` [PATCH v3 2/7] platform/x86/amd/pmf: cache BIOS output values for user-space metrics via util IOCTL Shyam Sundar S K
2026-03-25 14:08 ` Ilpo Järvinen
2026-03-01 13:11 ` [PATCH v3 3/7] platform/x86/amd/pmf: Add feature discovery support to util interface Shyam Sundar S K
2026-03-25 14:07 ` Ilpo Järvinen
2026-03-30 11:41 ` Shyam Sundar S K
2026-03-01 13:11 ` [PATCH v3 4/7] platform/x86/amd/pmf: Store commonly used enums in the header file Shyam Sundar S K
2026-03-25 13:34 ` Ilpo Järvinen [this message]
2026-03-01 13:11 ` [PATCH v3 5/7] platform/x86/amd/pmf: Move debug helper functions to UAPI header Shyam Sundar S K
2026-03-25 13:39 ` Ilpo Järvinen
2026-03-30 11:45 ` Shyam Sundar S K
2026-03-01 13:11 ` [PATCH v3 6/7] platform/x86/amd/pmf: Introduce AMD PMF testing tool for driver metrics and features Shyam Sundar S K
2026-03-25 13:54 ` Ilpo Järvinen
2026-03-25 15:07 ` Mario Limonciello
2026-03-26 10:20 ` Ilpo Järvinen
2026-03-30 11:42 ` Shyam Sundar S K
2026-03-01 13:11 ` [PATCH v3 7/7] Documentation/ABI: add testing entry for AMD PMF misc device interface Shyam Sundar S K
2026-03-25 13:58 ` Ilpo Järvinen
2026-03-25 15:08 ` Mario Limonciello
2026-03-26 10:14 ` Ilpo Järvinen
2026-03-02 19:36 ` [PATCH v3 0/7] platform/x86/amd/pmf: Introduce PMF util layer with userspace interface Mario Limonciello
2026-03-03 15:23 ` Shyam Sundar S K
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d9ffaa0-ea3c-b685-95f5-1533bf3e3c2b@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Sanket.Goswami@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=Yijun.Shen@Dell.com \
--cc=hansg@kernel.org \
--cc=mario.limonciello@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox