* [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD
@ 2025-04-26 17:29 Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 1/2] platform/x86: oxpec: Make turbo val apply a bitmask Antheas Kapenekakis
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2025-04-26 17:29 UTC (permalink / raw)
To: platform-driver-x86
Cc: linux-kernel, Derek John Clark,
Joaquín Ignacio Aramendía, Hans de Goede,
Ilpo Järvinen, Eileen, Antheas Kapenekakis
The OneXPlayer G1 is a new clamshell factor model by OneXPlayer. The
special quirk on this one is that there is an additional bit on the turbo
button register we should not touch, so the first patch converts the turbo
function to apply a mask instead.
Antheas Kapenekakis (2):
platform/x86: oxpec: Make turbo val apply a bitmask
platform/x86: oxpec: Add support for the OneXPlayer G1
drivers/platform/x86/oxpec.c | 121 +++++++++++++++++------------------
1 file changed, 60 insertions(+), 61 deletions(-)
base-commit: f5612600314bcce86934318601501e2d8301176d
--
2.49.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/2] platform/x86: oxpec: Make turbo val apply a bitmask
2025-04-26 17:29 [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Antheas Kapenekakis
@ 2025-04-26 17:29 ` Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 2/2] platform/x86: oxpec: Add support for the OneXPlayer G1 Antheas Kapenekakis
2025-05-05 13:52 ` [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Ilpo Järvinen
2 siblings, 0 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2025-04-26 17:29 UTC (permalink / raw)
To: platform-driver-x86
Cc: linux-kernel, Derek John Clark,
Joaquín Ignacio Aramendía, Hans de Goede,
Ilpo Järvinen, Eileen, Antheas Kapenekakis, Joshua Tam
On the OneXPlayer G1, the turbo register is multiplexed and contains an
extra bit (0x02) which is set on boot. Therefore, we should only change
the 0x40 bit to not affect other behavior. Collapse the disable and
enable functions, and apply a mask for the turbo bit instead.
Tested-by: Joshua Tam <csinaction@pm.me>
Suggested-by: Joshua Tam <csinaction@pm.me>
Signed-off-by: Joshua Tam <csinaction@pm.me>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
drivers/platform/x86/oxpec.c | 96 +++++++++++++-----------------------
1 file changed, 35 insertions(+), 61 deletions(-)
diff --git a/drivers/platform/x86/oxpec.c b/drivers/platform/x86/oxpec.c
index 4b48f4571b09b..86ac32eadd6ef 100644
--- a/drivers/platform/x86/oxpec.c
+++ b/drivers/platform/x86/oxpec.c
@@ -87,8 +87,6 @@ static struct device *oxp_dev;
#define OXP_MINI_TURBO_TAKE_VAL 0x01 /* Mini AO7 */
#define OXP_TURBO_TAKE_VAL 0x40 /* All other models */
-#define OXP_TURBO_RETURN_VAL 0x00 /* Common return val */
-
/* X1 Turbo LED */
#define OXP_X1_TURBO_LED_REG 0x57
@@ -328,95 +326,68 @@ static int write_to_ec(u8 reg, u8 value)
return ret;
}
-/* Turbo button toggle functions */
-static int tt_toggle_enable(void)
+/* Callbacks for turbo toggle attribute */
+static umode_t tt_toggle_is_visible(struct kobject *kobj,
+ struct attribute *attr, int n)
{
- u8 reg;
- u8 val;
-
switch (board) {
- case oxp_mini_amd_a07:
- reg = OXP_MINI_TURBO_SWITCH_REG;
- val = OXP_MINI_TURBO_TAKE_VAL;
- break;
case aok_zoe_a1:
+ case oxp_2:
case oxp_fly:
+ case oxp_mini_amd_a07:
case oxp_mini_amd_pro:
- reg = OXP_TURBO_SWITCH_REG;
- val = OXP_TURBO_TAKE_VAL;
- break;
- case oxp_2:
case oxp_x1:
- reg = OXP_2_TURBO_SWITCH_REG;
- val = OXP_TURBO_TAKE_VAL;
- break;
+ return attr->mode;
default:
- return -EINVAL;
+ break;
}
- return write_to_ec(reg, val);
+ return 0;
}
-static int tt_toggle_disable(void)
+static ssize_t tt_toggle_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
{
- u8 reg;
- u8 val;
+ u8 reg, mask, val;
+ long raw_val;
+ bool enable;
+ int ret;
+
+ ret = kstrtobool(buf, &enable);
+ if (ret)
+ return ret;
switch (board) {
case oxp_mini_amd_a07:
reg = OXP_MINI_TURBO_SWITCH_REG;
- val = OXP_TURBO_RETURN_VAL;
+ mask = OXP_MINI_TURBO_TAKE_VAL;
break;
case aok_zoe_a1:
case oxp_fly:
case oxp_mini_amd_pro:
reg = OXP_TURBO_SWITCH_REG;
- val = OXP_TURBO_RETURN_VAL;
+ mask = OXP_TURBO_TAKE_VAL;
break;
case oxp_2:
case oxp_x1:
reg = OXP_2_TURBO_SWITCH_REG;
- val = OXP_TURBO_RETURN_VAL;
+ mask = OXP_TURBO_TAKE_VAL;
break;
default:
return -EINVAL;
}
- return write_to_ec(reg, val);
-}
-
-/* Callbacks for turbo toggle attribute */
-static umode_t tt_toggle_is_visible(struct kobject *kobj,
- struct attribute *attr, int n)
-{
- switch (board) {
- case aok_zoe_a1:
- case oxp_2:
- case oxp_fly:
- case oxp_mini_amd_a07:
- case oxp_mini_amd_pro:
- case oxp_x1:
- return attr->mode;
- default:
- break;
- }
- return 0;
-}
-static ssize_t tt_toggle_store(struct device *dev,
- struct device_attribute *attr, const char *buf,
- size_t count)
-{
- bool value;
- int ret;
-
- ret = kstrtobool(buf, &value);
+ ret = read_from_ec(reg, 1, &raw_val);
if (ret)
return ret;
- if (value) {
- ret = tt_toggle_enable();
- } else {
- ret = tt_toggle_disable();
- }
+ val = raw_val;
+ if (enable)
+ val |= mask;
+ else
+ val &= ~mask;
+
+ ret = write_to_ec(reg, val);
if (ret)
return ret;
@@ -426,22 +397,25 @@ static ssize_t tt_toggle_store(struct device *dev,
static ssize_t tt_toggle_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
+ u8 reg, mask;
int retval;
long val;
- u8 reg;
switch (board) {
case oxp_mini_amd_a07:
reg = OXP_MINI_TURBO_SWITCH_REG;
+ mask = OXP_MINI_TURBO_TAKE_VAL;
break;
case aok_zoe_a1:
case oxp_fly:
case oxp_mini_amd_pro:
reg = OXP_TURBO_SWITCH_REG;
+ mask = OXP_TURBO_TAKE_VAL;
break;
case oxp_2:
case oxp_x1:
reg = OXP_2_TURBO_SWITCH_REG;
+ mask = OXP_TURBO_TAKE_VAL;
break;
default:
return -EINVAL;
@@ -451,7 +425,7 @@ static ssize_t tt_toggle_show(struct device *dev,
if (retval)
return retval;
- return sysfs_emit(buf, "%d\n", !!val);
+ return sysfs_emit(buf, "%d\n", (val & mask) == mask);
}
static DEVICE_ATTR_RW(tt_toggle);
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] platform/x86: oxpec: Add support for the OneXPlayer G1
2025-04-26 17:29 [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 1/2] platform/x86: oxpec: Make turbo val apply a bitmask Antheas Kapenekakis
@ 2025-04-26 17:29 ` Antheas Kapenekakis
2025-05-05 13:52 ` [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Ilpo Järvinen
2 siblings, 0 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2025-04-26 17:29 UTC (permalink / raw)
To: platform-driver-x86
Cc: linux-kernel, Derek John Clark,
Joaquín Ignacio Aramendía, Hans de Goede,
Ilpo Järvinen, Eileen, Antheas Kapenekakis, Joshua Tam
The OneXPlayer G1 is a new clamshell formfactor by OneXPlayer.
It has the same registers as an OneXPlayer X1, with the only
difference being the lack of a turbo led.
Tested-by: Joshua Tam <csinaction@pm.me>
Suggested-by: Joshua Tam <csinaction@pm.me>
Signed-off-by: Joshua Tam <csinaction@pm.me>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
drivers/platform/x86/oxpec.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/platform/x86/oxpec.c b/drivers/platform/x86/oxpec.c
index 86ac32eadd6ef..93e923b24feb6 100644
--- a/drivers/platform/x86/oxpec.c
+++ b/drivers/platform/x86/oxpec.c
@@ -58,6 +58,7 @@ enum oxp_board {
oxp_mini_amd_a07,
oxp_mini_amd_pro,
oxp_x1,
+ oxp_g1,
};
static enum oxp_board board;
@@ -241,6 +242,20 @@ static const struct dmi_system_id dmi_table[] = {
},
.driver_data = (void *)oxp_fly,
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 A"),
+ },
+ .driver_data = (void *)oxp_g1,
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER G1 i"),
+ },
+ .driver_data = (void *)oxp_g1,
+ },
{
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
@@ -337,6 +352,7 @@ static umode_t tt_toggle_is_visible(struct kobject *kobj,
case oxp_mini_amd_a07:
case oxp_mini_amd_pro:
case oxp_x1:
+ case oxp_g1:
return attr->mode;
default:
break;
@@ -370,6 +386,7 @@ static ssize_t tt_toggle_store(struct device *dev,
break;
case oxp_2:
case oxp_x1:
+ case oxp_g1:
reg = OXP_2_TURBO_SWITCH_REG;
mask = OXP_TURBO_TAKE_VAL;
break;
@@ -414,6 +431,7 @@ static ssize_t tt_toggle_show(struct device *dev,
break;
case oxp_2:
case oxp_x1:
+ case oxp_g1:
reg = OXP_2_TURBO_SWITCH_REG;
mask = OXP_TURBO_TAKE_VAL;
break;
@@ -502,6 +520,7 @@ static bool oxp_psy_ext_supported(void)
{
switch (board) {
case oxp_x1:
+ case oxp_g1:
case oxp_fly:
return true;
default:
@@ -640,6 +659,7 @@ static int oxp_pwm_enable(void)
case oxp_mini_amd_a07:
case oxp_mini_amd_pro:
case oxp_x1:
+ case oxp_g1:
return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
default:
return -EINVAL;
@@ -666,6 +686,7 @@ static int oxp_pwm_disable(void)
case oxp_mini_amd_a07:
case oxp_mini_amd_pro:
case oxp_x1:
+ case oxp_g1:
return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
default:
return -EINVAL;
@@ -692,6 +713,7 @@ static int oxp_pwm_read(long *val)
case oxp_mini_amd_a07:
case oxp_mini_amd_pro:
case oxp_x1:
+ case oxp_g1:
return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
default:
return -EOPNOTSUPP;
@@ -720,6 +742,7 @@ static int oxp_pwm_fan_speed(long *val)
return read_from_ec(ORANGEPI_SENSOR_FAN_REG, 2, val);
case oxp_2:
case oxp_x1:
+ case oxp_g1:
return read_from_ec(OXP_2_SENSOR_FAN_REG, 2, val);
case aok_zoe_a1:
case aya_neo_2:
@@ -753,6 +776,7 @@ static int oxp_pwm_input_write(long val)
return write_to_ec(ORANGEPI_SENSOR_PWM_REG, val);
case oxp_2:
case oxp_x1:
+ case oxp_g1:
/* scale to range [0-184] */
val = (val * 184) / 255;
return write_to_ec(OXP_SENSOR_PWM_REG, val);
@@ -792,6 +816,7 @@ static int oxp_pwm_input_read(long *val)
break;
case oxp_2:
case oxp_x1:
+ case oxp_g1:
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
if (ret)
return ret;
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD
2025-04-26 17:29 [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 1/2] platform/x86: oxpec: Make turbo val apply a bitmask Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 2/2] platform/x86: oxpec: Add support for the OneXPlayer G1 Antheas Kapenekakis
@ 2025-05-05 13:52 ` Ilpo Järvinen
2 siblings, 0 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2025-05-05 13:52 UTC (permalink / raw)
To: platform-driver-x86, Antheas Kapenekakis
Cc: linux-kernel, Derek John Clark,
Joaquín Ignacio Aramendía, Hans de Goede, Eileen
On Sat, 26 Apr 2025 19:29:53 +0200, Antheas Kapenekakis wrote:
> The OneXPlayer G1 is a new clamshell factor model by OneXPlayer. The
> special quirk on this one is that there is an additional bit on the turbo
> button register we should not touch, so the first patch converts the turbo
> function to apply a mask instead.
>
> Antheas Kapenekakis (2):
> platform/x86: oxpec: Make turbo val apply a bitmask
> platform/x86: oxpec: Add support for the OneXPlayer G1
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/2] platform/x86: oxpec: Make turbo val apply a bitmask
commit: 7b81040f02d59156ba440ac837535901b89fc254
[2/2] platform/x86: oxpec: Add support for the OneXPlayer G1
commit: e0fede5ff489be3ae30df7f0e0fda5395e364b34
--
i.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-05 13:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-26 17:29 [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 1/2] platform/x86: oxpec: Make turbo val apply a bitmask Antheas Kapenekakis
2025-04-26 17:29 ` [PATCH v1 2/2] platform/x86: oxpec: Add support for the OneXPlayer G1 Antheas Kapenekakis
2025-05-05 13:52 ` [PATCH v1 0/2] platform/x86: oxpec: Add support for OneXPlayer G1 Intel/AMD Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox