2022-11-04 11:07:00 -03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
* Platform driver for OneXPlayer, AOKZOE, AYANEO, and OrangePi Handhelds
|
|
|
|
* that expose fan reading and control via hwmon sysfs.
|
2022-11-04 11:07:00 -03:00
|
|
|
*
|
2022-12-28 18:56:09 -08:00
|
|
|
* Old OXP boards have the same DMI strings and they are told apart by
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
* the boot cpu vendor (Intel/AMD). Of these older models only AMD is
|
|
|
|
* supported.
|
|
|
|
*
|
2022-11-25 08:49:01 -03:00
|
|
|
* 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
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
* AOKZOE are not scaled but have the same EC layout. Newer models
|
|
|
|
* like the 2 and X1 are [0-184] and are scaled to 0-255. OrangePi
|
|
|
|
* are [1-244] and scaled to 0-255.
|
2022-11-04 11:07:00 -03:00
|
|
|
*
|
|
|
|
* Copyright (C) 2022 Joaquín I. Aramendía <samsagax@gmail.com>
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
* Copyright (C) 2024 Derek J. Clark <derekjohn.clark@gmail.com>
|
2022-11-04 11:07:00 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
#include <linux/dmi.h>
|
|
|
|
#include <linux/hwmon.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/processor.h>
|
|
|
|
|
|
|
|
/* Handle ACPI lock mechanism */
|
|
|
|
static u32 oxp_mutex;
|
|
|
|
|
|
|
|
#define ACPI_LOCK_DELAY_MS 500
|
|
|
|
|
|
|
|
static bool lock_global_acpi_lock(void)
|
|
|
|
{
|
|
|
|
return ACPI_SUCCESS(acpi_acquire_global_lock(ACPI_LOCK_DELAY_MS, &oxp_mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool unlock_global_acpi_lock(void)
|
|
|
|
{
|
|
|
|
return ACPI_SUCCESS(acpi_release_global_lock(oxp_mutex));
|
|
|
|
}
|
|
|
|
|
2022-11-25 08:49:01 -03:00
|
|
|
enum oxp_board {
|
|
|
|
aok_zoe_a1 = 1,
|
2023-04-26 15:44:20 -03:00
|
|
|
aya_neo_2,
|
2022-12-28 18:56:09 -08:00
|
|
|
aya_neo_air,
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
aya_neo_air_1s,
|
2024-02-09 10:01:23 +01:00
|
|
|
aya_neo_air_plus_mendo,
|
2022-12-28 18:56:09 -08:00
|
|
|
aya_neo_air_pro,
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
aya_neo_flip,
|
2023-04-26 15:44:20 -03:00
|
|
|
aya_neo_geek,
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
aya_neo_kun,
|
|
|
|
orange_pi_neo,
|
|
|
|
oxp_2,
|
|
|
|
oxp_fly,
|
2022-11-25 08:49:01 -03:00
|
|
|
oxp_mini_amd,
|
2023-06-11 11:33:20 -03:00
|
|
|
oxp_mini_amd_a07,
|
2022-11-25 08:49:01 -03:00
|
|
|
oxp_mini_amd_pro,
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
oxp_x1,
|
2022-11-25 08:49:01 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
static enum oxp_board board;
|
|
|
|
|
2023-06-11 11:33:20 -03:00
|
|
|
/* Fan reading and PWM */
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
#define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */
|
|
|
|
#define OXP_2_SENSOR_FAN_REG 0x58 /* Fan reading is 2 registers long */
|
|
|
|
#define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */
|
|
|
|
#define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */
|
|
|
|
#define PWM_MODE_AUTO 0x00
|
|
|
|
#define PWM_MODE_MANUAL 0x01
|
|
|
|
|
|
|
|
/* OrangePi fan reading and PWM */
|
|
|
|
#define ORANGEPI_SENSOR_FAN_REG 0x78 /* Fan reading is 2 registers long */
|
|
|
|
#define ORANGEPI_SENSOR_PWM_ENABLE_REG 0x40 /* PWM enable is 1 register long */
|
|
|
|
#define ORANGEPI_SENSOR_PWM_REG 0x38 /* PWM reading is 1 register long */
|
2022-11-04 11:07:00 -03:00
|
|
|
|
2023-06-11 11:33:20 -03:00
|
|
|
/* Turbo button takeover function
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
* Different boards have different values and EC registers
|
2023-06-11 11:33:20 -03:00
|
|
|
* for the same function
|
|
|
|
*/
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
#define OXP_TURBO_SWITCH_REG 0xF1 /* Mini Pro, OneXFly, AOKZOE */
|
|
|
|
#define OXP_2_TURBO_SWITCH_REG 0xEB /* OXP2 and X1 */
|
|
|
|
#define OXP_MINI_TURBO_SWITCH_REG 0x1E /* Mini AO7 */
|
|
|
|
|
|
|
|
#define OXP_MINI_TURBO_TAKE_VAL 0x01 /* Mini AO7 */
|
|
|
|
#define OXP_TURBO_TAKE_VAL 0x40 /* All other models */
|
2023-06-11 11:33:20 -03:00
|
|
|
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
#define OXP_TURBO_RETURN_VAL 0x00 /* Common return val */
|
2023-06-11 11:33:20 -03:00
|
|
|
|
2022-11-04 11:07:00 -03:00
|
|
|
static const struct dmi_system_id dmi_table[] = {
|
2022-11-25 08:49:01 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AOKZOE"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AOKZOE A1 AR07"),
|
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)aok_zoe_a1,
|
2022-11-25 08:49:01 -03:00
|
|
|
},
|
2023-06-24 22:23:44 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AOKZOE"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AOKZOE A1 Pro"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)aok_zoe_a1,
|
|
|
|
},
|
2023-04-26 15:44:20 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
DMI_MATCH(DMI_BOARD_NAME, "AYANEO 2"),
|
2023-04-26 15:44:20 -03:00
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)aya_neo_2,
|
2023-04-26 15:44:20 -03:00
|
|
|
},
|
2022-12-28 18:56:09 -08:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"),
|
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)aya_neo_air,
|
2022-12-28 18:56:09 -08:00
|
|
|
},
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR 1S"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)aya_neo_air_1s,
|
|
|
|
},
|
2024-02-09 10:01:23 +01:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AB05-Mendocino"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)aya_neo_air_plus_mendo,
|
|
|
|
},
|
2022-12-28 18:56:09 -08:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"),
|
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)aya_neo_air_pro,
|
2022-12-28 18:56:09 -08:00
|
|
|
},
|
2023-04-26 15:44:20 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
DMI_MATCH(DMI_BOARD_NAME, "FLIP"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)aya_neo_flip,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
|
|
|
DMI_MATCH(DMI_BOARD_NAME, "GEEK"),
|
2023-04-26 15:44:20 -03:00
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)aya_neo_geek,
|
2023-04-26 15:44:20 -03:00
|
|
|
},
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "KUN"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)aya_neo_kun,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "OrangePi"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "NEO-01"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)orange_pi_neo,
|
|
|
|
},
|
2022-11-04 11:07:00 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"),
|
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)oxp_mini_amd,
|
2022-11-25 08:49:01 -03:00
|
|
|
},
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
|
|
|
|
DMI_MATCH(DMI_BOARD_NAME, "ONEXPLAYER 2"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)oxp_2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER F1"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)oxp_fly,
|
|
|
|
},
|
2023-05-17 15:35:41 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER mini A07"),
|
|
|
|
},
|
2023-06-11 11:33:20 -03:00
|
|
|
.driver_data = (void *)oxp_mini_amd_a07,
|
2023-05-17 15:35:41 -03:00
|
|
|
},
|
2022-11-25 08:49:01 -03:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
|
|
|
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER Mini Pro"),
|
|
|
|
},
|
2023-04-29 11:25:48 -03:00
|
|
|
.driver_data = (void *)oxp_mini_amd_pro,
|
2022-11-04 11:07:00 -03:00
|
|
|
},
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
{
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
|
|
|
|
DMI_MATCH(DMI_BOARD_NAME, "ONEXPLAYER X1"),
|
|
|
|
},
|
|
|
|
.driver_data = (void *)oxp_x1,
|
|
|
|
},
|
2022-11-04 11:07:00 -03:00
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Helper functions to handle EC read/write */
|
|
|
|
static int read_from_ec(u8 reg, int size, long *val)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int ret;
|
|
|
|
u8 buffer;
|
|
|
|
|
|
|
|
if (!lock_global_acpi_lock())
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
*val = 0;
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
ret = ec_read(reg + i, &buffer);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
*val <<= i * 8;
|
|
|
|
*val += buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!unlock_global_acpi_lock())
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-05-25 11:26:52 -03:00
|
|
|
static int write_to_ec(u8 reg, u8 value)
|
2022-11-04 11:07:00 -03:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (!lock_global_acpi_lock())
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
ret = ec_write(reg, value);
|
|
|
|
|
|
|
|
if (!unlock_global_acpi_lock())
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2023-06-11 11:33:20 -03:00
|
|
|
/* Turbo button toggle functions */
|
|
|
|
static int tt_toggle_enable(void)
|
|
|
|
{
|
|
|
|
u8 reg;
|
|
|
|
u8 val;
|
|
|
|
|
|
|
|
switch (board) {
|
|
|
|
case oxp_mini_amd_a07:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
reg = OXP_MINI_TURBO_SWITCH_REG;
|
|
|
|
val = OXP_MINI_TURBO_TAKE_VAL;
|
2023-06-11 11:33:20 -03:00
|
|
|
break;
|
|
|
|
case aok_zoe_a1:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd_pro:
|
2023-06-11 11:33:20 -03:00
|
|
|
reg = OXP_TURBO_SWITCH_REG;
|
|
|
|
val = OXP_TURBO_TAKE_VAL;
|
|
|
|
break;
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_2:
|
|
|
|
case oxp_x1:
|
|
|
|
reg = OXP_2_TURBO_SWITCH_REG;
|
|
|
|
val = OXP_TURBO_TAKE_VAL;
|
|
|
|
break;
|
2023-06-11 11:33:20 -03:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return write_to_ec(reg, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tt_toggle_disable(void)
|
|
|
|
{
|
|
|
|
u8 reg;
|
|
|
|
u8 val;
|
|
|
|
|
|
|
|
switch (board) {
|
|
|
|
case oxp_mini_amd_a07:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
reg = OXP_MINI_TURBO_SWITCH_REG;
|
|
|
|
val = OXP_TURBO_RETURN_VAL;
|
2023-06-11 11:33:20 -03:00
|
|
|
break;
|
|
|
|
case aok_zoe_a1:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd_pro:
|
2023-06-11 11:33:20 -03:00
|
|
|
reg = OXP_TURBO_SWITCH_REG;
|
|
|
|
val = OXP_TURBO_RETURN_VAL;
|
|
|
|
break;
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_2:
|
|
|
|
case oxp_x1:
|
|
|
|
reg = OXP_2_TURBO_SWITCH_REG;
|
|
|
|
val = OXP_TURBO_RETURN_VAL;
|
|
|
|
break;
|
2023-06-11 11:33:20 -03:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
return write_to_ec(reg, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Callbacks for turbo toggle attribute */
|
2023-07-17 19:25:15 -03:00
|
|
|
static umode_t tt_toggle_is_visible(struct kobject *kobj,
|
|
|
|
struct attribute *attr, int n)
|
|
|
|
{
|
|
|
|
switch (board) {
|
|
|
|
case aok_zoe_a1:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_2:
|
|
|
|
case oxp_fly:
|
2023-07-17 19:25:15 -03:00
|
|
|
case oxp_mini_amd_a07:
|
|
|
|
case oxp_mini_amd_pro:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_x1:
|
2023-07-17 19:25:15 -03:00
|
|
|
return attr->mode;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-06-11 11:33:20 -03:00
|
|
|
static ssize_t tt_toggle_store(struct device *dev,
|
|
|
|
struct device_attribute *attr, const char *buf,
|
|
|
|
size_t count)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
bool value;
|
|
|
|
|
|
|
|
rval = kstrtobool(buf, &value);
|
|
|
|
if (rval)
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
rval = tt_toggle_enable();
|
|
|
|
} else {
|
|
|
|
rval = tt_toggle_disable();
|
|
|
|
}
|
2023-06-17 15:11:43 -03:00
|
|
|
if (rval)
|
|
|
|
return rval;
|
|
|
|
|
2023-06-11 11:33:20 -03:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t tt_toggle_show(struct device *dev,
|
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
u8 reg;
|
|
|
|
long val;
|
|
|
|
|
|
|
|
switch (board) {
|
|
|
|
case oxp_mini_amd_a07:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
reg = OXP_MINI_TURBO_SWITCH_REG;
|
2023-06-11 11:33:20 -03:00
|
|
|
break;
|
|
|
|
case aok_zoe_a1:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd_pro:
|
2023-06-11 11:33:20 -03:00
|
|
|
reg = OXP_TURBO_SWITCH_REG;
|
|
|
|
break;
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_2:
|
|
|
|
case oxp_x1:
|
|
|
|
reg = OXP_2_TURBO_SWITCH_REG;
|
|
|
|
break;
|
2023-06-11 11:33:20 -03:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = read_from_ec(reg, 1, &val);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
return sysfs_emit(buf, "%d\n", !!val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static DEVICE_ATTR_RW(tt_toggle);
|
|
|
|
|
|
|
|
/* PWM enable/disable functions */
|
2023-05-25 11:26:52 -03:00
|
|
|
static int oxp_pwm_enable(void)
|
2022-11-04 11:07:00 -03:00
|
|
|
{
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
switch (board) {
|
|
|
|
case orange_pi_neo:
|
|
|
|
return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
|
|
|
|
case aok_zoe_a1:
|
|
|
|
case aya_neo_2:
|
|
|
|
case aya_neo_air:
|
|
|
|
case aya_neo_air_plus_mendo:
|
|
|
|
case aya_neo_air_pro:
|
|
|
|
case aya_neo_flip:
|
|
|
|
case aya_neo_geek:
|
|
|
|
case aya_neo_kun:
|
|
|
|
case oxp_2:
|
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd:
|
|
|
|
case oxp_mini_amd_a07:
|
|
|
|
case oxp_mini_amd_pro:
|
|
|
|
case oxp_x1:
|
|
|
|
return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2022-11-04 11:07:00 -03:00
|
|
|
}
|
|
|
|
|
2023-05-25 11:26:52 -03:00
|
|
|
static int oxp_pwm_disable(void)
|
2022-11-04 11:07:00 -03:00
|
|
|
{
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
switch (board) {
|
|
|
|
case orange_pi_neo:
|
|
|
|
return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
|
|
|
|
case aok_zoe_a1:
|
|
|
|
case aya_neo_2:
|
|
|
|
case aya_neo_air:
|
|
|
|
case aya_neo_air_1s:
|
|
|
|
case aya_neo_air_plus_mendo:
|
|
|
|
case aya_neo_air_pro:
|
|
|
|
case aya_neo_flip:
|
|
|
|
case aya_neo_geek:
|
|
|
|
case aya_neo_kun:
|
|
|
|
case oxp_2:
|
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd:
|
|
|
|
case oxp_mini_amd_a07:
|
|
|
|
case oxp_mini_amd_pro:
|
|
|
|
case oxp_x1:
|
|
|
|
return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2022-11-04 11:07:00 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Callbacks for hwmon interface */
|
|
|
|
static umode_t oxp_ec_hwmon_is_visible(const void *drvdata,
|
|
|
|
enum hwmon_sensor_types type, u32 attr, int channel)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case hwmon_fan:
|
|
|
|
return 0444;
|
|
|
|
case hwmon_pwm:
|
|
|
|
return 0644;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
|
|
|
|
u32 attr, int channel, long *val)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case hwmon_fan:
|
|
|
|
switch (attr) {
|
|
|
|
case hwmon_fan_input:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
switch (board) {
|
|
|
|
case orange_pi_neo:
|
|
|
|
return read_from_ec(ORANGEPI_SENSOR_FAN_REG, 2, val);
|
|
|
|
case oxp_2:
|
|
|
|
case oxp_x1:
|
|
|
|
return read_from_ec(OXP_2_SENSOR_FAN_REG, 2, val);
|
|
|
|
case aok_zoe_a1:
|
|
|
|
case aya_neo_2:
|
|
|
|
case aya_neo_air:
|
|
|
|
case aya_neo_air_1s:
|
|
|
|
case aya_neo_air_plus_mendo:
|
|
|
|
case aya_neo_air_pro:
|
|
|
|
case aya_neo_flip:
|
|
|
|
case aya_neo_geek:
|
|
|
|
case aya_neo_kun:
|
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd:
|
|
|
|
case oxp_mini_amd_a07:
|
|
|
|
case oxp_mini_amd_pro:
|
|
|
|
return read_from_ec(OXP_SENSOR_FAN_REG, 2, val);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang
clang warns (or errors due to CONFIG_WERROR):
drivers/hwmon/oxp-sensors.c:481:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:553:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:556:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:607:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing breaks to
silence the warnings.
Fixes: b82b38a49926 ("hwmon: (oxp-sensors) Add support for multiple new devices.")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-dc48496ac67a@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-28 11:05:35 -07:00
|
|
|
break;
|
2022-11-04 11:07:00 -03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case hwmon_pwm:
|
|
|
|
switch (attr) {
|
|
|
|
case hwmon_pwm_input:
|
2022-12-28 18:56:09 -08:00
|
|
|
switch (board) {
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case orange_pi_neo:
|
|
|
|
ret = read_from_ec(ORANGEPI_SENSOR_PWM_REG, 1, val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
/* scale from range [1-244] */
|
|
|
|
*val = ((*val - 1) * 254 / 243) + 1;
|
|
|
|
break;
|
|
|
|
case oxp_2:
|
|
|
|
case oxp_x1:
|
|
|
|
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
/* scale from range [0-184] */
|
|
|
|
*val = (*val * 255) / 184;
|
|
|
|
break;
|
2023-04-26 15:44:20 -03:00
|
|
|
case aya_neo_2:
|
2022-12-28 18:56:09 -08:00
|
|
|
case aya_neo_air:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case aya_neo_air_1s:
|
2024-02-09 10:01:23 +01:00
|
|
|
case aya_neo_air_plus_mendo:
|
2022-12-28 18:56:09 -08:00
|
|
|
case aya_neo_air_pro:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case aya_neo_flip:
|
2023-04-26 15:44:20 -03:00
|
|
|
case aya_neo_geek:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case aya_neo_kun:
|
2022-12-28 18:56:09 -08:00
|
|
|
case oxp_mini_amd:
|
2023-06-11 11:33:20 -03:00
|
|
|
case oxp_mini_amd_a07:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
/* scale from range [0-100] */
|
2022-11-25 08:49:01 -03:00
|
|
|
*val = (*val * 255) / 100;
|
2022-12-28 18:56:09 -08:00
|
|
|
break;
|
|
|
|
case aok_zoe_a1:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd_pro:
|
2022-12-28 18:56:09 -08:00
|
|
|
default:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2022-12-28 18:56:09 -08:00
|
|
|
break;
|
|
|
|
}
|
2022-11-04 11:07:00 -03:00
|
|
|
return 0;
|
|
|
|
case hwmon_pwm_enable:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
switch (board) {
|
|
|
|
case orange_pi_neo:
|
|
|
|
return read_from_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, 1, val);
|
|
|
|
case aok_zoe_a1:
|
|
|
|
case aya_neo_2:
|
|
|
|
case aya_neo_air:
|
|
|
|
case aya_neo_air_1s:
|
|
|
|
case aya_neo_air_plus_mendo:
|
|
|
|
case aya_neo_air_pro:
|
|
|
|
case aya_neo_flip:
|
|
|
|
case aya_neo_geek:
|
|
|
|
case aya_neo_kun:
|
|
|
|
case oxp_2:
|
|
|
|
case oxp_fly:
|
|
|
|
case oxp_mini_amd:
|
|
|
|
case oxp_mini_amd_a07:
|
|
|
|
case oxp_mini_amd_pro:
|
|
|
|
case oxp_x1:
|
|
|
|
return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang
clang warns (or errors due to CONFIG_WERROR):
drivers/hwmon/oxp-sensors.c:481:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:553:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:556:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:607:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing breaks to
silence the warnings.
Fixes: b82b38a49926 ("hwmon: (oxp-sensors) Add support for multiple new devices.")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-dc48496ac67a@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-28 11:05:35 -07:00
|
|
|
break;
|
2022-11-04 11:07:00 -03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang
clang warns (or errors due to CONFIG_WERROR):
drivers/hwmon/oxp-sensors.c:481:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:553:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:556:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:607:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing breaks to
silence the warnings.
Fixes: b82b38a49926 ("hwmon: (oxp-sensors) Add support for multiple new devices.")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-dc48496ac67a@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-28 11:05:35 -07:00
|
|
|
break;
|
2022-11-04 11:07:00 -03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
|
|
|
|
u32 attr, int channel, long val)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case hwmon_pwm:
|
|
|
|
switch (attr) {
|
|
|
|
case hwmon_pwm_enable:
|
|
|
|
if (val == 1)
|
2023-05-25 11:26:52 -03:00
|
|
|
return oxp_pwm_enable();
|
2022-11-04 11:07:00 -03:00
|
|
|
else if (val == 0)
|
2023-05-25 11:26:52 -03:00
|
|
|
return oxp_pwm_disable();
|
2022-11-04 11:07:00 -03:00
|
|
|
return -EINVAL;
|
|
|
|
case hwmon_pwm_input:
|
|
|
|
if (val < 0 || val > 255)
|
|
|
|
return -EINVAL;
|
2022-12-28 18:56:09 -08:00
|
|
|
switch (board) {
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case orange_pi_neo:
|
|
|
|
/* scale to range [1-244] */
|
|
|
|
val = ((val - 1) * 243 / 254) + 1;
|
|
|
|
return write_to_ec(ORANGEPI_SENSOR_PWM_REG, val);
|
|
|
|
case oxp_2:
|
|
|
|
case oxp_x1:
|
|
|
|
/* scale to range [0-184] */
|
|
|
|
val = (val * 184) / 255;
|
|
|
|
return write_to_ec(OXP_SENSOR_PWM_REG, val);
|
2023-04-26 15:44:20 -03:00
|
|
|
case aya_neo_2:
|
2022-12-28 18:56:09 -08:00
|
|
|
case aya_neo_air:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case aya_neo_air_1s:
|
2024-02-09 10:01:23 +01:00
|
|
|
case aya_neo_air_plus_mendo:
|
2022-12-28 18:56:09 -08:00
|
|
|
case aya_neo_air_pro:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case aya_neo_flip:
|
2023-04-26 15:44:20 -03:00
|
|
|
case aya_neo_geek:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case aya_neo_kun:
|
2022-12-28 18:56:09 -08:00
|
|
|
case oxp_mini_amd:
|
2023-06-11 11:33:20 -03:00
|
|
|
case oxp_mini_amd_a07:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
/* scale to range [0-100] */
|
2022-11-25 08:49:01 -03:00
|
|
|
val = (val * 100) / 255;
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
return write_to_ec(OXP_SENSOR_PWM_REG, val);
|
2022-12-28 18:56:09 -08:00
|
|
|
case aok_zoe_a1:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
case oxp_fly:
|
2022-12-28 18:56:09 -08:00
|
|
|
case oxp_mini_amd_pro:
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
return write_to_ec(OXP_SENSOR_PWM_REG, val);
|
2022-12-28 18:56:09 -08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
hwmon: (oxp-sensors) Add missing breaks to fix -Wimplicit-fallthrough with clang
clang warns (or errors due to CONFIG_WERROR):
drivers/hwmon/oxp-sensors.c:481:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:553:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:556:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
drivers/hwmon/oxp-sensors.c:607:3: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
Clang is a little more pedantic than GCC, which does not warn when
falling through to a case that is just break or return. Clang's version
is more in line with the kernel's own stance in deprecated.rst, which
states that all switch/case blocks must end in either break,
fallthrough, continue, goto, or return. Add the missing breaks to
silence the warnings.
Fixes: b82b38a49926 ("hwmon: (oxp-sensors) Add support for multiple new devices.")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240828-hwmon-oxp-sensors-fix-clang-implicit-fallthrough-v1-1-dc48496ac67a@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-28 11:05:35 -07:00
|
|
|
break;
|
2022-11-04 11:07:00 -03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Known sensors in the OXP EC controllers */
|
2023-04-06 22:35:30 +02:00
|
|
|
static const struct hwmon_channel_info * const oxp_platform_sensors[] = {
|
2022-11-04 11:07:00 -03:00
|
|
|
HWMON_CHANNEL_INFO(fan,
|
|
|
|
HWMON_F_INPUT),
|
|
|
|
HWMON_CHANNEL_INFO(pwm,
|
|
|
|
HWMON_PWM_INPUT | HWMON_PWM_ENABLE),
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2023-06-11 11:33:20 -03:00
|
|
|
static struct attribute *oxp_ec_attrs[] = {
|
|
|
|
&dev_attr_tt_toggle.attr,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2023-07-17 19:25:15 -03:00
|
|
|
static struct attribute_group oxp_ec_attribute_group = {
|
|
|
|
.is_visible = tt_toggle_is_visible,
|
|
|
|
.attrs = oxp_ec_attrs,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct attribute_group *oxp_ec_groups[] = {
|
|
|
|
&oxp_ec_attribute_group,
|
|
|
|
NULL
|
|
|
|
};
|
2023-06-11 11:33:20 -03:00
|
|
|
|
2022-11-04 11:07:00 -03:00
|
|
|
static const struct hwmon_ops oxp_ec_hwmon_ops = {
|
|
|
|
.is_visible = oxp_ec_hwmon_is_visible,
|
|
|
|
.read = oxp_platform_read,
|
|
|
|
.write = oxp_platform_write,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct hwmon_chip_info oxp_ec_chip_info = {
|
|
|
|
.ops = &oxp_ec_hwmon_ops,
|
|
|
|
.info = oxp_platform_sensors,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Initialization logic */
|
|
|
|
static int oxp_platform_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct device *dev = &pdev->dev;
|
|
|
|
struct device *hwdev;
|
|
|
|
|
|
|
|
hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL,
|
|
|
|
&oxp_ec_chip_info, NULL);
|
|
|
|
|
|
|
|
return PTR_ERR_OR_ZERO(hwdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver oxp_platform_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "oxp-platform",
|
2023-07-17 19:25:15 -03:00
|
|
|
.dev_groups = oxp_ec_groups,
|
2022-11-04 11:07:00 -03:00
|
|
|
},
|
|
|
|
.probe = oxp_platform_probe,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device *oxp_platform_device;
|
|
|
|
|
|
|
|
static int __init oxp_platform_init(void)
|
|
|
|
{
|
2023-07-17 19:25:16 -03:00
|
|
|
const struct dmi_system_id *dmi_entry;
|
|
|
|
|
|
|
|
dmi_entry = dmi_first_match(dmi_table);
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
if (!dmi_entry)
|
2023-07-17 19:25:16 -03:00
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
board = (enum oxp_board)(unsigned long)dmi_entry->driver_data;
|
|
|
|
|
hwmon: (oxp-sensors) Add support for multiple new devices.
Add support for the OrangePi NEO-01. It uses different registers for PWM
manual mode, set PWM, and read fan speed than previous devices. Valid PWM
input and duty cycle is 1-244, we scale this from 1-255 to maintain
compatibility with the existing interface.
Add OneXPlayer 2 series, OneXFly, and X1 series models. The 2/X1 series use
new registers for turbo button takeover and read fan speed. X1 has an Intel
variant so change the CPU detection at init to only check for the affected
devices. While at it, adjust formatting of some constants and reorder all
cases alphabetically for consistency. Rename OXP_OLD constants to OXP_MINI
for disambiguation. Update code comments for clarity.
Add support for AYANEO models 2S, AIR 1S, Flip series, GEEK 1S, and KUN.
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Kevin Greenberg <kdgreenberg234@protonmail.com>
Tested-by: Joshua Tam <csinaction@pm.me>
Tested-by: Parth Menon <parthasarathymenon@gmail.com>
Tested-by: Philip Müller <philm@manjaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408160329.TLNbIwRC-lkp@intel.com/
Message-ID: <20240822183525.27289-2-derekjohn.clark@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-22 11:35:25 -07:00
|
|
|
/*
|
|
|
|
* Have to check for AMD processor here because DMI strings are the same
|
|
|
|
* between Intel and AMD boards on older OneXPlayer devices, the only way
|
|
|
|
* to tell them apart is the CPU. Old Intel boards have an unsupported EC.
|
|
|
|
*/
|
|
|
|
if (board == oxp_mini_amd && boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2022-11-04 11:07:00 -03:00
|
|
|
oxp_platform_device =
|
|
|
|
platform_create_bundle(&oxp_platform_driver,
|
|
|
|
oxp_platform_probe, NULL, 0, NULL, 0);
|
|
|
|
|
|
|
|
return PTR_ERR_OR_ZERO(oxp_platform_device);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit oxp_platform_exit(void)
|
|
|
|
{
|
|
|
|
platform_device_unregister(oxp_platform_device);
|
|
|
|
platform_driver_unregister(&oxp_platform_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(dmi, dmi_table);
|
|
|
|
|
|
|
|
module_init(oxp_platform_init);
|
|
|
|
module_exit(oxp_platform_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Joaquín Ignacio Aramendía <samsagax@gmail.com>");
|
|
|
|
MODULE_DESCRIPTION("Platform driver that handles EC sensors of OneXPlayer devices");
|
|
|
|
MODULE_LICENSE("GPL");
|