* [PATCH v4 1/5] platform/x86: acer-wmi: use WMI calls for platform profile handling
2025-01-13 13:14 [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Hridesh MG
@ 2025-01-13 13:14 ` Hridesh MG
2025-01-13 13:14 ` [PATCH v4 2/5] platform/x86: acer-wmi: use new helper function for setting overclocks Hridesh MG
` (4 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Hridesh MG @ 2025-01-13 13:14 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Armin Wolf, Kurt Borja
Cc: platform-driver-x86, linux-kernel, Shuah Khan, Hridesh MG
Improve the platform profile handling by using WMI calls to fetch the
current platform profile instead of directly accessing it from the EC.
This is beneficial because the EC address differs for certain laptops.
Link: https://lore.kernel.org/platform-driver-x86/d7be714c-3103-42ee-ad15-223a3fe67f80@gmx.de/
Co-developed-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Kurt Borja <kuurtb@gmail.com>
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
---
drivers/platform/x86/acer-wmi.c | 185 ++++++++++++++++++++++++++++------------
1 file changed, 129 insertions(+), 56 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index b3043d78a7b38a7b773da5ecd4846ca11e8595f5..97eabb0ec42781a27e6a00ce0df4c8a815c1b817 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -31,6 +31,7 @@
#include <acpi/video.h>
#include <linux/hwmon.h>
#include <linux/units.h>
+#include <linux/unaligned.h>
#include <linux/bitfield.h>
MODULE_AUTHOR("Carlos Corbacho");
@@ -68,8 +69,11 @@ MODULE_LICENSE("GPL");
#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_WMID_GET_GAMING_MISC_SETTING_METHODID 23
-#define ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET 0x54
+#define ACER_GAMING_MISC_SETTING_STATUS_MASK GENMASK_ULL(7, 0)
+#define ACER_GAMING_MISC_SETTING_INDEX_MASK GENMASK_ULL(7, 0)
+#define ACER_GAMING_MISC_SETTING_VALUE_MASK GENMASK_ULL(15, 8)
#define ACER_PREDATOR_V4_RETURN_STATUS_BIT_MASK GENMASK_ULL(7, 0)
#define ACER_PREDATOR_V4_SENSOR_INDEX_BIT_MASK GENMASK_ULL(15, 8)
@@ -115,6 +119,10 @@ enum acer_wmi_predator_v4_sensor_id {
ACER_WMID_SENSOR_GPU_TEMPERATURE = 0x0A,
};
+enum acer_wmi_gaming_misc_setting {
+ ACER_WMID_MISC_SETTING_PLATFORM_PROFILE = 0x000B,
+};
+
static const struct key_entry acer_wmi_keymap[] __initconst = {
{KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */
{KE_KEY, 0x03, {KEY_WLAN} }, /* WiFi */
@@ -751,20 +759,12 @@ static bool platform_profile_support;
*/
static int last_non_turbo_profile;
-enum acer_predator_v4_thermal_profile_ec {
- ACER_PREDATOR_V4_THERMAL_PROFILE_ECO = 0x04,
- ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO = 0x03,
- ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE = 0x02,
- ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x01,
- ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x00,
-};
-
-enum acer_predator_v4_thermal_profile_wmi {
- ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI = 0x060B,
- ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI = 0x050B,
- ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI = 0x040B,
- ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI = 0x0B,
- ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI = 0x010B,
+enum acer_predator_v4_thermal_profile {
+ ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x00,
+ ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x01,
+ ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE = 0x04,
+ ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO = 0x05,
+ ACER_PREDATOR_V4_THERMAL_PROFILE_ECO = 0x06,
};
/* Find which quirks are needed for a particular vendor/ model pair */
@@ -1477,6 +1477,45 @@ WMI_gaming_execute_u64(u32 method_id, u64 in, u64 *out)
return status;
}
+static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)
+{
+ struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL };
+ struct acpi_buffer input = {
+ .length = sizeof(in),
+ .pointer = &in,
+ };
+ union acpi_object *obj;
+ acpi_status status;
+ int ret = 0;
+
+ status = wmi_evaluate_method(WMID_GUID4, 0, method_id, &input, &result);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ obj = result.pointer;
+ if (obj && out) {
+ switch (obj->type) {
+ case ACPI_TYPE_INTEGER:
+ *out = obj->integer.value;
+ break;
+ case ACPI_TYPE_BUFFER:
+ if (obj->buffer.length < sizeof(*out))
+ ret = -ENOMSG;
+ else
+ *out = get_unaligned_le64(obj->buffer.pointer);
+
+ break;
+ default:
+ ret = -ENOMSG;
+ break;
+ }
+ }
+
+ kfree(obj);
+
+ return ret;
+}
+
static acpi_status WMID_gaming_set_u64(u64 value, u32 cap)
{
u32 method_id = 0;
@@ -1565,6 +1604,48 @@ static void WMID_gaming_set_fan_mode(u8 fan_mode)
WMID_gaming_set_u64(gpu_fan_config2 | gpu_fan_config1 << 16, ACER_CAP_TURBO_FAN);
}
+static int WMID_gaming_set_misc_setting(enum acer_wmi_gaming_misc_setting setting, u8 value)
+{
+ acpi_status status;
+ u64 input = 0;
+ u64 result;
+
+ input |= FIELD_PREP(ACER_GAMING_MISC_SETTING_INDEX_MASK, setting);
+ input |= FIELD_PREP(ACER_GAMING_MISC_SETTING_VALUE_MASK, value);
+
+ status = WMI_gaming_execute_u64(ACER_WMID_SET_GAMING_MISC_SETTING_METHODID, input, &result);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ /* The return status must be zero for the operation to have succeeded */
+ if (FIELD_GET(ACER_GAMING_MISC_SETTING_STATUS_MASK, result))
+ return -EIO;
+
+ return 0;
+}
+
+static int WMID_gaming_get_misc_setting(enum acer_wmi_gaming_misc_setting setting, u8 *value)
+{
+ u64 input = 0;
+ u64 result;
+ int ret;
+
+ input |= FIELD_PREP(ACER_GAMING_MISC_SETTING_INDEX_MASK, setting);
+
+ ret = WMI_gaming_execute_u32_u64(ACER_WMID_GET_GAMING_MISC_SETTING_METHODID, input,
+ &result);
+ if (ret < 0)
+ return ret;
+
+ /* The return status must be zero for the operation to have succeeded */
+ if (FIELD_GET(ACER_GAMING_MISC_SETTING_STATUS_MASK, result))
+ return -EIO;
+
+ *value = FIELD_GET(ACER_GAMING_MISC_SETTING_VALUE_MASK, result);
+
+ return 0;
+}
+
/*
* Generic Device (interface-independent)
*/
@@ -1833,9 +1914,8 @@ acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof,
u8 tp;
int err;
- err = ec_read(ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET, &tp);
-
- if (err < 0)
+ err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, &tp);
+ if (err)
return err;
switch (tp) {
@@ -1865,36 +1945,33 @@ static int
acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
enum platform_profile_option profile)
{
- int tp;
- acpi_status status;
+ int err, tp;
switch (profile) {
case PLATFORM_PROFILE_PERFORMANCE:
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
break;
case PLATFORM_PROFILE_BALANCED_PERFORMANCE:
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
break;
case PLATFORM_PROFILE_BALANCED:
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
break;
case PLATFORM_PROFILE_QUIET:
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
break;
case PLATFORM_PROFILE_LOW_POWER:
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
break;
default:
return -EOPNOTSUPP;
}
- status = WMI_gaming_execute_u64(
- ACER_WMID_SET_GAMING_MISC_SETTING_METHODID, tp, NULL);
-
- if (ACPI_FAILURE(status))
- return -EIO;
+ err = WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
+ if (err)
+ return err;
- if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI)
+ if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
last_non_turbo_profile = tp;
return 0;
@@ -1931,7 +2008,7 @@ static int acer_platform_profile_setup(struct platform_device *device)
/* Set default non-turbo profile */
last_non_turbo_profile =
- ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
}
return 0;
}
@@ -1946,12 +2023,10 @@ static int acer_thermal_profile_change(void)
u8 current_tp;
int tp, err;
u64 on_AC;
- acpi_status status;
-
- err = ec_read(ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET,
- ¤t_tp);
- if (err < 0)
+ err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE,
+ ¤t_tp);
+ if (err)
return err;
/* Check power source */
@@ -1962,54 +2037,52 @@ static int acer_thermal_profile_change(void)
switch (current_tp) {
case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO:
if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
else
tp = last_non_turbo_profile;
break;
case ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE:
if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
break;
case ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED:
if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
break;
case ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET:
if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
break;
case ACER_PREDATOR_V4_THERMAL_PROFILE_ECO:
if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI;
+ tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
break;
default:
return -EOPNOTSUPP;
}
- status = WMI_gaming_execute_u64(
- ACER_WMID_SET_GAMING_MISC_SETTING_METHODID, tp, NULL);
-
- if (ACPI_FAILURE(status))
- return -EIO;
+ err = WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
+ if (err)
+ return err;
/* Store non-turbo profile for turbo mode toggle*/
- if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO_WMI)
+ if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
last_non_turbo_profile = tp;
platform_profile_notify(&platform_profile_handler);
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v4 2/5] platform/x86: acer-wmi: use new helper function for setting overclocks
2025-01-13 13:14 [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Hridesh MG
2025-01-13 13:14 ` [PATCH v4 1/5] platform/x86: acer-wmi: use WMI calls for " Hridesh MG
@ 2025-01-13 13:14 ` Hridesh MG
2025-01-13 13:14 ` [PATCH v4 3/5] platform/x86: acer-wmi: simplify platform profile cycling Hridesh MG
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Hridesh MG @ 2025-01-13 13:14 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Armin Wolf, Kurt Borja
Cc: platform-driver-x86, linux-kernel, Shuah Khan, Hridesh MG
Migrate the OC handling in acer_toggle_turbo() to the new helper
function for issuing the SetGamingMiscSetting WMI call.
Reviewed-by: Kurt Borja <kuurtb@gmail.com>
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
---
drivers/platform/x86/acer-wmi.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 97eabb0ec42781a27e6a00ce0df4c8a815c1b817..f662e3740408f70e1e921a90fe75ce441fd239d0 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -119,7 +119,14 @@ enum acer_wmi_predator_v4_sensor_id {
ACER_WMID_SENSOR_GPU_TEMPERATURE = 0x0A,
};
+enum acer_wmi_predator_v4_oc {
+ ACER_WMID_OC_NORMAL = 0x0000,
+ ACER_WMID_OC_TURBO = 0x0002,
+};
+
enum acer_wmi_gaming_misc_setting {
+ ACER_WMID_MISC_SETTING_OC_1 = 0x0005,
+ ACER_WMID_MISC_SETTING_OC_2 = 0x0007,
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE = 0x000B,
};
@@ -1530,9 +1537,6 @@ static acpi_status WMID_gaming_set_u64(u64 value, u32 cap)
case ACER_CAP_TURBO_FAN:
method_id = ACER_WMID_SET_GAMING_FAN_BEHAVIOR;
break;
- case ACER_CAP_TURBO_OC:
- method_id = ACER_WMID_SET_GAMING_MISC_SETTING_METHODID;
- break;
default:
return AE_BAD_PARAMETER;
}
@@ -1891,8 +1895,12 @@ static int acer_toggle_turbo(void)
WMID_gaming_set_fan_mode(0x1);
/* Set OC to normal */
- WMID_gaming_set_u64(0x5, ACER_CAP_TURBO_OC);
- WMID_gaming_set_u64(0x7, ACER_CAP_TURBO_OC);
+ if (has_cap(ACER_CAP_TURBO_OC)) {
+ WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_OC_1,
+ ACER_WMID_OC_NORMAL);
+ WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_OC_2,
+ ACER_WMID_OC_NORMAL);
+ }
} else {
/* Turn on turbo led */
WMID_gaming_set_u64(0x10001, ACER_CAP_TURBO_LED);
@@ -1901,8 +1909,12 @@ static int acer_toggle_turbo(void)
WMID_gaming_set_fan_mode(0x2);
/* Set OC to turbo mode */
- WMID_gaming_set_u64(0x205, ACER_CAP_TURBO_OC);
- WMID_gaming_set_u64(0x207, ACER_CAP_TURBO_OC);
+ if (has_cap(ACER_CAP_TURBO_OC)) {
+ WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_OC_1,
+ ACER_WMID_OC_TURBO);
+ WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_OC_2,
+ ACER_WMID_OC_TURBO);
+ }
}
return turbo_led_state;
}
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v4 3/5] platform/x86: acer-wmi: simplify platform profile cycling
2025-01-13 13:14 [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Hridesh MG
2025-01-13 13:14 ` [PATCH v4 1/5] platform/x86: acer-wmi: use WMI calls for " Hridesh MG
2025-01-13 13:14 ` [PATCH v4 2/5] platform/x86: acer-wmi: use new helper function for setting overclocks Hridesh MG
@ 2025-01-13 13:14 ` Hridesh MG
2025-01-14 3:52 ` Kurt Borja
2025-01-13 13:14 ` [PATCH v4 4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices Hridesh MG
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Hridesh MG @ 2025-01-13 13:14 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Armin Wolf, Kurt Borja
Cc: platform-driver-x86, linux-kernel, Shuah Khan, Hridesh MG
Make use of platform_profile_cycle() to simplify the logic used for
cycling through the different platform profiles. Also remove the
unnecessary handling for AC power, as the hardware accepts different
profiles regardless of whether AC is plugged in.
Link: https://lore.kernel.org/platform-driver-x86/20e3ac66-b040-49a9-ab00-0adcfdaed2ff@gmx.de/
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
---
drivers/platform/x86/acer-wmi.c | 78 ++++++++++-------------------------------
1 file changed, 19 insertions(+), 59 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index f662e3740408f70e1e921a90fe75ce441fd239d0..88416c37eca0af2099b0c8d91b38912a4e5d108f 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2028,76 +2028,36 @@ static int acer_platform_profile_setup(struct platform_device *device)
static int acer_thermal_profile_change(void)
{
/*
- * This mode key can rotate each mode or toggle turbo mode.
- * On battery, only ECO and BALANCED mode are available.
+ * This mode key will either cycle through each mode or toggle the turbo profile.
*/
if (quirks->predator_v4) {
u8 current_tp;
- int tp, err;
- u64 on_AC;
+ int err, tp;
- err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE,
- ¤t_tp);
- if (err)
- return err;
-
- /* Check power source */
- err = WMID_gaming_get_sys_info(ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC);
- if (err < 0)
- return err;
+ if (cycle_gaming_thermal_profile) {
+ platform_profile_cycle();
+ } else {
+ err = WMID_gaming_get_misc_setting(
+ ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, ¤t_tp);
+ if (err)
+ return err;
- switch (current_tp) {
- case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO:
- if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
- else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
- else
+ if (current_tp == ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
tp = last_non_turbo_profile;
- break;
- case ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE:
- if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
- else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
- break;
- case ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED:
- if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
- else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
- else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
- break;
- case ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET:
- if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
- else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
- else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
- break;
- case ACER_PREDATOR_V4_THERMAL_PROFILE_ECO:
- if (!on_AC)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
- else if (cycle_gaming_thermal_profile)
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
else
tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
- break;
- default:
- return -EOPNOTSUPP;
- }
- err = WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
- if (err)
- return err;
+ err = WMID_gaming_set_misc_setting(
+ ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
+ if (err)
+ return err;
- /* Store non-turbo profile for turbo mode toggle*/
- if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
- last_non_turbo_profile = tp;
+ /* Store last profile for toggle */
+ if (current_tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
+ last_non_turbo_profile = current_tp;
- platform_profile_notify(&platform_profile_handler);
+ platform_profile_notify(&platform_profile_handler);
+ }
}
return 0;
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 3/5] platform/x86: acer-wmi: simplify platform profile cycling
2025-01-13 13:14 ` [PATCH v4 3/5] platform/x86: acer-wmi: simplify platform profile cycling Hridesh MG
@ 2025-01-14 3:52 ` Kurt Borja
0 siblings, 0 replies; 13+ messages in thread
From: Kurt Borja @ 2025-01-14 3:52 UTC (permalink / raw)
To: Hridesh MG
Cc: Hans de Goede, Ilpo Järvinen, Armin Wolf,
platform-driver-x86, linux-kernel, Shuah Khan
On Mon, Jan 13, 2025 at 06:44:11PM +0530, Hridesh MG wrote:
> Make use of platform_profile_cycle() to simplify the logic used for
> cycling through the different platform profiles. Also remove the
> unnecessary handling for AC power, as the hardware accepts different
> profiles regardless of whether AC is plugged in.
>
> Link: https://lore.kernel.org/platform-driver-x86/20e3ac66-b040-49a9-ab00-0adcfdaed2ff@gmx.de/
> Signed-off-by: Hridesh MG <hridesh699@gmail.com>
Reviewed-by: Kurt Borja <kuurtb@gmail.com>
> ---
> drivers/platform/x86/acer-wmi.c | 78 ++++++++++-------------------------------
> 1 file changed, 19 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index f662e3740408f70e1e921a90fe75ce441fd239d0..88416c37eca0af2099b0c8d91b38912a4e5d108f 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2028,76 +2028,36 @@ static int acer_platform_profile_setup(struct platform_device *device)
> static int acer_thermal_profile_change(void)
> {
> /*
> - * This mode key can rotate each mode or toggle turbo mode.
> - * On battery, only ECO and BALANCED mode are available.
> + * This mode key will either cycle through each mode or toggle the turbo profile.
> */
> if (quirks->predator_v4) {
> u8 current_tp;
> - int tp, err;
> - u64 on_AC;
> + int err, tp;
>
> - err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE,
> - ¤t_tp);
> - if (err)
> - return err;
> -
> - /* Check power source */
> - err = WMID_gaming_get_sys_info(ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC);
> - if (err < 0)
> - return err;
> + if (cycle_gaming_thermal_profile) {
> + platform_profile_cycle();
> + } else {
> + err = WMID_gaming_get_misc_setting(
> + ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, ¤t_tp);
> + if (err)
> + return err;
>
> - switch (current_tp) {
> - case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO:
> - if (!on_AC)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> - else if (cycle_gaming_thermal_profile)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
> - else
> + if (current_tp == ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
> tp = last_non_turbo_profile;
> - break;
> - case ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE:
> - if (!on_AC)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> - else
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> - break;
> - case ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED:
> - if (!on_AC)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
> - else if (cycle_gaming_thermal_profile)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
> - else
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> - break;
> - case ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET:
> - if (!on_AC)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> - else if (cycle_gaming_thermal_profile)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> - else
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> - break;
> - case ACER_PREDATOR_V4_THERMAL_PROFILE_ECO:
> - if (!on_AC)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> - else if (cycle_gaming_thermal_profile)
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
> else
> tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> - break;
> - default:
> - return -EOPNOTSUPP;
> - }
>
> - err = WMID_gaming_set_misc_setting(ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
> - if (err)
> - return err;
> + err = WMID_gaming_set_misc_setting(
> + ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
> + if (err)
> + return err;
>
> - /* Store non-turbo profile for turbo mode toggle*/
> - if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
> - last_non_turbo_profile = tp;
> + /* Store last profile for toggle */
> + if (current_tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
> + last_non_turbo_profile = current_tp;
>
> - platform_profile_notify(&platform_profile_handler);
> + platform_profile_notify(&platform_profile_handler);
> + }
> }
>
> return 0;
>
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices
2025-01-13 13:14 [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Hridesh MG
` (2 preceding siblings ...)
2025-01-13 13:14 ` [PATCH v4 3/5] platform/x86: acer-wmi: simplify platform profile cycling Hridesh MG
@ 2025-01-13 13:14 ` Hridesh MG
2025-01-14 3:53 ` Kurt Borja
2025-01-13 13:14 ` [PATCH v4 5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58 Hridesh MG
2025-01-15 14:37 ` [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Ilpo Järvinen
5 siblings, 1 reply; 13+ messages in thread
From: Hridesh MG @ 2025-01-13 13:14 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Armin Wolf, Kurt Borja
Cc: platform-driver-x86, linux-kernel, Shuah Khan, Hridesh MG
Currently the choices for the platform profile are hardcoded. There is
an ACPI bitmap accessible via WMI that specifies the supported profiles,
use this bitmap to dynamically set the choices for the platform profile.
Link: https://lore.kernel.org/platform-driver-x86/ecb60ee5-3df7-4d7e-8ebf-8c162b339ade@gmx.de/
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
---
drivers/platform/x86/acer-wmi.c | 67 ++++++++++++++++++++++++++++++++---------
1 file changed, 52 insertions(+), 15 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 88416c37eca0af2099b0c8d91b38912a4e5d108f..37f8c2019925391185e1e0952dac563daf923320 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -33,6 +33,7 @@
#include <linux/units.h>
#include <linux/unaligned.h>
#include <linux/bitfield.h>
+#include <linux/bitmap.h>
MODULE_AUTHOR("Carlos Corbacho");
MODULE_DESCRIPTION("Acer Laptop WMI Extras Driver");
@@ -127,6 +128,7 @@ enum acer_wmi_predator_v4_oc {
enum acer_wmi_gaming_misc_setting {
ACER_WMID_MISC_SETTING_OC_1 = 0x0005,
ACER_WMID_MISC_SETTING_OC_2 = 0x0007,
+ ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES = 0x000A,
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE = 0x000B,
};
@@ -766,6 +768,9 @@ static bool platform_profile_support;
*/
static int last_non_turbo_profile;
+/* The most performant supported profile */
+static int acer_predator_v4_max_perf;
+
enum acer_predator_v4_thermal_profile {
ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x00,
ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x01,
@@ -1983,7 +1988,7 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
if (err)
return err;
- if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
+ if (tp != acer_predator_v4_max_perf)
last_non_turbo_profile = tp;
return 0;
@@ -1992,6 +1997,7 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
static int acer_platform_profile_setup(struct platform_device *device)
{
if (quirks->predator_v4) {
+ unsigned long supported_profiles;
int err;
platform_profile_handler.name = "acer-wmi";
@@ -2001,16 +2007,46 @@ static int acer_platform_profile_setup(struct platform_device *device)
platform_profile_handler.profile_set =
acer_predator_v4_platform_profile_set;
- set_bit(PLATFORM_PROFILE_PERFORMANCE,
- platform_profile_handler.choices);
- set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE,
- platform_profile_handler.choices);
- set_bit(PLATFORM_PROFILE_BALANCED,
- platform_profile_handler.choices);
- set_bit(PLATFORM_PROFILE_QUIET,
- platform_profile_handler.choices);
- set_bit(PLATFORM_PROFILE_LOW_POWER,
- platform_profile_handler.choices);
+ err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES,
+ (u8 *)&supported_profiles);
+ if (err)
+ return err;
+
+ /* Iterate through supported profiles in order of increasing performance */
+ if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_ECO, &supported_profiles)) {
+ set_bit(PLATFORM_PROFILE_LOW_POWER,
+ platform_profile_handler.choices);
+ acer_predator_v4_max_perf =
+ ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
+ }
+
+ if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET, &supported_profiles)) {
+ set_bit(PLATFORM_PROFILE_QUIET,
+ platform_profile_handler.choices);
+ acer_predator_v4_max_perf =
+ ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
+ }
+
+ if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED, &supported_profiles)) {
+ set_bit(PLATFORM_PROFILE_BALANCED,
+ platform_profile_handler.choices);
+ acer_predator_v4_max_perf =
+ ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
+ }
+
+ if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE, &supported_profiles)) {
+ set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE,
+ platform_profile_handler.choices);
+ acer_predator_v4_max_perf =
+ ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
+ }
+
+ if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO, &supported_profiles)) {
+ set_bit(PLATFORM_PROFILE_PERFORMANCE,
+ platform_profile_handler.choices);
+ acer_predator_v4_max_perf =
+ ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
+ }
err = platform_profile_register(&platform_profile_handler);
if (err)
@@ -2028,7 +2064,8 @@ static int acer_platform_profile_setup(struct platform_device *device)
static int acer_thermal_profile_change(void)
{
/*
- * This mode key will either cycle through each mode or toggle the turbo profile.
+ * This mode key will either cycle through each mode or toggle the
+ * most performant profile.
*/
if (quirks->predator_v4) {
u8 current_tp;
@@ -2042,10 +2079,10 @@ static int acer_thermal_profile_change(void)
if (err)
return err;
- if (current_tp == ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
+ if (current_tp == acer_predator_v4_max_perf)
tp = last_non_turbo_profile;
else
- tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
+ tp = acer_predator_v4_max_perf;
err = WMID_gaming_set_misc_setting(
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
@@ -2053,7 +2090,7 @@ static int acer_thermal_profile_change(void)
return err;
/* Store last profile for toggle */
- if (current_tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
+ if (current_tp != acer_predator_v4_max_perf)
last_non_turbo_profile = current_tp;
platform_profile_notify(&platform_profile_handler);
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices
2025-01-13 13:14 ` [PATCH v4 4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices Hridesh MG
@ 2025-01-14 3:53 ` Kurt Borja
0 siblings, 0 replies; 13+ messages in thread
From: Kurt Borja @ 2025-01-14 3:53 UTC (permalink / raw)
To: Hridesh MG
Cc: Hans de Goede, Ilpo Järvinen, Armin Wolf,
platform-driver-x86, linux-kernel, Shuah Khan
On Mon, Jan 13, 2025 at 06:44:12PM +0530, Hridesh MG wrote:
> Currently the choices for the platform profile are hardcoded. There is
> an ACPI bitmap accessible via WMI that specifies the supported profiles,
> use this bitmap to dynamically set the choices for the platform profile.
>
> Link: https://lore.kernel.org/platform-driver-x86/ecb60ee5-3df7-4d7e-8ebf-8c162b339ade@gmx.de/
> Signed-off-by: Hridesh MG <hridesh699@gmail.com>
Reviewed-by: Kurt Borja <kuurtb@gmail.com>
> ---
> drivers/platform/x86/acer-wmi.c | 67 ++++++++++++++++++++++++++++++++---------
> 1 file changed, 52 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 88416c37eca0af2099b0c8d91b38912a4e5d108f..37f8c2019925391185e1e0952dac563daf923320 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -33,6 +33,7 @@
> #include <linux/units.h>
> #include <linux/unaligned.h>
> #include <linux/bitfield.h>
> +#include <linux/bitmap.h>
>
> MODULE_AUTHOR("Carlos Corbacho");
> MODULE_DESCRIPTION("Acer Laptop WMI Extras Driver");
> @@ -127,6 +128,7 @@ enum acer_wmi_predator_v4_oc {
> enum acer_wmi_gaming_misc_setting {
> ACER_WMID_MISC_SETTING_OC_1 = 0x0005,
> ACER_WMID_MISC_SETTING_OC_2 = 0x0007,
> + ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES = 0x000A,
> ACER_WMID_MISC_SETTING_PLATFORM_PROFILE = 0x000B,
> };
>
> @@ -766,6 +768,9 @@ static bool platform_profile_support;
> */
> static int last_non_turbo_profile;
>
> +/* The most performant supported profile */
> +static int acer_predator_v4_max_perf;
> +
> enum acer_predator_v4_thermal_profile {
> ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x00,
> ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x01,
> @@ -1983,7 +1988,7 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
> if (err)
> return err;
>
> - if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
> + if (tp != acer_predator_v4_max_perf)
> last_non_turbo_profile = tp;
>
> return 0;
> @@ -1992,6 +1997,7 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
> static int acer_platform_profile_setup(struct platform_device *device)
> {
> if (quirks->predator_v4) {
> + unsigned long supported_profiles;
> int err;
>
> platform_profile_handler.name = "acer-wmi";
> @@ -2001,16 +2007,46 @@ static int acer_platform_profile_setup(struct platform_device *device)
> platform_profile_handler.profile_set =
> acer_predator_v4_platform_profile_set;
>
> - set_bit(PLATFORM_PROFILE_PERFORMANCE,
> - platform_profile_handler.choices);
> - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE,
> - platform_profile_handler.choices);
> - set_bit(PLATFORM_PROFILE_BALANCED,
> - platform_profile_handler.choices);
> - set_bit(PLATFORM_PROFILE_QUIET,
> - platform_profile_handler.choices);
> - set_bit(PLATFORM_PROFILE_LOW_POWER,
> - platform_profile_handler.choices);
> + err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES,
> + (u8 *)&supported_profiles);
> + if (err)
> + return err;
> +
> + /* Iterate through supported profiles in order of increasing performance */
> + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_ECO, &supported_profiles)) {
> + set_bit(PLATFORM_PROFILE_LOW_POWER,
> + platform_profile_handler.choices);
> + acer_predator_v4_max_perf =
> + ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
> + }
> +
> + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET, &supported_profiles)) {
> + set_bit(PLATFORM_PROFILE_QUIET,
> + platform_profile_handler.choices);
> + acer_predator_v4_max_perf =
> + ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
> + }
> +
> + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED, &supported_profiles)) {
> + set_bit(PLATFORM_PROFILE_BALANCED,
> + platform_profile_handler.choices);
> + acer_predator_v4_max_perf =
> + ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
> + }
> +
> + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE, &supported_profiles)) {
> + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE,
> + platform_profile_handler.choices);
> + acer_predator_v4_max_perf =
> + ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
> + }
> +
> + if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO, &supported_profiles)) {
> + set_bit(PLATFORM_PROFILE_PERFORMANCE,
> + platform_profile_handler.choices);
> + acer_predator_v4_max_perf =
> + ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> + }
>
> err = platform_profile_register(&platform_profile_handler);
> if (err)
> @@ -2028,7 +2064,8 @@ static int acer_platform_profile_setup(struct platform_device *device)
> static int acer_thermal_profile_change(void)
> {
> /*
> - * This mode key will either cycle through each mode or toggle the turbo profile.
> + * This mode key will either cycle through each mode or toggle the
> + * most performant profile.
> */
> if (quirks->predator_v4) {
> u8 current_tp;
> @@ -2042,10 +2079,10 @@ static int acer_thermal_profile_change(void)
> if (err)
> return err;
>
> - if (current_tp == ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
> + if (current_tp == acer_predator_v4_max_perf)
> tp = last_non_turbo_profile;
> else
> - tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
> + tp = acer_predator_v4_max_perf;
>
> err = WMID_gaming_set_misc_setting(
> ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
> @@ -2053,7 +2090,7 @@ static int acer_thermal_profile_change(void)
> return err;
>
> /* Store last profile for toggle */
> - if (current_tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
> + if (current_tp != acer_predator_v4_max_perf)
> last_non_turbo_profile = current_tp;
>
> platform_profile_notify(&platform_profile_handler);
>
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58
2025-01-13 13:14 [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Hridesh MG
` (3 preceding siblings ...)
2025-01-13 13:14 ` [PATCH v4 4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices Hridesh MG
@ 2025-01-13 13:14 ` Hridesh MG
2025-01-14 3:55 ` Kurt Borja
2025-01-15 14:37 ` [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Ilpo Järvinen
5 siblings, 1 reply; 13+ messages in thread
From: Hridesh MG @ 2025-01-13 13:14 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen, Armin Wolf, Kurt Borja
Cc: platform-driver-x86, linux-kernel, Shuah Khan, Hridesh MG
Add predator_v4 quirk for the Acer Nitro AN515-58 to enable fan speed
monitoring and platform_profile handling.
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
---
drivers/platform/x86/acer-wmi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 37f8c2019925391185e1e0952dac563daf923320..04bfa8fe12c2fd9a3c8be8d06f47431f8143d6c9 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -601,6 +601,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = {
},
.driver_data = &quirk_acer_travelmate_2490,
},
+ {
+ .callback = dmi_matched,
+ .ident = "Acer Nitro AN515-58",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Nitro AN515-58"),
+ },
+ .driver_data = &quirk_acer_predator_v4,
+ },
{
.callback = dmi_matched,
.ident = "Acer Predator PH315-53",
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58
2025-01-13 13:14 ` [PATCH v4 5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58 Hridesh MG
@ 2025-01-14 3:55 ` Kurt Borja
0 siblings, 0 replies; 13+ messages in thread
From: Kurt Borja @ 2025-01-14 3:55 UTC (permalink / raw)
To: Hridesh MG
Cc: Hans de Goede, Ilpo Järvinen, Armin Wolf,
platform-driver-x86, linux-kernel, Shuah Khan
On Mon, Jan 13, 2025 at 06:44:13PM +0530, Hridesh MG wrote:
> Add predator_v4 quirk for the Acer Nitro AN515-58 to enable fan speed
> monitoring and platform_profile handling.
>
> Signed-off-by: Hridesh MG <hridesh699@gmail.com>
Reviewed-by: Kurt Borja <kuurtb@gmail.com>
> ---
> drivers/platform/x86/acer-wmi.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 37f8c2019925391185e1e0952dac563daf923320..04bfa8fe12c2fd9a3c8be8d06f47431f8143d6c9 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -601,6 +601,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = {
> },
> .driver_data = &quirk_acer_travelmate_2490,
> },
> + {
> + .callback = dmi_matched,
> + .ident = "Acer Nitro AN515-58",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "Nitro AN515-58"),
> + },
> + .driver_data = &quirk_acer_predator_v4,
> + },
> {
> .callback = dmi_matched,
> .ident = "Acer Predator PH315-53",
>
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling
2025-01-13 13:14 [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Hridesh MG
` (4 preceding siblings ...)
2025-01-13 13:14 ` [PATCH v4 5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58 Hridesh MG
@ 2025-01-15 14:37 ` Ilpo Järvinen
2025-01-15 15:23 ` Hridesh MG
5 siblings, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2025-01-15 14:37 UTC (permalink / raw)
To: Hans de Goede, Armin Wolf, Kurt Borja, Hridesh MG
Cc: platform-driver-x86, linux-kernel, Shuah Khan
On Mon, 13 Jan 2025 18:44:08 +0530, Hridesh MG wrote:
> This patch improves the platform profile handling for laptops using the
> Acer Predator interface by making the following changes -
>
> 1) Using WMI calls to fetch the current platform profile instead of
> directly accessing it from the EC. A new helper function is
> introduced for this purpose.
> 2) Simplifying the cycling of platform profiles by making use of
> platform_profile_cycle()
> 3) Using an ACPI bitmap to dynamically set platform_profile_choices to
> better reflect the supported profiles.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/5] platform/x86: acer-wmi: use WMI calls for platform profile handling
commit: 2d76708c2221dde33d86aeef19f6d7d5f62148b4
[2/5] platform/x86: acer-wmi: use new helper function for setting overclocks
commit: cd44e09bb89d4a33514b9ec3d972f0d2d13f5cfd
[3/5] platform/x86: acer-wmi: simplify platform profile cycling
commit: 61c461a90fbfc038d9663713f293d60fcb58c41d
[4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices
commit: 191e21f1a4c3948957adc037734449f4a965dec5
[5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58
commit: 549fcf58cf5837d401d0de906093169b05365609
--
i.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling
2025-01-15 14:37 ` [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling Ilpo Järvinen
@ 2025-01-15 15:23 ` Hridesh MG
2025-01-15 19:07 ` Armin Wolf
2025-01-15 21:54 ` Kurt Borja
0 siblings, 2 replies; 13+ messages in thread
From: Hridesh MG @ 2025-01-15 15:23 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Hans de Goede, Armin Wolf, Kurt Borja, platform-driver-x86,
linux-kernel, Shuah Khan
On Wed, Jan 15, 2025 at 8:07 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Mon, 13 Jan 2025 18:44:08 +0530, Hridesh MG wrote:
>
> > This patch improves the platform profile handling for laptops using the
> > Acer Predator interface by making the following changes -
> >
> > 1) Using WMI calls to fetch the current platform profile instead of
> > directly accessing it from the EC. A new helper function is
> > introduced for this purpose.
> > 2) Simplifying the cycling of platform profiles by making use of
> > platform_profile_cycle()
> > 3) Using an ACPI bitmap to dynamically set platform_profile_choices to
> > better reflect the supported profiles.
> >
> > [...]
>
>
> Thank you for your contribution, it has been applied to my local
> review-ilpo-next branch. Note it will show up in the public
> platform-drivers-x86/review-ilpo-next branch only once I've pushed my
> local branch there, which might take a while.
>
> The list of commits applied:
> [1/5] platform/x86: acer-wmi: use WMI calls for platform profile handling
> commit: 2d76708c2221dde33d86aeef19f6d7d5f62148b4
> [2/5] platform/x86: acer-wmi: use new helper function for setting overclocks
> commit: cd44e09bb89d4a33514b9ec3d972f0d2d13f5cfd
> [3/5] platform/x86: acer-wmi: simplify platform profile cycling
> commit: 61c461a90fbfc038d9663713f293d60fcb58c41d
> [4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices
> commit: 191e21f1a4c3948957adc037734449f4a965dec5
> [5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58
> commit: 549fcf58cf5837d401d0de906093169b05365609
>
> --
> i.
>
Awesome, thanks a lot! I would like to once again thank Armin Wolf and
Kurt Borja for their guidance and help in creating this patchset, this
is my first meaningful [ to me atleast :) ] contribution to the kernel
and I'm quite proud of it. Working on this issue was pretty fun and I
learnt a lot regarding different things, it really did make me
appreciate kernel developers even more.
--
Thanks,
Hridesh MG
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling
2025-01-15 15:23 ` Hridesh MG
@ 2025-01-15 19:07 ` Armin Wolf
2025-01-15 21:54 ` Kurt Borja
1 sibling, 0 replies; 13+ messages in thread
From: Armin Wolf @ 2025-01-15 19:07 UTC (permalink / raw)
To: Hridesh MG, Ilpo Järvinen
Cc: Hans de Goede, Kurt Borja, platform-driver-x86, linux-kernel, Shuah Khan
Am 15.01.25 um 16:23 schrieb Hridesh MG:
> On Wed, Jan 15, 2025 at 8:07 PM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
>> On Mon, 13 Jan 2025 18:44:08 +0530, Hridesh MG wrote:
>>
>>> This patch improves the platform profile handling for laptops using the
>>> Acer Predator interface by making the following changes -
>>>
>>> 1) Using WMI calls to fetch the current platform profile instead of
>>> directly accessing it from the EC. A new helper function is
>>> introduced for this purpose.
>>> 2) Simplifying the cycling of platform profiles by making use of
>>> platform_profile_cycle()
>>> 3) Using an ACPI bitmap to dynamically set platform_profile_choices to
>>> better reflect the supported profiles.
>>>
>>> [...]
>>
>> Thank you for your contribution, it has been applied to my local
>> review-ilpo-next branch. Note it will show up in the public
>> platform-drivers-x86/review-ilpo-next branch only once I've pushed my
>> local branch there, which might take a while.
>>
>> The list of commits applied:
>> [1/5] platform/x86: acer-wmi: use WMI calls for platform profile handling
>> commit: 2d76708c2221dde33d86aeef19f6d7d5f62148b4
>> [2/5] platform/x86: acer-wmi: use new helper function for setting overclocks
>> commit: cd44e09bb89d4a33514b9ec3d972f0d2d13f5cfd
>> [3/5] platform/x86: acer-wmi: simplify platform profile cycling
>> commit: 61c461a90fbfc038d9663713f293d60fcb58c41d
>> [4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices
>> commit: 191e21f1a4c3948957adc037734449f4a965dec5
>> [5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58
>> commit: 549fcf58cf5837d401d0de906093169b05365609
>>
>> --
>> i.
>>
> Awesome, thanks a lot! I would like to once again thank Armin Wolf and
> Kurt Borja for their guidance and help in creating this patchset, this
> is my first meaningful [ to me atleast :) ] contribution to the kernel
> and I'm quite proud of it. Working on this issue was pretty fun and I
> learnt a lot regarding different things, it really did make me
> appreciate kernel developers even more.
>
Thank you :).
Your patch will not only be meaningful to you, since all other users of acer-wmi will now
enjoy improved platform profile support for their machines.
Thanks,
Armin Wolf
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4 0/5] platform/x86 acer-wmi: Improve platform profile handling
2025-01-15 15:23 ` Hridesh MG
2025-01-15 19:07 ` Armin Wolf
@ 2025-01-15 21:54 ` Kurt Borja
1 sibling, 0 replies; 13+ messages in thread
From: Kurt Borja @ 2025-01-15 21:54 UTC (permalink / raw)
To: Hridesh MG
Cc: Ilpo Järvinen, Hans de Goede, Armin Wolf,
platform-driver-x86, linux-kernel, Shuah Khan
On Wed, Jan 15, 2025 at 08:53:12PM +0530, Hridesh MG wrote:
> On Wed, Jan 15, 2025 at 8:07 PM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > On Mon, 13 Jan 2025 18:44:08 +0530, Hridesh MG wrote:
> >
> > > This patch improves the platform profile handling for laptops using the
> > > Acer Predator interface by making the following changes -
> > >
> > > 1) Using WMI calls to fetch the current platform profile instead of
> > > directly accessing it from the EC. A new helper function is
> > > introduced for this purpose.
> > > 2) Simplifying the cycling of platform profiles by making use of
> > > platform_profile_cycle()
> > > 3) Using an ACPI bitmap to dynamically set platform_profile_choices to
> > > better reflect the supported profiles.
> > >
> > > [...]
> >
> >
> > Thank you for your contribution, it has been applied to my local
> > review-ilpo-next branch. Note it will show up in the public
> > platform-drivers-x86/review-ilpo-next branch only once I've pushed my
> > local branch there, which might take a while.
> >
> > The list of commits applied:
> > [1/5] platform/x86: acer-wmi: use WMI calls for platform profile handling
> > commit: 2d76708c2221dde33d86aeef19f6d7d5f62148b4
> > [2/5] platform/x86: acer-wmi: use new helper function for setting overclocks
> > commit: cd44e09bb89d4a33514b9ec3d972f0d2d13f5cfd
> > [3/5] platform/x86: acer-wmi: simplify platform profile cycling
> > commit: 61c461a90fbfc038d9663713f293d60fcb58c41d
> > [4/5] platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices
> > commit: 191e21f1a4c3948957adc037734449f4a965dec5
> > [5/5] platform/x86: acer-wmi: add support for Acer Nitro AN515-58
> > commit: 549fcf58cf5837d401d0de906093169b05365609
> >
> > --
> > i.
> >
> Awesome, thanks a lot! I would like to once again thank Armin Wolf and
> Kurt Borja for their guidance and help in creating this patchset, this
> is my first meaningful [ to me atleast :) ] contribution to the kernel
> and I'm quite proud of it. Working on this issue was pretty fun and I
> learnt a lot regarding different things, it really did make me
> appreciate kernel developers even more.
Hi Hridesh,
I'm pretty much still a newbie, so I'm glad I could help :) It is really
fun to contribute to this community.
~ Kurt
>
> --
> Thanks,
> Hridesh MG
^ permalink raw reply [flat|nested] 13+ messages in thread