2022-12-28 23:22:15

by Derek J. Clark

[permalink] [raw]
Subject: [PATCH v3] Add support for the AYANEO AIR and AYANEO AIR Pro models of handheld devices. These devices use the same EC registers and logic as the One X Player mini AMD. Previous AYANEO models are not supported as they use a different EC and do not have the necessary fan speed write enable and setting registers. The driver is tested on AYANEO AIR while AIR Pro model EC functionality and DMI data were verified using command line tools by another user.

The added devices are:
- AYANEO AIR (AMD 5560U)
- AYANEO AIR Pro (AMD 5560U)
- AYANEO AIR Pro (AMD 5825U)
---
Bundled all cases that lead to break.
Spelling and grammar fixes.
More verbose description of supported devices.
---
Signed-off-by: Derek J. Clark <[email protected]>
---
Documentation/hwmon/oxp-sensors.rst | 19 +++++++----
MAINTAINERS | 1 +
drivers/hwmon/oxp-sensors.c | 52 ++++++++++++++++++++++++-----
3 files changed, 56 insertions(+), 16 deletions(-)

diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst
index 39c588ec5c50..7f6e8def5aef 100644
--- a/Documentation/hwmon/oxp-sensors.rst
+++ b/Documentation/hwmon/oxp-sensors.rst
@@ -3,18 +3,21 @@
Kernel driver oxp-sensors
=========================

-Author:
+Authors:
+ - Derek John Clark <[email protected]>
- Joaquín Ignacio Aramendía <[email protected]>

-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 supportable as the EC
+model is different and do not appear to have manual control capabilities.

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 --git a/MAINTAINERS b/MAINTAINERS
index 90220659206c..8bce95170f12 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15346,6 +15346,7 @@ F: drivers/mtd/nand/onenand/
F: include/linux/mtd/onenand*.h

ONEXPLAYER FAN DRIVER
+M: Derek John Clark <[email protected]>
M: Joaquín Ignacio Aramendía <[email protected]>
L: [email protected]
S: Maintained
diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
index f84ec8f8eda9..36872b57912a 100644
--- a/drivers/hwmon/oxp-sensors.c
+++ b/drivers/hwmon/oxp-sensors.c
@@ -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 OneXPlayer, AOK ZOE, and Aya Neo 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 apart 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,8 @@ static bool unlock_global_acpi_lock(void)

enum oxp_board {
aok_zoe_a1 = 1,
+ aya_neo_air,
+ aya_neo_air_pro,
oxp_mini_amd,
oxp_mini_amd_pro,
};
@@ -60,6 +62,20 @@ static const struct dmi_system_id dmi_table[] = {
},
.driver_data = (void *) &(enum oxp_board) {aok_zoe_a1},
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"),
+ },
+ .driver_data = (void *) &(enum oxp_board) {aya_neo_air},
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"),
+ },
+ .driver_data = (void *) &(enum oxp_board) {aya_neo_air_pro},
+ },
{
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
@@ -161,8 +177,17 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
if (ret)
return ret;
- if (board == oxp_mini_amd)
+ switch (board) {
+ case aya_neo_air:
+ case aya_neo_air_pro:
+ case oxp_mini_amd:
*val = (*val * 255) / 100;
+ break;
+ case aok_zoe_a1:
+ case oxp_mini_amd_pro:
+ default:
+ break;
+ }
return 0;
case hwmon_pwm_enable:
return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
@@ -191,8 +216,17 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
case hwmon_pwm_input:
if (val < 0 || val > 255)
return -EINVAL;
- if (board == oxp_mini_amd)
+ switch (board) {
+ case aya_neo_air:
+ case aya_neo_air_pro:
+ case oxp_mini_amd:
val = (val * 100) / 255;
+ break;
+ case aok_zoe_a1:
+ case oxp_mini_amd_pro:
+ default:
+ break;
+ }
return write_to_ec(dev, OXP_SENSOR_PWM_REG, val);
default:
break;
@@ -233,7 +267,7 @@ static int oxp_platform_probe(struct platform_device *pdev)

/*
* Have to check for AMD processor here because DMI strings are the
- * same between Intel and AMD boards, the only way to tell them appart
+ * same between Intel and AMD boards, the only way to tell them apart
* is the CPU.
* Intel boards seem to have different EC registers and values to
* read/write.
--
2.39.0


2022-12-29 00:45:13

by Derek J. Clark

[permalink] [raw]
Subject: Re: [PATCH v3] Add support for the AYANEO AIR and AYANEO AIR Pro models of handheld devices. These devices use the same EC registers and logic as the One X Player mini AMD. Previous AYANEO models are not supported as they use a different EC and do not have the necessary fan speed write enable and setting registers. The driver is tested on AYANEO AIR while AIR Pro model EC functionality and DMI data were verified using command line tools by another user.

On Wed, Dec 28, 2022 at 4:10 PM Guenter Roeck <[email protected]> wrote:
>
> On Wed, Dec 28, 2022 at 03:06:32PM -0800, Derek J. Clark wrote:
> > The added devices are:
> > - AYANEO AIR (AMD 5560U)
> > - AYANEO AIR Pro (AMD 5560U)
> > - AYANEO AIR Pro (AMD 5825U)
>
> Add:
>
> While at it, fix spelling error (appart -> apart).
>
To clarify, do you want this added to the patch description? There
were a couple other spelling errors I fixed as well (PLayer -> Player,
capabilities -> capabilities).
I.E.

Add:
- AYANEO AIR (AMD 5560U)
- AYANEO AIR Pro (AMD 5560U)
- AYANEO AIR Pro (AMD 5825U)
Fix spelling errors (appart -> apart, capabilities -> capabilities,
PLayer -> Player).

> > ---
> > Bundled all cases that lead to break.
> > Spelling and grammar fixes.
> > More verbose description of supported devices.
> > ---
> > Signed-off-by: Derek J. Clark <[email protected]>
> > ---
> > Documentation/hwmon/oxp-sensors.rst | 19 +++++++----
> > MAINTAINERS | 1 +
> > drivers/hwmon/oxp-sensors.c | 52 ++++++++++++++++++++++++-----
> > 3 files changed, 56 insertions(+), 16 deletions(-)
> >
> > diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst
> > index 39c588ec5c50..7f6e8def5aef 100644
> > --- a/Documentation/hwmon/oxp-sensors.rst
> > +++ b/Documentation/hwmon/oxp-sensors.rst
> > @@ -3,18 +3,21 @@
> > Kernel driver oxp-sensors
> > =========================
> >
> > -Author:
> > +Authors:
> > + - Derek John Clark <[email protected]>
> > - Joaquín Ignacio Aramendía <[email protected]>
> >
> > -Description:
> > +Description
> > ------------
>
> I am not going to accept this. The change is POV, and it is unrelated to
> this patch. Either submit a separate patch or let the person requesting
> the change submit it. It is very unlikely that I am going to accept it,
> though, since the change is POV, unnecessary, and the original author may
> rightfully come back tomorrow and submit a revert.
>
> Really, seriously, please refrain from making such changes.
>
> Guenter
>
Understood, I will revert it in v4.

Thanks.

2022-12-29 00:52:31

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v3] Add support for the AYANEO AIR and AYANEO AIR Pro models of handheld devices. These devices use the same EC registers and logic as the One X Player mini AMD. Previous AYANEO models are not supported as they use a different EC and do not have the necessary fan speed write enable and setting registers. The driver is tested on AYANEO AIR while AIR Pro model EC functionality and DMI data were verified using command line tools by another user.

On Wed, Dec 28, 2022 at 03:06:32PM -0800, Derek J. Clark wrote:
> The added devices are:
> - AYANEO AIR (AMD 5560U)
> - AYANEO AIR Pro (AMD 5560U)
> - AYANEO AIR Pro (AMD 5825U)

Add:

While at it, fix spelling error (appart -> apart).

> ---
> Bundled all cases that lead to break.
> Spelling and grammar fixes.
> More verbose description of supported devices.
> ---
> Signed-off-by: Derek J. Clark <[email protected]>
> ---
> Documentation/hwmon/oxp-sensors.rst | 19 +++++++----
> MAINTAINERS | 1 +
> drivers/hwmon/oxp-sensors.c | 52 ++++++++++++++++++++++++-----
> 3 files changed, 56 insertions(+), 16 deletions(-)
>
> diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst
> index 39c588ec5c50..7f6e8def5aef 100644
> --- a/Documentation/hwmon/oxp-sensors.rst
> +++ b/Documentation/hwmon/oxp-sensors.rst
> @@ -3,18 +3,21 @@
> Kernel driver oxp-sensors
> =========================
>
> -Author:
> +Authors:
> + - Derek John Clark <[email protected]>
> - Joaqu?n Ignacio Aramend?a <[email protected]>
>
> -Description:
> +Description
> ------------

I am not going to accept this. The change is POV, and it is unrelated to
this patch. Either submit a separate patch or let the person requesting
the change submit it. It is very unlikely that I am going to accept it,
though, since the change is POV, unnecessary, and the original author may
rightfully come back tomorrow and submit a revert.

Really, seriously, please refrain from making such changes.

Guenter

>
> -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 supportable as the EC
> +model is different and do not appear to have manual control capabilities.
>
> 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 --git a/MAINTAINERS b/MAINTAINERS
> index 90220659206c..8bce95170f12 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15346,6 +15346,7 @@ F: drivers/mtd/nand/onenand/
> F: include/linux/mtd/onenand*.h
>
> ONEXPLAYER FAN DRIVER
> +M: Derek John Clark <[email protected]>
> M: Joaqu?n Ignacio Aramend?a <[email protected]>
> L: [email protected]
> S: Maintained
> diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
> index f84ec8f8eda9..36872b57912a 100644
> --- a/drivers/hwmon/oxp-sensors.c
> +++ b/drivers/hwmon/oxp-sensors.c
> @@ -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 OneXPlayer, AOK ZOE, and Aya Neo 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 apart 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,8 @@ static bool unlock_global_acpi_lock(void)
>
> enum oxp_board {
> aok_zoe_a1 = 1,
> + aya_neo_air,
> + aya_neo_air_pro,
> oxp_mini_amd,
> oxp_mini_amd_pro,
> };
> @@ -60,6 +62,20 @@ static const struct dmi_system_id dmi_table[] = {
> },
> .driver_data = (void *) &(enum oxp_board) {aok_zoe_a1},
> },
> + {
> + .matches = {
> + DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
> + DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"),
> + },
> + .driver_data = (void *) &(enum oxp_board) {aya_neo_air},
> + },
> + {
> + .matches = {
> + DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
> + DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"),
> + },
> + .driver_data = (void *) &(enum oxp_board) {aya_neo_air_pro},
> + },
> {
> .matches = {
> DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
> @@ -161,8 +177,17 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
> ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
> if (ret)
> return ret;
> - if (board == oxp_mini_amd)
> + switch (board) {
> + case aya_neo_air:
> + case aya_neo_air_pro:
> + case oxp_mini_amd:
> *val = (*val * 255) / 100;
> + break;
> + case aok_zoe_a1:
> + case oxp_mini_amd_pro:
> + default:
> + break;
> + }
> return 0;
> case hwmon_pwm_enable:
> return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
> @@ -191,8 +216,17 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
> case hwmon_pwm_input:
> if (val < 0 || val > 255)
> return -EINVAL;
> - if (board == oxp_mini_amd)
> + switch (board) {
> + case aya_neo_air:
> + case aya_neo_air_pro:
> + case oxp_mini_amd:
> val = (val * 100) / 255;
> + break;
> + case aok_zoe_a1:
> + case oxp_mini_amd_pro:
> + default:
> + break;
> + }
> return write_to_ec(dev, OXP_SENSOR_PWM_REG, val);
> default:
> break;
> @@ -233,7 +267,7 @@ static int oxp_platform_probe(struct platform_device *pdev)
>
> /*
> * Have to check for AMD processor here because DMI strings are the
> - * same between Intel and AMD boards, the only way to tell them appart
> + * same between Intel and AMD boards, the only way to tell them apart
> * is the CPU.
> * Intel boards seem to have different EC registers and values to
> * read/write.
> --
> 2.39.0
>

2022-12-29 02:13:23

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v3] Add support for the AYANEO AIR and AYANEO AIR Pro models of handheld devices. These devices use the same EC registers and logic as the One X Player mini AMD. Previous AYANEO models are not supported as they use a different EC and do not have the necessary fan speed write enable and setting registers. The driver is tested on AYANEO AIR while AIR Pro model EC functionality and DMI data were verified using command line tools by another user.

On Wed, Dec 28, 2022 at 04:32:44PM -0800, Derek John Clark wrote:
> On Wed, Dec 28, 2022 at 4:10 PM Guenter Roeck <[email protected]> wrote:
> >
> > On Wed, Dec 28, 2022 at 03:06:32PM -0800, Derek J. Clark wrote:
> > > The added devices are:
> > > - AYANEO AIR (AMD 5560U)
> > > - AYANEO AIR Pro (AMD 5560U)
> > > - AYANEO AIR Pro (AMD 5825U)
> >
> > Add:
> >
> > While at it, fix spelling error (appart -> apart).
> >
> To clarify, do you want this added to the patch description? There

Yes, but ...

> were a couple other spelling errors I fixed as well (PLayer -> Player,
> capabilities -> capabilities).
> I.E.
>
> Add:
> - AYANEO AIR (AMD 5560U)
> - AYANEO AIR Pro (AMD 5560U)
> - AYANEO AIR Pro (AMD 5825U)
> Fix spelling errors (appart -> apart, capabilities -> capabilities,
> PLayer -> Player).
>

Confused. There is no "PLayer" anywhere in the Linux kernel, and
"capabilities" does not even appear in the current code.

If you refer to a change from an older version of the patch to a
more recent version, that belongs into the change log, not the commit
description.

Guenter

> > > ---
> > > Bundled all cases that lead to break.
> > > Spelling and grammar fixes.
> > > More verbose description of supported devices.
> > > ---
> > > Signed-off-by: Derek J. Clark <[email protected]>
> > > ---
> > > Documentation/hwmon/oxp-sensors.rst | 19 +++++++----
> > > MAINTAINERS | 1 +
> > > drivers/hwmon/oxp-sensors.c | 52 ++++++++++++++++++++++++-----
> > > 3 files changed, 56 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst
> > > index 39c588ec5c50..7f6e8def5aef 100644
> > > --- a/Documentation/hwmon/oxp-sensors.rst
> > > +++ b/Documentation/hwmon/oxp-sensors.rst
> > > @@ -3,18 +3,21 @@
> > > Kernel driver oxp-sensors
> > > =========================
> > >
> > > -Author:
> > > +Authors:
> > > + - Derek John Clark <[email protected]>
> > > - Joaqu?n Ignacio Aramend?a <[email protected]>
> > >
> > > -Description:
> > > +Description
> > > ------------
> >
> > I am not going to accept this. The change is POV, and it is unrelated to
> > this patch. Either submit a separate patch or let the person requesting
> > the change submit it. It is very unlikely that I am going to accept it,
> > though, since the change is POV, unnecessary, and the original author may
> > rightfully come back tomorrow and submit a revert.
> >
> > Really, seriously, please refrain from making such changes.
> >
> > Guenter
> >
> Understood, I will revert it in v4.
>
> Thanks.