Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1218146rwb; Wed, 14 Dec 2022 07:49:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf7CUIuRnGDBH7nP2rWN9C95bf08ypHLua7Zic+yaWkOqG2zzJkfu4/bQpMcqTTqvMoDBUAe X-Received: by 2002:a05:6a21:8ccc:b0:a4:efdd:a9b9 with SMTP id ta12-20020a056a218ccc00b000a4efdda9b9mr31600726pzb.44.1671032980924; Wed, 14 Dec 2022 07:49:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671032980; cv=none; d=google.com; s=arc-20160816; b=FzvXTPGl1jCPek/wL/+pcye1OaqiUfXnY3ru/vrfwG3bHnXpRNi3jWMiwgCoJ2r9ON Mbb99ro/bydDZUWxUmpsh6q7H/x21Oq0sj9KRw92WYNJ3dRe3FiZ8cdyOp4YFlKwXLVF 8QaBz9r4+F4YmawNAuUDXALk/j5DrNq3macDCOsAxUXt1gVDzsSd5glEfkPzbsSkWbHk oG1OI67GWCp53ShyfXwT0hRw4IC9hTrYv5gKybuOwFhbwPITZnfTVC7Kl3roZdtpVApa NZvU574OD8kgcy2YARHSh2qFikpfJVgMeE2QI/+kacn/c4OcXybmCDqW12pU0ucOSJfS yulg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MB+cjJ0APVSPLYKSXokJmYfJJzb5hyUnGFn3uvrOCQs=; b=Hyj3yGiZSsjWz35v/wBpKh/mq2j645Huh5pnGhm6UxV4X0kL91TnNxEguJ+6cOGTll w88j9H1tZdMbMsZWU2EdzjFkNEvlFs0LvU2hCr19e0tqSklV8zzsGO5Kpb/MuDuB6zM2 4AdZp/zHwt8Br2c++VaXXXIxoLNfgsVAKEM5QUIjy+nxwHKBxRdO3PdEdVv9RL8zzh5s h4pEY6bguaWNvBDeUGHWFV5ft336sL1+UP58xpN0+FulgKsL0+U1kFskMm+tbFP2BOdN rar5xfLytizjANcbYPNxwX8YKHoemdW7kBPD3CyM6AJZX15BKvEgpgpplmmYkiFGF72W DPwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YzK6BC77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a63f90d000000b0045c88c3b799si24726pgi.709.2022.12.14.07.49.31; Wed, 14 Dec 2022 07:49:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YzK6BC77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237917AbiLNPkq (ORCPT + 69 others); Wed, 14 Dec 2022 10:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238680AbiLNPkl (ORCPT ); Wed, 14 Dec 2022 10:40:41 -0500 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE0160DC; Wed, 14 Dec 2022 07:40:40 -0800 (PST) Received: by mail-ot1-x32e.google.com with SMTP id q18-20020a056830441200b006704633f258so1985746otv.0; Wed, 14 Dec 2022 07:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MB+cjJ0APVSPLYKSXokJmYfJJzb5hyUnGFn3uvrOCQs=; b=YzK6BC77zHknUwqd/KFXfr2QqsoewRVPzPQNToJD2oWI12PC2oGU+FIEn1Esh1cWru t/12wDjSd8xJL93Dg34+waP3jflFCF8pZYFgl2j2kpJzIAK+beIW2DarCOAPNqZ23jXe XdtXnG0cw2GSnTg0lYk8zfgAmPba2GBmUSARVsF+0n14/upTmIjtwgShbbFOSwCcy8kJ kt0s9p60N4Jzn+GN1Mn9jZG9/5a10Tj0dl8tPiXAiHg9P+nARR+OrPPFwkO9VuCehrVv cZdbGaXP38BrLMtpdZGFgQ95eDPsAbrWc0PM4PGc+txf1cJjSLoPlgwS8C8RzkAsFOhR H9SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MB+cjJ0APVSPLYKSXokJmYfJJzb5hyUnGFn3uvrOCQs=; b=2eBWyi75o3uv+6CNjGtT4PInlYXcvjk4OBbVDPsIydlNqd0aS6Ptb/cMBoOsoAd5yg VjNsDCee1sVnbhRIxPBt4gw7HVzruYaX5zvVpK6FoEu7oVd+hRt5F1ridKK7WRhxR7Zi IEkULIESXxuoy9iEK2uLNQsO2+4voe2F4U0861uWFVQ/VDHraByeBlWfqaaqYmB/gcDr o9qmt6KHrm7GKLrkmMyMMP9/mTpjlbAVz9Htzf6DKzo5l9wq9kmVNNeCyn2Ki+EOrwMr M8+xArua4H4oJQPGMziyMQBtlzafzetvhuSVfuRtmmYlpQF27QybnBHswmymTMz8kzBW l/+Q== X-Gm-Message-State: ANoB5pkaL8q5fr8A+U8csKIO7VHClSeeRRFolf+xbiBe8sE1bL37IpHo UaihvD0o2rFi+g5h3CZ6E8s= X-Received: by 2002:a9d:51c3:0:b0:670:6cfe:385 with SMTP id d3-20020a9d51c3000000b006706cfe0385mr13244001oth.23.1671032439413; Wed, 14 Dec 2022 07:40:39 -0800 (PST) Received: from localhost.localdomain (108-228-232-20.lightspeed.sndgca.sbcglobal.net. [108.228.232.20]) by smtp.gmail.com with ESMTPSA id 88-20020a9d0161000000b0066c49ce8b77sm2455146otu.77.2022.12.14.07.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 07:40:39 -0800 (PST) From: "Derek J. Clark" To: linux@roeck-us.net Cc: "Derek J. Clark" , Jean Delvare , Jonathan Corbet , =?UTF-8?q?Joaqu=C3=ADn=20Ignacio=20Aramend=C3=ADa?= , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] hwmon: (oxp-sensors) Add AYANEO AIR and AIR Pro Date: Wed, 14 Dec 2022 07:39:08 -0800 Message-Id: <20221214153908.99926-1-derekjohn.clark@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for the AYANEO AIR and AYANEO AIR Pro models of handheld devices. These devices use the same EC registers and logic as the One X Player mini AMD. Previous AYANEO models are not supported as they use a different EC and do not have the necessary fan speed write enable and setting registers. Tihe driver is tested on Aya Neo AIR while AIR Pro model EC functionality and DMI data were verified using command line tools by another user. The added devices are: - AYANEO AIR (AMD 5560U) - AYANEO AIR Pro (AMD 5560U) - AYANEO AIR Pro (AMD 5825U) Signed-off-by: Derek J. Clark --- Documentation/hwmon/oxp-sensors.rst | 19 ++++++---- MAINTAINERS | 1 + drivers/hwmon/oxp-sensors.c | 54 ++++++++++++++++++++++++----- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/Documentation/hwmon/oxp-sensors.rst b/Documentation/hwmon/oxp-sensors.rst index 39c588ec5c50..a53c961065b2 100644 --- a/Documentation/hwmon/oxp-sensors.rst +++ b/Documentation/hwmon/oxp-sensors.rst @@ -3,18 +3,21 @@ Kernel driver oxp-sensors ========================= -Author: +Authors: + - Derek John Clark - Joaquín Ignacio Aramendía -Description: +Description ------------ -One X Player devices from One Netbook provide fan readings and fan control -through its Embedded Controller. +Handheld devices from One Netbook and Aya Neo provide fan readings and fan +control through their embedded controllers. -Currently only supports AMD boards from the One X Player and AOK ZOE lineup. -Intel boards could be supported if we could figure out the EC registers and -values to write to since the EC layout and model is different. +Currently only supports AMD boards from One X Player, AOK ZOE, and some Aya +Neo devices. One X PLayer Intel boards could be supported if we could figure +out the EC registers and values to write to since the EC layout and model is +different. Aya Neo devices preceding the AIR may not be usable as the EC model +is different and do not appear to have manual control capabiltities. Supported devices ----------------- @@ -22,6 +25,8 @@ Supported devices Currently the driver supports the following handhelds: - AOK ZOE A1 + - Aya Neo AIR + - Aya Neo AIR Pro - OneXPlayer AMD - OneXPlayer mini AMD - OneXPlayer mini AMD PRO diff --git a/MAINTAINERS b/MAINTAINERS index 90220659206c..8bce95170f12 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15346,6 +15346,7 @@ F: drivers/mtd/nand/onenand/ F: include/linux/mtd/onenand*.h ONEXPLAYER FAN DRIVER +M: Derek John Clark M: Joaquín Ignacio Aramendía L: linux-hwmon@vger.kernel.org S: Maintained diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c index f84ec8f8eda9..7adc0199ea66 100644 --- a/drivers/hwmon/oxp-sensors.c +++ b/drivers/hwmon/oxp-sensors.c @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Platform driver for OXP Handhelds that expose fan reading and control - * via hwmon sysfs. + * Platform driver for Handhelds that expose fan reading and control via + * hwmon sysfs. * - * Old boards have the same DMI strings and they are told appart by the - * boot cpu vendor (Intel/AMD). Currently only AMD boards are supported - * but the code is made to be simple to add other handheld boards in the - * future. + * Old OXP boards have the same DMI strings and they are told 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]. * Old AMD boards use [0-100] as range in the EC, the written value is * scaled to accommodate for that. Newer boards like the mini PRO and @@ -42,6 +42,8 @@ static bool unlock_global_acpi_lock(void) enum oxp_board { aok_zoe_a1 = 1, + aya_neo_air, + aya_neo_air_pro, oxp_mini_amd, oxp_mini_amd_pro, }; @@ -60,6 +62,20 @@ static const struct dmi_system_id dmi_table[] = { }, .driver_data = (void *) &(enum oxp_board) {aok_zoe_a1}, }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR"), + }, + .driver_data = (void *) &(enum oxp_board) {aya_neo_air}, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR Pro"), + }, + .driver_data = (void *) &(enum oxp_board) {aya_neo_air_pro}, + }, { .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"), @@ -161,8 +177,19 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type, ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val); if (ret) return ret; - if (board == oxp_mini_amd) + switch (board) { + case aok_zoe_a1: + break; + case aya_neo_air: + case aya_neo_air_pro: + case oxp_mini_amd: *val = (*val * 255) / 100; + break; + case oxp_mini_amd_pro: + break; + default: + break; + } return 0; case hwmon_pwm_enable: return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val); @@ -191,8 +218,19 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type, case hwmon_pwm_input: if (val < 0 || val > 255) return -EINVAL; - if (board == oxp_mini_amd) + switch (board) { + case aok_zoe_a1: + break; + case aya_neo_air: + case aya_neo_air_pro: + case oxp_mini_amd: val = (val * 100) / 255; + break; + case oxp_mini_amd_pro: + break; + default: + break; + } return write_to_ec(dev, OXP_SENSOR_PWM_REG, val); default: break; -- 2.38.1