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. Add the AMD_PMF_ prefix to the laptop_placement and platform_type enums since these names are overly generic for inclusion in a UAPI header
Showing the changes to include/uapi (1 of 5 files). Show all
Unified · Split
| @@ -42,6 +42,80 @@ · 41 unmodified lines | |||
| 42 | #define AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_AC BIT(3) | 42 | #define AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_AC BIT(3) |
| 43 | #define AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_DC BIT(4) | 43 | #define AMD_PMF_FEAT_DYNAMIC_POWER_SLIDER_DC BIT(4) |
| 44 | 44 | ||
| 45 | /** | ||
| 46 | * enum amd_pmf_laptop_placement - Describes the physical placement of the laptop | ||
| 47 | * @AMD_PMF_LP_UNKNOWN: Placement cannot be determined | ||
| 48 | * @AMD_PMF_ON_TABLE: Laptop is placed on a stable surface like a table or desk | ||
| 49 | * @AMD_PMF_ON_LAP_MOTION: Laptop is on a lap with detected motion | ||
| 50 | * @AMD_PMF_IN_BAG: Laptop is detected to be inside a bag or case | ||
| 51 | * @AMD_PMF_OUT_OF_BAG: Laptop has been removed from bag or case | ||
| 52 | * @AMD_PMF_LP_UNDEFINED: Placement state is undefined | ||
| 53 | * | ||
| 54 | * This enumeration represents the physical placement state of the laptop | ||
| 55 | * as detected by platform sensors. Used for adaptive power management | ||
| 56 | * and thermal policies. | ||
| 57 | */ | ||
| 58 | enum amd_pmf_laptop_placement { | ||
| 59 | AMD_PMF_LP_UNKNOWN, | ||
| 60 | AMD_PMF_ON_TABLE, | ||
| 61 | AMD_PMF_ON_LAP_MOTION, | ||
| 62 | AMD_PMF_IN_BAG, | ||
| 63 | AMD_PMF_OUT_OF_BAG, | ||
| 64 | AMD_PMF_LP_UNDEFINED, | ||
| 65 | }; | ||
| 66 | |||
| 67 | /** | ||
| 68 | * enum amd_pmf_ta_slider - Trusted Application power slider positions | ||
| 69 | * @AMD_PMF_TA_BEST_BATTERY: Maximum battery savings, minimal performance | ||
| 70 | * @AMD_PMF_TA_BETTER_BATTERY: Balanced towards battery life | ||
| 71 | * @AMD_PMF_TA_BETTER_PERFORMANCE: Balanced towards performance | ||
| 72 | * @AMD_PMF_TA_BEST_PERFORMANCE: Maximum performance, higher power consumption | ||
| 73 | * @AMD_PMF_TA_MAX: Sentinel value indicating maximum enum value | ||
| 74 | * | ||
| 75 | * This enumeration defines the power slider positions used by the | ||
| 76 | * AMD PMF Trusted Application for dynamic power management decisions. | ||
| 77 | * These correspond to the Windows power slider UI positions. | ||
| 78 | */ | ||
| 79 | enum amd_pmf_ta_slider { | ||
| 80 | AMD_PMF_TA_BEST_BATTERY, | ||
| 81 | AMD_PMF_TA_BETTER_BATTERY, | ||
| 82 | AMD_PMF_TA_BETTER_PERFORMANCE, | ||
| 83 | AMD_PMF_TA_BEST_PERFORMANCE, | ||
| 84 | AMD_PMF_TA_MAX, | ||
| 85 | }; | ||
| 86 | |||
| 87 | /** | ||
| 88 | * enum amd_pmf_platform_type - Describes the physical form factor orientation | ||
| 89 | * @AMD_PMF_PTYPE_UNKNOWN: Platform type cannot be determined | ||
| 90 | * @AMD_PMF_LID_CLOSE: Laptop lid is closed | ||
| 91 | * @AMD_PMF_CLAMSHELL: Traditional laptop mode with keyboard and screen | ||
| 92 | * @AMD_PMF_FLAT: Device is lying flat on a surface | ||
| 93 | * @AMD_PMF_TENT: Device is in tent mode (keyboard folded back, standing) | ||
| 94 | * @AMD_PMF_STAND: Device is propped up in stand orientation | ||
| 95 | * @AMD_PMF_TABLET: Device is in tablet mode with keyboard hidden | ||
| 96 | * @AMD_PMF_BOOK: Device is in book reading orientation | ||
| 97 | * @AMD_PMF_PRESENTATION: Device is in presentation mode | ||
| 98 | * @AMD_PMF_PULL_FWD: Screen is pulled forward towards user | ||
| 99 | * @AMD_PMF_PTYPE_INVALID: Invalid platform type marker | ||
| 100 | * | ||
| 101 | * This enumeration describes the current physical orientation or form | ||
| 102 | * factor of convertible/2-in-1 devices. Used for optimizing power and | ||
| 103 | * thermal management based on device posture. | ||
| 104 | */ | ||
| 105 | enum amd_pmf_platform_type { | ||
| 106 | AMD_PMF_PTYPE_UNKNOWN, | ||
| 107 | AMD_PMF_LID_CLOSE, | ||
| 108 | AMD_PMF_CLAMSHELL, | ||
| 109 | AMD_PMF_FLAT, | ||
| 110 | AMD_PMF_TENT, | ||
| 111 | AMD_PMF_STAND, | ||
| 112 | AMD_PMF_TABLET, | ||
| 113 | AMD_PMF_BOOK, | ||
| 114 | AMD_PMF_PRESENTATION, | ||
| 115 | AMD_PMF_PULL_FWD, | ||
| 116 | AMD_PMF_PTYPE_INVALID = 0xf, | ||
| 117 | }; | ||
| 118 | |||
| 45 | struct amd_pmf_info { | 119 | struct amd_pmf_info { |
| 46 | __u64 size; | 120 | __u64 size; |
| 47 | 121 | ||