mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] platform/x86: uniwill-laptop: Support the Eluktronics RP-15
@ 2026-12-05  8:10 Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 1/3] platform/x86: uniwill-laptop: Optionally apply keyboard backlight levels Farhan via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Farhan via B4 Relay @ 2026-12-05  8:10 UTC (permalink / raw)
  To: Armin Wolf, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel, Farhan

This series adds support for the Eluktronics RP-15 (Red Pill Gen 1), a
Tongfang/Uniwill laptop with an AMD Ryzen 7 4800H and an NVIDIA RTX 2060,
similar to the TUXEDO Polaris 15 Gen1 AMD.

Patch 1 fixes the keyboard backlight keys on ECs that report the new level
but leave applying it to the driver (as the RP-15 does once manual control
is enabled). It is a descriptor flag, so other devices are unaffected.
Patch 2 adds the RP-15 with the features verified on the device. Patch 3
makes Fn lock and super key lock changes pollable, for on-screen displays.

Note for the RP-15 class: the EC registers at 0x0743-0x0746, which this
driver uses for NVIDIA cTGP control, hold the manual fan PWM levels here
(confirmed from the vendor software's register constants), so the cTGP
feature must stay disabled on this device.

Testing
-------
- Device: Eluktronics RP-15, BIOS N.1.21ELU09, EC project ID 0x10.
- Build: the series on for-next (fea9dfe6c) compiles in-tree with W=1
  without warnings.
- Runtime: the running kernel is Ubuntu 7.0.0-38, so the driver from this
  series was built out-of-tree against it, with two lines removed that need
  newer core APIs (mc_subled.max_intensity, wmi_driver.min_event_size).
  Checked:
  - CPU/GPU temperatures and both fans, including under load;
  - RGB keyboard backlight: colour, and the brightness keys now change the
    level, with brightness and brightness_hw_changed in agreement (without
    patch 1: brightness 3, brightness_hw_changed 4, no visible change);
  - poll() on fn_lock and super_key_enable wakes for sysfs writes and for
    the Fn+Esc / super key lock keys.
- Not tested, and therefore not enabled for the RP-15: battery charge
  modes and USB-C power priority. Both attributes read sane values with
  the Polaris descriptor.

Tool use
--------
These patches, including the changelogs, were written with an AI coding
assistant (Claude Code, Anthropic's Claude Opus 5.5) in an interactive
session. It reverse-engineered the EC interface on the device (ACPI
tables, EC RAM dumps, the vendor application's metadata), wrote an
out-of-tree driver, and ported the relevant changes to for-next. I
directed the work, ran the hardware tests, and reviewed the patches.
Each patch carries an Assisted-by tag.

Future work: the vendor's performance modes (Office/Gaming/Beast, mode
button and its LEDs), power limits and fan boost work on this device with
the same EC. I would like to propose them as platform_profile and hwmon
pwm1_enable support in a follow-up RFC.

---
Farhan (3):
      platform/x86: uniwill-laptop: Optionally apply keyboard backlight levels
      platform/x86: uniwill-laptop: Add support for the Eluktronics RP-15
      platform/x86: uniwill-laptop: Notify userspace about Fn and super key lock changes

 .../ABI/testing/sysfs-driver-uniwill-laptop        |  6 ++
 drivers/platform/x86/uniwill/uniwill-acpi.c        | 69 ++++++++++++++++++----
 2 files changed, 64 insertions(+), 11 deletions(-)
---
base-commit: fea9dfe6c4d93dc3f4b4b3534dc25bf283eaef08
change-id: 20261015-rp15-e1ad915492de

Best regards,
-- 
Farhan <khan.10.0412@gmail.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] platform/x86: uniwill-laptop: Optionally apply keyboard backlight levels
  2026-12-05  8:10 [PATCH 0/3] platform/x86: uniwill-laptop: Support the Eluktronics RP-15 Farhan via B4 Relay
@ 2026-12-05  8:10 ` Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 2/3] platform/x86: uniwill-laptop: Add support for the Eluktronics RP-15 Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 3/3] platform/x86: uniwill-laptop: Notify userspace about Fn and super key lock changes Farhan via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Farhan via B4 Relay @ 2026-12-05  8:10 UTC (permalink / raw)
  To: Armin Wolf, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel, Farhan

From: Farhan <khan.10.0412@gmail.com>

Once the driver has enabled manual control, the EC on some devices keeps
reporting UNIWILL_OSD_KB_LED_LEVEL* events when the keyboard backlight
keys are pressed, but no longer changes the backlight itself. The driver
then only notifies userspace about a brightness change that never
happened, so the keys appear to do nothing: brightness_hw_changed shows
the new level while the brightness attribute keeps the old one.

Add a device descriptor flag for such devices which makes the driver
write the reported level to the EC before notifying userspace.

Assisted-by: LLM
Signed-off-by: Farhan <khan.10.0412@gmail.com>
---
 drivers/platform/x86/uniwill/uniwill-acpi.c | 36 ++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index e2a6a704e..1f1d62c39 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -408,6 +408,7 @@ struct uniwill_data {
 	struct mc_subled led_mc_subled_info[LED_CHANNELS];
 	bool kbd_led_single_color;
 	u8 kbd_led_max_brightness;
+	bool kbd_led_apply_level;
 	unsigned int last_kbd_status;
 	union {
 		struct {
@@ -434,6 +435,12 @@ struct uniwill_device_descriptor {
 	unsigned int features;
 	bool kbd_led_single_color;
 	u8 kbd_led_max_brightness;
+	/*
+	 * Some ECs only report the new keyboard backlight level when the
+	 * brightness keys are pressed while the driver controls the EC,
+	 * but do not apply it themselves.
+	 */
+	bool kbd_led_apply_level;
 	u8 lightbar_max_intensity;
 	/* Executed during driver probing */
 	int (*probe)(struct uniwill_data *data);
@@ -1670,6 +1677,17 @@ static int uniwill_led_init(struct uniwill_data *data)
 							 &init_data);
 }
 
+#define KBD_LED_MASK	(KBD_BRIGHTNESS_MASK | KBD_APPLY | KBD_POWER_OFF)
+
+static int uniwill_kbd_led_write_brightness(struct uniwill_data *data, int brightness)
+{
+	/* KBD_POWER_OFF is always implicitly cleared */
+	unsigned int regval = FIELD_PREP(KBD_BRIGHTNESS_MASK, brightness) | KBD_APPLY;
+
+	/* We must ensure that the "apply" bit is always written */
+	return regmap_write_bits(data->regmap, EC_ADDR_KBD_STATUS, KBD_LED_MASK, regval);
+}
+
 static int uniwill_notify_kbd_led(struct uniwill_data *data, int brightness)
 {
 	struct led_classdev *led_cdev;
@@ -1708,6 +1726,12 @@ static int uniwill_notify_kbd_led(struct uniwill_data *data, int brightness)
 
 	guard(mutex)(&led_cdev->led_access);
 
+	if (data->kbd_led_apply_level) {
+		ret = uniwill_kbd_led_write_brightness(data, brightness);
+		if (ret < 0)
+			return ret;
+	}
+
 	/* Sync the LED brightness with the actual hardware state */
 	ret = led_update_brightness(led_cdev);
 	if (ret < 0)
@@ -1718,17 +1742,6 @@ static int uniwill_notify_kbd_led(struct uniwill_data *data, int brightness)
 	return 0;
 }
 
-#define KBD_LED_MASK	(KBD_BRIGHTNESS_MASK | KBD_APPLY | KBD_POWER_OFF)
-
-static int uniwill_kbd_led_write_brightness(struct uniwill_data *data, int brightness)
-{
-	/* KBD_POWER_OFF is always implicitly cleared */
-	unsigned int regval = FIELD_PREP(KBD_BRIGHTNESS_MASK, brightness) | KBD_APPLY;
-
-	/* We must ensure that the "apply" bit is always written */
-	return regmap_write_bits(data->regmap, EC_ADDR_KBD_STATUS, KBD_LED_MASK, regval);
-}
-
 static int uniwill_kbd_led_read_brightness(struct uniwill_data *data)
 {
 	unsigned int regval;
@@ -2442,6 +2455,7 @@ static int uniwill_probe(struct platform_device *pdev)
 	data->features = device_descriptor.features;
 	data->kbd_led_single_color = device_descriptor.kbd_led_single_color;
 	data->kbd_led_max_brightness = device_descriptor.kbd_led_max_brightness;
+	data->kbd_led_apply_level = device_descriptor.kbd_led_apply_level;
 	data->lightbar_max_intensity = device_descriptor.lightbar_max_intensity;
 
 	/*

-- 
2.53.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] platform/x86: uniwill-laptop: Add support for the Eluktronics RP-15
  2026-12-05  8:10 [PATCH 0/3] platform/x86: uniwill-laptop: Support the Eluktronics RP-15 Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 1/3] platform/x86: uniwill-laptop: Optionally apply keyboard backlight levels Farhan via B4 Relay
@ 2026-12-05  8:10 ` Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 3/3] platform/x86: uniwill-laptop: Notify userspace about Fn and super key lock changes Farhan via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Farhan via B4 Relay @ 2026-12-05  8:10 UTC (permalink / raw)
  To: Armin Wolf, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel, Farhan

From: Farhan <khan.10.0412@gmail.com>

The Eluktronics RP-15 (Red Pill Gen 1, SKU RP-15 G1) is a Tongfang
barebone with an AMD Ryzen 7 4800H and an NVIDIA RTX 2060, similar to the
TUXEDO Polaris 15 Gen1 AMD. Its DMI board name is empty, so match on the
system vendor and product name instead.

The following features were tested on the device: Fn lock and the Super
key lock (including the WMI events), CPU and GPU temperatures and both
fan speeds (checked under load), and the RGB keyboard backlight with four
brightness levels.

The EC does not apply the brightness keys itself while the driver
controls it (see the previous patch), so set kbd_led_apply_level.

Battery charge modes and USB-C power priority are left out because they
could not be tested on this unit. NVIDIA cTGP control must not be
enabled: on this EC, the registers at 0x0743-0x0746 hold the manual fan
PWM levels used by the vendor software, not cTGP settings.

Assisted-by: LLM
Signed-off-by: Farhan <khan.10.0412@gmail.com>
---
 drivers/platform/x86/uniwill/uniwill-acpi.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 1f1d62c39..18190a8a8 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -2903,6 +2903,19 @@ static struct uniwill_device_descriptor gkxmrxx_gkxnpxx_gkxnrxx_descriptor __ini
 	.kbd_led_max_brightness = 4,
 };
 
+static struct uniwill_device_descriptor eluktronics_rp15_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_KEYBOARD_BACKLIGHT,
+	.kbd_led_single_color = false,
+	.kbd_led_max_brightness = 4,
+	.kbd_led_apply_level = true,
+};
+
 static struct uniwill_device_descriptor gmxmpxx_descriptor __initdata = {
 	.features = UNIWILL_FEATURE_FN_LOCK |
 		    UNIWILL_FEATURE_SUPER_KEY |
@@ -3243,6 +3256,14 @@ static const struct dmi_system_id uniwill_dmi_table[] __initconst = {
 		},
 		.driver_data = &lapqc71a_lapqc71b_descriptor,
 	},
+	{
+		.ident = "Eluktronics RP-15",
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Eluktronics Inc."),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "RP-15"),
+		},
+		.driver_data = &eluktronics_rp15_descriptor,
+	},
 	{
 		.ident = "Intel NUC x15",
 		.matches = {

-- 
2.53.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] platform/x86: uniwill-laptop: Notify userspace about Fn and super key lock changes
  2026-12-05  8:10 [PATCH 0/3] platform/x86: uniwill-laptop: Support the Eluktronics RP-15 Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 1/3] platform/x86: uniwill-laptop: Optionally apply keyboard backlight levels Farhan via B4 Relay
  2026-12-05  8:10 ` [PATCH 2/3] platform/x86: uniwill-laptop: Add support for the Eluktronics RP-15 Farhan via B4 Relay
@ 2026-12-05  8:10 ` Farhan via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Farhan via B4 Relay @ 2026-12-05  8:10 UTC (permalink / raw)
  To: Armin Wolf, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel, Farhan

From: Farhan <khan.10.0412@gmail.com>

Userspace (for example an on-screen display) can poll fn_lock and
super_key_enable to follow the lock states, but only Fn lock changes made
with the Fn lock key are currently signalled.

Writing fn_lock does not cause the EC to send an event, so notify from
the store function as well. The EC does send events when the super key
lock changes, both from the keyboard and through super_key_enable, so
notify super_key_enable when one of them arrives instead of passing it to
the (ignoring) keymap.

Document that both files can be polled.

Assisted-by: LLM
Signed-off-by: Farhan <khan.10.0412@gmail.com>
---
 Documentation/ABI/testing/sysfs-driver-uniwill-laptop |  6 ++++++
 drivers/platform/x86/uniwill/uniwill-acpi.c           | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-driver-uniwill-laptop b/Documentation/ABI/testing/sysfs-driver-uniwill-laptop
index 5f7eccb2d..e9bc275ea 100644
--- a/Documentation/ABI/testing/sysfs-driver-uniwill-laptop
+++ b/Documentation/ABI/testing/sysfs-driver-uniwill-laptop
@@ -8,6 +8,9 @@ Description:
 
 		Reading this file returns the current enable status of the FN lock functionality.
 
+		The file can be polled for changes, including those made with the
+		Fn lock key.
+
 What:		/sys/bus/platform/devices/INOU0000:XX/super_key_enable
 Date:		November 2025
 KernelVersion:	6.19
@@ -18,6 +21,9 @@ Description:
 
 		Reading this file returns the current enable status of the super key.
 
+		The file can be polled for changes, including those made with the
+		super key lock key.
+
 What:		/sys/bus/platform/devices/INOU0000:XX/touchpad_toggle_enable
 Date:		November 2025
 KernelVersion:	6.19
diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index 18190a8a8..a0f4f5b5a 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -762,6 +762,9 @@ static ssize_t fn_lock_store(struct device *dev, const struct device_attribute *
 	if (ret < 0)
 		return ret;
 
+	/* Unlike Fn+Esc, this does not cause the EC to send an event */
+	sysfs_notify(&dev->kobj, NULL, "fn_lock");
+
 	return count;
 }
 
@@ -2330,6 +2333,15 @@ static int uniwill_notifier_call(struct notifier_block *nb, unsigned long action
 
 		sysfs_notify(&data->dev->kobj, NULL, "fn_lock");
 
+		return NOTIFY_OK;
+	case UNIWILL_OSD_SUPER_KEY_DISABLE:
+	case UNIWILL_OSD_SUPER_KEY_ENABLE:
+	case UNIWILL_OSD_SUPER_KEY_STATE_CHANGED:
+		if (!uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY))
+			return NOTIFY_DONE;
+
+		sysfs_notify(&data->dev->kobj, NULL, "super_key_enable");
+
 		return NOTIFY_OK;
 	case UNIWILL_OSD_KB_LED_LEVEL0:
 		if (!uniwill_device_supports(data, UNIWILL_FEATURE_KEYBOARD_BACKLIGHT))

-- 
2.53.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-05  8:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05  8:10 [PATCH 0/3] platform/x86: uniwill-laptop: Support the Eluktronics RP-15 Farhan via B4 Relay
2026-12-05  8:10 ` [PATCH 1/3] platform/x86: uniwill-laptop: Optionally apply keyboard backlight levels Farhan via B4 Relay
2026-12-05  8:10 ` [PATCH 2/3] platform/x86: uniwill-laptop: Add support for the Eluktronics RP-15 Farhan via B4 Relay
2026-12-05  8:10 ` [PATCH 3/3] platform/x86: uniwill-laptop: Notify userspace about Fn and super key lock changes Farhan via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®