summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/oxp-sensors.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (oxp-sensors) Move tt_toggle attribute to dev_groupsJoaquín Ignacio Aramendía2023-07-181-14/+24
| | | | | | | | | | | | | | 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: be144ee49127 ("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>
* hwmon: (oxp-sensors) Add support for AOKZOE A1 PROJerrod Frost2023-06-241-0/+7
| | | | | | | | | | | | 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>
* hwmon: (oxp-sensors) Simplify logic of error returnJoaquín Ignacio Aramendía2023-06-181-4/+3
| | | | | | | | | 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>
* hwmon: (oxp-sensors) Remove unused headerJoaquín Ignacio Aramendía2023-06-181-1/+0
| | | | | | | | 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>
* hwmon: (oxp-sensors) Add tt_toggle attribute on supported boardsJoaquín Ignacio Aramendía2023-06-171-1/+133
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* hwmon: (oxp-sensors) Stop passing device structureJoaquín Ignacio Aramendía2023-06-081-8/+8
| | | | | | | | | | | 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>
* hwmon: (oxp-sensors) Add new DMI match for OXP MiniJoaquín Ignacio Aramendía2023-06-081-0/+7
| | | | | | | | | | 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>
* hwmon: (oxp-sensors) Use less convoluted enum castJoaquín Ignacio Aramendía2023-06-081-8/+8
| | | | | | | | | | | | | | | | | 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>
* hwmon: (oxp-sensors) Add AYANEO 2 and Geek modelsJoaquín Ignacio Aramendía2023-06-081-0/+20
| | | | | | | | | | | | | 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>
* hwmon: oxp-sensors: constify pointers to hwmon_channel_infoKrzysztof Kozlowski2023-04-191-1/+1
| | | | | | | | 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>
* hwmon: (oxp-sensors) Add AYANEO AIR and AIR ProDerek J. Clark2023-02-031-9/+43
| | | | | | | | | | | | | | | | | | | | | | 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>
* hwmon: (oxp-sensors) Fix pwm readingJoaquín Ignacio Aramendía2022-12-041-1/+1
| | | | | | | | 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>
* hwmon: (oxp-sensors) Add AOK ZOE and Mini PROJoaquín Ignacio Aramendía2022-12-041-6/+34
| | | | | | | | | | | | | | 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>
* hwmon: add OneXPlayer mini AMD sensors driverJoaquín Ignacio Aramendía2022-12-041-0/+256
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>