From cc4c1445b97102f470ab44ae15cbc2461db6abc5 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 24 Sep 2021 22:26:15 +0200 Subject: [PATCH 01/40] Fix whitespace --- src/tuxedo_io/tuxedo_io_ioctl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index f271707..f63fb7f 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -85,6 +85,6 @@ #define W_UW_FANSPEED2 _IOW(MAGIC_WRITE_UW, 0x11, int32_t*) #define W_UW_MODE _IOW(MAGIC_WRITE_UW, 0x12, int32_t*) #define W_UW_MODE_ENABLE _IOW(MAGIC_WRITE_UW, 0x13, int32_t*) -#define W_UW_FANAUTO _IO(MAGIC_WRITE_UW, 0x14) // undo all previous calls of W_UW_FANSPEED and W_UW_FANSPEED2 +#define W_UW_FANAUTO _IO(MAGIC_WRITE_UW, 0x14) // undo all previous calls of W_UW_FANSPEED and W_UW_FANSPEED2 #endif From dd5e48fb0990f85993e881d8470c7f15dca8afc2 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 24 Sep 2021 23:32:25 +0200 Subject: [PATCH 02/40] Add uw TDP ioctl interface --- src/tuxedo_io/tuxedo_io.c | 79 +++++++++++++++++++++++++++++++++ src/tuxedo_io/tuxedo_io_ioctl.h | 8 ++++ 2 files changed, 87 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 22f51e4..874f89c 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "../clevo_interfaces.h" #include "../uniwill_interfaces.h" #include "tuxedo_io_ioctl.h" @@ -50,8 +52,21 @@ static u32 clevo_identify(void) return clevo_get_active_interface_id(NULL) == 0 ? 1 : 0; } +static bool uniwill_tdp_config_two; +static bool uniwill_tdp_config_three; + static u32 uniwill_identify(void) { + // Device check for two configurable TDPs + uniwill_tdp_config_two = false +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + || dmi_match(DMI_PRODUCT_SKU, "0001") +#endif + ; + + // Device check for three configurable TDPs + uniwill_tdp_config_three = false; + return uniwill_get_active_interface_id(NULL) == 0 ? 1 : 0; } @@ -203,6 +218,45 @@ static u32 uw_set_fan_auto(void) return 0; } +static int uw_get_tdp(u8 tdp_index) +{ + u8 tdp_data; + u16 tdp_base_addr = 0x0783; + u16 tdp_current_addr = tdp_base_addr + tdp_index; + bool has_current_setting = false; + + if (tdp_index < 2 && uniwill_tdp_config_two) + has_current_setting = true; + else if (tdp_index < 3 && uniwill_tdp_config_three) + has_current_setting = true; + + if (!has_current_setting) + return -1; + + uniwill_read_ec_ram(tdp_current_addr, &tdp_data); + + return tdp_data; +} + +static int uw_set_tdp(u8 tdp_index, u8 tdp_data) +{ + u16 tdp_base_addr = 0x0783; + u16 tdp_current_addr = tdp_base_addr + tdp_index; + bool has_current_setting = false; + + if (tdp_index < 2 && uniwill_tdp_config_two) + has_current_setting = true; + else if (tdp_index < 3 && uniwill_tdp_config_three) + has_current_setting = true; + + if (!has_current_setting) + return -1; + + uniwill_write_ec_ram(tdp_current_addr, tdp_data); + + return 0; +} + static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigned long arg) { u32 result = 0; @@ -261,6 +315,19 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne result = byte_data; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; + case R_UW_TDP0: + result = uw_get_tdp(0); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP1: + result = uw_get_tdp(1); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP2: + result = uw_get_tdp(2); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + #ifdef DEBUG case R_TF_BC: copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg)); @@ -304,6 +371,18 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne case W_UW_FANAUTO: uw_set_fan_auto(); break; + case W_UW_TDP0: + copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); + uw_set_tdp(0, argument); + break; + case W_UW_TDP1: + copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); + uw_set_tdp(1, argument); + break; + case W_UW_TDP2: + copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); + uw_set_tdp(2, argument); + break; #ifdef DEBUG case W_TF_BC: reg_write_return.dword = 0; diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index f63fb7f..e177fe1 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -80,6 +80,10 @@ #define R_UW_MODE _IOR(MAGIC_READ_UW, 0x14, int32_t*) #define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x15, int32_t*) +#define R_UW_TDP0 _IOR(MAGIC_READ_UW, 0x16, int32_t*) +#define R_UW_TDP1 _IOR(MAGIC_READ_UW, 0x17, int32_t*) +#define R_UW_TDP2 _IOR(MAGIC_READ_UW, 0x18, int32_t*) + // Write #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) #define W_UW_FANSPEED2 _IOW(MAGIC_WRITE_UW, 0x11, int32_t*) @@ -87,4 +91,8 @@ #define W_UW_MODE_ENABLE _IOW(MAGIC_WRITE_UW, 0x13, int32_t*) #define W_UW_FANAUTO _IO(MAGIC_WRITE_UW, 0x14) // undo all previous calls of W_UW_FANSPEED and W_UW_FANSPEED2 +#define W_UW_TDP0 _IOW(MAGIC_WRITE_UW, 0x15, int32_t*) +#define W_UW_TDP1 _IOW(MAGIC_WRITE_UW, 0x16, int32_t*) +#define W_UW_TDP2 _IOW(MAGIC_WRITE_UW, 0x17, int32_t*) + #endif From 7593dd33ee06d8c62bfe563e18857f67715df24e Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Tue, 19 Oct 2021 20:13:14 +0200 Subject: [PATCH 03/40] Add uw min/max TDP interface - Min/max TDP interface prototype - Identification structure for "old style" uw perf. profiles --- src/tuxedo_io/tuxedo_io.c | 122 +++++++++++++++++++++++++++++++- src/tuxedo_io/tuxedo_io_ioctl.h | 6 ++ 2 files changed, 125 insertions(+), 3 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 874f89c..9153e95 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -47,20 +47,68 @@ MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BC); static u32 id_check_clevo; static u32 id_check_uniwill; +/** + * strstr version of dmi_match + */ +static bool dmi_string_in(enum dmi_field f, const char *str) +{ + const char *info = dmi_get_system_info(f); + + if (info == NULL || str == NULL) + return info == str; + + return strstr(info, str) != NULL; +} + static u32 clevo_identify(void) { return clevo_get_active_interface_id(NULL) == 0 ? 1 : 0; } +/* + * Identification for uniwill_power_profile_v1 + * + * - Two profiles present in low power devices often called + * "power save" and "balanced". + * - Three profiles present mainly in devices with discrete + * graphics card often called "power save", "balanced" + * and "enthusiast" + */ +static bool uniwill_profile_v1; +static bool uniwill_profile_v1_two_profs; +static bool uniwill_profile_v1_three_profs; + static bool uniwill_tdp_config_two; static bool uniwill_tdp_config_three; static u32 uniwill_identify(void) { + uniwill_profile_v1_two_profs = false + // TODO: BA15 + || dmi_match(DMI_BOARD_NAME, "PULSE1401") + || dmi_match(DMI_BOARD_NAME, "PULSE1501") + ; + + uniwill_profile_v1_three_profs = false + || dmi_match(DMI_BOARD_NAME, "POLARIS1501A1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501A2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501I1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501I2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701A1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") + ; + + uniwill_profile_v1 = + uniwill_profile_v1_two_profs || + uniwill_profile_v1_three_profs; + // Device check for two configurable TDPs uniwill_tdp_config_two = false #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - || dmi_match(DMI_PRODUCT_SKU, "0001") + || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") + || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") #endif ; @@ -218,6 +266,44 @@ static u32 uw_set_fan_auto(void) return 0; } +/* + * TDP boundary definitions per device + */ +static int tdp_min_ph4tux[] = { 0x00, 0x00, 0x00 }; +static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; +static int tdp_min_ph4trx[] = { 0x00, 0x00, 0x00 }; +static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; + +static int uw_get_tdp_min(u8 tdp_index) +{ + int tdp_min = 0; + if (tdp_index > 2) + return -EINVAL; + + if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX")) { + tdp_min = tdp_min_ph4tux[tdp_index]; + } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX")) { + tdp_min = tdp_min_ph4trx[tdp_index]; + } + + return tdp_min; +} + +static int uw_get_tdp_max(u8 tdp_index) +{ + int tdp_max = 0; + if (tdp_index > 2) + return -EINVAL; + + if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX")) { + tdp_max = tdp_max_ph4tux[tdp_index]; + } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX")) { + tdp_max = tdp_max_ph4trx[tdp_index]; + } + + return tdp_max; +} + static int uw_get_tdp(u8 tdp_index) { u8 tdp_data; @@ -231,7 +317,7 @@ static int uw_get_tdp(u8 tdp_index) has_current_setting = true; if (!has_current_setting) - return -1; + return -EPERM; uniwill_read_ec_ram(tdp_current_addr, &tdp_data); @@ -240,6 +326,7 @@ static int uw_get_tdp(u8 tdp_index) static int uw_set_tdp(u8 tdp_index, u8 tdp_data) { + int tdp_min, tdp_max; u16 tdp_base_addr = 0x0783; u16 tdp_current_addr = tdp_base_addr + tdp_index; bool has_current_setting = false; @@ -249,8 +336,13 @@ static int uw_set_tdp(u8 tdp_index, u8 tdp_data) else if (tdp_index < 3 && uniwill_tdp_config_three) has_current_setting = true; + tdp_min = uw_get_tdp_min(tdp_index); + tdp_max = uw_get_tdp_max(tdp_index); + if (tdp_data < tdp_min || tdp_data > tdp_max) + return -EINVAL; + if (!has_current_setting) - return -1; + return -EPERM; uniwill_write_ec_ram(tdp_current_addr, tdp_data); @@ -327,6 +419,30 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne result = uw_get_tdp(2); copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; + case R_UW_TDP0_MIN: + result = uw_get_tdp_min(0); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP1_MIN: + result = uw_get_tdp_min(1); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP2_MIN: + result = uw_get_tdp_min(2); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP0_MAX: + result = uw_get_tdp_max(0); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP1_MAX: + result = uw_get_tdp_max(1); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_TDP2_MAX: + result = uw_get_tdp_max(2); + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; #ifdef DEBUG case R_TF_BC: diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index e177fe1..45f55b0 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -83,6 +83,12 @@ #define R_UW_TDP0 _IOR(MAGIC_READ_UW, 0x16, int32_t*) #define R_UW_TDP1 _IOR(MAGIC_READ_UW, 0x17, int32_t*) #define R_UW_TDP2 _IOR(MAGIC_READ_UW, 0x18, int32_t*) +#define R_UW_TDP0_MIN _IOR(MAGIC_READ_UW, 0x19, int32_t*) +#define R_UW_TDP1_MIN _IOR(MAGIC_READ_UW, 0x1a, int32_t*) +#define R_UW_TDP2_MIN _IOR(MAGIC_READ_UW, 0x1b, int32_t*) +#define R_UW_TDP0_MAX _IOR(MAGIC_READ_UW, 0x1c, int32_t*) +#define R_UW_TDP1_MAX _IOR(MAGIC_READ_UW, 0x1d, int32_t*) +#define R_UW_TDP2_MAX _IOR(MAGIC_READ_UW, 0x1e, int32_t*) // Write #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) From ad8d42454ee0bfd2ab82ac1b678911f225b7a155 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Mon, 8 Nov 2021 20:26:15 +0100 Subject: [PATCH 04/40] Add PH4TQX --- src/tuxedo_io/tuxedo_io.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 9153e95..56e5cda 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -109,6 +109,7 @@ static u32 uniwill_identify(void) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") + || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") #endif ; @@ -269,11 +270,15 @@ static u32 uw_set_fan_auto(void) /* * TDP boundary definitions per device */ -static int tdp_min_ph4tux[] = { 0x00, 0x00, 0x00 }; +static int tdp_min_ph4tux[] = { 0x07, 0x07, 0x00 }; static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; -static int tdp_min_ph4trx[] = { 0x00, 0x00, 0x00 }; + +static int tdp_min_ph4trx[] = { 0x07, 0x07, 0x00 }; static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; +static int tdp_min_ph4tqx[] = { 0x07, 0x07, 0x00 }; +static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; + static int uw_get_tdp_min(u8 tdp_index) { int tdp_min = 0; @@ -284,6 +289,8 @@ static int uw_get_tdp_min(u8 tdp_index) tdp_min = tdp_min_ph4tux[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX")) { tdp_min = tdp_min_ph4trx[tdp_index]; + } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { + tdp_min = tdp_min_ph4tqx[tdp_index]; } return tdp_min; @@ -299,6 +306,8 @@ static int uw_get_tdp_max(u8 tdp_index) tdp_max = tdp_max_ph4tux[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX")) { tdp_max = tdp_max_ph4trx[tdp_index]; + } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { + tdp_max = tdp_max_ph4tqx[tdp_index]; } return tdp_max; From feca6dbcf4ee1ef7ecd1d24ddd84318b47443d50 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Mon, 8 Nov 2021 23:02:49 +0100 Subject: [PATCH 05/40] tuxedo_io: Add uw perf prof ioctl interface --- src/tuxedo_io/tuxedo_io.c | 47 +++++++++++++++++++++++++++++++++ src/tuxedo_io/tuxedo_io_ioctl.h | 4 +++ 2 files changed, 51 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 56e5cda..bb9720e 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -358,6 +358,41 @@ static int uw_set_tdp(u8 tdp_index, u8 tdp_data) return 0; } +/** + * Set profile 1-3 to 0xa0, 0x00 or 0x10 depending on + * device support. + */ +static u32 uw_set_performance_profile_v1(u8 profile_index) +{ + u8 current_value = 0x00, next_value; + u8 clear_bits = 0xa0 | 0x10; + u32 result; + result = uniwill_read_ec_ram(0x0751, ¤t_value); + if (result >= 0) { + next_value = current_value & ~clear_bits; + switch (profile_index) { + case 0x01: + next_value |= 0xa0; + break; + case 0x02: + next_value |= 0x00; + break; + case 0x03: + next_value |= 0x10; + break; + default: + result = -EINVAL; + break; + } + + if (result != -EINVAL) { + result = uniwill_write_ec_ram(0x0751, next_value); + } + } + + return result; +} + static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigned long arg) { u32 result = 0; @@ -452,6 +487,14 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne result = uw_get_tdp_max(2); copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; + case R_UW_PROFS_AVAILABLE: + result = 0; + if (uniwill_profile_v1_two_profs) + result = 2; + else if (uniwill_profile_v1_three_profs) + result = 3; + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; #ifdef DEBUG case R_TF_BC: @@ -508,6 +551,10 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); uw_set_tdp(2, argument); break; + case W_UW_PERF_PROF: + copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); + uw_set_performance_profile_v1(argument); + break; #ifdef DEBUG case W_TF_BC: reg_write_return.dword = 0; diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index 45f55b0..a98d79c 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -90,6 +90,8 @@ #define R_UW_TDP1_MAX _IOR(MAGIC_READ_UW, 0x1d, int32_t*) #define R_UW_TDP2_MAX _IOR(MAGIC_READ_UW, 0x1e, int32_t*) +#define R_UW_PROFS_AVAILABLE _IOR(MAGIC_READ_UW, 0x1f, int32_t*) + // Write #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) #define W_UW_FANSPEED2 _IOW(MAGIC_WRITE_UW, 0x11, int32_t*) @@ -101,4 +103,6 @@ #define W_UW_TDP1 _IOW(MAGIC_WRITE_UW, 0x16, int32_t*) #define W_UW_TDP2 _IOW(MAGIC_WRITE_UW, 0x17, int32_t*) +#define W_UW_PERF_PROF _IOW(MAGIC_WRITE_UW, 0x18, int32_t*) + #endif From 55022eb636e2ae67090d9646d7121b73d3cb83a0 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 10 Nov 2021 20:28:33 +0100 Subject: [PATCH 06/40] Add BA15 with two power profiles --- src/tuxedo_io/tuxedo_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index bb9720e..8a6ebfb 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -84,7 +84,7 @@ static bool uniwill_tdp_config_three; static u32 uniwill_identify(void) { uniwill_profile_v1_two_profs = false - // TODO: BA15 + || dmi_match(DMI_BOARD_NAME, "PF5PU1G") || dmi_match(DMI_BOARD_NAME, "PULSE1401") || dmi_match(DMI_BOARD_NAME, "PULSE1501") ; From f08b9af71470b3c5f3ee15459cb6927f8f8865c2 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 10 Nov 2021 21:29:03 +0100 Subject: [PATCH 07/40] Add three profiles to polaris/stellaris gen2/3 for the LEDs --- src/tuxedo_io/tuxedo_io.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 8a6ebfb..2d5ee92 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -90,6 +90,7 @@ static u32 uniwill_identify(void) ; uniwill_profile_v1_three_profs = false + // Devices with "classic" profile support || dmi_match(DMI_BOARD_NAME, "POLARIS1501A1650TI") || dmi_match(DMI_BOARD_NAME, "POLARIS1501A2060") || dmi_match(DMI_BOARD_NAME, "POLARIS1501I1650TI") @@ -98,6 +99,13 @@ static u32 uniwill_identify(void) || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") + // Devices where profile mainly controls power profile LED status + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") ; uniwill_profile_v1 = From 5173c0fc33106c9293fae4d5ba0b716794543589 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 10 Nov 2021 21:42:52 +0100 Subject: [PATCH 08/40] Add TDP support for stellaris/polaris gen 2/3 --- src/tuxedo_io/tuxedo_io.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 2d5ee92..14785c1 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -118,6 +118,12 @@ static u32 uniwill_identify(void) || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") #endif ; @@ -287,6 +293,9 @@ static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; static int tdp_min_ph4tqx[] = { 0x07, 0x07, 0x00 }; static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; +static int tdp_min_gmxtgxx[] = { 0x00, 0x00, 0x00 }; +static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0x78 }; + static int uw_get_tdp_min(u8 tdp_index) { int tdp_min = 0; @@ -299,6 +308,9 @@ static int uw_get_tdp_min(u8 tdp_index) tdp_min = tdp_min_ph4trx[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { tdp_min = tdp_min_ph4tqx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { + tdp_min = tdp_min_gmxtgxx[tdp_index]; } return tdp_min; @@ -316,6 +328,9 @@ static int uw_get_tdp_max(u8 tdp_index) tdp_max = tdp_max_ph4trx[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { tdp_max = tdp_max_ph4tqx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { + tdp_max = tdp_max_gmxtgxx[tdp_index]; } return tdp_max; From d848111bb742914a295782163bf4d42f69c7c0bf Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 11 Nov 2021 22:09:21 +0100 Subject: [PATCH 09/40] Move uw device features to interfaces struct --- src/tuxedo_io/tuxedo_io.c | 78 +++++---------------------------------- src/uniwill_interfaces.h | 23 ++++++++++++ src/uniwill_keyboard.h | 59 +++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 69 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 14785c1..3eee737 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -47,6 +47,8 @@ MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BC); static u32 id_check_clevo; static u32 id_check_uniwill; +static struct uniwill_device_features_t *uw_feats; + /** * strstr version of dmi_match */ @@ -65,71 +67,9 @@ static u32 clevo_identify(void) return clevo_get_active_interface_id(NULL) == 0 ? 1 : 0; } -/* - * Identification for uniwill_power_profile_v1 - * - * - Two profiles present in low power devices often called - * "power save" and "balanced". - * - Three profiles present mainly in devices with discrete - * graphics card often called "power save", "balanced" - * and "enthusiast" - */ -static bool uniwill_profile_v1; -static bool uniwill_profile_v1_two_profs; -static bool uniwill_profile_v1_three_profs; - -static bool uniwill_tdp_config_two; -static bool uniwill_tdp_config_three; - static u32 uniwill_identify(void) { - uniwill_profile_v1_two_profs = false - || dmi_match(DMI_BOARD_NAME, "PF5PU1G") - || dmi_match(DMI_BOARD_NAME, "PULSE1401") - || dmi_match(DMI_BOARD_NAME, "PULSE1501") - ; - - uniwill_profile_v1_three_profs = false - // Devices with "classic" profile support - || dmi_match(DMI_BOARD_NAME, "POLARIS1501A1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1501A2060") - || dmi_match(DMI_BOARD_NAME, "POLARIS1501I1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1501I2060") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701A1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") - || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") - // Devices where profile mainly controls power profile LED status - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") - ; - - uniwill_profile_v1 = - uniwill_profile_v1_two_profs || - uniwill_profile_v1_three_profs; - - // Device check for two configurable TDPs - uniwill_tdp_config_two = false -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") - || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") - || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") -#endif - ; - - // Device check for three configurable TDPs - uniwill_tdp_config_three = false; - + uw_feats = uniwill_get_device_features(); return uniwill_get_active_interface_id(NULL) == 0 ? 1 : 0; } @@ -343,9 +283,9 @@ static int uw_get_tdp(u8 tdp_index) u16 tdp_current_addr = tdp_base_addr + tdp_index; bool has_current_setting = false; - if (tdp_index < 2 && uniwill_tdp_config_two) + if (tdp_index < 2 && uw_feats->uniwill_tdp_config_two) has_current_setting = true; - else if (tdp_index < 3 && uniwill_tdp_config_three) + else if (tdp_index < 3 && uw_feats->uniwill_tdp_config_three) has_current_setting = true; if (!has_current_setting) @@ -363,9 +303,9 @@ static int uw_set_tdp(u8 tdp_index, u8 tdp_data) u16 tdp_current_addr = tdp_base_addr + tdp_index; bool has_current_setting = false; - if (tdp_index < 2 && uniwill_tdp_config_two) + if (tdp_index < 2 && uw_feats->uniwill_tdp_config_two) has_current_setting = true; - else if (tdp_index < 3 && uniwill_tdp_config_three) + else if (tdp_index < 3 && uw_feats->uniwill_tdp_config_three) has_current_setting = true; tdp_min = uw_get_tdp_min(tdp_index); @@ -512,9 +452,9 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne break; case R_UW_PROFS_AVAILABLE: result = 0; - if (uniwill_profile_v1_two_profs) + if (uw_feats->uniwill_profile_v1_two_profs) result = 2; - else if (uniwill_profile_v1_three_profs) + else if (uw_feats->uniwill_profile_v1_three_profs) result = 3; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index 3c1bf45..10ae6e3 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -46,11 +46,34 @@ struct uniwill_interface_t { uniwill_write_ec_ram_t *write_ec_ram; }; +struct uniwill_device_features_t { + /** + * Identification for uniwill_power_profile_v1 + * + * - Two profiles present in low power devices often called + * "power save" and "balanced". + * - Three profiles present mainly in devices with discrete + * graphics card often called "power save", "balanced" + * and "enthusiast" + */ + bool uniwill_profile_v1; + bool uniwill_profile_v1_two_profs; + bool uniwill_profile_v1_three_profs; + /** + * Two or three configurable TDP values. Generally two for + * low power/more mobile devices and three for heavier workstations + * and gaming devices. + */ + bool uniwill_tdp_config_two; + bool uniwill_tdp_config_three; +}; + u32 uniwill_add_interface(struct uniwill_interface_t *new_interface); u32 uniwill_remove_interface(struct uniwill_interface_t *interface); uniwill_read_ec_ram_t uniwill_read_ec_ram; uniwill_write_ec_ram_t uniwill_write_ec_ram; u32 uniwill_get_active_interface_id(char **id_str); +struct uniwill_device_features_t *uniwill_get_device_features(void); union uw_ec_read_return { u32 dword; diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 41f7b8d..969e3ca 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -67,6 +67,8 @@ struct kbd_led_state_uw_t { .color = UNIWILL_COLOR_DEFAULT, }; +struct uniwill_device_features_t uniwill_device_features; + static u8 uniwill_kbd_bl_enable_state_on_start; static bool uniwill_kbd_bl_type_rgb_single_color = true; @@ -180,6 +182,61 @@ u32 uniwill_get_active_interface_id(char **id_str) } EXPORT_SYMBOL(uniwill_get_active_interface_id); +struct uniwill_device_features_t *uniwill_get_device_features(void) +{ + struct uniwill_device_features_t *uw_feats = &uniwill_device_features; + + uw_feats->uniwill_profile_v1_two_profs = false + || dmi_match(DMI_BOARD_NAME, "PF5PU1G") + || dmi_match(DMI_BOARD_NAME, "PULSE1401") + || dmi_match(DMI_BOARD_NAME, "PULSE1501") + ; + + uw_feats->uniwill_profile_v1_three_profs = false + // Devices with "classic" profile support + || dmi_match(DMI_BOARD_NAME, "POLARIS1501A1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501A2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501I1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1501I2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701A1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") + || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") + // Devices where profile mainly controls power profile LED status + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") + ; + + uw_feats->uniwill_profile_v1 = + uw_feats->uniwill_profile_v1_two_profs || + uw_feats->uniwill_profile_v1_three_profs; + + // Device check for two configurable TDPs + uw_feats->uniwill_tdp_config_two = false +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") + || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") + || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") +#endif + ; + + // Device check for three configurable TDPs + uw_feats->uniwill_tdp_config_three = false; + + return uw_feats; +} +EXPORT_SYMBOL(uniwill_get_device_features); + static void key_event_work(struct work_struct *work) { sparse_keymap_report_known_event( @@ -742,6 +799,8 @@ static int uniwill_keyboard_probe(struct platform_device *dev) u8 data; int status; + uniwill_get_device_features(); + // FIXME Hard set balanced profile until we have implemented a way to // switch it while tuxedo_io is loaded // uw_ec_write_addr(0x51, 0x07, 0x00, 0x00, ®_write_return); From 4903b89239be4e5ddcb9d0a095149a5b443621a7 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 11 Nov 2021 22:19:57 +0100 Subject: [PATCH 10/40] Split v1 three profile feature to include leds only version extra --- src/tuxedo_io/tuxedo_io.c | 2 +- src/uniwill_interfaces.h | 1 + src/uniwill_keyboard.h | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 3eee737..28ffdc8 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -454,7 +454,7 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne result = 0; if (uw_feats->uniwill_profile_v1_two_profs) result = 2; - else if (uw_feats->uniwill_profile_v1_three_profs) + else if (uw_feats->uniwill_profile_v1_three_profs || uw_feats->uniwill_profile_v1_three_profs_leds_only) result = 3; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index 10ae6e3..409319c 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -59,6 +59,7 @@ struct uniwill_device_features_t { bool uniwill_profile_v1; bool uniwill_profile_v1_two_profs; bool uniwill_profile_v1_three_profs; + bool uniwill_profile_v1_three_profs_leds_only; /** * Two or three configurable TDP values. Generally two for * low power/more mobile devices and three for heavier workstations diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 969e3ca..7a60656 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -202,13 +202,18 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") + ; + + uw_feats->uniwill_profile_v1_three_profs_leds_only = false // Devices where profile mainly controls power profile LED status +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") +#endif ; uw_feats->uniwill_profile_v1 = @@ -799,7 +804,7 @@ static int uniwill_keyboard_probe(struct platform_device *dev) u8 data; int status; - uniwill_get_device_features(); + struct uniwill_device_features_t *uw_feats = uniwill_get_device_features(); // FIXME Hard set balanced profile until we have implemented a way to // switch it while tuxedo_io is loaded From bd56c1ecb912bb5cbe7c12dd2ae26f7aed16d2ba Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 11 Nov 2021 22:31:12 +0100 Subject: [PATCH 11/40] Restrict fan-curve copy to "v1" profile devices only --- src/uniwill_keyboard.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 7a60656..72febab 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -811,11 +811,13 @@ static int uniwill_keyboard_probe(struct platform_device *dev) // uw_ec_write_addr(0x51, 0x07, 0x00, 0x00, ®_write_return); uniwill_write_ec_ram(0x0751, 0x00); - // Set manual-mode fan-curve in 0x0743 - 0x0747 - // Some kind of default fan-curve is stored in 0x0786 - 0x078a: Using it to initialize manual-mode fan-curve - for (i = 0; i < 5; ++i) { - uniwill_read_ec_ram(0x0786 + i, &data); - uniwill_write_ec_ram(0x0743 + i, data); + if (uw_feats->uniwill_profile_v1) { + // Set manual-mode fan-curve in 0x0743 - 0x0747 + // Some kind of default fan-curve is stored in 0x0786 - 0x078a: Using it to initialize manual-mode fan-curve + for (i = 0; i < 5; ++i) { + uniwill_read_ec_ram(0x0786 + i, &data); + uniwill_write_ec_ram(0x0743 + i, data); + } } // Enable manual mode From 91742ab1c590cafdd1b551f29b69961e2c0392ea Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 11 Nov 2021 23:01:46 +0100 Subject: [PATCH 12/40] Move and correct TDP device ids --- src/uniwill_keyboard.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 72febab..ffb77ab 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -226,17 +226,18 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") #endif ; // Device check for three configurable TDPs - uw_feats->uniwill_tdp_config_three = false; + uw_feats->uniwill_tdp_config_three = false + //|| dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + //|| dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + //|| dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") + //|| dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") + ; return uw_feats; } From 68800661b4ac972f45fcf28250f4b76dfbe87ab7 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 12 Nov 2021 23:10:10 +0100 Subject: [PATCH 13/40] Modify and add TDP device definitions - Basic 120W upper limit over all - Change min limit to 1W - Add Polaris gen 2 - Add Polaris/Stellaris AMD gen 3 --- src/tuxedo_io/tuxedo_io.c | 31 +++++++++++++++++++++++++++---- src/uniwill_keyboard.h | 8 ++++---- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 28ffdc8..6955d51 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -224,18 +224,27 @@ static u32 uw_set_fan_auto(void) /* * TDP boundary definitions per device */ -static int tdp_min_ph4tux[] = { 0x07, 0x07, 0x00 }; +static int tdp_min_ph4tux[] = { 0x01, 0x01, 0x00 }; static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; -static int tdp_min_ph4trx[] = { 0x07, 0x07, 0x00 }; +static int tdp_min_ph4trx[] = { 0x01, 0x01, 0x00 }; static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; -static int tdp_min_ph4tqx[] = { 0x07, 0x07, 0x00 }; +static int tdp_min_ph4tqx[] = { 0x01, 0x01, 0x00 }; static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; -static int tdp_min_gmxtgxx[] = { 0x00, 0x00, 0x00 }; +static int tdp_min_gmxngxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxngxx[] = { 0x78, 0x78, 0x78 }; + +static int tdp_min_gmxmgxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0x78 }; + +static int tdp_min_gmxtgxx[] = { 0x01, 0x01, 0x01 }; static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0x78 }; +static int tdp_min_gmxzgxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxzgxx[] = { 0x78, 0x78, 0x78 }; + static int uw_get_tdp_min(u8 tdp_index) { int tdp_min = 0; @@ -248,9 +257,16 @@ static int uw_get_tdp_min(u8 tdp_index) tdp_min = tdp_min_ph4trx[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { tdp_min = tdp_min_ph4tqx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { + tdp_min = tdp_min_gmxngxx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02")) { + tdp_min = tdp_min_gmxmgxx[tdp_index]; } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { tdp_min = tdp_min_gmxtgxx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { + tdp_min = tdp_min_gmxzgxx[tdp_index]; } return tdp_min; @@ -268,9 +284,16 @@ static int uw_get_tdp_max(u8 tdp_index) tdp_max = tdp_max_ph4trx[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { tdp_max = tdp_max_ph4tqx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { + tdp_max = tdp_max_gmxngxx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02")) { + tdp_max = tdp_max_gmxmgxx[tdp_index]; } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { tdp_max = tdp_max_gmxtgxx[tdp_index]; + } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { + tdp_max = tdp_max_gmxzgxx[tdp_index]; } return tdp_max; diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index ffb77ab..fb0ed3a 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -231,12 +231,12 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) // Device check for three configurable TDPs uw_feats->uniwill_tdp_config_three = false - //|| dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") - //|| dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") - //|| dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") + || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - //|| dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") ; return uw_feats; From 50ea0bb09f69ebef64f5cef57d2a821076082776 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Tue, 23 Nov 2021 15:38:45 +0100 Subject: [PATCH 14/40] Change model ID for some models --- src/tuxedo_io/tuxedo_io.c | 8 ++++---- src/uniwill_interfaces.h | 1 + src/uniwill_keyboard.h | 9 +++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 6955d51..24714fe 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -251,9 +251,9 @@ static int uw_get_tdp_min(u8 tdp_index) if (tdp_index > 2) return -EINVAL; - if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX")) { + if (uw_feats->model == 0x13) { tdp_min = tdp_min_ph4tux[tdp_index]; - } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX")) { + } else if (uw_feats->model == 0x12) { tdp_min = tdp_min_ph4trx[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { tdp_min = tdp_min_ph4tqx[tdp_index]; @@ -278,9 +278,9 @@ static int uw_get_tdp_max(u8 tdp_index) if (tdp_index > 2) return -EINVAL; - if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX")) { + if (uw_feats->model == 0x13) { tdp_max = tdp_max_ph4tux[tdp_index]; - } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX")) { + } else if (uw_feats->model == 0x12) { tdp_max = tdp_max_ph4trx[tdp_index]; } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { tdp_max = tdp_max_ph4tqx[tdp_index]; diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index 409319c..c161d26 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -47,6 +47,7 @@ struct uniwill_interface_t { }; struct uniwill_device_features_t { + u8 model; /** * Identification for uniwill_power_profile_v1 * diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index fb0ed3a..518130f 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -185,6 +185,11 @@ EXPORT_SYMBOL(uniwill_get_active_interface_id); struct uniwill_device_features_t *uniwill_get_device_features(void) { struct uniwill_device_features_t *uw_feats = &uniwill_device_features; + u32 status; + + status = uniwill_read_ec_ram(0x0740, &uw_feats->model); + if (status != 0) + uw_feats->model = 0; uw_feats->uniwill_profile_v1_two_profs = false || dmi_match(DMI_BOARD_NAME, "PF5PU1G") @@ -223,8 +228,8 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) // Device check for two configurable TDPs uw_feats->uniwill_tdp_config_two = false #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TUX") - || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TRX") + || uw_feats->model == 0x13 + || uw_feats->model == 0x12 || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") #endif ; From 3fbc761cc9ca30e2a02480f6088d47f2ec55bad5 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 26 Nov 2021 15:43:18 +0100 Subject: [PATCH 15/40] Rearrange uw tdp identification + min/max getters Support for a device now only depending on if min/max definitions exist for chosen tdp parameter. --- src/tuxedo_io/tuxedo_io.c | 160 ++++++++++++++++++++------------------ src/uniwill_interfaces.h | 7 -- src/uniwill_keyboard.h | 19 ----- 3 files changed, 83 insertions(+), 103 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 24714fe..86d16ab 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -67,9 +67,68 @@ static u32 clevo_identify(void) return clevo_get_active_interface_id(NULL) == 0 ? 1 : 0; } +/* + * TDP boundary definitions per device + */ +static int tdp_min_ph4tux[] = { 0x01, 0x01, 0x00 }; +static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; + +static int tdp_min_ph4trx[] = { 0x01, 0x01, 0x00 }; +static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; + +static int tdp_min_ph4tqx[] = { 0x01, 0x01, 0x00 }; +static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; + +static int tdp_min_gmxngxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxngxx[] = { 0x78, 0x78, 0x78 }; + +static int tdp_min_gmxmgxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0x78 }; + +static int tdp_min_gmxtgxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0x78 }; + +static int tdp_min_gmxzgxx[] = { 0x01, 0x01, 0x01 }; +static int tdp_max_gmxzgxx[] = { 0x78, 0x78, 0x78 }; + +static int *tdp_min_defs = NULL; +static int *tdp_max_defs = NULL; + +void uw_id_tdp(void) +{ + if (uw_feats->model == 0x13) { + tdp_min_defs = tdp_min_ph4tux; + tdp_max_defs = tdp_max_ph4tux; + } else if (uw_feats->model == 0x12) { + tdp_min_defs = tdp_min_ph4trx; + tdp_max_defs = tdp_max_ph4trx; + } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { + tdp_min_defs = tdp_min_ph4tqx; + tdp_max_defs = tdp_max_ph4tqx; + } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { + tdp_min_defs = tdp_min_gmxngxx; + tdp_max_defs = tdp_max_gmxngxx; + } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02")) { + tdp_min_defs = tdp_min_gmxmgxx; + tdp_max_defs = tdp_max_gmxmgxx; + } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { + tdp_min_defs = tdp_min_gmxtgxx; + tdp_max_defs = tdp_max_gmxtgxx; + } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { + tdp_min_defs = tdp_min_gmxzgxx; + tdp_max_defs = tdp_max_gmxzgxx; + } else { + tdp_min_defs = NULL; + tdp_max_defs = NULL; + } +} + static u32 uniwill_identify(void) { uw_feats = uniwill_get_device_features(); + uw_id_tdp(); return uniwill_get_active_interface_id(NULL) == 0 ? 1 : 0; } @@ -221,82 +280,34 @@ static u32 uw_set_fan_auto(void) return 0; } -/* - * TDP boundary definitions per device - */ -static int tdp_min_ph4tux[] = { 0x01, 0x01, 0x00 }; -static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; - -static int tdp_min_ph4trx[] = { 0x01, 0x01, 0x00 }; -static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; - -static int tdp_min_ph4tqx[] = { 0x01, 0x01, 0x00 }; -static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; - -static int tdp_min_gmxngxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxngxx[] = { 0x78, 0x78, 0x78 }; - -static int tdp_min_gmxmgxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0x78 }; - -static int tdp_min_gmxtgxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0x78 }; - -static int tdp_min_gmxzgxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxzgxx[] = { 0x78, 0x78, 0x78 }; - static int uw_get_tdp_min(u8 tdp_index) { - int tdp_min = 0; if (tdp_index > 2) return -EINVAL; - if (uw_feats->model == 0x13) { - tdp_min = tdp_min_ph4tux[tdp_index]; - } else if (uw_feats->model == 0x12) { - tdp_min = tdp_min_ph4trx[tdp_index]; - } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { - tdp_min = tdp_min_ph4tqx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { - tdp_min = tdp_min_gmxngxx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02")) { - tdp_min = tdp_min_gmxmgxx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { - tdp_min = tdp_min_gmxtgxx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { - tdp_min = tdp_min_gmxzgxx[tdp_index]; + if (tdp_min_defs == NULL) + return -ENODEV; + + if (tdp_min_defs[tdp_index] <= 0) { + return -ENODEV; } - return tdp_min; + return tdp_min_defs[tdp_index]; } static int uw_get_tdp_max(u8 tdp_index) { - int tdp_max = 0; if (tdp_index > 2) return -EINVAL; - if (uw_feats->model == 0x13) { - tdp_max = tdp_max_ph4tux[tdp_index]; - } else if (uw_feats->model == 0x12) { - tdp_max = tdp_max_ph4trx[tdp_index]; - } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { - tdp_max = tdp_max_ph4tqx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { - tdp_max = tdp_max_gmxngxx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02")) { - tdp_max = tdp_max_gmxmgxx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03")) { - tdp_max = tdp_max_gmxtgxx[tdp_index]; - } else if ( dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { - tdp_max = tdp_max_gmxzgxx[tdp_index]; + if (tdp_max_defs == NULL) + return -ENODEV; + + if (tdp_max_defs[tdp_index] <= 0) { + return -ENODEV; } - return tdp_max; + return tdp_max_defs[tdp_index]; } static int uw_get_tdp(u8 tdp_index) @@ -304,17 +315,16 @@ static int uw_get_tdp(u8 tdp_index) u8 tdp_data; u16 tdp_base_addr = 0x0783; u16 tdp_current_addr = tdp_base_addr + tdp_index; - bool has_current_setting = false; + int status; - if (tdp_index < 2 && uw_feats->uniwill_tdp_config_two) - has_current_setting = true; - else if (tdp_index < 3 && uw_feats->uniwill_tdp_config_three) - has_current_setting = true; + // Use min tdp to detect support for chosen tdp parameter + int min_tdp_status = uw_get_tdp_min(tdp_index); + if (min_tdp_status < 0) + return min_tdp_status; - if (!has_current_setting) - return -EPERM; - - uniwill_read_ec_ram(tdp_current_addr, &tdp_data); + status = uniwill_read_ec_ram(tdp_current_addr, &tdp_data); + if (status < 0) + return status; return tdp_data; } @@ -324,21 +334,17 @@ static int uw_set_tdp(u8 tdp_index, u8 tdp_data) int tdp_min, tdp_max; u16 tdp_base_addr = 0x0783; u16 tdp_current_addr = tdp_base_addr + tdp_index; - bool has_current_setting = false; - if (tdp_index < 2 && uw_feats->uniwill_tdp_config_two) - has_current_setting = true; - else if (tdp_index < 3 && uw_feats->uniwill_tdp_config_three) - has_current_setting = true; + // Use min tdp to detect support for chosen tdp parameter + int min_tdp_status = uw_get_tdp_min(tdp_index); + if (min_tdp_status < 0) + return min_tdp_status; tdp_min = uw_get_tdp_min(tdp_index); tdp_max = uw_get_tdp_max(tdp_index); if (tdp_data < tdp_min || tdp_data > tdp_max) return -EINVAL; - if (!has_current_setting) - return -EPERM; - uniwill_write_ec_ram(tdp_current_addr, tdp_data); return 0; diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index c161d26..b7f29f1 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -61,13 +61,6 @@ struct uniwill_device_features_t { bool uniwill_profile_v1_two_profs; bool uniwill_profile_v1_three_profs; bool uniwill_profile_v1_three_profs_leds_only; - /** - * Two or three configurable TDP values. Generally two for - * low power/more mobile devices and three for heavier workstations - * and gaming devices. - */ - bool uniwill_tdp_config_two; - bool uniwill_tdp_config_three; }; u32 uniwill_add_interface(struct uniwill_interface_t *new_interface); diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 518130f..45cbb81 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -225,25 +225,6 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) uw_feats->uniwill_profile_v1_two_profs || uw_feats->uniwill_profile_v1_three_profs; - // Device check for two configurable TDPs - uw_feats->uniwill_tdp_config_two = false -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - || uw_feats->model == 0x13 - || uw_feats->model == 0x12 - || dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX") -#endif - ; - - // Device check for three configurable TDPs - uw_feats->uniwill_tdp_config_three = false - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI02") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA03") - || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") - || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") - ; - return uw_feats; } EXPORT_SYMBOL(uniwill_get_device_features); From b6dea7ac2e873c9c6ee62593e9967f09b23a9d16 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 26 Nov 2021 15:49:17 +0100 Subject: [PATCH 16/40] Update uw tdp defs for polaris/stellaris Changes according to reported original table values - Min TDPs changed to 10W - Intel PL4 now max 200W resulting in 120/120/200 - AMD max defs lowered to 80/80/95 --- src/tuxedo_io/tuxedo_io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 86d16ab..3a532d6 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -79,17 +79,17 @@ static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; static int tdp_min_ph4tqx[] = { 0x01, 0x01, 0x00 }; static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; -static int tdp_min_gmxngxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxngxx[] = { 0x78, 0x78, 0x78 }; +static int tdp_min_gmxngxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_max_gmxngxx[] = { 0x50, 0x50, 0x5f }; -static int tdp_min_gmxmgxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0x78 }; +static int tdp_min_gmxmgxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0xc8 }; -static int tdp_min_gmxtgxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0x78 }; +static int tdp_min_gmxtgxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0xc8 }; -static int tdp_min_gmxzgxx[] = { 0x01, 0x01, 0x01 }; -static int tdp_max_gmxzgxx[] = { 0x78, 0x78, 0x78 }; +static int tdp_min_gmxzgxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_max_gmxzgxx[] = { 0x50, 0x50, 0x5f }; static int *tdp_min_defs = NULL; static int *tdp_max_defs = NULL; From 0d4a633c6569f4d3ea80560adae71a7b5af05839 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Mon, 10 Jan 2022 19:44:15 +0100 Subject: [PATCH 17/40] Add IBP14gen6 id and refactor model numbers --- src/tuxedo_io/tuxedo_io.c | 6 +++--- src/uniwill_interfaces.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 3a532d6..94e5625 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -96,13 +96,13 @@ static int *tdp_max_defs = NULL; void uw_id_tdp(void) { - if (uw_feats->model == 0x13) { + if (uw_feats->model == UW_MODEL_PH4TUX) { tdp_min_defs = tdp_min_ph4tux; tdp_max_defs = tdp_max_ph4tux; - } else if (uw_feats->model == 0x12) { + } else if (uw_feats->model == UW_MODEL_PH4TRX) { tdp_min_defs = tdp_min_ph4trx; tdp_max_defs = tdp_max_ph4trx; - } else if (dmi_string_in(DMI_PRODUCT_SERIAL, "PH4TQX")) { + } else if (uw_feats->model == UW_MODEL_PH4TQF) { tdp_min_defs = tdp_min_ph4tqx; tdp_max_defs = tdp_max_ph4tqx; } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index b7f29f1..fbc1d71 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -46,6 +46,10 @@ struct uniwill_interface_t { uniwill_write_ec_ram_t *write_ec_ram; }; +#define UW_MODEL_PH4TUX 0x13 +#define UW_MODEL_PH4TRX 0x12 +#define UW_MODEL_PH4TQF 0x14 + struct uniwill_device_features_t { u8 model; /** From 0b6d0073b2feb0b21f8b41988d83a177fd91c0e0 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Mon, 17 Jan 2022 21:16:29 +0100 Subject: [PATCH 18/40] Assign three profiles to xmg fusion --- src/uniwill_keyboard.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 45cbb81..ea5a50f 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -207,6 +207,9 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") + || dmi_match(DMI_BOARD_NAME, "LAPQC71A") + || dmi_match(DMI_BOARD_NAME, "LAPQC71B") + || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") ; uw_feats->uniwill_profile_v1_three_profs_leds_only = false From e9b429cceac6a639153ff0edfc6d65004464885a Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 30 Mar 2022 11:15:06 +0200 Subject: [PATCH 19/40] Fix build on older kernel --- src/tuxedo_io/tuxedo_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 94e5625..02380d5 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2019-2021 TUXEDO Computers GmbH + * Copyright (c) 2019-2022 TUXEDO Computers GmbH * * This file is part of tuxedo-io. * @@ -105,6 +105,7 @@ void uw_id_tdp(void) } else if (uw_feats->model == UW_MODEL_PH4TQF) { tdp_min_defs = tdp_min_ph4tqx; tdp_max_defs = tdp_max_ph4tqx; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { tdp_min_defs = tdp_min_gmxngxx; tdp_max_defs = tdp_max_gmxngxx; @@ -119,6 +120,7 @@ void uw_id_tdp(void) || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { tdp_min_defs = tdp_min_gmxzgxx; tdp_max_defs = tdp_max_gmxzgxx; +#endif } else { tdp_min_defs = NULL; tdp_max_defs = NULL; From a3f73cc50254e83ef387688937b3e017d85b5e27 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 30 Mar 2022 11:16:08 +0200 Subject: [PATCH 20/40] ioctl: Add uw model id getter --- src/tuxedo_io/tuxedo_io.c | 4 ++++ src/tuxedo_io/tuxedo_io_ioctl.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 02380d5..90a310b 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -415,6 +415,10 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne copy_result = copy_to_user((char *) arg, str_no_if, strlen(str_no_if) + 1); } break; + case R_UW_MODEL_ID: + result = uw_feats->model; + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; case R_UW_FANSPEED: uniwill_read_ec_ram(0x1804, &byte_data); result = byte_data; diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index a98d79c..596dbfe 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2019-2021 TUXEDO Computers GmbH + * Copyright (c) 2019-2022 TUXEDO Computers GmbH * * This file is part of tuxedo-io. * @@ -72,6 +72,7 @@ // Read #define R_UW_HW_IF_STR _IOR(MAGIC_READ_UW, 0x00, char*) +#define R_UW_MODEL_ID _IOR(MAGIC_READ_UW, 0x01, int32_t*) #define R_UW_FANSPEED _IOR(MAGIC_READ_UW, 0x10, int32_t*) #define R_UW_FANSPEED2 _IOR(MAGIC_READ_UW, 0x11, int32_t*) #define R_UW_FAN_TEMP _IOR(MAGIC_READ_UW, 0x12, int32_t*) From a8a934b4f176f1b0c2fb6d165c236da6c581e985 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 27 Jul 2022 12:27:14 +0200 Subject: [PATCH 21/40] Add polaris intel gen 4 power defs --- src/tuxedo_io/tuxedo_io.c | 6 ++++++ src/uniwill_keyboard.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 90a310b..8526b40 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -91,6 +91,9 @@ static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0xc8 }; static int tdp_min_gmxzgxx[] = { 0x0a, 0x0a, 0x0a }; static int tdp_max_gmxzgxx[] = { 0x50, 0x50, 0x5f }; +static int tdp_min_gmxagxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_max_gmxagxx[] = { 0x78, 0x78, 0xd7 }; + static int *tdp_min_defs = NULL; static int *tdp_max_defs = NULL; @@ -120,6 +123,9 @@ void uw_id_tdp(void) || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03")) { tdp_min_defs = tdp_min_gmxzgxx; tdp_max_defs = tdp_max_gmxzgxx; + } else if (dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04")) { + tdp_min_defs = tdp_min_gmxagxx; + tdp_max_defs = tdp_max_gmxagxx; #endif } else { tdp_min_defs = NULL; diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index ea5a50f..e242419 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -221,6 +221,7 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) || dmi_match(DMI_PRODUCT_SKU, "POLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") + || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") #endif ; From dd26ff6100f1af47acc6ff02053a5f346c2788df Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 12 Aug 2022 15:26:18 +0200 Subject: [PATCH 22/40] Change min selectable TDP for all impl. devices to 5 W --- src/tuxedo_io/tuxedo_io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 8526b40..5c66979 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -70,28 +70,28 @@ static u32 clevo_identify(void) /* * TDP boundary definitions per device */ -static int tdp_min_ph4tux[] = { 0x01, 0x01, 0x00 }; +static int tdp_min_ph4tux[] = { 0x05, 0x05, 0x00 }; static int tdp_max_ph4tux[] = { 0x26, 0x26, 0x00 }; -static int tdp_min_ph4trx[] = { 0x01, 0x01, 0x00 }; +static int tdp_min_ph4trx[] = { 0x05, 0x05, 0x00 }; static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; -static int tdp_min_ph4tqx[] = { 0x01, 0x01, 0x00 }; +static int tdp_min_ph4tqx[] = { 0x05, 0x05, 0x00 }; static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; -static int tdp_min_gmxngxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_min_gmxngxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxngxx[] = { 0x50, 0x50, 0x5f }; -static int tdp_min_gmxmgxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_min_gmxmgxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxmgxx[] = { 0x78, 0x78, 0xc8 }; -static int tdp_min_gmxtgxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_min_gmxtgxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxtgxx[] = { 0x78, 0x78, 0xc8 }; -static int tdp_min_gmxzgxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_min_gmxzgxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxzgxx[] = { 0x50, 0x50, 0x5f }; -static int tdp_min_gmxagxx[] = { 0x0a, 0x0a, 0x0a }; +static int tdp_min_gmxagxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxagxx[] = { 0x78, 0x78, 0xd7 }; static int *tdp_min_defs = NULL; From 44801d689f5bd2e583a283f2d23a24d78a03bf71 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 19 Aug 2022 17:12:34 +0200 Subject: [PATCH 23/40] Add Pulse 15 Gen 2 defs (tdp + id) --- src/tuxedo_io/tuxedo_io.c | 6 ++++++ src/uniwill_interfaces.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 5c66979..6bb514d 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -79,6 +79,9 @@ static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; static int tdp_min_ph4tqx[] = { 0x05, 0x05, 0x00 }; static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; +static int tdp_min_pfxluxg[] = { 0x05, 0x05, 0x05 }; +static int tdp_max_pfxluxg[] = { 0x23, 0x23, 0x28 }; + static int tdp_min_gmxngxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxngxx[] = { 0x50, 0x50, 0x5f }; @@ -109,6 +112,9 @@ void uw_id_tdp(void) tdp_min_defs = tdp_min_ph4tqx; tdp_max_defs = tdp_max_ph4tqx; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + } else if (dmi_match(DMI_PRODUCT_SKU, "PULSE1502")) { + tdp_min_defs = tdp_min_pfxluxg; + tdp_max_defs = tdp_max_pfxluxg; } else if (dmi_match(DMI_PRODUCT_SKU, "POLARIS1XA02")) { tdp_min_defs = tdp_min_gmxngxx; tdp_max_defs = tdp_max_gmxngxx; diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index fbc1d71..7287d00 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -46,6 +46,7 @@ struct uniwill_interface_t { uniwill_write_ec_ram_t *write_ec_ram; }; +#define UW_MODEL_PF5LUXG 0x09 #define UW_MODEL_PH4TUX 0x13 #define UW_MODEL_PH4TRX 0x12 #define UW_MODEL_PH4TQF 0x14 From cbc4267071cbaf33f03303e255ef8863d7e669d0 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 15 Sep 2022 16:04:17 +0200 Subject: [PATCH 24/40] Add Stellaris AMD gen 4 ID for lightbar support --- src/uniwill_keyboard.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 41f7b8d..3646ab1 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -699,6 +699,7 @@ static int uw_lightbar_init(struct platform_device *dev) || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") + || dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04") #endif ; From 67a80ca3a220c45cbc6780cee5d706ae555da774 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Fri, 23 Sep 2022 11:45:40 +0200 Subject: [PATCH 25/40] Remove XMG Fusion from three profiles list Not compatible with current control mechanism --- src/uniwill_keyboard.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index e242419..382f7e4 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -207,9 +207,11 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) || dmi_match(DMI_BOARD_NAME, "POLARIS1701A2060") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I1650TI") || dmi_match(DMI_BOARD_NAME, "POLARIS1701I2060") - || dmi_match(DMI_BOARD_NAME, "LAPQC71A") - || dmi_match(DMI_BOARD_NAME, "LAPQC71B") - || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") + // Note: XMG Fusion removed for now, seem to have + // neither same power profile control nor TDP set + //|| dmi_match(DMI_BOARD_NAME, "LAPQC71A") + //|| dmi_match(DMI_BOARD_NAME, "LAPQC71B") + //|| dmi_match(DMI_PRODUCT_NAME, "A60 MUV") ; uw_feats->uniwill_profile_v1_three_profs_leds_only = false From e6ecf69560ae8023e5dd8a1155a8b4ce8f9f580e Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Tue, 27 Sep 2022 15:06:23 +0200 Subject: [PATCH 26/40] Add TDP ranges for IBPGen7 --- src/tuxedo_io/tuxedo_io.c | 6 ++++++ src/uniwill_interfaces.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 6bb514d..29eafe3 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -79,6 +79,9 @@ static int tdp_max_ph4trx[] = { 0x32, 0x32, 0x00 }; static int tdp_min_ph4tqx[] = { 0x05, 0x05, 0x00 }; static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 }; +static int tdp_min_ph4axx[] = { 0x05, 0x05, 0x00 }; +static int tdp_max_ph4axx[] = { 0x2d, 0x3c, 0x00 }; + static int tdp_min_pfxluxg[] = { 0x05, 0x05, 0x05 }; static int tdp_max_pfxluxg[] = { 0x23, 0x23, 0x28 }; @@ -111,6 +114,9 @@ void uw_id_tdp(void) } else if (uw_feats->model == UW_MODEL_PH4TQF) { tdp_min_defs = tdp_min_ph4tqx; tdp_max_defs = tdp_max_ph4tqx; + } else if (uw_feats->model == UW_MODEL_PH4AQF_ARX) { + tdp_min_defs = tdp_min_ph4axx; + tdp_max_defs = tdp_max_ph4axx; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) } else if (dmi_match(DMI_PRODUCT_SKU, "PULSE1502")) { tdp_min_defs = tdp_min_pfxluxg; diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index 7287d00..219c814 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -50,6 +50,7 @@ struct uniwill_interface_t { #define UW_MODEL_PH4TUX 0x13 #define UW_MODEL_PH4TRX 0x12 #define UW_MODEL_PH4TQF 0x14 +#define UW_MODEL_PH4AQF_ARX 0x17 struct uniwill_device_features_t { u8 model; From b9b6f240c8d10c00372c51cd351f1716b4272ee6 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Tue, 27 Sep 2022 15:13:13 +0200 Subject: [PATCH 27/40] Add Stellaris AMD Gen4 TDP ranges + threeprofile leds id --- src/tuxedo_io/tuxedo_io.c | 6 ++++++ src/uniwill_keyboard.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 29eafe3..d25583a 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -100,6 +100,9 @@ static int tdp_max_gmxzgxx[] = { 0x50, 0x50, 0x5f }; static int tdp_min_gmxagxx[] = { 0x05, 0x05, 0x05 }; static int tdp_max_gmxagxx[] = { 0x78, 0x78, 0xd7 }; +static int tdp_min_gmxrgxx[] = { 0x05, 0x05, 0x05 }; +static int tdp_max_gmxrgxx[] = { 0x64, 0x64, 0x6e }; + static int *tdp_min_defs = NULL; static int *tdp_max_defs = NULL; @@ -138,6 +141,9 @@ void uw_id_tdp(void) } else if (dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04")) { tdp_min_defs = tdp_min_gmxagxx; tdp_max_defs = tdp_max_gmxagxx; + } else if (dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04")) { + tdp_min_defs = tdp_min_gmxrgxx; + tdp_max_defs = tdp_max_gmxrgxx; #endif } else { tdp_min_defs = NULL; diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 382f7e4..547e505 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -224,6 +224,7 @@ struct uniwill_device_features_t *uniwill_get_device_features(void) || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XA03") || dmi_match(DMI_PRODUCT_SKU, "STELLARIS1XI04") + || dmi_match(DMI_PRODUCT_SKU, "STEPOL1XA04") #endif ; From 5055221eea348302a46086c3870f9f40341a6915 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Wed, 28 Sep 2022 19:23:16 +0200 Subject: [PATCH 28/40] Implement new fan control --- src/tuxedo_io/tuxedo_io.c | 122 +++++++++++++++++++++++++++++++------- 1 file changed, 101 insertions(+), 21 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 22f51e4..5d8d627 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -156,6 +156,67 @@ static long clevo_ioctl_interface(struct file *file, unsigned int cmd, unsigned return 0; } +static int has_universal_ec_fan_control(void) { + int ret; + u8 data; + + ret = uniwill_read_ec_ram(0x0751, &data); + if (ret < 0) { + return ret; + } + return (data >> 6) & 1; +} + +static bool fans_initialized = false; + +static int uw_init_fan(void) { + int i; + + u16 addr_use_custom_fan_table_0 = 0x07c5; + u16 addr_use_custom_fan_table_1 = 0x07c6; + u8 offset_use_custom_fan_table_0 = 7; + u8 offset_use_custom_fan_table_1 = 2; + u8 value_use_custom_fan_table_0; + u8 value_use_custom_fan_table_1; + u16 addr_cpu_custom_fan_table_end_temp = 0x0f00; + u16 addr_cpu_custom_fan_table_start_temp = 0x0f10; + u16 addr_cpu_custom_fan_table_fan_speed = 0x0f20; + u16 addr_gpu_custom_fan_table_end_temp = 0x0f30; + u16 addr_gpu_custom_fan_table_start_temp = 0x0f40; + u16 addr_gpu_custom_fan_table_fan_speed = 0x0f50; + + if (!fans_initialized && (has_universal_ec_fan_control() == 1)) { + uniwill_read_ec_ram(addr_use_custom_fan_table_0, &value_use_custom_fan_table_0); + uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); + + if (!((value_use_custom_fan_table_0 >> offset_use_custom_fan_table_0) & 1)) { + uniwill_write_ec_ram(addr_use_custom_fan_table_0, value_use_custom_fan_table_0 + (1 << offset_use_custom_fan_table_0)); + } + if (!((value_use_custom_fan_table_1 >> offset_use_custom_fan_table_1) & 1)) { + uniwill_write_ec_ram(addr_use_custom_fan_table_1, value_use_custom_fan_table_1 + (1 << offset_use_custom_fan_table_1)); + } + + uniwill_write_ec_ram(addr_cpu_custom_fan_table_end_temp, 0xff); + uniwill_write_ec_ram(addr_cpu_custom_fan_table_start_temp, 0x00); + uniwill_write_ec_ram(addr_cpu_custom_fan_table_fan_speed, 0x00); + uniwill_write_ec_ram(addr_gpu_custom_fan_table_end_temp, 0xff); + uniwill_write_ec_ram(addr_gpu_custom_fan_table_start_temp, 0x00); + uniwill_write_ec_ram(addr_gpu_custom_fan_table_fan_speed, 0x00); + for (i = 0x1; i <= 0xf; ++i) { + uniwill_write_ec_ram(addr_cpu_custom_fan_table_end_temp + i, 0xff); + uniwill_write_ec_ram(addr_cpu_custom_fan_table_start_temp + i, 0xff); + uniwill_write_ec_ram(addr_cpu_custom_fan_table_fan_speed + i, 0x00); + uniwill_write_ec_ram(addr_gpu_custom_fan_table_end_temp + i, 0xff); + uniwill_write_ec_ram(addr_gpu_custom_fan_table_start_temp + i, 0xff); + uniwill_write_ec_ram(addr_gpu_custom_fan_table_fan_speed + i, 0x00); + } + } + + fans_initialized = true; + + return 0; // TODO Sensefull error handling +} + static u32 uw_set_fan(u32 fan_index, u8 fan_speed) { u32 i; @@ -164,30 +225,49 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed) u16 addr_fan1 = 0x1809; u16 addr_for_fan; - if (fan_index == 0) - addr_for_fan = addr_fan0; - else if (fan_index == 1) - addr_for_fan = addr_fan1; - else - return -EINVAL; + u16 addr_cpu_custom_fan_table_fan_speed = 0x0f20; + u16 addr_gpu_custom_fan_table_fan_speed = 0x0f50; + + if (has_universal_ec_fan_control() == 1) { + uw_init_fan(); + + // TODO Disable full fan mode + + if (fan_index == 0) + addr_for_fan = addr_cpu_custom_fan_table_fan_speed; + else if (fan_index == 1) + addr_for_fan = addr_gpu_custom_fan_table_fan_speed; + else + return -EINVAL; - // Check current mode - uniwill_read_ec_ram(0x0751, &mode_data); - if (!(mode_data & 0x40)) { - // If not "full fan mode" (i.e. 0x40 bit set) switch to it (required for fancontrol) - uniwill_write_ec_ram(0x0751, mode_data | 0x40); - // Attempt to write both fans as quick as possible before complete ramp-up - pr_debug("prevent ramp-up start\n"); - for (i = 0; i < 10; ++i) { - uniwill_write_ec_ram(addr_fan0, fan_speed & 0xff); - uniwill_write_ec_ram(addr_fan1, fan_speed & 0xff); - msleep(10); - } - pr_debug("prevent ramp-up done\n"); - } else { - // Otherwise just set the chosen fan uniwill_write_ec_ram(addr_for_fan, fan_speed & 0xff); } + else { // old workaround using full fan mode + if (fan_index == 0) + addr_for_fan = addr_fan0; + else if (fan_index == 1) + addr_for_fan = addr_fan1; + else + return -EINVAL; + + // Check current mode + uniwill_read_ec_ram(0x0751, &mode_data); + if (!(mode_data & 0x40)) { + // If not "full fan mode" (i.e. 0x40 bit set) switch to it (required for fancontrol) + uniwill_write_ec_ram(0x0751, mode_data | 0x40); + // Attempt to write both fans as quick as possible before complete ramp-up + pr_debug("prevent ramp-up start\n"); + for (i = 0; i < 10; ++i) { + uniwill_write_ec_ram(addr_fan0, fan_speed & 0xff); + uniwill_write_ec_ram(addr_fan1, fan_speed & 0xff); + msleep(10); + } + pr_debug("prevent ramp-up done\n"); + } else { + // Otherwise just set the chosen fan + uniwill_write_ec_ram(addr_for_fan, fan_speed & 0xff); + } + } return 0; } From d3a8c76aa6a4967783804aeca23f69fd41e847d7 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Thu, 29 Sep 2022 15:15:14 +0200 Subject: [PATCH 29/40] Fix wrong address --- src/tuxedo_io/tuxedo_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 5d8d627..0c0fee0 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -160,7 +160,7 @@ static int has_universal_ec_fan_control(void) { int ret; u8 data; - ret = uniwill_read_ec_ram(0x0751, &data); + ret = uniwill_read_ec_ram(0x078e, &data); if (ret < 0) { return ret; } From e92bbccbe06a97245c989abb89b6994dcde95e90 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Thu, 29 Sep 2022 15:16:04 +0200 Subject: [PATCH 30/40] Make sure full fan mode is (un-)set correctly --- src/tuxedo_io/tuxedo_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 0c0fee0..b7311bb 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -167,6 +167,23 @@ static int has_universal_ec_fan_control(void) { return (data >> 6) & 1; } +static int set_full_fan_mode(bool enable) { + u8 mode_data; + + uniwill_read_ec_ram(0x0751, &mode_data); + + if (enable && !(mode_data & 0x40)) { + // If not "full fan mode" (i.e. 0x40 bit not set) switch to it (required for old fancontrol) + return uniwill_write_ec_ram(0x0751, mode_data | 0x40); + } + else if (mode_data & 0x40){ + // If "full fan mode" (i.e. 0x40 bit set) turn it off (required for new fancontrol) + return uniwill_write_ec_ram(0x0751, mode_data & ~0x40); + } + + return 0; +} + static bool fans_initialized = false; static int uw_init_fan(void) { @@ -186,6 +203,8 @@ static int uw_init_fan(void) { u16 addr_gpu_custom_fan_table_fan_speed = 0x0f50; if (!fans_initialized && (has_universal_ec_fan_control() == 1)) { + set_full_fan_mode(false); + uniwill_read_ec_ram(addr_use_custom_fan_table_0, &value_use_custom_fan_table_0); uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); @@ -231,8 +250,6 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed) if (has_universal_ec_fan_control() == 1) { uw_init_fan(); - // TODO Disable full fan mode - if (fan_index == 0) addr_for_fan = addr_cpu_custom_fan_table_fan_speed; else if (fan_index == 1) @@ -254,7 +271,7 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed) uniwill_read_ec_ram(0x0751, &mode_data); if (!(mode_data & 0x40)) { // If not "full fan mode" (i.e. 0x40 bit set) switch to it (required for fancontrol) - uniwill_write_ec_ram(0x0751, mode_data | 0x40); + set_full_fan_mode(true); // Attempt to write both fans as quick as possible before complete ramp-up pr_debug("prevent ramp-up start\n"); for (i = 0; i < 10; ++i) { From 47bbd14ca0ad06b95739bc0fbc1e886043a357d7 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Thu, 29 Sep 2022 15:16:43 +0200 Subject: [PATCH 31/40] Remove useless comment, there few to no error handling in the whole module --- src/tuxedo_io/tuxedo_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index b7311bb..ad84fc7 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -233,7 +233,7 @@ static int uw_init_fan(void) { fans_initialized = true; - return 0; // TODO Sensefull error handling + return 0; } static u32 uw_set_fan(u32 fan_index, u8 fan_speed) From 44f7fd0151aeb3cd96764c99535d103c781ece10 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 4 Oct 2022 13:59:13 +0200 Subject: [PATCH 32/40] Expose fan control limitations to userspace --- src/tuxedo_io/tuxedo_io.c | 22 +++++++++++++++++++++- src/tuxedo_io/tuxedo_io_ioctl.h | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index ad84fc7..c8f087c 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -32,7 +32,7 @@ MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops"); MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_VERSION("0.2.4"); +MODULE_VERSION("0.2.5"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CLEVO_INTERFACES(); @@ -358,6 +358,26 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne result = byte_data; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; + case R_UW_FANS_OFF_POSSIBLE: + result = has_universal_ec_fan_control(); + if (result == 1) { + result = 0; + } + else if (result == 0) { + result = 1; + } + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; + case R_UW_FANSPEED_MIN: + result = has_universal_ec_fan_control(); + if (result == 1) { + result = 20; + } + else if (result == 0) { + result = 0; + } + copy_result = copy_to_user((void *) arg, &result, sizeof(result)); + break; #ifdef DEBUG case R_TF_BC: copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg)); diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index f271707..a829753 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -79,6 +79,8 @@ #define R_UW_MODE _IOR(MAGIC_READ_UW, 0x14, int32_t*) #define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x15, int32_t*) +#define R_UW_FANS_OFF_POSSIBLE _IOR(MAGIC_READ_UW, 0x16, int32_t*) +#define R_UW_FANSPEED_MIN _IOR(MAGIC_READ_UW, 0x17, int32_t*) // Write #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) From a8b3cb6dc38272c6602709a83dedc4db34ede1c7 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 4 Oct 2022 19:00:27 +0200 Subject: [PATCH 33/40] Fix define names --- src/tuxedo_io/tuxedo_io.c | 4 ++-- src/tuxedo_io/tuxedo_io_ioctl.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index c8f087c..71edfcf 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -358,7 +358,7 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne result = byte_data; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; - case R_UW_FANS_OFF_POSSIBLE: + case R_UW_FANS_OFF_AVAILABLE: result = has_universal_ec_fan_control(); if (result == 1) { result = 0; @@ -368,7 +368,7 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne } copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; - case R_UW_FANSPEED_MIN: + case R_UW_FANS_MIN_SPEED: result = has_universal_ec_fan_control(); if (result == 1) { result = 20; diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index a829753..d506232 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -79,8 +79,8 @@ #define R_UW_MODE _IOR(MAGIC_READ_UW, 0x14, int32_t*) #define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x15, int32_t*) -#define R_UW_FANS_OFF_POSSIBLE _IOR(MAGIC_READ_UW, 0x16, int32_t*) -#define R_UW_FANSPEED_MIN _IOR(MAGIC_READ_UW, 0x17, int32_t*) +#define R_UW_FANS_OFF_AVAILABLE _IOR(MAGIC_READ_UW, 0x16, int32_t*) +#define R_UW_FANS_MIN_SPEED _IOR(MAGIC_READ_UW, 0x17, int32_t*) // Write #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) From 19642a2496752d2e666170ef0dc4f296cf04236d Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Wed, 5 Oct 2022 16:25:37 +0200 Subject: [PATCH 34/40] Add retries for ex write and move enable custom fan table to end because of possible external race condition --- src/tuxedo_io/tuxedo_io.c | 53 +++++++++++++++++++++------------------ src/uniwill_interfaces.h | 2 ++ src/uniwill_keyboard.h | 26 +++++++++++++++++++ 3 files changed, 57 insertions(+), 24 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 71edfcf..d52db86 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -189,8 +189,8 @@ static bool fans_initialized = false; static int uw_init_fan(void) { int i; - u16 addr_use_custom_fan_table_0 = 0x07c5; - u16 addr_use_custom_fan_table_1 = 0x07c6; + u16 addr_use_custom_fan_table_0 = 0x07c5; // use different tables for both fans (0x0f00-0x0f2f and 0x0f30-0x0f5f respectivly) + u16 addr_use_custom_fan_table_1 = 0x07c6; // enable 0x0fxx fantables u8 offset_use_custom_fan_table_0 = 7; u8 offset_use_custom_fan_table_1 = 2; u8 value_use_custom_fan_table_0; @@ -206,28 +206,28 @@ static int uw_init_fan(void) { set_full_fan_mode(false); uniwill_read_ec_ram(addr_use_custom_fan_table_0, &value_use_custom_fan_table_0); - uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); - if (!((value_use_custom_fan_table_0 >> offset_use_custom_fan_table_0) & 1)) { - uniwill_write_ec_ram(addr_use_custom_fan_table_0, value_use_custom_fan_table_0 + (1 << offset_use_custom_fan_table_0)); - } - if (!((value_use_custom_fan_table_1 >> offset_use_custom_fan_table_1) & 1)) { - uniwill_write_ec_ram(addr_use_custom_fan_table_1, value_use_custom_fan_table_1 + (1 << offset_use_custom_fan_table_1)); + uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_0, value_use_custom_fan_table_0 + (1 << offset_use_custom_fan_table_0), 3); } - uniwill_write_ec_ram(addr_cpu_custom_fan_table_end_temp, 0xff); - uniwill_write_ec_ram(addr_cpu_custom_fan_table_start_temp, 0x00); - uniwill_write_ec_ram(addr_cpu_custom_fan_table_fan_speed, 0x00); - uniwill_write_ec_ram(addr_gpu_custom_fan_table_end_temp, 0xff); - uniwill_write_ec_ram(addr_gpu_custom_fan_table_start_temp, 0x00); - uniwill_write_ec_ram(addr_gpu_custom_fan_table_fan_speed, 0x00); + uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_end_temp, 0xff, 3); + uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_start_temp, 0x00, 3); + uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_fan_speed, 0x00, 3); + uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_end_temp, 0xff, 3); + uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_start_temp, 0x00, 3); + uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_fan_speed, 0x00, 3); for (i = 0x1; i <= 0xf; ++i) { - uniwill_write_ec_ram(addr_cpu_custom_fan_table_end_temp + i, 0xff); - uniwill_write_ec_ram(addr_cpu_custom_fan_table_start_temp + i, 0xff); - uniwill_write_ec_ram(addr_cpu_custom_fan_table_fan_speed + i, 0x00); - uniwill_write_ec_ram(addr_gpu_custom_fan_table_end_temp + i, 0xff); - uniwill_write_ec_ram(addr_gpu_custom_fan_table_start_temp + i, 0xff); - uniwill_write_ec_ram(addr_gpu_custom_fan_table_fan_speed + i, 0x00); + uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_end_temp + i, 0xff, 3); + uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_start_temp + i, 0xff, 3); + uniwill_write_ec_ram_with_retry(addr_cpu_custom_fan_table_fan_speed + i, 0x00, 3); + uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_end_temp + i, 0xff, 3); + uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_start_temp + i, 0xff, 3); + uniwill_write_ec_ram_with_retry(addr_gpu_custom_fan_table_fan_speed + i, 0x00, 3); + } + + uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); + if (!((value_use_custom_fan_table_1 >> offset_use_custom_fan_table_1) & 1)) { + uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_1, value_use_custom_fan_table_1 + (1 << offset_use_custom_fan_table_1), 3); } } @@ -292,10 +292,15 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed) static u32 uw_set_fan_auto(void) { u8 mode_data; - // Get current mode - uniwill_read_ec_ram(0x0751, &mode_data); - // Switch off "full fan mode" (i.e. unset 0x40 bit) - uniwill_write_ec_ram(0x0751, mode_data & 0xbf); + + if (has_universal_ec_fan_control() == 1) { + } + else { + // Get current mode + uniwill_read_ec_ram(0x0751, &mode_data); + // Switch off "full fan mode" (i.e. unset 0x40 bit) + uniwill_write_ec_ram(0x0751, mode_data & 0xbf); + } return 0; } diff --git a/src/uniwill_interfaces.h b/src/uniwill_interfaces.h index 3c1bf45..3ecd155 100644 --- a/src/uniwill_interfaces.h +++ b/src/uniwill_interfaces.h @@ -37,6 +37,7 @@ typedef u32 (uniwill_read_ec_ram_t)(u16, u8*); typedef u32 (uniwill_write_ec_ram_t)(u16, u8); +typedef u32 (uniwill_write_ec_ram_with_retry_t)(u16, u8, int); typedef void (uniwill_event_callb_t)(u32); struct uniwill_interface_t { @@ -50,6 +51,7 @@ u32 uniwill_add_interface(struct uniwill_interface_t *new_interface); u32 uniwill_remove_interface(struct uniwill_interface_t *interface); uniwill_read_ec_ram_t uniwill_read_ec_ram; uniwill_write_ec_ram_t uniwill_write_ec_ram; +uniwill_write_ec_ram_with_retry_t uniwill_write_ec_ram_with_retry; u32 uniwill_get_active_interface_id(char **id_str); union uw_ec_read_return { diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 41f7b8d..00e227f 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -124,6 +124,32 @@ u32 uniwill_write_ec_ram(u16 address, u8 data) } EXPORT_SYMBOL(uniwill_write_ec_ram); +u32 uniwill_write_ec_ram_with_retry(u16 address, u8 data, int retries) +{ + u32 status; + int i; + u8 control_data; + + for (i = 0; i < retries; ++i) { + status = uniwill_write_ec_ram(address, data); + if (status != 0) { + msleep(50); + continue; + } + else { + status = uniwill_read_ec_ram(address, &control_data); + if (status != 0 || data != control_data) { + msleep(50); + continue; + } + break; + } + } + + return status; +} +EXPORT_SYMBOL(uniwill_write_ec_ram_with_retry); + static DEFINE_MUTEX(uniwill_interface_modification_lock); u32 uniwill_add_interface(struct uniwill_interface_t *interface) From 824933fc7029dc784362763d4e20bcc6167ea129 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 6 Oct 2022 09:08:41 +0200 Subject: [PATCH 35/40] Update version to 3.0.11 + changelog --- .../usr/share/doc/module-name/changelog.gz | Bin 1327 -> 1419 bytes dkms.conf | 2 +- src/tuxedo_keyboard.c | 2 +- src_pkg/rpm_pkg.spec | 4 ++++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deb/module-name/usr/share/doc/module-name/changelog.gz b/deb/module-name/usr/share/doc/module-name/changelog.gz index a54bc6d82fe4176bc60f5562cb93713cd064edd0..bf28b18d0ed02a2cc7eac2f41bd742a9e1ec82c2 100644 GIT binary patch literal 1419 zcmV;61$6o!iwFpxeLiCX17m1mZf9j|Z)X6lSKDseMi71XR}B16NUg1q6lq)P1$BH0 z+`^7g$4K6SCApFoTJ92ik?eeZXP2ZzwNhvneX#{{FK5o2Gcz>yh34{fNncY*R1Smj zC>Vv|@Mo}UPDS?mE0^mdfFI#b7$tL?Q6StPTMElKhHai9)ayTxS@K1C}X?|QC#9pX|f@#gf{9UT#l8T)xr2s+K zcwSCdETj792u@Go3ZC%9l&U%WV(iQB#s`_nqO=ak2!H(s@M&RBAUK1MnSm&XA_yka zAesgN{1k*iaCBt$aue*~<}%OW$xzOTV%jl9Ip7M2fwTF-q(p(XWhs^M%dhE-SZ=m2 zjdVQp1|MC(WvMFgVLTmQbb+57z<&4sDNI&p@Pq$#j=zvqC@|feg24Page6t85tK^K zU@g^>C}~CBNCV#yl!o7eBz!}4U~aaGU@!1!xu#+KE=)W(A#AXvBwKneATx?Xj`=1f z#bd<04=49hoIrTdBs9c7({S9y$;Ed#iIItek@rA$s~Adc0)JRuAq%5veBOoZ`~WhS zn@3q`t=7F~G{XG3|6|WAqN2x%7R$y=+P2sU@zUGHwcRGf)i-ab$xhyBGLBb{PP=cJ3y zvjcS2i&;C*Bhb{qAmhW{0u0VuxG=|I7p~+0u7{^2xPRW&A45O>!+dV(&Gqy9k01XG zlOTH2`Y(@_1w&L!*uCY7QzA}n2^nwdw>HF3V1gk_dLbg>Avrl>~C+9;bDiw3}kTjho| z6NYX@uBjU?u?+b&r|W_>Bg+~a493N@!4U#xR%FiVXfN~H+FxxWS-HE96(y$yQc}$@ zhylA99HYOFYc!Wvk9T+uY+Up8z^ipk~Wjdq7tR zb2IC%B)2H1)Ea|+_wV!xu(`nad*QYeGjoP*>9xikbxbai@0bU1f1rXY(t-?)Yue=B zc)&n>kh2|mx$o-6JG~?Ey}yYhnI=hBB+=nW9L@Mu01CAxm5;y=kjOVaLiRVSYX1^z z&?=<5eK*#o7YA4YXfBD9>aettX0r)Gk8{&beGvEYn_DWhF{~Ju?2FVz2rH_J2~hj4Ny#W95E@G&!vlMw&R!f78T=Pz&)BNGQBAAsyev114>;1A1dWMMRm&-##^ z9YE%C^B`-j<#fd|sy(9-=Fk0~dS)TzJEGgw=m-~1$NS~!lC`8tpoo)6IEB$v``ku@=9dB+SLYf6taAUO-!RC(J>)q{_iZhYRn|o^Hc)0ju zq*H9^yy&Cz^Z=dBV%E*`1T-};%J_J&0E4p*F3fS*hbuXN>;5qb?mqA8kD(v`VLrF? z{q^T}A3y#XCPDP7^WEb3nkWhd5s+E6!YAZX z;{n3B5{owc{H6BW)q;pQ?#Y{$vU?rgpAt?)hAaG*p?L@|;EuF;IGshk9cH>;%+zTv zj9(;VD7K^nZ90pRK4{TFiDaCvS!|7ah8h>lft{O+us_QVfP=uT|04yAMtO9(Pt*!PboPZA)(o=g1Ss zY5pzaL~A^3OU=Ih2(Bbm<&u*scb1@9qcq>TZPpuUvqeRaTsfaRO1*F^PK@JL zceUP-p1GFgI+h}OF}&>6A@5_qK5MgU>l z2QWDd@GrVG97>XK{NNi-De+A+U>=l8=Yz62^S)8f?V_9->b*C3yu&%Z8KW@5pl4c+ z`~=XG0#z&~ ziG1TLWPh`&@h`CktwNfg9UJ+%Z6bF!;s95$c~exswLm8BHT<{2S_d7sgJ)e?FZzNG l_Xq6(-{VMF0~z>BwuW-n4mg3Ey^@Z{{{}n5Wulr80035vf;s>I diff --git a/dkms.conf b/dkms.conf index 8d923cf..a3386c9 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME=tuxedo-keyboard -PACKAGE_VERSION=3.0.10 +PACKAGE_VERSION=3.0.11 DEST_MODULE_LOCATION[0]="/kernel/lib/" BUILT_MODULE_NAME[0]="tuxedo_keyboard" diff --git a/src/tuxedo_keyboard.c b/src/tuxedo_keyboard.c index 43e05ce..a0a421a 100644 --- a/src/tuxedo_keyboard.c +++ b/src/tuxedo_keyboard.c @@ -26,7 +26,7 @@ MODULE_AUTHOR("TUXEDO Computers GmbH "); MODULE_DESCRIPTION("TUXEDO Computers keyboard & keyboard backlight Driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION("3.0.10"); +MODULE_VERSION("3.0.11"); static DEFINE_MUTEX(tuxedo_keyboard_init_driver_lock); diff --git a/src_pkg/rpm_pkg.spec b/src_pkg/rpm_pkg.spec index c75a08a..6b3b2b3 100644 --- a/src_pkg/rpm_pkg.spec +++ b/src_pkg/rpm_pkg.spec @@ -142,6 +142,10 @@ exit 0 %changelog +* Thu Oct 06 2022 C Sandberg 3.0.11-1 +- Introduce alternative fan control (uw) +- Fan control parameters from driver "has fan off" and "min fan speed" +- Fixes missing/broken fan control on newer devices * Thu Apr 28 2022 C Sandberg 3.0.10-1 - Add Stellaris Intel gen 4 lightbar support - Default lightbar to off From 5ee0e18335738540c65f400fc62ab8efdc2b7b4f Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Fri, 7 Oct 2022 10:52:56 +0200 Subject: [PATCH 36/40] Fix conflicting ioctl numbers and update api version --- src/tuxedo_io/tuxedo_io.c | 2 +- src/tuxedo_io/tuxedo_io_ioctl.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index e84b058..605e81d 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -34,7 +34,7 @@ MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops"); MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_VERSION("0.2.5"); +MODULE_VERSION("0.2.6"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CLEVO_INTERFACES(); diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index 797e616..4a7c60e 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -83,17 +83,17 @@ #define R_UW_FANS_OFF_AVAILABLE _IOR(MAGIC_READ_UW, 0x16, int32_t*) #define R_UW_FANS_MIN_SPEED _IOR(MAGIC_READ_UW, 0x17, int32_t*) -#define R_UW_TDP0 _IOR(MAGIC_READ_UW, 0x16, int32_t*) -#define R_UW_TDP1 _IOR(MAGIC_READ_UW, 0x17, int32_t*) -#define R_UW_TDP2 _IOR(MAGIC_READ_UW, 0x18, int32_t*) -#define R_UW_TDP0_MIN _IOR(MAGIC_READ_UW, 0x19, int32_t*) -#define R_UW_TDP1_MIN _IOR(MAGIC_READ_UW, 0x1a, int32_t*) -#define R_UW_TDP2_MIN _IOR(MAGIC_READ_UW, 0x1b, int32_t*) -#define R_UW_TDP0_MAX _IOR(MAGIC_READ_UW, 0x1c, int32_t*) -#define R_UW_TDP1_MAX _IOR(MAGIC_READ_UW, 0x1d, int32_t*) -#define R_UW_TDP2_MAX _IOR(MAGIC_READ_UW, 0x1e, int32_t*) +#define R_UW_TDP0 _IOR(MAGIC_READ_UW, 0x18, int32_t*) +#define R_UW_TDP1 _IOR(MAGIC_READ_UW, 0x19, int32_t*) +#define R_UW_TDP2 _IOR(MAGIC_READ_UW, 0x1a, int32_t*) +#define R_UW_TDP0_MIN _IOR(MAGIC_READ_UW, 0x1b, int32_t*) +#define R_UW_TDP1_MIN _IOR(MAGIC_READ_UW, 0x1c, int32_t*) +#define R_UW_TDP2_MIN _IOR(MAGIC_READ_UW, 0x1d, int32_t*) +#define R_UW_TDP0_MAX _IOR(MAGIC_READ_UW, 0x1e, int32_t*) +#define R_UW_TDP1_MAX _IOR(MAGIC_READ_UW, 0x1f, int32_t*) +#define R_UW_TDP2_MAX _IOR(MAGIC_READ_UW, 0x20, int32_t*) -#define R_UW_PROFS_AVAILABLE _IOR(MAGIC_READ_UW, 0x1f, int32_t*) +#define R_UW_PROFS_AVAILABLE _IOR(MAGIC_READ_UW, 0x21, int32_t*) // Write #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) From e8dc238ae139a259134088a64f6789fef446976e Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Mon, 10 Oct 2022 07:39:47 +0000 Subject: [PATCH 37/40] Update version to 3.1.0 + changelog --- .../usr/share/doc/module-name/changelog.gz | Bin 1419 -> 1450 bytes dkms.conf | 2 +- src/tuxedo_io/tuxedo_io.c | 2 +- src/tuxedo_keyboard.c | 2 +- src_pkg/rpm_pkg.spec | 4 +++- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deb/module-name/usr/share/doc/module-name/changelog.gz b/deb/module-name/usr/share/doc/module-name/changelog.gz index bf28b18d0ed02a2cc7eac2f41bd742a9e1ec82c2..4440c1de8dcd60d018cb272aec16f65478d24111 100644 GIT binary patch literal 1450 zcmV;b1y%YViwFoo%R^%V17m1mZf9j|Z)X6lSle#fMi71XR}B16NR6$K6lq)P1$FE= za0@#|ogjG&mgGuWXt_)5MY8kton4X=)kvmU^u-a#y_`97X3j9iKG9sBF6nbBiOOLx z9)+V|_zPGyry_g)jmz~Bz|U}*=TOQuRZuE9W1MOrA_tR~FtZ{vObWu8d4_>q508%E z^c1e(5tpP?&EZ#LpZ+lZu1prCHB{*l{`wu@PKpx<1NfL3h=M4BU@{%Y(;$F1L5P2k zj?9l3gHagn0eLHolDW+&5RO*}V%Unpj0ni2d&MhsZs|?yVM!DzsKW#^B@4(EZc}i) zAlh%1v)Qqa_PAieKhY(n`Ehj+dqOS>rZp4ux2cj#Dt4}v0t9u$<#fd|s{4@hX<<(w zINKp7h&JRL;^t5S9}VT4D5f1#lmo7S7&x0ROiC1JTb5E8zxZjH20!^<=lBa*g#y#fDG1D;Ls(KZ8+nDoTB;>c(u%y1 z2EHRG4Zj6R_)eT?TZ&*$@L;*7Vf;2sJU1b1u%#qhdM+R{ibIb1CMCsV#Js=SFPemg z_-7i9yEwUcfs+`SI2d^kWH*YT)F$w!#g@)V7oBGZ=&TpBcAiI|sewVp z`?uTRyoC#M9CqPK4&b_fOoF@5yZS?K_;>NSrSGplzx(*{uP_OsSFQj0P?cbaiV3^7 zTyaXosVyPnP5;)07z#`aJ#J^53Z=QWa~WYIC*9*(`FY@c?05i^Veh{H3b5s|68r+>_UqvU?rgpAt?) zhAaG*zIg~Ia7UUvoK2%nhZ*k|Gj*B^;};3(i!EtE8&9L83tDtgA{nPExwRv&U#W7c zTJU{p|2OOrdI4#gL_Ce-&avYluayHd4IBoal*9i#Y{h5SUP?HKm4H=T6{X9CFIW0x zoUR7jaQZhr4C9(+E}p6x=E=U9s9MgO)phI_fH`3*bd9QoOzgI_GcWt!Kn zxSe;Kv8#9gNZ^r{8v%rI7r^8&z`yCX;82o;;|p&%g~TV#ht(mev|cEiGha9AxmlFs zm!Ge_-s2t4@%0#m5e6O8a^xp~jufcbveq8Z6~f%ix+}>o$|<$RV7>cy`UKcqVEnys zTZ)-ELtA>TaYr4KOXMB%Anp%TP(@mhp{bfS`R_eoAU??1j=cQ;BGk3hI}-2xO(e-Q zNxCA54oBi>#;*cUs5Pm41b%=-zVQ*Vzgbn+FR=zoh18!N8~M3yB6m0905@avx~YC^ zfQ;N@_-~E13Oa5E&#JRdx`Gb(2kimh<49Nm>G>sFK{;;*oWRXqNvp>H0Vy#O3|bNZ E0Iv$jBLDyZ delta 1416 zcmV;31$X+Y3yTYXABzYGpM5@K0s~`cVQyz-Y;R`(tykM_+eQ$5_g4)3P)MzIHRt3EaYtQO8K$f+e|<7FzBSdy(vXeP@@XM72_A7Jab=axZ7joHH{t_J!v1bV*-R zNmLGl@hBLD;qYg$YEDJ=`YV^~BY+>_P8cO~n^7R#P$h_eVJiwVA|R9Q6^DUc5B<{H z*29u0Qc&EWVWwmOxx#Gv@sVeYcJRM(jfu9_}e)s+h1K$yphTnoDd_#3$ZnlaEU@!1!xu#+KE|ahU7k>{Y_fnid zc+n&@#6Qz;+{MYocQ}cWiGz{%Kz6GbN^JsvSY9CuqiKBJh3xzQGMAf2S!u1-y=OGS z{JH;Q&n%>TM|8Uy9pJ+8aKAiVvXN$BIk819aAlSv$`o z(A2;naCf8Ny}LqGn*d~WH@_4E6WAO8%KAbQjKFOQW4 zLsU%Iz2%BiB2H}y8E@*hHpEb1f+0(KAuS4IhO*JJsGnw%OI3+R4}W`mB^o!C4N1J1 zjyub8yoW^BJ#tu~-lf%0O6(#j2B%!1!UmEvSEID+A$3p=c*7BGDnRlUMrq~BORES} zsQz6w_w1|?3Mo$A)r@fVjXEM#u_mf+u2#7=i(G0vKp0nI(T2~TE5BVWh?wJ^ylyGG z*Wvvs;Y4J(!f)xDhktMa_oT_g*);0xFysAVrcQHV{9Qu&VoO@k#?vV2f)*W=NXF?( zZrhR9uT(izE%-jQ{~PuQdjV;RL_Ce-&avYluT=+V3OEctDTn`c*ox1ty_9eeD*;_x znbPIL+m*f;r>ns>oc=`*!?>oIizjeJFY4^N`=+Qy%i1WL8Gnlgz=m7phBXt0Zbh!C z8!oX7`8B8Of;A({8XFA8#k9c@0%lfZ&gy6{^V-^9Z6jH^yN?wmrv*|{%`k`oyBQp# zzmID)msgK>cn)k~wNBl(llssBnzz8}QoqPDhji%nq8YG(k~!_e_h*`)z@$Yta{XQT zM57Sth7^Ng*?(JA^yU6T-M@#eRaUSy<9yrF>%uwk#BrK`%{b8-58G0+Z$E-7NLjk% zq{^KosMaXWcez}Pws7n9M%rvq5+qm7=Z;b@+>#UHxYcc~*Q95zWx0-}h+gzBdt-Qz ztD4`iL(Y+(Ejsu`3og^V?uy%aw;8*7*N+6AXt@zU7=L#GOb!G5i*5~vk|Z2o_=ZzR zeA0Ya9g<4xg|a#GzEQ8uq8z{cy!U#KcR0t_V-!XhbWF>Up8z^ipk~Wjdq7tRb2IC% zB)2H1)Ea|+_wV!xu(`nad*QYeGjoP*>9xikbxbai@0bU1f1rXY(t-?)Yue=Bc)&n> zkh2|mxpnXA#yhQ5dZ+gfxHj^ diff --git a/dkms.conf b/dkms.conf index a3386c9..73e8551 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME=tuxedo-keyboard -PACKAGE_VERSION=3.0.11 +PACKAGE_VERSION=3.1.0 DEST_MODULE_LOCATION[0]="/kernel/lib/" BUILT_MODULE_NAME[0]="tuxedo_keyboard" diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 605e81d..f451c39 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -34,7 +34,7 @@ MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops"); MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_VERSION("0.2.6"); +MODULE_VERSION("0.3.0"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CLEVO_INTERFACES(); diff --git a/src/tuxedo_keyboard.c b/src/tuxedo_keyboard.c index a0a421a..0a329ea 100644 --- a/src/tuxedo_keyboard.c +++ b/src/tuxedo_keyboard.c @@ -26,7 +26,7 @@ MODULE_AUTHOR("TUXEDO Computers GmbH "); MODULE_DESCRIPTION("TUXEDO Computers keyboard & keyboard backlight Driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION("3.0.11"); +MODULE_VERSION("3.1.0"); static DEFINE_MUTEX(tuxedo_keyboard_init_driver_lock); diff --git a/src_pkg/rpm_pkg.spec b/src_pkg/rpm_pkg.spec index 6b3b2b3..66dbb20 100644 --- a/src_pkg/rpm_pkg.spec +++ b/src_pkg/rpm_pkg.spec @@ -142,6 +142,8 @@ exit 0 %changelog +* Mon Oct 10 2022 C Sandberg 3.1.0-1 +- Add power profiles and tdp functionality (uw) * Thu Oct 06 2022 C Sandberg 3.0.11-1 - Introduce alternative fan control (uw) - Fan control parameters from driver "has fan off" and "min fan speed" @@ -213,4 +215,4 @@ exit 0 * Tue Mar 17 2020 C Sandberg 2.0.1-0 - New packaging * Wed Dec 18 2019 Richard Sailer 2.0.0-1 -- Initial DKMS package for back-lit keyboard 2nd generation \ No newline at end of file +- Initial DKMS package for back-lit keyboard 2nd generation From 493541f81cefa0ef273c8ea58d8a43d9e4d8b038 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Fri, 14 Oct 2022 15:42:40 +0200 Subject: [PATCH 38/40] Reenable fan-off on all TF devices --- src/tuxedo_io/tuxedo_io.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index f451c39..f76e16d 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -360,6 +360,16 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed) else return -EINVAL; + if (fan_speed == 0) { + // Avoid hard coded EC behaviour: Setting fan speed = 0x00 spins the fan up + // to 0x3c (30%) for 3 minutes before going to 0x00. Setting fan speed = 1 + // also causes the fan to stop since on 2020 or later TF devices the + // microcontroller in the fan itself is intelligent enough to not try to + // start up the motor when the speed is to slow. Older devices don't use + // this fan controll anyway, but the else case below. + fan_speed = 1; + } + uniwill_write_ec_ram(addr_for_fan, fan_speed & 0xff); } else { // old workaround using full fan mode @@ -576,23 +586,25 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; case R_UW_FANS_OFF_AVAILABLE: - result = has_universal_ec_fan_control(); + /*result = has_universal_ec_fan_control(); if (result == 1) { result = 0; } else if (result == 0) { result = 1; - } + }*/ + result = 1; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; case R_UW_FANS_MIN_SPEED: - result = has_universal_ec_fan_control(); + /*result = has_universal_ec_fan_control(); if (result == 1) { result = 20; } else if (result == 0) { result = 0; - } + }*/ + result = 20; copy_result = copy_to_user((void *) arg, &result, sizeof(result)); break; case R_UW_TDP0: From ab675b1475f0dd5fe495e6605b4de7c6b336b08a Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Mon, 17 Oct 2022 16:57:14 +0200 Subject: [PATCH 39/40] Add missing set fans auto implementation --- src/tuxedo_io/tuxedo_io.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index f76e16d..deba2a0 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -407,6 +407,21 @@ static u32 uw_set_fan_auto(void) u8 mode_data; if (has_universal_ec_fan_control() == 1) { + u16 addr_use_custom_fan_table_0 = 0x07c5; // use different tables for both fans (0x0f00-0x0f2f and 0x0f30-0x0f5f respectivly) + u16 addr_use_custom_fan_table_1 = 0x07c6; // enable 0x0fxx fantables + u8 offset_use_custom_fan_table_0 = 7; + u8 offset_use_custom_fan_table_1 = 2; + u8 value_use_custom_fan_table_0; + u8 value_use_custom_fan_table_1; + uniwill_read_ec_ram(addr_use_custom_fan_table_1, &value_use_custom_fan_table_1); + if ((value_use_custom_fan_table_1 >> offset_use_custom_fan_table_1) & 1) { + uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_1, value_use_custom_fan_table_1 - (1 << offset_use_custom_fan_table_1), 3); + } + uniwill_read_ec_ram(addr_use_custom_fan_table_0, &value_use_custom_fan_table_0); + if ((value_use_custom_fan_table_0 >> offset_use_custom_fan_table_0) & 1) { + uniwill_write_ec_ram_with_retry(addr_use_custom_fan_table_0, value_use_custom_fan_table_0 - (1 << offset_use_custom_fan_table_0), 3); + } + fans_initialized = false; } else { // Get current mode From b46ca9ef44568c6c384929a73624bd9ba9158577 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Mon, 17 Oct 2022 16:04:54 +0000 Subject: [PATCH 40/40] Update version to 3.1.1 + changelog --- .../usr/share/doc/module-name/changelog.gz | Bin 1450 -> 1544 bytes dkms.conf | 2 +- src/tuxedo_io/tuxedo_io.c | 2 +- src/tuxedo_keyboard.c | 2 +- src_pkg/rpm_pkg.spec | 3 +++ 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/deb/module-name/usr/share/doc/module-name/changelog.gz b/deb/module-name/usr/share/doc/module-name/changelog.gz index 4440c1de8dcd60d018cb272aec16f65478d24111..d0547ca481c32ec3dddc0317fae1cd7eeba97b2c 100644 GIT binary patch literal 1544 zcmV+j2KV_NiwFo$d`)8l17m1mZf9j|Z)X6lSle#fMi71XR}B16NUf!il<13kK^f&L}f6T zjKgs_{1vR4Q<1*>&gJ?D;Ai+isUQibkQ1RtGS4BG3bZUJWOT(+s=+LXfw?rm3>d2f z%|PZrG!QVfD5WCm^fOfK1^w z1;-0aquY#$Klafc7fkqXbV+G;+$0mZD45omx;KfEODcA*lmY~G#MP4NL(a#AJ%QkK zhnygKJ%7l}p#(k|$~jS}C1i?nz!fkB&gKh~5EQm8QLx4@zpnMUd1$2Lp*Q&G94<>$ zi*GucoOgl0IDq}`?Nb=9PT?p2=?p(1t59INu|5Un&mk=8n7T-R+l(Gm**L2WsT7zxby}r`XbY(M9L!0Xpl&texjEXlh`P^8W2MIBVg; z9EV-F;sdxIp5oyC)2{w-Hhf=vZt2bSr?>Cl{~g9b^h4{vJXR$bqGH1CEmxcpF|sA3 zyy@TC5JQ0poXi8gkQN1!qip>6_TQ$G<2d)C(Zk-g5>1-U7P_%I>1@l>JtVs6k--Y} zF0IA^i&Mn;4dogY4v>tw9;Mw3se^LB8;)qx0pcHFlvY)FX%&GA)xW#uo}Cp!A;rjD z&2Y$nqmD>btcjv6|KhC?9w3Zsu~>$mK3Da2wIE`Sdm78LdmY}N5KcsjEBuzec?d7y zo-}zlokg7!X0l(*)M+l9zDh`6Y;gdLkf5RT( zEFevjn9iotPTO&i*J=VZ4IBm^mBarsY{h5SUP@@hO28_viqhr6mn(fXPFI6%IQ^R* zhH*_(7f;}tUeq~t_qnJ>%i1WLqTi>^?N_;Bjlcn)k~wNBlRllssB7H@&w zrGAj64(ZVC#bUq#O6If=-=ArA0v9d1k?U9G6Zy9eNH7?d{-}z++`p^m_pr6f3btmP zZ%2CFI0v3Me5v}Ha-uaJwxwp@egs#LvUJHwlsijMtx=k9GPxFQ;nwSowCSQGNUogE z9i?8lB`3yltJ_+yNl)F#auZ7tz3AWeCh#CvHNRnpoFnfoI{3vBTqapP6}Nu3v0c6U zM+{H2+z23?b^(kJ1N=a@1&5L(93S|BQ%JRW7e6SK)&pfT=IchiG>bBP^YgXW+uos% zuWb}Y7<9Ph$UA_J6sUYzYY*rOVQ#$cN^*;GN~|$h@BW!S0X7#He=ppYVrEWpEWOmY zqYmd1`H6WD_d6=6A}z?!R85=w8xI(W4>I48m;Wz9T|2!a@w2~)B%Z}_S0vHlNF2@X ze=rKQCY6uC8%X3Eze4smtLpkC)?lfS`n6*tKetU}?nX3lIh)r_^=kuU?7oKo)>x~c ur;YKfI_pJO(Bb}|J>UnlgcXpUZ?YAXv&P^A&U?kJ8vh3)CwM1i6953KNctN9 literal 1450 zcmV;b1y%YViwFoo%R^%V17m1mZf9j|Z)X6lSle#fMi71XR}B16NR6$K6lq)P1$FE= za0@#|ogjG&mgGuWXt_)5MY8kton4X=)kvmU^u-a#y_`97X3j9iKG9sBF6nbBiOOLx z9)+V|_zPGyry_g)jmz~Bz|U}*=TOQuRZuE9W1MOrA_tR~FtZ{vObWu8d4_>q508%E z^c1e(5tpP?&EZ#LpZ+lZu1prCHB{*l{`wu@PKpx<1NfL3h=M4BU@{%Y(;$F1L5P2k zj?9l3gHagn0eLHolDW+&5RO*}V%Unpj0ni2d&MhsZs|?yVM!DzsKW#^B@4(EZc}i) zAlh%1v)Qqa_PAieKhY(n`Ehj+dqOS>rZp4ux2cj#Dt4}v0t9u$<#fd|s{4@hX<<(w zINKp7h&JRL;^t5S9}VT4D5f1#lmo7S7&x0ROiC1JTb5E8zxZjH20!^<=lBa*g#y#fDG1D;Ls(KZ8+nDoTB;>c(u%y1 z2EHRG4Zj6R_)eT?TZ&*$@L;*7Vf;2sJU1b1u%#qhdM+R{ibIb1CMCsV#Js=SFPemg z_-7i9yEwUcfs+`SI2d^kWH*YT)F$w!#g@)V7oBGZ=&TpBcAiI|sewVp z`?uTRyoC#M9CqPK4&b_fOoF@5yZS?K_;>NSrSGplzx(*{uP_OsSFQj0P?cbaiV3^7 zTyaXosVyPnP5;)07z#`aJ#J^53Z=QWa~WYIC*9*(`FY@c?05i^Veh{H3b5s|68r+>_UqvU?rgpAt?) zhAaG*zIg~Ia7UUvoK2%nhZ*k|Gj*B^;};3(i!EtE8&9L83tDtgA{nPExwRv&U#W7c zTJU{p|2OOrdI4#gL_Ce-&avYluayHd4IBoal*9i#Y{h5SUP?HKm4H=T6{X9CFIW0x zoUR7jaQZhr4C9(+E}p6x=E=U9s9MgO)phI_fH`3*bd9QoOzgI_GcWt!Kn zxSe;Kv8#9gNZ^r{8v%rI7r^8&z`yCX;82o;;|p&%g~TV#ht(mev|cEiGha9AxmlFs zm!Ge_-s2t4@%0#m5e6O8a^xp~jufcbveq8Z6~f%ix+}>o$|<$RV7>cy`UKcqVEnys zTZ)-ELtA>TaYr4KOXMB%Anp%TP(@mhp{bfS`R_eoAU??1j=cQ;BGk3hI}-2xO(e-Q zNxCA54oBi>#;*cUs5Pm41b%=-zVQ*Vzgbn+FR=zoh18!N8~M3yB6m0905@avx~YC^ zfQ;N@_-~E13Oa5E&#JRdx`Gb(2kimh<49Nm>G>sFK{;;*oWRXqNvp>H0Vy#O3|bNZ E0Iv$jBLDyZ diff --git a/dkms.conf b/dkms.conf index 73e8551..df82bf3 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME=tuxedo-keyboard -PACKAGE_VERSION=3.1.0 +PACKAGE_VERSION=3.1.1 DEST_MODULE_LOCATION[0]="/kernel/lib/" BUILT_MODULE_NAME[0]="tuxedo_keyboard" diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index deba2a0..607fc34 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -34,7 +34,7 @@ MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops"); MODULE_AUTHOR("TUXEDO Computers GmbH "); -MODULE_VERSION("0.3.0"); +MODULE_VERSION("0.3.1"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CLEVO_INTERFACES(); diff --git a/src/tuxedo_keyboard.c b/src/tuxedo_keyboard.c index 0a329ea..57f2ba6 100644 --- a/src/tuxedo_keyboard.c +++ b/src/tuxedo_keyboard.c @@ -26,7 +26,7 @@ MODULE_AUTHOR("TUXEDO Computers GmbH "); MODULE_DESCRIPTION("TUXEDO Computers keyboard & keyboard backlight Driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION("3.1.0"); +MODULE_VERSION("3.1.1"); static DEFINE_MUTEX(tuxedo_keyboard_init_driver_lock); diff --git a/src_pkg/rpm_pkg.spec b/src_pkg/rpm_pkg.spec index 66dbb20..6963417 100644 --- a/src_pkg/rpm_pkg.spec +++ b/src_pkg/rpm_pkg.spec @@ -142,6 +142,9 @@ exit 0 %changelog +* Mon Oct 17 2022 C Sandberg 3.1.1-1 +- Reenable fans-off for some devices that got it turned of as a temporary workaround +- Fix default fan curve not being reenabled when tccd is stopped * Mon Oct 10 2022 C Sandberg 3.1.0-1 - Add power profiles and tdp functionality (uw) * Thu Oct 06 2022 C Sandberg 3.0.11-1