platform/x86/uniwill: uniwill-laptop: Rework hwmon feature defines
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/4 platform/x86/uniwill: uniwill-laptop: Rework hwmon feature defines
From: Armin Wolf <[email protected]>
Split hwmon feature define in smaller parts to accommodate for diverse hardware. You can now specify the presence of a cpu and/or a gpu temp sensor separately and if one or 2 fans exists.
--- drivers/platform/x86/uniwill/uniwill-acpi.c | 68 ++++++++++++++++++--- 1 file changed, 61 insertions(+), 7 deletions(-)
drivers/platform/x86/uniwill/uniwill-acpi.c +61 -7
@@ -319,8 +319,11 @@#define UNIWILL_FEATURE_TOUCHPAD_TOGGLE BIT(2)#define UNIWILL_FEATURE_LIGHTBAR BIT(3)#define UNIWILL_FEATURE_BATTERY BIT(4) -#define UNIWILL_FEATURE_HWMON BIT(5) -#define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(6) +#define UNIWILL_FEATURE_CPU_TEMP BIT(5) +#define UNIWILL_FEATURE_GPU_TEMP BIT(6) +#define UNIWILL_FEATURE_PRIMARY_FAN BIT(7) +#define UNIWILL_FEATURE_SECONDARY_FAN BIT(8) +#define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9)struct uniwill_data {struct device *dev;
@@ -427,7 +430,7 @@ static const struct key_entry uniwill_keymap[] = { { KE_END } }; -static inline bool uniwill_device_supports (struct uniwill_data *data, +static inline bool uniwill_device_supports (const struct uniwill_data *data,unsigned int features) {return (data->features & features) == features;
@@ -937,6 +940,48 @@ static const struct attribute_group *uniwill_groups[] = { NULL }; +static umode_t uniwill_is_visible (const void *drvdata,enum hwmon_sensor_types type,u32 attr, +int channel) +{ +const struct uniwill_data *data = drvdata; +unsigned int feature; + +switch (type) { +case hwmon_temp: +switch (channel) { +case 0 : + feature =UNIWILL_FEATURE_CPU_TEMP ; +break ; +case 1 : + feature =UNIWILL_FEATURE_GPU_TEMP ; +break ; +default : +return 0 ; + } +break ; +case hwmon_fan: +case hwmon_pwm: +switch (channel) { +case 0 : + feature =UNIWILL_FEATURE_PRIMARY_FAN ; +break ; +case 1 : + feature =UNIWILL_FEATURE_SECONDARY_FAN ; +break ; +default : +return 0 ; + } +break ; +default : +return 0 ; + } + +if (uniwill_device_supports (data, feature)) +return 0444 ; + +return 0 ; +} +static int uniwill_read (struct device *dev,enum hwmon_sensor_types type,u32 attr,int channel,long *val) {
@@ -1020,7 +1065,7 @@ static int uniwill_read_string(struct device *dev, enum hwmon_sensor_types type, }static const struct hwmon_ops uniwill_ops = { - .visible =0444 , + .is_visible = uniwill_is_visible, .read = uniwill_read, .read_string = uniwill_read_string, };
@@ -1048,7 +1093,10 @@ static int uniwill_hwmon_init(struct uniwill_data *data) {struct device *hdev; -if (!uniwill_device_supports (data,UNIWILL_FEATURE_HWMON )) +if (!uniwill_device_supports (data,UNIWILL_FEATURE_CPU_TEMP ) && + !uniwill_device_supports (data,UNIWILL_FEATURE_GPU_TEMP ) && + !uniwill_device_supports (data,UNIWILL_FEATURE_PRIMARY_FAN ) && + !uniwill_device_supports (data,UNIWILL_FEATURE_SECONDARY_FAN ))return 0 ; hdev = devm_hwmon_device_register_with_info(data->dev, "uniwill", data,
@@ -1687,7 +1735,10 @@ static struct uniwill_device_descriptor lapac71h_descriptor __initdata = {UNIWILL_FEATURE_SUPER_KEY |UNIWILL_FEATURE_TOUCHPAD_TOGGLE |UNIWILL_FEATURE_BATTERY | - UNIWILL_FEATURE_HWMON, +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | + UNIWILL_FEATURE_SECONDARY_FAN, }; static struct uniwill_device_descriptor lapkc71f_descriptor __initdata = {
@@ -1696,7 +1747,10 @@ static struct uniwill_device_descriptor lapkc71f_descriptor __initdata = {UNIWILL_FEATURE_TOUCHPAD_TOGGLE |UNIWILL_FEATURE_LIGHTBAR |UNIWILL_FEATURE_BATTERY | - UNIWILL_FEATURE_HWMON, +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | + UNIWILL_FEATURE_SECONDARY_FAN, };static int phxarx1_phxaqf1_probe (struct uniwill_data *data)
Signature · 1 line
2.43.0
PATCH v3 2/4 platform/x86/uniwill: Implement USB-C power priority setting
In reply to a message not in the archiveOn some devices Uniwill offers the option to set the USB-C port to prioritise charging or performance. This patch exposes this setting to the userspace via sysfs for all TUXEDO devices supporting it.
--- drivers/platform/x86/uniwill/uniwill-acpi.c | 147 +++++++++++++++++++- 1 file changed, 140 insertions(+), 7 deletions(-)
drivers/platform/x86/uniwill/uniwill-acpi.c +140 -7
@@ -266,8 +266,8 @@#define BATTERY_CHARGE_FULL_OVER_24H BIT(3)#define BATTERY_ERM_STATUS_REACHED BIT(4) -#define EC_ADDR_CHARGE_PRIO 0x07CC -#define CHARGING_PERFORMANCE BIT(7) +#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC +#define USB_C_POWER_PRIORITY BIT(7)/* Same bits as EC_ADDR_LIGHTBAR_AC_CTRL except LIGHTBAR_S3_OFF */ #define EC_ADDR_LIGHTBAR_BAT_CTRL 0x07E2
@@ -324,6 +324,12 @@#define UNIWILL_FEATURE_PRIMARY_FAN BIT(7)#define UNIWILL_FEATURE_SECONDARY_FAN BIT(8)#define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9) +#define UNIWILL_FEATURE_USB_C_POWER_PRIORITY BIT(10) + +enum usb_c_power_priority_options { +USB_C_POWER_PRIORITY_OPTIONS_CHARGING =0 , +USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE , +};struct uniwill_data {struct device *dev;
@@ -343,6 +349,8 @@ struct uniwill_data {struct mutex input_lock;/* Protects input sequence during notify */ struct input_dev *input_device;struct notifier_block nb; +struct mutex usb_c_power_priority_lock;/* Protects dependent bit write and state safe */ +enum usb_c_power_priority_options last_usb_c_power_priority_option; };struct uniwill_battery_entry {
@@ -527,6 +535,7 @@ static bool uniwill_writeable_reg(struct device *dev, unsigned int reg)case EC_ADDR_CTGP_DB_CTGP_OFFSET :case EC_ADDR_CTGP_DB_TPP_OFFSET :case EC_ADDR_CTGP_DB_DB_OFFSET : +case EC_ADDR_USB_C_POWER_PRIORITY :return true;default :return false;
@@ -565,6 +574,7 @@ static bool uniwill_readable_reg(struct device *dev, unsigned int reg)case EC_ADDR_CTGP_DB_CTGP_OFFSET :case EC_ADDR_CTGP_DB_TPP_OFFSET :case EC_ADDR_CTGP_DB_DB_OFFSET : +case EC_ADDR_USB_C_POWER_PRIORITY :return true;default :return false;
@@ -587,6 +597,7 @@ static bool uniwill_volatile_reg(struct device *dev, unsigned int reg)case EC_ADDR_TRIGGER :case EC_ADDR_SWITCH_STATUS :case EC_ADDR_CHARGE_CTRL : +case EC_ADDR_USB_C_POWER_PRIORITY :return true;default :return false;
@@ -883,6 +894,106 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data)return 0 ; } +static const char *const USB_C_POWER_PRIORITY_OPTIONS_TEXT [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING ] ="charging" , + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE ] ="performance" , +}; + +static const u8 USB_C_POWER_PRIORITY_OPTIONS_VALUE [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING ] =0 , + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE ] =USB_C_POWER_PRIORITY , +}; + +static ssize_t usb_c_power_priority_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct uniwill_data *data =dev_get_drvdata (dev); +enum usb_c_power_priority_options option; +unsigned int value; +int ret; + + option =sysfs_match_string (USB_C_POWER_PRIORITY_OPTIONS_TEXT , buf); +if (option <0 ) +return option; + + value =USB_C_POWER_PRIORITY_OPTIONS_VALUE [option]; + +guard (mutex)(&data->usb_c_power_priority_lock); + + ret =regmap_update_bits (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , +USB_C_POWER_PRIORITY , value); +if (ret <0 ) +return ret; + + data->last_usb_c_power_priority_option = option; + +return count; +} + +static ssize_t usb_c_power_priority_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct uniwill_data *data =dev_get_drvdata (dev); +unsigned int value, i; +int ret; + + ret =regmap_read (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , &value); +if (ret <0 ) +return ret; + + value &=USB_C_POWER_PRIORITY ; + +for (i =0 ; i <ARRAY_SIZE (USB_C_POWER_PRIORITY_OPTIONS_VALUE ); ++i) +if (USB_C_POWER_PRIORITY_OPTIONS_VALUE [i] == value) +return sysfs_emit (buf,"%s\n" , +USB_C_POWER_PRIORITY_OPTIONS_TEXT [i]); + +/* Since all possible values are valid, this should be unreachable. */ +return -EINVAL ; +} + +static DEVICE_ATTR_RW (usb_c_power_priority); + +static int usb_c_power_priority_restore (struct uniwill_data *data) +{ +unsigned int value; + + value =USB_C_POWER_PRIORITY_OPTIONS_VALUE [data->last_usb_c_power_priority_option]; + +return regmap_update_bits (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , +USB_C_POWER_PRIORITY , value); +} + +static int usb_c_power_priority_init (struct uniwill_data *data) +{ +unsigned int value, i; +int ret; + +if (!uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return 0 ; + + ret =devm_mutex_init (data->dev, &data->usb_c_power_priority_lock); +if (ret <0 ) +return ret; + + ret =regmap_read (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , &value); +if (ret <0 ) +return ret; + + value &=USB_C_POWER_PRIORITY ; + +for (i =0 ; i <ARRAY_SIZE (USB_C_POWER_PRIORITY_OPTIONS_VALUE ); ++i) +if (USB_C_POWER_PRIORITY_OPTIONS_VALUE [i] == value) { + data->last_usb_c_power_priority_option = i; +return 0 ; + } + +/* Since all possible values are valid, this should be unreachable. */ +return -EINVAL ; +} +static struct attribute *uniwill_attrs[] = {/* Keyboard-related */ &dev_attr_fn_lock.attr,
@@ -893,6 +1004,7 @@ static struct attribute *uniwill_attrs[] = { &dev_attr_breathing_in_suspend.attr,/* Power-management-related */ &dev_attr_ctgp_offset.attr, + &dev_attr_usb_c_power_priority.attr, NULL };
@@ -927,6 +1039,11 @@ static umode_t uniwill_attr_is_visible(struct kobject *kobj, struct attribute *areturn attr->mode; } +if (attr == &dev_attr_usb_c_power_priority.attr) { +if (uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return attr->mode; + } +return 0 ; }
@@ -1417,11 +1534,10 @@ static int uniwill_notifier_call(struct notifier_block *nb, unsigned long actionreturn NOTIFY_OK ;case UNIWILL_OSD_DC_ADAPTER_CHANGED : -/* noop for the time being, will change once charging priority -* gets implemented. -*/ +if (!uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return NOTIFY_DONE ; -return NOTIFY_OK ; +return notifier_from_errno (usb_c_power_priority_restore (data));case UNIWILL_OSD_FN_LOCK :if (!uniwill_device_supports (data,UNIWILL_FEATURE_FN_LOCK ))return NOTIFY_DONE ;
@@ -1515,10 +1631,15 @@ static int uniwill_probe(struct platform_device *pdev)return PTR_ERR (regmap); data->regmap = regmap; + ret =devm_mutex_init (&pdev->dev, &data->super_key_lock);if (ret <0 )return ret; + ret =usb_c_power_priority_init (data); +if (ret <0 ) +return ret; + ret =uniwill_ec_init (data);if (ret <0 )return ret;
@@ -1681,6 +1802,14 @@ static int uniwill_resume_nvidia_ctgp(struct uniwill_data *data) CTGP_DB_DB_ENABLE | CTGP_DB_CTGP_ENABLE); } +static int uniwill_resume_usb_c_power_priority (struct uniwill_data *data) +{ +if (!uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return 0 ; + +return usb_c_power_priority_restore (data); +} +static int uniwill_resume (struct device *dev) {struct uniwill_data *data =dev_get_drvdata (dev);
@@ -1704,7 +1833,11 @@ static int uniwill_resume(struct device *dev)if (ret <0 )return ret; -return uniwill_resume_nvidia_ctgp (data); + ret =uniwill_resume_nvidia_ctgp (data); +if (ret <0 ) +return ret; + +return uniwill_resume_usb_c_power_priority (data); } static DEFINE_SIMPLE_DEV_PM_OPS(uniwill_pm_ops, uniwill_suspend, uniwill_resume);
Signature · 1 line
2.43.0
Armin Wolf
maintainerRe: [PATCH v3 2/4] platform/x86/uniwill: Implement USB-C power priority setting
Am 27.02.26 um 21:07 schrieb Werner Sembach:
Quoted 120 lines
On some devices Uniwill offers the option to set the USB-C port to prioritise charging or performance. This patch exposes this setting to the userspace via sysfs for all TUXEDO devices supporting it.
Signed-off-by Werner Sembach <[email protected]>--- drivers/platform/x86/uniwill/uniwill-acpi.c | 147 +++++++++++++++++++- 1 file changed, 140 insertions(+), 7 deletions(-)drivers/platform/x86/uniwill/uniwill-acpi.c +59
-2@@ -266,8 +266,8 @@#define BATTERY_CHARGE_FULL_OVER_24H BIT(3)#define BATTERY_ERM_STATUS_REACHED BIT(4) -#define EC_ADDR_CHARGE_PRIO 0x07CC -#define CHARGING_PERFORMANCE BIT(7) +#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC +#define USB_C_POWER_PRIORITY BIT(7)/* Same bits as EC_ADDR_LIGHTBAR_AC_CTRL except LIGHTBAR_S3_OFF */ #define EC_ADDR_LIGHTBAR_BAT_CTRL 0x07E2@@ -324,6 +324,12 @@#define UNIWILL_FEATURE_PRIMARY_FAN BIT(7)#define UNIWILL_FEATURE_SECONDARY_FAN BIT(8)#define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9) +#define UNIWILL_FEATURE_USB_C_POWER_PRIORITY BIT(10) + +enum usb_c_power_priority_options { +USB_C_POWER_PRIORITY_OPTIONS_CHARGING =0 , +USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE , +};struct uniwill_data {struct device *dev;@@ -343,6 +349,8 @@ struct uniwill_data {struct mutex input_lock;/* Protects input sequence during notify */ struct input_dev *input_device;struct notifier_block nb; +struct mutex usb_c_power_priority_lock;/* Protects dependent bit write and state safe */ +enum usb_c_power_priority_options last_usb_c_power_priority_option; };struct uniwill_battery_entry {@@ -527,6 +535,7 @@ static bool uniwill_writeable_reg(struct device *dev, unsigned int reg)case EC_ADDR_CTGP_DB_CTGP_OFFSET :case EC_ADDR_CTGP_DB_TPP_OFFSET :case EC_ADDR_CTGP_DB_DB_OFFSET : +case EC_ADDR_USB_C_POWER_PRIORITY :return true;default :return false;@@ -565,6 +574,7 @@ static bool uniwill_readable_reg(struct device *dev, unsigned int reg)case EC_ADDR_CTGP_DB_CTGP_OFFSET :case EC_ADDR_CTGP_DB_TPP_OFFSET :case EC_ADDR_CTGP_DB_DB_OFFSET : +case EC_ADDR_USB_C_POWER_PRIORITY :return true;default :return false;@@ -587,6 +597,7 @@ static bool uniwill_volatile_reg(struct device *dev, unsigned int reg)case EC_ADDR_TRIGGER :case EC_ADDR_SWITCH_STATUS :case EC_ADDR_CHARGE_CTRL : +case EC_ADDR_USB_C_POWER_PRIORITY :return true;default :return false;@@ -883,6 +894,106 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data)return 0 ; } +static const char *const USB_C_POWER_PRIORITY_OPTIONS_TEXT [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING ] ="charging" , + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE ] ="performance" , +}; + +static const u8 USB_C_POWER_PRIORITY_OPTIONS_VALUE [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING ] =0 , + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE ] =USB_C_POWER_PRIORITY , +}; + +static ssize_t usb_c_power_priority_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct uniwill_data *data =dev_get_drvdata (dev); +enum usb_c_power_priority_options option; +unsigned int value; +int ret; + + option =sysfs_match_string (USB_C_POWER_PRIORITY_OPTIONS_TEXT , buf); +if (option <0 ) +return option; + + value =USB_C_POWER_PRIORITY_OPTIONS_VALUE [option]; + +guard (mutex)(&data->usb_c_power_priority_lock); + + ret =regmap_update_bits (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , +USB_C_POWER_PRIORITY , value); +if (ret <0 ) +return ret; + + data->last_usb_c_power_priority_option = option; + +return count; +} + +static ssize_t usb_c_power_priority_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct uniwill_data *data =dev_get_drvdata (dev); +unsigned int value, i; +int ret; + + ret =regmap_read (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , &value);
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 952
Quoted 10 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +10
-0+if (ret <0 ) +return ret; + + value &=USB_C_POWER_PRIORITY ; + +for (i =0 ; i <ARRAY_SIZE (USB_C_POWER_PRIORITY_OPTIONS_VALUE ); ++i) +if (USB_C_POWER_PRIORITY_OPTIONS_VALUE [i] == value) +return sysfs_emit (buf,"%s\n" , +USB_C_POWER_PRIORITY_OPTIONS_TEXT [i]); +
Please drop this for-loop and use a if-statement instead:
if (value & USB_C_POWER_PRIORITY) return sysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE]); return sysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_CHARGING]);
Also, i think USB_C_POWER_PRIORITY_OPTIONS_VALUE[] is unnecessary. Using an if-statement would yield more readable code than using for-loops in this case.
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 963
Quoted 11 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +11
-0+/* Since all possible values are valid, this should be unreachable. */ +return -EINVAL ; +} + +static DEVICE_ATTR_RW (usb_c_power_priority); + +static int usb_c_power_priority_restore (struct uniwill_data *data) +{ +unsigned int value; + + value =USB_C_POWER_PRIORITY_OPTIONS_VALUE [data->last_usb_c_power_priority_option];
You need to take the appropriate mutex here.
Quoted 18 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +18
-0+ +return regmap_update_bits (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , +USB_C_POWER_PRIORITY , value); +} + +static int usb_c_power_priority_init (struct uniwill_data *data) +{ +unsigned int value, i; +int ret; + +if (!uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return 0 ; + + ret =devm_mutex_init (data->dev, &data->usb_c_power_priority_lock); +if (ret <0 ) +return ret; + + ret =regmap_read (data->regmap,EC_ADDR_USB_C_POWER_PRIORITY , &value);
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 991
Quoted 10 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +10
-0+if (ret <0 ) +return ret; + + value &=USB_C_POWER_PRIORITY ; + +for (i =0 ; i <ARRAY_SIZE (USB_C_POWER_PRIORITY_OPTIONS_VALUE ); ++i) +if (USB_C_POWER_PRIORITY_OPTIONS_VALUE [i] == value) { + data->last_usb_c_power_priority_option = i; +return 0 ; + }
Please drop this for-loop and use an if-statement instead.
Quoted 60 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +19
-4+ +/* Since all possible values are valid, this should be unreachable. */ +return -EINVAL ; +} +static struct attribute *uniwill_attrs[] = {/* Keyboard-related */ &dev_attr_fn_lock.attr,@@ -893,6 +1004,7 @@ static struct attribute *uniwill_attrs[] = { &dev_attr_breathing_in_suspend.attr,/* Power-management-related */ &dev_attr_ctgp_offset.attr, + &dev_attr_usb_c_power_priority.attr, NULL };@@ -927,6 +1039,11 @@ static umode_t uniwill_attr_is_visible(struct kobject *kobj, struct attribute *areturn attr->mode; } +if (attr == &dev_attr_usb_c_power_priority.attr) { +if (uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return attr->mode; + } +return 0 ; }@@ -1417,11 +1534,10 @@ static int uniwill_notifier_call(struct notifier_block *nb, unsigned long actionreturn NOTIFY_OK ;case UNIWILL_OSD_DC_ADAPTER_CHANGED : -/* noop for the time being, will change once charging priority -* gets implemented. -*/ +if (!uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return NOTIFY_DONE ; -return NOTIFY_OK ; +return notifier_from_errno (usb_c_power_priority_restore (data));case UNIWILL_OSD_FN_LOCK :if (!uniwill_device_supports (data,UNIWILL_FEATURE_FN_LOCK ))return NOTIFY_DONE ;@@ -1515,10 +1631,15 @@ static int uniwill_probe(struct platform_device *pdev)return PTR_ERR (regmap); data->regmap = regmap; + ret =devm_mutex_init (&pdev->dev, &data->super_key_lock);if (ret <0 )return ret; + ret =usb_c_power_priority_init (data); +if (ret <0 ) +return ret; + ret =uniwill_ec_init (data);if (ret <0 )return ret;
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_resume_nvidia_ctgp(struct uniwill_data *data) · line 1808
Quoted 7 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0@@ -1681,6 +1802,14 @@ static int uniwill_resume_nvidia_ctgp(struct uniwill_data *data) CTGP_DB_DB_ENABLE | CTGP_DB_CTGP_ENABLE); } +static int uniwill_resume_usb_c_power_priority (struct uniwill_data *data) +{ +if (!uniwill_device_supports (data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) +return 0 ;
I think it would make sense to move the feature check into usb_c_power_priority_restore(). This way usb_c_power_priority_restore() can be called by both the notifier and the resume code directly.
It would also be very nice if you can include a short changelog with your next patch series.
Thanks,
Armin Wolf
Quoted 20 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +9
-1+ +return usb_c_power_priority_restore (data); +} +static int uniwill_resume (struct device *dev) {struct uniwill_data *data =dev_get_drvdata (dev);@@ -1704,7 +1833,11 @@ static int uniwill_resume(struct device *dev)if (ret <0 )return ret; -return uniwill_resume_nvidia_ctgp (data); + ret =uniwill_resume_nvidia_ctgp (data); +if (ret <0 ) +return ret; + +return uniwill_resume_usb_c_power_priority (data); } static DEFINE_SIMPLE_DEV_PM_OPS(uniwill_pm_ops, uniwill_suspend, uniwill_resume);
Re: [PATCH v3 2/4] platform/x86/uniwill: Implement USB-C power priority setting
Am 01.03.26 um 14:05 schrieb Armin Wolf:
Quoted 135 lines
Am 27.02.26 um 21:07 schrieb Werner Sembach:
Quoted 120 lines
On some devices Uniwill offers the option to set the USB-C port to prioritise charging or performance. This patch exposes this setting to the userspace via sysfs for all TUXEDO devices supporting it.
Signed-off-by Werner Sembach <[email protected]>---
drivers/platform/x86/uniwill/uniwill-acpi.c| 147 +++++++++++++++++++-1 file changed, 140 insertions(+), 7 deletions(-)drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -266,8 +266,8 @@ #define BATTERY_CHARGE_FULL_OVER_24H BIT(3) #define BATTERY_ERM_STATUS_REACHED BIT(4)-#define EC_ADDR_CHARGE_PRIO
0x07CCdrivers/platform/x86/uniwill/uniwill-acpi.c +2
-1-#define CHARGING_PERFORMANCE BIT(7) +#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC +#define USB_C_POWER_PRIORITY BIT(7)/* Same bits as
EC_ADDR_LIGHTBAR_AC_CTRLexceptLIGHTBAR_S3_OFF*/ #define EC_ADDR_LIGHTBAR_BAT_CTRL0x07E2drivers/platform/x86/uniwill/uniwill-acpi.c +6
-0@@ -324,6 +324,12 @@ #define UNIWILL_FEATURE_PRIMARY_FAN BIT(7) #define UNIWILL_FEATURE_SECONDARY_FAN BIT(8) #define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9) +#define UNIWILL_FEATURE_USB_C_POWER_PRIORITY BIT(10) + +enum usb_c_power_priority_options { + USB_C_POWER_PRIORITY_OPTIONS_CHARGING = 0, + USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE, +}; struct uniwill_data { struct device *dev;@@ -343,6 +349,8 @@ struct uniwill_data {struct mutex input_lock; /* Protects input sequence during notify */ struct
input_dev*input_device;
structnotifier_blocknb;
+ struct mutexusb_c_power_priority_lock; /* Protects dependent bit write and state safe */
+ enumusb_c_power_priority_optionslast_usb_c_power_priority_option; };
structuniwill_battery_entry{drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -527,6 +535,7 @@ static bool uniwill_writeable_reg(struct device *dev, unsigned int reg)case
EC_ADDR_CTGP_DB_CTGP_OFFSET:
caseEC_ADDR_CTGP_DB_TPP_OFFSET:
caseEC_ADDR_CTGP_DB_DB_OFFSET:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -565,6 +574,7 @@ static bool uniwill_readable_reg(struct device *dev, unsigned int reg)case
EC_ADDR_CTGP_DB_CTGP_OFFSET:
caseEC_ADDR_CTGP_DB_TPP_OFFSET:
caseEC_ADDR_CTGP_DB_DB_OFFSET:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -587,6 +597,7 @@ static bool uniwill_volatile_reg(struct device *dev, unsigned int reg)case
EC_ADDR_TRIGGER:
caseEC_ADDR_SWITCH_STATUS:
caseEC_ADDR_CHARGE_CTRL:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +45
-0@@ -883,6 +894,106 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) return 0; } +static const char * const USB_C_POWER_PRIORITY_OPTIONS_TEXT[] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING] = "charging", + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE] = "performance", +}; + +static const u8 USB_C_POWER_PRIORITY_OPTIONS_VALUE [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING] = 0, + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE] = USB_C_POWER_PRIORITY, +}; + +static ssize_t usb_c_power_priority_store (struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct uniwill_data *data = dev_get_drvdata(dev); + enum usb_c_power_priority_options option; + unsigned int value; + int ret; + + option = sysfs_match_string(USB_C_POWER_PRIORITY_OPTIONS_TEXT, buf); + if (option < 0) + return option; + + value = USB_C_POWER_PRIORITY_OPTIONS_VALUE[option]; + + guard(mutex)(&data->usb_c_power_priority_lock); + + ret = regmap_update_bits(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, + USB_C_POWER_PRIORITY, value); + if (ret < 0) + return ret; + + data->last_usb_c_power_priority_option = option; + + return count; +} + +static ssize_t usb_c_power_priority_show (struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct uniwill_data *data = dev_get_drvdata(dev); + unsigned int value, i; + int ret; + + ret = regmap_read(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, &value);drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data · line 952
Quoted 10 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +10
-0+ if (ret < 0) + return ret; + + value &= USB_C_POWER_PRIORITY; + + for (i = 0; i < ARRAY_SIZE(USB_C_POWER_PRIORITY_OPTIONS_VALUE); ++i) + if (USB_C_POWER_PRIORITY_OPTIONS_VALUE[i] == value) + return sysfs_emit(buf, "%s\n", + USB_C_POWER_PRIORITY_OPTIONS_TEXT[i]); +Please drop this for-loop and use a if-statement instead:
Quoted 7 lines
if (value &
USB_C_POWER_PRIORITY)
returnsysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE]);return
sysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_CHARGING]);Also, i think USB_C_POWER_PRIORITY_OPTIONS_VALUE[] is unnecessary. Using an if-statement would yield more readable code than using for-loops in this case.
I can see where the for loop is unnecessary, but dropping USB_C_POWER_PRIORITY_OPTIONS_VALUE kinda obfuscates that there are 2 profiles, i like the clear association with the enum and stuff. the compile will be optimizing it out anyway.
Quoted 15 lines
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data)
Quoted 13 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +11
-0+ /* Since all possible values are valid, this should be unreachable. */ + return -EINVAL; +} + +static DEVICE_ATTR_RW (usb_c_power_priority); + +static int usb_c_power_priority_restore (struct uniwill_data *data) +{ + unsigned int value; + + value =USB_C_POWER_PRIORITY_OPTIONS_VALUE [data->last_usb_c_power_priority_option];You need to take the appropriate mutex here.
ack
Quoted 23 lines
Quoted 23 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +22
-0+ + return regmap_update_bits(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, + USB_C_POWER_PRIORITY, value); +} + +static int usb_c_power_priority_init (struct uniwill_data *data) +{ + unsigned int value, i; + int ret; + + if (!uniwill_device_supports(data, UNIWILL_FEATURE_USB_C_POWER_PRIORITY)) + return 0; + + ret = devm_mutex_init(data->dev, &data->usb_c_power_priority_lock); + if (ret < 0) + return ret; + + ret = regmap_read(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, &value); + if (ret < 0) + return ret; + + value &= USB_C_POWER_PRIORITY;
Quoted 8 lines
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 991
Quoted 6 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +6
-0+ + for (i = 0; i < ARRAY_SIZE(USB_C_POWER_PRIORITY_OPTIONS_VALUE); ++i) + if (USB_C_POWER_PRIORITY_OPTIONS_VALUE[i] == value) { + data->last_usb_c_power_priority_option = i; + return 0; + }Please drop this for-loop and use an if-statement instead.
ok
Quoted 59 lines
Quoted 59 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +5
-0+ + /* Since all possible values are valid, this should be unreachable. */ + return -EINVAL; +} + static struct attribute *uniwill_attrs[] = {/* Keyboard-related */
&dev_attr_fn_lock.attr,drivers/platform/x86/uniwill/uniwill-acpi.c +1
-0@@ -893,6 +1004,7 @@ static struct attribute *uniwill_attrs[] = { &dev_attr_breathing_in_suspend.attr, /* Power-management-related */ &dev_attr_ctgp_offset.attr, + &dev_attr_usb_c_power_priority.attr,NULL
};
@@ -927,6 +1039,11 @@ staticumode_tuniwill_attr_is_visible(struct kobject *kobj, struct attribute *a returnattr->mode;
}
+ if (attr == &dev_attr_usb_c_power_priority.attr) {
+ if (uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ returnattr->mode;
+ }
+
return 0;
}
@@ -1417,11 +1534,10 @@ static int uniwill_notifier_call(structnotifier_block*nb, unsigned long action returnNOTIFY_OK;
caseUNIWILL_OSD_DC_ADAPTER_CHANGED:
- /* noop for the time being, will change once charging priority
- * gets implemented.
- */
+ if (!uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ returnNOTIFY_DONE;
- returnNOTIFY_OK;
+ return notifier_from_errno(usb_c_power_priority_restore(data));
caseUNIWILL_OSD_FN_LOCK:
if (!uniwill_device_supports(data,UNIWILL_FEATURE_FN_LOCK))
returnNOTIFY_DONE;drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0@@ -1515,10 +1631,15 @@ static int uniwill_probe(struct platform_device *pdev) return PTR_ERR(regmap); data->regmap = regmap; + ret = devm_mutex_init(&pdev->dev, &data->super_key_lock); if (ret < 0) return ret; + ret = usb_c_power_priority_init(data); + if (ret < 0) + return ret; + ret = uniwill_ec_init(data); if (ret < 0) return ret;@@ -1681,6 +1802,14 @@ static int uniwill_resume_nvidia_ctgp(struct uniwill_data *data) CTGP_DB_DB_ENABLE | CTGP_DB_CTGP_ENABLE); }
Quoted 8 lines
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 975
Quoted 4 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +3
-0+static int uniwill_resume_usb_c_power_priority(struct uniwill_data *data) +{ + if (!uniwill_device_supports(data, UNIWILL_FEATURE_USB_C_POWER_PRIORITY)) + return 0;I think it would make sense to move the feature check into
usb_c_power_priority_restore(). This wayusb_c_power_priority_restore()can be called by both the notifier and the resume code directly.
How would i then distinct between returning NOTIFY_DONE and NOTIFY_OK? notifier_from_errno only returns NOTIFY_OK.
Quoted 2 lines
It would also be very nice if you can include a short changelog with your next patch series.
ack
Best Regerds,
Werner
Quoted 22 lines
Thanks,
Armin WolfQuoted 18 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0+ + return usb_c_power_priority_restore(data); +} + static int uniwill_resume(struct device *dev) {struct
uniwill_data*data =dev_get_drvdata(dev);drivers/platform/x86/uniwill/uniwill-acpi.c +5
-0@@ -1704,7 +1833,11 @@ static int uniwill_resume(struct device *dev) if (ret < 0) return ret; - return uniwill_resume_nvidia_ctgp(data); + ret = uniwill_resume_nvidia_ctgp(data); + if (ret < 0) + return ret; + + return uniwill_resume_usb_c_power_priority(data); } static DEFINE_SIMPLE_DEV_PM_OPS(uniwill_pm_ops, uniwill_suspend, uniwill_resume);
Armin Wolf
maintainerRe: [PATCH v3 2/4] platform/x86/uniwill: Implement USB-C power priority setting
Am 02.03.26 um 19:22 schrieb Werner Sembach:
Quoted 147 lines
Am 01.03.26 um 14:05 schrieb Armin Wolf:
Quoted 145 lines
Am 27.02.26 um 21:07 schrieb Werner Sembach:
Quoted 128 lines
On some devices Uniwill offers the option to set the USB-C port to prioritise charging or performance. This patch exposes this setting to the userspace via sysfs for all TUXEDO devices supporting it.
Signed-off-by Werner Sembach <[email protected]>---
drivers/platform/x86/uniwill/uniwill-acpi.c| 147
+++++++++++++++++++-1 file changed, 140 insertions(+), 7 deletions(-)drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -266,8 +266,8 @@ #define BATTERY_CHARGE_FULL_OVER_24H BIT(3) #define BATTERY_ERM_STATUS_REACHED BIT(4)-#define EC_ADDR_CHARGE_PRIO
0x07CCdrivers/platform/x86/uniwill/uniwill-acpi.c +2
-1-#define CHARGING_PERFORMANCE BIT(7) +#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC +#define USB_C_POWER_PRIORITY BIT(7)/* Same bits as
EC_ADDR_LIGHTBAR_AC_CTRLexceptLIGHTBAR_S3_OFF*/ #define EC_ADDR_LIGHTBAR_BAT_CTRL0x07E2drivers/platform/x86/uniwill/uniwill-acpi.c +6
-0@@ -324,6 +324,12 @@ #define UNIWILL_FEATURE_PRIMARY_FAN BIT(7) #define UNIWILL_FEATURE_SECONDARY_FAN BIT(8) #define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9) +#define UNIWILL_FEATURE_USB_C_POWER_PRIORITY BIT(10) + +enum usb_c_power_priority_options { + USB_C_POWER_PRIORITY_OPTIONS_CHARGING = 0, + USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE, +}; struct uniwill_data { struct device *dev;@@ -343,6 +349,8 @@ struct uniwill_data {struct mutex input_lock; /* Protects input sequence during notify */ struct
input_dev*input_device;
structnotifier_blocknb;
+ struct mutexusb_c_power_priority_lock; /* Protects dependent bit write and state safe */
+ enumusb_c_power_priority_optionslast_usb_c_power_priority_option;
};
structuniwill_battery_entry{drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -527,6 +535,7 @@ static bool uniwill_writeable_reg(struct device *dev, unsigned int reg)case
EC_ADDR_CTGP_DB_CTGP_OFFSET:
caseEC_ADDR_CTGP_DB_TPP_OFFSET:
caseEC_ADDR_CTGP_DB_DB_OFFSET:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -565,6 +574,7 @@ static bool uniwill_readable_reg(struct device *dev, unsigned int reg)case
EC_ADDR_CTGP_DB_CTGP_OFFSET:
caseEC_ADDR_CTGP_DB_TPP_OFFSET:
caseEC_ADDR_CTGP_DB_DB_OFFSET:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -587,6 +597,7 @@ static bool uniwill_volatile_reg(struct device *dev, unsigned int reg)case
EC_ADDR_TRIGGER:
caseEC_ADDR_SWITCH_STATUS:
caseEC_ADDR_CHARGE_CTRL:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +27
-0@@ -883,6 +894,106 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) return 0; } +static const char * const USB_C_POWER_PRIORITY_OPTIONS_TEXT[] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING] = "charging", + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE] = "performance", +}; + +static const u8 USB_C_POWER_PRIORITY_OPTIONS_VALUE [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING] = 0, + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE] =USB_C_POWER_PRIORITY , +}; + +static ssize_t usb_c_power_priority_store (struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct uniwill_data *data = dev_get_drvdata(dev); + enum usb_c_power_priority_options option; + unsigned int value; + int ret; + + option = sysfs_match_string(USB_C_POWER_PRIORITY_OPTIONS_TEXT, buf); + if (option < 0) + return option; + + value = USB_C_POWER_PRIORITY_OPTIONS_VALUE[option]; + + guard(mutex)(&data->usb_c_power_priority_lock); + + ret = regmap_update_bits(data->regmap,
EC_ADDR_USB_C_POWER_PRIORITY,
+USB_C_POWER_PRIORITY, value);
+ if (ret < 0)
+ return ret;drivers/platform/x86/uniwill/uniwill-acpi.c +15
-0+ + data->last_usb_c_power_priority_option = option; + + return count; +} + +static ssize_t usb_c_power_priority_show (struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct uniwill_data *data = dev_get_drvdata(dev); + unsigned int value, i; + int ret; + + ret = regmap_read(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY,&value);
+ if (ret < 0)
+ return ret;drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 952
Quoted 9 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +9
-0+ + value &= USB_C_POWER_PRIORITY; + + for (i = 0; i < ARRAY_SIZE(USB_C_POWER_PRIORITY_OPTIONS_VALUE); ++i) + if (USB_C_POWER_PRIORITY_OPTIONS_VALUE[i] == value) + return sysfs_emit(buf, "%s\n", + USB_C_POWER_PRIORITY_OPTIONS_TEXT[i]); +Please drop this for-loop and use a if-statement instead:
if (value &
USB_C_POWER_PRIORITY)
returnsysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE]);
Quoted 7 lines
Quoted 4 lines
return
sysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_CHARGING]);Also, i think USB_C_POWER_PRIORITY_OPTIONS_VALUE[] is unnecessary. Using an if-statement would yield more readable code than using for-loops in this case.
I can see where the for loop is unnecessary, but dropping USB_C_POWER_PRIORITY_OPTIONS_VALUE kinda obfuscates that there are 2 profiles, i like the clear association with the enum and stuff. the compile will be optimizing it out anyway.
Fine, then you can keep it as it is. In this case you might also keep the second for-loop.
Quoted 126 lines
Quoted 16 lines
Quoted 13 lines
+ /* Since all possible values are valid, this should be unreachable. */
+ return-EINVAL;drivers/platform/x86/uniwill/uniwill-acpi.c +9
-0+} + +static DEVICE_ATTR_RW (usb_c_power_priority); + +static int usb_c_power_priority_restore (struct uniwill_data *data) +{ + unsigned int value; + + value =Quoted 1 line
USB_C_POWER_PRIORITY_OPTIONS_VALUE[data->last_usb_c_power_priority_option];
You need to take the appropriate mutex here.
ack
Quoted 28 lines
Quoted 28 lines
+
+ return regmap_update_bits(data->regmap,EC_ADDR_USB_C_POWER_PRIORITY,
+USB_C_POWER_PRIORITY, value);drivers/platform/x86/uniwill/uniwill-acpi.c +8
-0+} + +static int usb_c_power_priority_init(struct uniwill_data *data) +{ + unsigned int value, i; + int ret; + + if (!uniwill_device_supports(data,
UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ return 0;
+
+ ret =devm_mutex_init(data->dev, &data->usb_c_power_priority_lock);
+ if (ret < 0)
+ return ret;
+
+ ret =regmap_read(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, &value);
+ if (ret < 0)
+ return ret;drivers/platform/x86/uniwill/uniwill-acpi.c +3
-0+ + value &= USB_C_POWER_PRIORITY; +Quoted 8 lines
Quoted 6 lines
+ for (i = 0; i <
ARRAY_SIZE(USB_C_POWER_PRIORITY_OPTIONS_VALUE); ++i)
+ if (USB_C_POWER_PRIORITY_OPTIONS_VALUE[i] == value) { +data->last_usb_c_power_priority_option= i; + return 0;
+ }Please drop this for-loop and use an if-statement instead.
ok
Quoted 63 lines
Quoted 63 lines
+
+ /* Since all possible values are valid, this should be unreachable. */
+ return-EINVAL;drivers/platform/x86/uniwill/uniwill-acpi.c +2
-0+} +static struct attribute *uniwill_attrs[] = {
/* Keyboard-related */
&dev_attr_fn_lock.attr,drivers/platform/x86/uniwill/uniwill-acpi.c +1
-0@@ -893,6 +1004,7 @@ static struct attribute *uniwill_attrs[] = { &dev_attr_breathing_in_suspend.attr, /* Power-management-related */ &dev_attr_ctgp_offset.attr, + &dev_attr_usb_c_power_priority.attr,NULL
};
@@ -927,6 +1039,11 @@ staticumode_tuniwill_attr_is_visible(struct kobject *kobj, struct attribute *a returnattr->mode;
}
+ if (attr == &dev_attr_usb_c_power_priority.attr) {
+ if (uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ returnattr->mode;
+ }
+
return 0;
}
@@ -1417,11 +1534,10 @@ static int uniwill_notifier_call(structnotifier_block*nb, unsigned long action returnNOTIFY_OK;
caseUNIWILL_OSD_DC_ADAPTER_CHANGED:
- /* noop for the time being, will change once charging priority
- * gets implemented.
- */
+ if (!uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ returnNOTIFY_DONE;
- returnNOTIFY_OK;
+ return
notifier_from_errno(usb_c_power_priority_restore(data));
caseUNIWILL_OSD_FN_LOCK:
if (!uniwill_device_supports(data,UNIWILL_FEATURE_FN_LOCK))
returnNOTIFY_DONE;drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0@@ -1515,10 +1631,15 @@ static int uniwill_probe(struct platform_device *pdev) return PTR_ERR(regmap); data->regmap = regmap; + ret = devm_mutex_init(&pdev->dev, &data->super_key_lock); if (ret < 0) return ret; + ret = usb_c_power_priority_init(data); + if (ret < 0) + return ret; + ret = uniwill_ec_init(data); if (ret < 0) return ret;@@ -1681,6 +1802,14 @@ static int uniwill_resume_nvidia_ctgp(struct uniwill_data *data) CTGP_DB_DB_ENABLE | CTGP_DB_CTGP_ENABLE); } +static int uniwill_resume_usb_c_power_priority(struct uniwill_data *data)Quoted 8 lines
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 975
Quoted 4 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +3
-0+{ + if (!uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY )) + return 0;I think it would make sense to move the feature check into
usb_c_power_priority_restore(). This wayusb_c_power_priority_restore()can be called by both the notifier and the resume code directly.
Quoted 2 lines
How would i then distinct between returning
NOTIFY_DONEandNOTIFY_OK?notifier_from_errnoonly returns NOTIFY_OK.
Good point, you might keep the existing code then.
Thanks,
Armin wolf
Quoted 32 lines
Quoted 2 lines
It would also be very nice if you can include a short changelog with your next patch series.
ack
Best Regerds,
Werner
Quoted 22 lines
Thanks,
Armin WolfQuoted 18 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0+ + return usb_c_power_priority_restore(data); +} + static int uniwill_resume(struct device *dev){
structuniwill_data*data =dev_get_drvdata(dev);drivers/platform/x86/uniwill/uniwill-acpi.c +5
-0@@ -1704,7 +1833,11 @@ static int uniwill_resume(struct device *dev) if (ret < 0) return ret; - return uniwill_resume_nvidia_ctgp(data); + ret = uniwill_resume_nvidia_ctgp(data); + if (ret < 0) + return ret; + + return uniwill_resume_usb_c_power_priority(data); } static DEFINE_SIMPLE_DEV_PM_OPS(uniwill_pm_ops, uniwill_suspend, uniwill_resume);
Re: [PATCH v3 2/4] platform/x86/uniwill: Implement USB-C power priority setting
In reply to Armin WolfAm 01.03.26 um 14:05 schrieb Armin Wolf:
Quoted 256 lines
Am 27.02.26 um 21:07 schrieb Werner Sembach:
Quoted 120 lines
On some devices Uniwill offers the option to set the USB-C port to prioritise charging or performance. This patch exposes this setting to the userspace via sysfs for all TUXEDO devices supporting it.
Signed-off-by Werner Sembach <[email protected]>---
drivers/platform/x86/uniwill/uniwill-acpi.c| 147 +++++++++++++++++++-1 file changed, 140 insertions(+), 7 deletions(-)drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -266,8 +266,8 @@ #define BATTERY_CHARGE_FULL_OVER_24H BIT(3) #define BATTERY_ERM_STATUS_REACHED BIT(4)-#define EC_ADDR_CHARGE_PRIO
0x07CCdrivers/platform/x86/uniwill/uniwill-acpi.c +2
-1-#define CHARGING_PERFORMANCE BIT(7) +#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC +#define USB_C_POWER_PRIORITY BIT(7)/* Same bits as
EC_ADDR_LIGHTBAR_AC_CTRLexceptLIGHTBAR_S3_OFF*/ #define EC_ADDR_LIGHTBAR_BAT_CTRL0x07E2drivers/platform/x86/uniwill/uniwill-acpi.c +6
-0@@ -324,6 +324,12 @@ #define UNIWILL_FEATURE_PRIMARY_FAN BIT(7) #define UNIWILL_FEATURE_SECONDARY_FAN BIT(8) #define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9) +#define UNIWILL_FEATURE_USB_C_POWER_PRIORITY BIT(10) + +enum usb_c_power_priority_options { + USB_C_POWER_PRIORITY_OPTIONS_CHARGING = 0, + USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE, +}; struct uniwill_data { struct device *dev;@@ -343,6 +349,8 @@ struct uniwill_data {struct mutex input_lock; /* Protects input sequence during notify */ struct
input_dev*input_device;
structnotifier_blocknb;
+ struct mutexusb_c_power_priority_lock; /* Protects dependent bit write and state safe */
+ enumusb_c_power_priority_optionslast_usb_c_power_priority_option; };
structuniwill_battery_entry{drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -527,6 +535,7 @@ static bool uniwill_writeable_reg(struct device *dev, unsigned int reg)case
EC_ADDR_CTGP_DB_CTGP_OFFSET:
caseEC_ADDR_CTGP_DB_TPP_OFFSET:
caseEC_ADDR_CTGP_DB_DB_OFFSET:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -565,6 +574,7 @@ static bool uniwill_readable_reg(struct device *dev, unsigned int reg)case
EC_ADDR_CTGP_DB_CTGP_OFFSET:
caseEC_ADDR_CTGP_DB_TPP_OFFSET:
caseEC_ADDR_CTGP_DB_DB_OFFSET:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +0
-0@@ -587,6 +597,7 @@ static bool uniwill_volatile_reg(struct device *dev, unsigned int reg)case
EC_ADDR_TRIGGER:
caseEC_ADDR_SWITCH_STATUS:
caseEC_ADDR_CHARGE_CTRL:
+ caseEC_ADDR_USB_C_POWER_PRIORITY:
return true;
default:
return false;drivers/platform/x86/uniwill/uniwill-acpi.c +45
-0@@ -883,6 +894,106 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) return 0; } +static const char * const USB_C_POWER_PRIORITY_OPTIONS_TEXT[] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING] = "charging", + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE] = "performance", +}; + +static const u8 USB_C_POWER_PRIORITY_OPTIONS_VALUE [] = { + [USB_C_POWER_PRIORITY_OPTIONS_CHARGING] = 0, + [USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE] = USB_C_POWER_PRIORITY, +}; + +static ssize_t usb_c_power_priority_store (struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct uniwill_data *data = dev_get_drvdata(dev); + enum usb_c_power_priority_options option; + unsigned int value; + int ret; + + option = sysfs_match_string(USB_C_POWER_PRIORITY_OPTIONS_TEXT, buf); + if (option < 0) + return option; + + value = USB_C_POWER_PRIORITY_OPTIONS_VALUE[option]; + + guard(mutex)(&data->usb_c_power_priority_lock); + + ret = regmap_update_bits(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, + USB_C_POWER_PRIORITY, value); + if (ret < 0) + return ret; + + data->last_usb_c_power_priority_option = option; + + return count; +} + +static ssize_t usb_c_power_priority_show (struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct uniwill_data *data = dev_get_drvdata(dev); + unsigned int value, i; + int ret; + + ret = regmap_read(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, &value);drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data · line 952
Quoted 10 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +10
-0+ if (ret < 0) + return ret; + + value &= USB_C_POWER_PRIORITY; + + for (i = 0; i < ARRAY_SIZE(USB_C_POWER_PRIORITY_OPTIONS_VALUE); ++i) + if (USB_C_POWER_PRIORITY_OPTIONS_VALUE[i] == value) + return sysfs_emit(buf, "%s\n", + USB_C_POWER_PRIORITY_OPTIONS_TEXT[i]); +Please drop this for-loop and use a if-statement instead:
if (value &
USB_C_POWER_PRIORITY)
returnsysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_PERFORMANCE]);return
sysfs_emit(buf, "%s\n", USB_C_POWER_PRIORITY_OPTIONS_TEXT[USB_C_POWER_PRIORITY_OPTIONS_CHARGING]);Also, i think USB_C_POWER_PRIORITY_OPTIONS_VALUE[] is unnecessary. Using an if-statement would yield more readable code than using for-loops in this case.
drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data)
Quoted 12 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +11
-0+ /* Since all possible values are valid, this should be unreachable. */ + return -EINVAL; +} + +static DEVICE_ATTR_RW (usb_c_power_priority); + +static int usb_c_power_priority_restore (struct uniwill_data *data) +{ + unsigned int value; + + value =USB_C_POWER_PRIORITY_OPTIONS_VALUE [data->last_usb_c_power_priority_option];You need to take the appropriate mutex here.
Quoted 18 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +18
-0+ + return regmap_update_bits(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, + USB_C_POWER_PRIORITY, value); +} + +static int usb_c_power_priority_init (struct uniwill_data *data) +{ + unsigned int value, i; + int ret; + + if (!uniwill_device_supports(data, UNIWILL_FEATURE_USB_C_POWER_PRIORITY)) + return 0; + + ret = devm_mutex_init(data->dev, &data->usb_c_power_priority_lock); + if (ret < 0) + return ret; + + ret = regmap_read(data->regmap, EC_ADDR_USB_C_POWER_PRIORITY, &value);drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_nvidia_ctgp_init(struct uniwill_data *data) · line 991
Quoted 10 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +10
-0+ if (ret < 0) + return ret; + + value &= USB_C_POWER_PRIORITY; + + for (i = 0; i < ARRAY_SIZE(USB_C_POWER_PRIORITY_OPTIONS_VALUE); ++i) + if (USB_C_POWER_PRIORITY_OPTIONS_VALUE[i] == value) { + data->last_usb_c_power_priority_option = i; + return 0; + }Please drop this for-loop and use an if-statement instead.
Quoted 55 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +5
-0+ + /* Since all possible values are valid, this should be unreachable. */ + return -EINVAL; +} + static struct attribute *uniwill_attrs[] = {/* Keyboard-related */
&dev_attr_fn_lock.attr,drivers/platform/x86/uniwill/uniwill-acpi.c +1
-0@@ -893,6 +1004,7 @@ static struct attribute *uniwill_attrs[] = { &dev_attr_breathing_in_suspend.attr, /* Power-management-related */ &dev_attr_ctgp_offset.attr, + &dev_attr_usb_c_power_priority.attr,NULL
};
@@ -927,6 +1039,11 @@ staticumode_tuniwill_attr_is_visible(struct kobject *kobj, struct attribute *a returnattr->mode;
}
+ if (attr == &dev_attr_usb_c_power_priority.attr) {
+ if (uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ returnattr->mode;
+ }
+
return 0;
}
@@ -1417,11 +1534,10 @@ static int uniwill_notifier_call(structnotifier_block*nb, unsigned long action returnNOTIFY_OK;
caseUNIWILL_OSD_DC_ADAPTER_CHANGED:
- /* noop for the time being, will change once charging priority
- * gets implemented.
- */
+ if (!uniwill_device_supports(data,UNIWILL_FEATURE_USB_C_POWER_PRIORITY))
+ returnNOTIFY_DONE;
- returnNOTIFY_OK;
+ return notifier_from_errno(usb_c_power_priority_restore(data));
caseUNIWILL_OSD_FN_LOCK:
if (!uniwill_device_supports(data,UNIWILL_FEATURE_FN_LOCK))
returnNOTIFY_DONE;drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0@@ -1515,10 +1631,15 @@ static int uniwill_probe(struct platform_device *pdev) return PTR_ERR(regmap); data->regmap = regmap; + ret = devm_mutex_init(&pdev->dev, &data->super_key_lock); if (ret < 0) return ret; + ret = usb_c_power_priority_init(data); + if (ret < 0) + return ret; + ret = uniwill_ec_init(data); if (ret < 0) return ret;drivers/platform/x86/uniwill/uniwill-acpi.c static int uniwill_resume_nvidia_ctgp(struct · line 1808
Quoted 7 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +3
-0@@ -1681,6 +1802,14 @@ static int uniwill_resume_nvidia_ctgp(struct uniwill_data *data) CTGP_DB_DB_ENABLE | CTGP_DB_CTGP_ENABLE); } +static int uniwill_resume_usb_c_power_priority(struct uniwill_data *data) +{ + if (!uniwill_device_supports(data, UNIWILL_FEATURE_USB_C_POWER_PRIORITY)) + return 0;I think it would make sense to move the feature check into
usb_c_power_priority_restore(). This wayusb_c_power_priority_restore()can be called by both the notifier and the resume code directly.
Quoted 1 line
It would also be very nice if you can include a short changelog with your next patch series.
sorry was a user error on using git send-email: i created the cover letter but never sent it
Quoted 22 lines
Thanks,
Armin WolfQuoted 18 lines
drivers/platform/x86/uniwill/uniwill-acpi.c +4
-0+ + return usb_c_power_priority_restore(data); +} + static int uniwill_resume(struct device *dev) {struct
uniwill_data*data =dev_get_drvdata(dev);drivers/platform/x86/uniwill/uniwill-acpi.c +5
-0@@ -1704,7 +1833,11 @@ static int uniwill_resume(struct device *dev) if (ret < 0) return ret; - return uniwill_resume_nvidia_ctgp(data); + ret = uniwill_resume_nvidia_ctgp(data); + if (ret < 0) + return ret; + + return uniwill_resume_usb_c_power_priority(data); } static DEFINE_SIMPLE_DEV_PM_OPS(uniwill_pm_ops, uniwill_suspend, uniwill_resume);
PATCH v3 3/4 platform/x86/uniwill: Apply features across all TUXEDO devices
In reply to a message not in the archiveUses the more fine granular and/or new feature defines to enable more features across the TUXEDO device lineup.
Also adds features defines that where already present, but not tested until now.
Also fixes XMG Fusion system vendor name and clarifies edition in ident.
--- drivers/platform/x86/uniwill/uniwill-acpi.c | 214 ++++++++++++++------ 1 file changed, 156 insertions(+), 58 deletions(-)
drivers/platform/x86/uniwill/uniwill-acpi.c +156 -58
@@ -110,6 +110,8 @@#define EC_ADDR_BAT_CYCLE_COUNT_2 0x04A7#define EC_ADDR_PROJECT_ID 0x0740 +#define PROJECT_ID_PH4TRX1 0x12 +#define PROJECT_ID_PH6TRX1 0x15#define EC_ADDR_AP_OEM 0x0741#define ENABLE_MANUAL_CTRL BIT(0)
@@ -1863,6 +1865,15 @@ static struct platform_driver uniwill_driver = { .shutdown = uniwill_shutdown, }; +static struct uniwill_device_descriptor lapqc71a_lapqc71b_descriptor__initdata = { + .features =UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_BATTERY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN , +}; +static struct uniwill_device_descriptor lapac71h_descriptor__initdata = { .features =UNIWILL_FEATURE_FN_LOCK | UNIWILL_FEATURE_SUPER_KEY |
@@ -1886,6 +1897,85 @@ static struct uniwill_device_descriptor lapkc71f_descriptor __initdata = { UNIWILL_FEATURE_SECONDARY_FAN, }; +/* +* The featuresets below reflect somewhat chronological changes: +* 1 -> 2: UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL is added to the EC firmware. +* 2 -> 3: UNIWILL_FEATURE_USB_C_POWER_PRIORITY is removed from the EC firmware. +* Some devices might divert from this timeline. +*/ + +static struct uniwill_device_descriptor tux_featureset_1_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN | +UNIWILL_FEATURE_USB_C_POWER_PRIORITY , +}; + +static struct uniwill_device_descriptor tux_featureset_1_nvidia_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN | +UNIWILL_FEATURE_USB_C_POWER_PRIORITY , +}; + +static struct uniwill_device_descriptor tux_featureset_2_nvidia_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN | +UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL | +UNIWILL_FEATURE_USB_C_POWER_PRIORITY , +}; + +static struct uniwill_device_descriptor tux_featureset_3_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN , +}; + +static struct uniwill_device_descriptor tux_featureset_3_nvidia_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN | +UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL , +}; + +static int phxtxx1_probe (struct uniwill_data *data) +{ +unsigned int value; +int ret; + + ret =regmap_read (data->regmap,EC_ADDR_PROJECT_ID , &value); +if (ret <0 ) +return ret; + +if (value ==PROJECT_ID_PH4TRX1 || value ==PROJECT_ID_PH6TRX1 ) + data->features |=UNIWILL_FEATURE_SECONDARY_FAN ; + +return 0 ; +}; + +static struct uniwill_device_descriptor phxtxx1_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_USB_C_POWER_PRIORITY , + .probe = phxtxx1_probe, +}; +static int phxarx1_phxaqf1_probe (struct uniwill_data *data) {unsigned int value;
@@ -1896,37 +1986,45 @@ static int phxarx1_phxaqf1_probe(struct uniwill_data *data)return ret;if (value &HAS_GPU ) - data->features |=UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL ; + data->features |=UNIWILL_FEATURE_GPU_TEMP | +UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL ;return 0 ; };static struct uniwill_device_descriptor phxarx1_phxaqf1_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN | +UNIWILL_FEATURE_SECONDARY_FAN | +UNIWILL_FEATURE_USB_C_POWER_PRIORITY , .probe = phxarx1_phxaqf1_probe, }; -static struct uniwill_device_descriptor tux_featureset_1_descriptor__initdata = { - .features =UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL , +static struct uniwill_device_descriptor pf5pu1g_descriptor__initdata = { + .features =UNIWILL_FEATURE_FN_LOCK | +UNIWILL_FEATURE_SUPER_KEY | +UNIWILL_FEATURE_CPU_TEMP | +UNIWILL_FEATURE_PRIMARY_FAN , }; -static struct uniwill_device_descriptor empty_descriptor__initdata = {}; -static const struct dmi_system_id uniwill_dmi_table[]__initconst = { { - .ident ="XMG FUSION 15" , + .ident ="XMG FUSION 15 (L19)" , .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ), +DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ),DMI_EXACT_MATCH (DMI_BOARD_NAME ,"LAPQC71A" ), }, - .driver_data = &empty_descriptor, + .driver_data = &lapqc71a_lapqc71b_descriptor, }, { - .ident ="XMG FUSION 15" , + .ident ="XMG FUSION 15 (L19)" , .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ), +DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ),DMI_EXACT_MATCH (DMI_BOARD_NAME ,"LAPQC71B" ), }, - .driver_data = &empty_descriptor, + .driver_data = &lapqc71a_lapqc71b_descriptor, }, { .ident ="Intel NUC x15" ,
@@ -1950,7 +2048,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PHxTxX1"), }, - .driver_data = &empty_descriptor, + .driver_data = &phxtxx1_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14 Gen6 Intel",
@@ -1958,7 +2056,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PHxTQx1"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14/16 Gen7 Intel",
@@ -1974,7 +2072,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PH6AG01_PH6AQ71_PH6AQI1"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14/16 Gen8 Intel/Commodore Omnia-Book Pro Gen 8",
@@ -1982,7 +2080,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PH4PRX1_PH6PRX1"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14 Gen8 Intel/Commodore Omnia-Book Pro Gen 8",
@@ -1990,7 +2088,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PH4PG31"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 16 Gen8 Intel",
@@ -1998,7 +2096,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PH6PG01_PH6PG71"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14/15 Gen9 AMD",
@@ -2006,7 +2104,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GXxHRXx"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14/15 Gen9 Intel/Commodore Omnia-Book 15 Gen9",
@@ -2014,7 +2112,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GXxMRXx"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14/15 Gen10 AMD",
@@ -2022,7 +2120,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "XxHP4NAx"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 14/15 Gen10 AMD",
@@ -2030,7 +2128,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "XxKK4NAx_XxSP4NAx"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_descriptor, }, { .ident = "TUXEDO InfinityBook Pro 15 Gen10 Intel",
@@ -2038,7 +2136,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "XxAR4NAx"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_descriptor, }, { .ident = "TUXEDO InfinityBook Max 15 Gen10 AMD",
@@ -2046,7 +2144,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X5KK45xS_X5SP45xS"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Max 16 Gen10 AMD",
@@ -2054,7 +2152,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X6HP45xU"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Max 16 Gen10 AMD",
@@ -2062,7 +2160,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X6KK45xU_X6SP45xU"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Max 15 Gen10 Intel",
@@ -2070,7 +2168,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X5AR45xS"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO InfinityBook Max 16 Gen10 Intel",
@@ -2078,7 +2176,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X6AR55xU"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15 Gen1 AMD",
@@ -2086,7 +2184,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1501A1650TI"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15 Gen1 AMD",
@@ -2094,7 +2192,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1501A2060"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 17 Gen1 AMD",
@@ -2102,7 +2200,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1701A1650TI"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 17 Gen1 AMD",
@@ -2110,7 +2208,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1701A2060"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15 Gen1 Intel",
@@ -2118,7 +2216,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1501I1650TI"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15 Gen1 Intel",
@@ -2126,7 +2224,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1501I2060"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 17 Gen1 Intel",
@@ -2134,7 +2232,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1701I1650TI"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 17 Gen1 Intel",
@@ -2142,7 +2240,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "POLARIS1701I2060"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Trinity 15 Intel Gen1",
@@ -2150,7 +2248,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "TRINITY1501I"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Trinity 17 Intel Gen1",
@@ -2158,7 +2256,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "TRINITY1701I"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15/17 Gen2 AMD",
@@ -2166,7 +2264,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxMGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15/17 Gen2 Intel",
@@ -2174,7 +2272,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxNGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris/Polaris 15/17 Gen3 AMD",
@@ -2182,7 +2280,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxZGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris/Polaris 15/17 Gen3 Intel",
@@ -2190,7 +2288,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxTGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris/Polaris 15/17 Gen4 AMD",
@@ -2198,7 +2296,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxRGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 15 Gen4 Intel",
@@ -2206,7 +2304,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxAGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Polaris 15/17 Gen5 AMD",
@@ -2214,7 +2312,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxXGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_2_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16 Gen5 AMD",
@@ -2222,7 +2320,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GM6XGxX"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16/17 Gen5 Intel/Commodore ORION Gen 5",
@@ -2230,7 +2328,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxPXxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris Slim 15 Gen6 AMD",
@@ -2238,7 +2336,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GMxHGxx"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris Slim 15 Gen6 Intel/Commodore ORION Slim 15 Gen6",
@@ -2246,7 +2344,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GM5IXxA"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16 Gen6 Intel/Commodore ORION 16 Gen6",
@@ -2254,7 +2352,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GM6IXxB_MB1"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16 Gen6 Intel/Commodore ORION 16 Gen6",
@@ -2262,7 +2360,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GM6IXxB_MB2"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 17 Gen6 Intel/Commodore ORION 17 Gen6",
@@ -2270,7 +2368,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "GM7IXxN"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16 Gen7 AMD",
@@ -2278,7 +2376,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X6FR5xxY"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16 Gen7 Intel",
@@ -2286,7 +2384,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X6AR5xxY"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Stellaris 16 Gen7 Intel",
@@ -2294,7 +2392,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "X6AR5xxY_mLED"), }, - .driver_data = &tux_featureset_1_descriptor, + .driver_data = &tux_featureset_3_nvidia_descriptor, }, { .ident = "TUXEDO Book BA15 Gen10 AMD",
@@ -2302,7 +2400,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PF5PU1G"), }, - .driver_data = &empty_descriptor, + .driver_data = &pf5pu1g_descriptor, }, { .ident = "TUXEDO Pulse 14 Gen1 AMD",
@@ -2310,7 +2408,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PULSE1401"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_descriptor, }, { .ident = "TUXEDO Pulse 15 Gen1 AMD",
@@ -2318,7 +2416,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PULSE1501"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_descriptor, }, { .ident = "TUXEDO Pulse 15 Gen2 AMD",
@@ -2326,7 +2424,7 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = { DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "PF5LUXG"), }, - .driver_data = &empty_descriptor, + .driver_data = &tux_featureset_1_descriptor, }, { } };
Signature · 1 line
2.43.0
PATCH v3 4/4 Documentation: laptops: Update documentation for uniwill laptops
In reply to a message not in the archiveAdds short description for two new sysfs entries, ctgp_offset and usb_c_power_priority, to the documentation of uniwill laptops.
--- .../ABI/testing/sysfs-driver-uniwill-laptop | 25 +++++++++++++++++++ .../admin-guide/laptops/uniwill-laptop.rst | 12 +++++++++ 2 files changed, 37 insertions(+)
Documentation/ABI/testing/sysfs-driver-uniwill-laptop +25 -0
@@ -51,3 +51,28 @@ Description: Reading this file returns the current status of the breathing animation functionality. + +What: /sys/bus/platform/devices/INOU0000:XX/ctgp_offset +Date: January 2026 +KernelVersion: 7.0 +Contact: Werner Sembach <[email protected]> +Description: + Allows userspace applications to set the configurable TGP offset on top of the base + TGP. Base TGP and max TGP and therefore the max cTGP offset are device specific. + Note that setting the maximal cTGP leaves no window open for Dynamic Boost, + effectifly disabling that feature for the GPU to always be prioritized. + + Reading this file returns the current configurable TGP offset. + +What: /sys/bus/platform/devices/INOU0000:XX/usb_c_power_priority +Date: February 2026 +KernelVersion: 7.1 +Contact: Werner Sembach <[email protected]> +Description: + Allows userspace applications to choose the USB-C power distribution profile between + one that offers a bigger share of the power to the battery and one that offers more + of it to the CPU. Writing "charging"/"performance" into this file selects the + respective profile. + + Reading this file returns the profile names with the currently active one in + brackets.
Documentation/admin-guide/laptops/uniwill-laptop.rst +12 -0
@@ -50,6 +50,10 @@ between 1 and 100 percent are supported. Additionally the driver signals the presence of battery charging issues through the standard ``health`` power supply sysfs attribute. +It also let you set whether an USB-C power source should prioritise charging the battery or +delivering immediate power to the cpu. See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for +details. + Lightbar --------
@@ -58,3 +62,11 @@ LED class device. The default name of this LED class device is ``uniwill:multico See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details on how to control the various animation modes of the lightbar. + +Configurable TGP +-------- + +The ``uniwill-laptop`` driver allows to set the configurable TGP for devices with NVIDIA GPUs that +allow it. + +See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details.
Signature · 1 line
2.43.0
Re: [PATCH v3 4/4] Documentation: laptops: Update documentation for uniwill laptops
Am 27.02.26 um 21:07 schrieb Werner Sembach:
Quoted 2 lines
Adds short description for two new sysfs entries,
ctgp_offsetandusb_c_power_priority, to the documentation of uniwill laptops.
Quoted 66 lines
Signed-off-by Werner Sembach <[email protected]>--- .../ABI/testing/sysfs-driver-uniwill-laptop | 25 +++++++++++++++++++ .../admin-guide/laptops/uniwill-laptop.rst | 12 +++++++++ 2 files changed, 37 insertions(+)Documentation/ABI/testing/sysfs-driver-uniwill-laptop +25
-0@@ -51,3 +51,28 @@ Description: Reading this file returns the current status of the breathing animation functionality. + +What: /sys/bus/platform/devices/INOU0000:XX/ctgp_offset +Date: January 2026 +KernelVersion: 7.0 +Contact: Werner Sembach <[email protected]> +Description: + Allows userspace applications to set the configurable TGP offset on top of the base + TGP. Base TGP and max TGP and therefore the max cTGP offset are device specific. + Note that setting the maximal cTGP leaves no window open for Dynamic Boost, + effectifly disabling that feature for the GPU to always be prioritized. + + Reading this file returns the current configurable TGP offset. + +What: /sys/bus/platform/devices/INOU0000:XX/usb_c_power_priority +Date: February 2026 +KernelVersion: 7.1 +Contact: Werner Sembach <[email protected]> +Description: + Allows userspace applications to choose the USB-C power distribution profile between + one that offers a bigger share of the power to the battery and one that offers more + of it to the CPU. Writing "charging"/"performance" into this file selects the + respective profile. + + Reading this file returns the profile names with the currently active one in + brackets.Documentation/admin-guide/laptops/uniwill-laptop.rst +12
-0@@ -50,6 +50,10 @@ between 1 and 100 percent are supported. Additionally the driver signals the presence of battery charging issues through the standard ``health`` power supply sysfs attribute. +It also let you set whether an USB-C power source should prioritise charging the battery or +delivering immediate power to the cpu. See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for +details. + Lightbar --------@@ -58,3 +62,11 @@ LED class device. The default name of this LED class device is ``uniwill:multico See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details on how to control the various animation modes of the lightbar. + +Configurable TGP +-------- + +The ``uniwill-laptop`` driver allows to set the configurable TGP for devices with NVIDIA GPUs that +allow it. + +See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details.