Commit Graph

16 Commits

Author SHA1 Message Date
Sebastian Kranz
692cf83bc3 hwmon: (oxp-sensors) Add support for Ayaneo Air Plus 7320u.
Add support for handheld AYANEO AIR Plus with the same EC registers
to add proper fan control.

Functionality was tested successfully.

Signed-off-by: Sebastian Kranz <tklightforce@googlemail.com>
Link: https://lore.kernel.org/r/20240209090157.3232-1-tklightforce@googlemail.com
[groeck: Fixed up commit message]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-02-25 12:37:46 -08:00
Joaquín Ignacio Aramendía
49ffb5eefe hwmon: (oxp-sensors) Move board detection to the init function
Move detection logic to the start of init() function so we won't
instantiate the driver if the board is not compatible.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230717222526.229984-3-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-08-21 06:04:29 -07:00
Joaquín Ignacio Aramendía
957961b6dc hwmon: (oxp-sensors) Move tt_toggle attribute to dev_groups
A driver should not be manually adding groups in its probe function (it
will race with userspace), so replace the call to devm_device_add_groups()
to use the platform dev_groups callback instead.

This will allow for removal of the devm_device_add_groups() function.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Fixes: be144ee491 ("hwmon: (oxp-sensors) Add tt_toggle attribute on supported boards")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230717222526.229984-2-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-07-18 19:44:19 -07:00
Jerrod Frost
4dbbaf8fbd hwmon: (oxp-sensors) Add support for AOKZOE A1 PRO
This device is an iteration over the AOKZOE A1 with the same EC mapping
and features.

It also has support for tt_toggle.

Signed-off-by: Jerrod Frost <jcfrosty@proton.me>
Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230625012347.121352-2-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-24 20:17:18 -07:00
Joaquín Ignacio Aramendía
37f665ffa8 hwmon: (oxp-sensors) Simplify logic of error return
Take return logic on error out of if-else, eliminating
duplicated code in tt_togle_store() function.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230617181159.32844-3-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-18 08:54:31 -07:00
Joaquín Ignacio Aramendía
d7696214b0 hwmon: (oxp-sensors) Remove unused header
We are not using <dev_printk.h>, remove that.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230617181159.32844-2-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-18 08:53:52 -07:00
Joaquín Ignacio Aramendía
be144ee491 hwmon: (oxp-sensors) Add tt_toggle attribute on supported boards
OneXPlayer boards from the last generation (both for OneXPlayer and AOK
ZOE brands) have a toggle in the EC to switch the "Turbo/Silent" button
into a different keyboard event.

Add a means to use that "Turbo button takeover" function and expose it
to userspace in a custom sysfs `tt_toggle` attribute. It can be read to
take the current state. Write 1|0 to activate the function. The specific
keycode is dependent on the board but can be checked by running
`evtest` utility.

Newer BIOS on the OneXPlayer added this function aside from string changes.
Add a board enum to differentiate it from the old OneXplayer Mini AMD BIOS.

Currently known supported boards:
- AOK ZOE A1
- OneXPlayer Mini AMD (only newer BIOS version supported)
- OneXPlayer Mini Pro

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230611143332.40590-2-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-17 20:49:18 -07:00
Joaquín Ignacio Aramendía
7590e659e0 hwmon: (oxp-sensors) Stop passing device structure
We don't need to pass device structure to write_to_ec() so we remove
that from the function declaration.
The same is valid for pwm_enable() and pwm_disable() as we were passing
the pointer to hand it off to write_to_ec().

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230525142652.41981-1-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-08 06:41:18 -07:00
Joaquín Ignacio Aramendía
7d0c2c61b1 hwmon: (oxp-sensors) Add new DMI match for OXP Mini
A newer BIOS version for the OneXPlayer Mini AMD modified vendor and
board name strings. Add those to the match table and set the same board
model as older OXP Mini AMD.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230517183540.187383-1-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-08 06:41:18 -07:00
Joaquín Ignacio Aramendía
5d06ec4279 hwmon: (oxp-sensors) Use less convoluted enum cast
Change

  .driver_data = (void *) &(enum type) {enum_literal};

to more readable form:

  .driver_data = (void *) enum_literal;

and corresponding cast usage as board type flag.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230429142547.328125-1-samsagax@gmail.com
[groeck: Use double cast for assignment from driver_data to fix clang build warning]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-08 06:41:16 -07:00
Joaquín Ignacio Aramendía
f415cb6c0f hwmon: (oxp-sensors) Add AYANEO 2 and Geek models
Add support for handhelds with same EC registers
  - AYANEO 2
  - AYANEO GEEK

All functionality tests succeed on AYANEO 2 by "pastaq" user on Discord
and AYANEO GEEK tested by "oneoc" Discord user.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20230426184420.99945-1-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-06-08 06:41:16 -07:00
Krzysztof Kozlowski
195030d34e hwmon: oxp-sensors: constify pointers to hwmon_channel_info
Statically allocated array of pointed to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-04-19 07:08:38 -07:00
Derek J. Clark
ebd4bfee2b hwmon: (oxp-sensors) Add AYANEO AIR and AIR Pro
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.

Add:
- AYANEO AIR (AMD 5560U)
- AYANEO AIR Pro (AMD 5560U)
- AYANEO AIR Pro (AMD 5825U)

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

Link: https://lore.kernel.org/r/20221229025609.147482-1-derekjohn.clark@gmail.com
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
[groeck: Sanitize commit description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2023-02-03 07:30:09 -08:00
Joaquín Ignacio Aramendía
0cd3ba682a hwmon: (oxp-sensors) Fix pwm reading
PWM reading is only 1 register long.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20221128185206.212022-1-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04 16:45:03 -08:00
Joaquín Ignacio Aramendía
3ca0f12a02 hwmon: (oxp-sensors) Add AOK ZOE and Mini PRO
Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices.
DMI strings are added to this driver since the same EC layout is used and
has similar specs as the OXP mini AMD.

The added devices are:
- OneXPlayer mini PRO (AMD 6800U)
- AOK ZOE A1 (AMD 6800U)

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20221125114901.11309-1-samsagax@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04 16:45:03 -08:00
Joaquín Ignacio Aramendía
ed264e8a7d hwmon: add OneXPlayer mini AMD sensors driver
Sensors driver for OXP Handhelds from One-Netbook that expose fan reading
and control via hwmon sysfs.

As far as I could gather all OXP boards have the same DMI strings and
they can be told appart only by the boot cpu vendor (Intel/AMD).
Currently only AMD boards are supported since Intel have different EC
registers and values to read/write.

Fan control is provided via pwm interface in the range [0-255]. AMD
boards have [0-100] as range in the EC, the written value is scaled to
accommodate for that.

Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>
Link: https://lore.kernel.org/r/20221104140659.593608-1-samsagax@gmail.com
[groeck: Removed misleading comment about module_platform_driver()]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-12-04 16:45:02 -08:00