Fix sensors patch.

This commit is contained in:
fewtarius 2023-05-02 12:04:11 +00:00
parent 9a0473365d
commit 6c51c16653
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A

View file

@ -0,0 +1,172 @@
diff -rupN linux-6.1.27.orig/Documentation/hwmon/oxp-sensors.rst linux-6.1.27/Documentation/hwmon/oxp-sensors.rst
--- linux-6.1.27.orig/Documentation/hwmon/oxp-sensors.rst 2023-05-02 01:46:52.201812789 +0000
+++ linux-6.1.27/Documentation/hwmon/oxp-sensors.rst 2023-05-02 01:46:58.725674940 +0000
@@ -3,18 +3,21 @@
Kernel driver oxp-sensors
=========================
-Author:
+Authors:
+ - Derek John Clark <derekjohn.clark@gmail.com>
- Joaquín Ignacio Aramendía <samsagax@gmail.com>
-Description:
+Description
------------
-One X Player devices from One Netbook provide fan readings and fan control
-through its Embedded Controller.
+Handheld devices from One Netbook and Aya Neo provide fan readings and fan
+control through their embedded controllers.
-Currently only supports AMD boards from the One X Player and AOK ZOE lineup.
-Intel boards could be supported if we could figure out the EC registers and
-values to write to since the EC layout and model is different.
+Currently only supports AMD boards from One X Player, AOK ZOE, and some Aya
+Neo devices. One X PLayer Intel boards could be supported if we could figure
+out the EC registers and values to write to since the EC layout and model is
+different. Aya Neo devices preceding the AIR may not be usable as the EC model
+is different and do not appear to have manual control capabiltities.
Supported devices
-----------------
@@ -22,6 +25,8 @@ Supported devices
Currently the driver supports the following handhelds:
- AOK ZOE A1
+ - Aya Neo AIR
+ - Aya Neo AIR Pro
- OneXPlayer AMD
- OneXPlayer mini AMD
- OneXPlayer mini AMD PRO
diff -rupN linux-6.1.27.orig/drivers/hwmon/oxp-sensors.c linux-6.1.27/drivers/hwmon/oxp-sensors.c
--- linux-6.1.27.orig/drivers/hwmon/oxp-sensors.c 2023-05-02 01:46:52.213812535 +0000
+++ linux-6.1.27/drivers/hwmon/oxp-sensors.c 2023-05-02 12:03:27.665299741 +0000
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0+
/*
- * Platform driver for OXP Handhelds that expose fan reading and control
- * via hwmon sysfs.
+ * Platform driver for Handhelds that expose fan reading and control via
+ * hwmon sysfs.
*
- * Old boards have the same DMI strings and they are told appart by the
- * boot cpu vendor (Intel/AMD). Currently only AMD boards are supported
- * but the code is made to be simple to add other handheld boards in the
- * future.
+ * Old OXP boards have the same DMI strings and they are told appart by
+ * the boot cpu vendor (Intel/AMD). Currently only AMD boards are
+ * supported but the code is made to be simple to add other handheld
+ * boards in the future.
* Fan control is provided via pwm interface in the range [0-255].
* Old AMD boards use [0-100] as range in the EC, the written value is
* scaled to accommodate for that. Newer boards like the mini PRO and
@@ -42,6 +42,9 @@ static bool unlock_global_acpi_lock(void
enum oxp_board {
aok_zoe_a1 = 1,
+ aya_neo_air,
+ aya_neo_air_pro,
+ aya_neo_air_plus,
oxp_mini_amd,
oxp_mini_amd_pro,
};
@@ -62,6 +65,27 @@ static const struct dmi_system_id dmi_ta
},
{
.matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AIR"),
+ },
+ .driver_data = (void *) &(enum oxp_board) {aya_neo_air},
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AIR Pro"),
+ },
+ .driver_data = (void *) &(enum oxp_board) {aya_neo_air_pro},
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AIR Plus"),
+ },
+ .driver_data = (void *) &(enum oxp_board) {aya_neo_air_plus},
+ },
+ {
+ .matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"),
},
@@ -161,8 +185,20 @@ static int oxp_platform_read(struct devi
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
if (ret)
return ret;
- if (board == oxp_mini_amd)
+ switch (board) {
+ case aok_zoe_a1:
+ break;
+ case aya_neo_air:
+ case aya_neo_air_pro:
+ case aya_neo_air_plus:
+ case oxp_mini_amd:
*val = (*val * 255) / 100;
+ break;
+ case oxp_mini_amd_pro:
+ break;
+ default:
+ break;
+ }
return 0;
case hwmon_pwm_enable:
return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
@@ -191,8 +227,20 @@ static int oxp_platform_write(struct dev
case hwmon_pwm_input:
if (val < 0 || val > 255)
return -EINVAL;
- if (board == oxp_mini_amd)
+ switch (board) {
+ case aok_zoe_a1:
+ break;
+ case aya_neo_air:
+ case aya_neo_air_pro:
+ case aya_neo_air_plus:
+ case oxp_mini_amd:
val = (val * 100) / 255;
+ break;
+ case oxp_mini_amd_pro:
+ break;
+ default:
+ break;
+ }
return write_to_ec(dev, OXP_SENSOR_PWM_REG, val);
default:
break;
diff -rupN linux-6.1.27.orig/MAINTAINERS linux-6.1.27/MAINTAINERS
--- linux-6.1.27.orig/MAINTAINERS 2023-05-02 01:46:52.217812450 +0000
+++ linux-6.1.27/MAINTAINERS 2023-05-02 01:46:58.729674855 +0000
@@ -15348,6 +15348,7 @@ F: drivers/mtd/nand/onenand/
F: include/linux/mtd/onenand*.h
ONEXPLAYER FAN DRIVER
+M: Derek John Clark <derekjohn.clark@gmail.com>
M: Joaquín Ignacio Aramendía <samsagax@gmail.com>
L: linux-hwmon@vger.kernel.org
S: Maintained
diff -rupN linux-6.1.27.orig/MAINTAINERS.orig linux-6.1.27/MAINTAINERS.orig
--- linux-6.1.27.orig/MAINTAINERS.orig 2023-05-01 20:39:26.912428456 +0000
+++ linux-6.1.27/MAINTAINERS.orig 2023-05-02 01:46:41.170045608 +0000
@@ -15347,6 +15347,12 @@ S: Maintained
F: drivers/mtd/nand/onenand/
F: include/linux/mtd/onenand*.h
+ONEXPLAYER FAN DRIVER
+M: Joaquín Ignacio Aramendía <samsagax@gmail.com>
+L: linux-hwmon@vger.kernel.org
+S: Maintained
+F: drivers/hwmon/oxp-sensors.c
+
ONION OMEGA2+ BOARD
M: Harvey Hunt <harveyhuntnexus@gmail.com>
L: linux-mips@vger.kernel.org