Skip to content

Commit 02c15e3

Browse files
antheasij-intel
authored andcommitted
platform/x86: ayaneo-ec: Move Ayaneo devices from oxpec to ayaneo-ec
Currently, the oxpec driver contains Ayaneo devices. Move them to the new ayaneo-ec driver, which is dedicated to them. As this driver supports charge inhibition for Ayaneo, add support for it for the AIR, AIR 1S, AB05-Medoncino, AIR Pro, and Kun, referenced from the out-of-tree ayaneo-platform driver. In addition, update the readmes of oxpec to reflect this change. Link: https://github.com/ShadowBlip/ayaneo-platform Tested-by: Derek J. Clark <derekjohn.clark@gmail.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev> Link: https://patch.msgid.link/20251119174505.597218-6-lkml@antheas.dev Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent e921a8b commit 02c15e3

3 files changed

Lines changed: 67 additions & 117 deletions

File tree

drivers/platform/x86/Kconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,9 +1038,7 @@ config OXP_EC
10381038
help
10391039
Enables support for the platform EC of OneXPlayer and AOKZOE
10401040
handheld devices. This includes fan speed, fan controls, and
1041-
disabling the default TDP behavior of the device. Due to legacy
1042-
reasons, this driver also provides hwmon functionality to Ayaneo
1043-
devices and the OrangePi Neo.
1041+
disabling the default TDP behavior of the device.
10441042

10451043
source "drivers/platform/x86/tuxedo/Kconfig"
10461044

drivers/platform/x86/ayaneo-ec.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,78 @@ struct ayaneo_ec_platform_data {
5454
struct acpi_battery_hook battery_hook;
5555
};
5656

57+
static const struct ayaneo_ec_quirk quirk_fan = {
58+
.has_fan_control = true,
59+
};
60+
61+
static const struct ayaneo_ec_quirk quirk_charge_limit = {
62+
.has_fan_control = true,
63+
.has_charge_control = true,
64+
};
65+
5766
static const struct ayaneo_ec_quirk quirk_ayaneo3 = {
5867
.has_fan_control = true,
5968
.has_charge_control = true,
6069
.has_magic_modules = true,
6170
};
6271

6372
static const struct dmi_system_id dmi_table[] = {
73+
{
74+
.matches = {
75+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
76+
DMI_MATCH(DMI_BOARD_NAME, "AYANEO 2"),
77+
},
78+
.driver_data = (void *)&quirk_fan,
79+
},
80+
{
81+
.matches = {
82+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
83+
DMI_MATCH(DMI_BOARD_NAME, "FLIP"),
84+
},
85+
.driver_data = (void *)&quirk_fan,
86+
},
87+
{
88+
.matches = {
89+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
90+
DMI_MATCH(DMI_BOARD_NAME, "GEEK"),
91+
},
92+
.driver_data = (void *)&quirk_fan,
93+
},
94+
{
95+
.matches = {
96+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
97+
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"),
98+
},
99+
.driver_data = (void *)&quirk_charge_limit,
100+
},
101+
{
102+
.matches = {
103+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
104+
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR 1S"),
105+
},
106+
.driver_data = (void *)&quirk_charge_limit,
107+
},
108+
{
109+
.matches = {
110+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
111+
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AB05-Mendocino"),
112+
},
113+
.driver_data = (void *)&quirk_charge_limit,
114+
},
115+
{
116+
.matches = {
117+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
118+
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"),
119+
},
120+
.driver_data = (void *)&quirk_charge_limit,
121+
},
122+
{
123+
.matches = {
124+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
125+
DMI_EXACT_MATCH(DMI_BOARD_NAME, "KUN"),
126+
},
127+
.driver_data = (void *)&quirk_charge_limit,
128+
},
64129
{
65130
.matches = {
66131
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),

drivers/platform/x86/oxpec.c

Lines changed: 1 addition & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0+
22
/*
3-
* Platform driver for OneXPlayer and AOKZOE devices. For the time being,
4-
* it also exposes fan controls for AYANEO, and OrangePi Handhelds via
5-
* hwmon sysfs.
3+
* Platform driver for OneXPlayer and AOKZOE devices.
64
*
75
* Fan control is provided via pwm interface in the range [0-255].
86
* Old AMD boards use [0-100] as range in the EC, the written value is
@@ -43,14 +41,6 @@ static bool unlock_global_acpi_lock(void)
4341

4442
enum oxp_board {
4543
aok_zoe_a1 = 1,
46-
aya_neo_2,
47-
aya_neo_air,
48-
aya_neo_air_1s,
49-
aya_neo_air_plus_mendo,
50-
aya_neo_air_pro,
51-
aya_neo_flip,
52-
aya_neo_geek,
53-
aya_neo_kun,
5444
orange_pi_neo,
5545
oxp_2,
5646
oxp_fly,
@@ -131,62 +121,6 @@ static const struct dmi_system_id dmi_table[] = {
131121
},
132122
.driver_data = (void *)oxp_fly,
133123
},
134-
{
135-
.matches = {
136-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
137-
DMI_MATCH(DMI_BOARD_NAME, "AYANEO 2"),
138-
},
139-
.driver_data = (void *)aya_neo_2,
140-
},
141-
{
142-
.matches = {
143-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
144-
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"),
145-
},
146-
.driver_data = (void *)aya_neo_air,
147-
},
148-
{
149-
.matches = {
150-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
151-
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR 1S"),
152-
},
153-
.driver_data = (void *)aya_neo_air_1s,
154-
},
155-
{
156-
.matches = {
157-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
158-
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AB05-Mendocino"),
159-
},
160-
.driver_data = (void *)aya_neo_air_plus_mendo,
161-
},
162-
{
163-
.matches = {
164-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
165-
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"),
166-
},
167-
.driver_data = (void *)aya_neo_air_pro,
168-
},
169-
{
170-
.matches = {
171-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
172-
DMI_MATCH(DMI_BOARD_NAME, "FLIP"),
173-
},
174-
.driver_data = (void *)aya_neo_flip,
175-
},
176-
{
177-
.matches = {
178-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
179-
DMI_MATCH(DMI_BOARD_NAME, "GEEK"),
180-
},
181-
.driver_data = (void *)aya_neo_geek,
182-
},
183-
{
184-
.matches = {
185-
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
186-
DMI_EXACT_MATCH(DMI_BOARD_NAME, "KUN"),
187-
},
188-
.driver_data = (void *)aya_neo_kun,
189-
},
190124
{
191125
.matches = {
192126
DMI_MATCH(DMI_BOARD_VENDOR, "OrangePi"),
@@ -672,13 +606,6 @@ static int oxp_pwm_enable(void)
672606
case orange_pi_neo:
673607
return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
674608
case aok_zoe_a1:
675-
case aya_neo_2:
676-
case aya_neo_air:
677-
case aya_neo_air_plus_mendo:
678-
case aya_neo_air_pro:
679-
case aya_neo_flip:
680-
case aya_neo_geek:
681-
case aya_neo_kun:
682609
case oxp_2:
683610
case oxp_fly:
684611
case oxp_mini_amd:
@@ -699,14 +626,6 @@ static int oxp_pwm_disable(void)
699626
case orange_pi_neo:
700627
return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
701628
case aok_zoe_a1:
702-
case aya_neo_2:
703-
case aya_neo_air:
704-
case aya_neo_air_1s:
705-
case aya_neo_air_plus_mendo:
706-
case aya_neo_air_pro:
707-
case aya_neo_flip:
708-
case aya_neo_geek:
709-
case aya_neo_kun:
710629
case oxp_2:
711630
case oxp_fly:
712631
case oxp_mini_amd:
@@ -727,14 +646,6 @@ static int oxp_pwm_read(long *val)
727646
case orange_pi_neo:
728647
return read_from_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, 1, val);
729648
case aok_zoe_a1:
730-
case aya_neo_2:
731-
case aya_neo_air:
732-
case aya_neo_air_1s:
733-
case aya_neo_air_plus_mendo:
734-
case aya_neo_air_pro:
735-
case aya_neo_flip:
736-
case aya_neo_geek:
737-
case aya_neo_kun:
738649
case oxp_2:
739650
case oxp_fly:
740651
case oxp_mini_amd:
@@ -774,14 +685,6 @@ static int oxp_pwm_fan_speed(long *val)
774685
case oxp_g1_i:
775686
return read_from_ec(OXP_2_SENSOR_FAN_REG, 2, val);
776687
case aok_zoe_a1:
777-
case aya_neo_2:
778-
case aya_neo_air:
779-
case aya_neo_air_1s:
780-
case aya_neo_air_plus_mendo:
781-
case aya_neo_air_pro:
782-
case aya_neo_flip:
783-
case aya_neo_geek:
784-
case aya_neo_kun:
785688
case oxp_fly:
786689
case oxp_mini_amd:
787690
case oxp_mini_amd_a07:
@@ -810,14 +713,6 @@ static int oxp_pwm_input_write(long val)
810713
/* scale to range [0-184] */
811714
val = (val * 184) / 255;
812715
return write_to_ec(OXP_SENSOR_PWM_REG, val);
813-
case aya_neo_2:
814-
case aya_neo_air:
815-
case aya_neo_air_1s:
816-
case aya_neo_air_plus_mendo:
817-
case aya_neo_air_pro:
818-
case aya_neo_flip:
819-
case aya_neo_geek:
820-
case aya_neo_kun:
821716
case oxp_mini_amd:
822717
case oxp_mini_amd_a07:
823718
/* scale to range [0-100] */
@@ -854,14 +749,6 @@ static int oxp_pwm_input_read(long *val)
854749
/* scale from range [0-184] */
855750
*val = (*val * 255) / 184;
856751
break;
857-
case aya_neo_2:
858-
case aya_neo_air:
859-
case aya_neo_air_1s:
860-
case aya_neo_air_plus_mendo:
861-
case aya_neo_air_pro:
862-
case aya_neo_flip:
863-
case aya_neo_geek:
864-
case aya_neo_kun:
865752
case oxp_mini_amd:
866753
case oxp_mini_amd_a07:
867754
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);

0 commit comments

Comments
 (0)