Message ID | 20221119162347.36698-1-samsagax@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon: (oxp-sensors) Add AOK ZOE and Mini PRO | expand |
On Sat, Nov 19, 2022 at 01:23:48PM -0300, Joaquín Ignacio Aramendía wrote: > Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices. > DMI strings are added to this driver since the same EC layout is used and > has similar specs as the OXP mini AMD. > > The added devices are: > - OneXPlayer mini PRO (AMD 6800U) > - AOK ZOE A1 (AMD 5800U) > > Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com> Applied to hwmon-next. Thanks, Guenter
El dom, 20 nov 2022 a la(s) 10:46, Guenter Roeck (linux@roeck-us.net) escribió: > > On Sat, Nov 19, 2022 at 01:23:48PM -0300, Joaquín Ignacio Aramendía wrote: > > Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices. > > DMI strings are added to this driver since the same EC layout is used and > > has similar specs as the OXP mini AMD. > > > > The added devices are: > > - OneXPlayer mini PRO (AMD 6800U) > > - AOK ZOE A1 (AMD 5800U) > > > > Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com> > > Applied to hwmon-next. > > Thanks, > Guenter Oh, great! Thanks Guenter. I just realized I made a typo in the commit message. Would you mind if I correct it and resend a v2 of the patch?
On Sun, Nov 20, 2022 at 10:01:09PM -0300, Joaquin Aramendia wrote: > El dom, 20 nov 2022 a la(s) 10:46, Guenter Roeck (linux@roeck-us.net) escribió: > > > > On Sat, Nov 19, 2022 at 01:23:48PM -0300, Joaquín Ignacio Aramendía wrote: > > > Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices. > > > DMI strings are added to this driver since the same EC layout is used and > > > has similar specs as the OXP mini AMD. > > > > > > The added devices are: > > > - OneXPlayer mini PRO (AMD 6800U) > > > - AOK ZOE A1 (AMD 5800U) > > > > > > Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com> > > > > Applied to hwmon-next. > > > > Thanks, > > Guenter > > Oh, great! Thanks Guenter. I just realized I made a typo in the commit > message. Would you mind if I correct it and resend a v2 of the patch? I don't mind, but I don't see the typo. What is it ? Guenter > -- > Joaquín I. Aramendía
El mié, 23 nov 2022 a la(s) 13:22, Guenter Roeck (linux@roeck-us.net) escribió: > > On Sun, Nov 20, 2022 at 10:01:09PM -0300, Joaquin Aramendia wrote: > > El dom, 20 nov 2022 a la(s) 10:46, Guenter Roeck (linux@roeck-us.net) escribió: > > > > > > On Sat, Nov 19, 2022 at 01:23:48PM -0300, Joaquín Ignacio Aramendía wrote: > > > > Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices. > > > > DMI strings are added to this driver since the same EC layout is used and > > > > has similar specs as the OXP mini AMD. > > > > > > > > The added devices are: > > > > - OneXPlayer mini PRO (AMD 6800U) > > > > - AOK ZOE A1 (AMD 5800U) > > > > > > > > Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com> > > > > > > Applied to hwmon-next. > > > > > > Thanks, > > > Guenter > > > > Oh, great! Thanks Guenter. I just realized I made a typo in the commit > > message. Would you mind if I correct it and resend a v2 of the patch? > > I don't mind, but I don't see the typo. What is it ? > The AOK ZOE A1 has a 6800U APU. Also there is an unhelpful info message I should get rid of in init function. Will be sending v2 shortly. > Guenter > > > -- > > Joaquín I. Aramendía
diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst index f612dddc964a..39c588ec5c50 100644 --- a/Documentation/hwmon/oxp-sensors.rst +++ b/Documentation/hwmon/oxp-sensors.rst @@ -12,9 +12,19 @@ Description: One X Player devices from One Netbook provide fan readings and fan control through its Embedded Controller. -Currently only supports AMD boards from the One X Player lineup. Intel boards -could be supported if we could figure out the EC registers and values to write -to since the EC layout and model is different. +Currently only supports AMD boards from the One X Player and AOK ZOE lineup. +Intel boards could be supported if we could figure out the EC registers and +values to write to since the EC layout and model is different. + +Supported devices +----------------- + +Currently the driver supports the following handhelds: + + - AOK ZOE A1 + - OneXPlayer AMD + - OneXPlayer mini AMD + - OneXPlayer mini AMD PRO Sysfs entries ------------- diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c index da54a38f4454..23e575479d1a 100644 --- a/drivers/hwmon/oxp-sensors.c +++ b/drivers/hwmon/oxp-sensors.c @@ -3,13 +3,14 @@ * Platform driver for OXP Handhelds that expose fan reading and control * via hwmon sysfs. * - * All boards have the same DMI strings and they are told appart by the + * Old boards have the same DMI strings and they are told appart by the * boot cpu vendor (Intel/AMD). Currently only AMD boards are supported * but the code is made to be simple to add other handheld boards in the * future. - * Fan control is provided via pwm interface in the range [0-255]. AMD - * boards use [0-100] as range in the EC, the written value is scaled to - * accommodate for that. + * 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 + * AOK ZOE are not scaled but have the same EC layout. * * Copyright (C) 2022 Joaquín I. Aramendía <samsagax@gmail.com> */ @@ -39,16 +40,39 @@ static bool unlock_global_acpi_lock(void) return ACPI_SUCCESS(acpi_release_global_lock(oxp_mutex)); } +enum oxp_board { + aok_zoe_a1 = 1, + oxp_mini_amd, + oxp_mini_amd_pro, +}; + +static enum oxp_board board; + #define OXP_SENSOR_FAN_REG 0x76 /* 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 */ static const struct dmi_system_id dmi_table[] = { + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "AOKZOE"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "AOKZOE A1 AR07"), + }, + .driver_data = (void *) &(enum oxp_board) {aok_zoe_a1}, + }, { .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONE XPLAYER"), }, + .driver_data = (void *) &(enum oxp_board) {oxp_mini_amd}, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER Mini Pro"), + }, + .driver_data = (void *) &(enum oxp_board) {oxp_mini_amd_pro}, }, {}, }; @@ -137,7 +161,8 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type, ret = read_from_ec(OXP_SENSOR_PWM_REG, 2, val); if (ret) return ret; - *val = (*val * 255) / 100; + if (board == oxp_mini_amd) + *val = (*val * 255) / 100; return 0; case hwmon_pwm_enable: return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val); @@ -166,7 +191,8 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type, case hwmon_pwm_input: if (val < 0 || val > 255) return -EINVAL; - val = (val * 100) / 255; + if (board == oxp_mini_amd) + val = (val * 100) / 255; return write_to_ec(dev, OXP_SENSOR_PWM_REG, val); default: break; @@ -216,6 +242,9 @@ static int oxp_platform_probe(struct platform_device *pdev) if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) return -ENODEV; + board = *((enum oxp_board *) dmi_entry->driver_data); + dev_info(dev, "Board: %i", board); + hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL, &oxp_ec_chip_info, NULL);
Add support for the AOK ZOE A1 and OXP Mini PRO handheld devices. DMI strings are added to this driver since the same EC layout is used and has similar specs as the OXP mini AMD. The added devices are: - OneXPlayer mini PRO (AMD 6800U) - AOK ZOE A1 (AMD 5800U) Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com> --- Documentation/hwmon/oxp-sensors.rst | 16 ++++++++--- drivers/hwmon/oxp-sensors.c | 41 ++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 9 deletions(-) base-commit: 27fea302952d8c90cafbdbee96bafeca03544401 -- 2.38.1