From patchwork Tue Apr 21 08:00:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 998A517EA for ; Tue, 21 Apr 2020 08:01:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6332E20B1F for ; Tue, 21 Apr 2020 08:01:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o3QczknJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="dqccmwCP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6332E20B1F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XqPzczAU2Q08MkZskX+2AzrvfezPLSbr+Vd/PX1lI0Y=; b=o3QczknJ1PBdWt gvaU+kxzoSGg89BgpsIBteEZ+cdUT0VKmJHX/zd1g5N2Zxtkn2wAm/VuW9bGXPRTx/ARkN+1VY+1N 5wWequFO5sKHUn+4BMoDo76cnmPGT2rphuVAWox+4UZsrqiFi/KBiqcdnbtS6giFGw3bEm0boH57+ d1ehW49KGWugHBrwblLAIrvGROYjwRGBQxCIahrEn2dkPL+8ar8PlBVgd7fgNWzeCrcMmG45ZmklA bskTJ2l5ibWaRPAYd+KLhqXbca9BJNY9Ti9JniTjekXVAukB/7/iCj9esKT6mn/auC4/Kn9OtAJhI iT7zTJUD98IM1CVZu3kg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqZ-0001UV-TK; Tue, 21 Apr 2020 08:01:35 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnq9-00016s-Mu for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:12 +0000 Received: by mail-wr1-x443.google.com with SMTP id j1so9906811wrt.1 for ; Tue, 21 Apr 2020 01:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XS8MLiD43HRCDGUhNCWbHcgAStwvWxC9A943TxLQEZ4=; b=dqccmwCPUeowj8HiqvQkLRNkuOeABsVeVjPM+aYtVdGHzR30TfxrgLOVQ1lBF8Zq5N Zm+BFJSq6bB/WLfyqH+0q2K+A77wqVXCuymPMdDSom8ufRIU4pMd2Q1Z2gbJ1UABDiw0 AkjZVTl6POa+4J9BLZfMUJv8vTD7PSXZWHOUajpqlCgen4CVqPn8DLypKKU9BxfndNQU rESK9iZ84iwp8PY66iTHa+ykgf/1vnPYltV7QVv9WMOFB0+4D1h3+0peupb8kt0aTfCC H161G2/+KQz9ZPWWSEpcGWJPSR+c9UGTuzHDxePJ9eeDmHmlnMg9w0fxtv5jl88gdona XXWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XS8MLiD43HRCDGUhNCWbHcgAStwvWxC9A943TxLQEZ4=; b=cEHFcvV13JGnPU3jm2cWqaheGXf5QECceOfKY7OE5WZjhgxnA22g62e5c854HTMlen VD/NaUSuAEq7y6vFIt8GZGbY9sM/ScrK9nax6ZVO84lf6FI4PaEnrm6iHmC7LvjIZj5N dg0biZY+VHFqkPTtZUscIZjZLaiQpXao+Mh1PS0t/r5o/9Iprk2iN6s99QmTsNpE3tZv ROsLsRisG6RN+bYIaoDMohD8SXXdh63BT9/Z5WH+Y7I7w1Y+8nftYs8Ub+/EO7J2L3mk 6V3WGGHhwm8PtJ1OnboZefUdRKoF5wfrGcdor2JZZGybDzfxryRDEX5pLK0OYhDB3YWn ClwA== X-Gm-Message-State: AGi0PubqPiqjYE1RGpiMx5MBsH3XEKhRVUcMhhXDj8FLV//wKFwIYfAg fcruDebTFYeunSDEzSoF5N9pTw== X-Google-Smtp-Source: APiQypL3ext83ZV7Ejx37wb5fdthOPJTVdWdGp7RREmAluHAuw2POo2GOmh2ApeG2micdKbP7iIQgQ== X-Received: by 2002:adf:dc06:: with SMTP id t6mr21931763wri.385.1587456067996; Tue, 21 Apr 2020 01:01:07 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:07 -0700 (PDT) From: Neil Armstrong To: lee.jones@linaro.org, jdelvare@suse.com, linux@roeck-us.net, srinivas.kandagatla@linaro.org, devicetree@vger.kernel.org Subject: [RFC 1/8] dt-bindings: mfd: add Khadas Microcontroller bindings Date: Tue, 21 Apr 2020 10:00:55 +0200 Message-Id: <20200421080102.22796-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010109_766156_C0B9A1AA X-CRM114-Status: GOOD ( 10.21 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org This Microcontroller is present on the Khadas VIM1, VIM2, VIM3 and Edge boards. It has multiple boot control features like password check, power-on options, power-off control and system FAN control on recent boards. Signed-off-by: Neil Armstrong Reviewed-by: Rob Herring --- .../devicetree/bindings/mfd/khadas,mcu.yaml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/khadas,mcu.yaml diff --git a/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml new file mode 100644 index 000000000000..a3b976f101e8 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/khadas,mcu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Khadas on-board Microcontroller Device Tree Bindings + +maintainers: + - Neil Armstrong + +description: | + Khadas embeds a microcontroller on their VIM and Edge boards adding some + system feature as PWM Fan control (for VIM2 rev14 or VIM3), User memory + storage, IR/Key resume control, system power LED control and more. + +properties: + compatible: + enum: + - khadas,mcu # MCU revision is discoverable + + "#cooling-cells": # Only needed for boards having FAN control feature + const: 2 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + khadas_mcu: system-controller@18 { + compatible = "khadas,mcu"; + reg = <0x18>; + #cooling-cells = <2>; + }; + }; From patchwork Tue Apr 21 08:00:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500709 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6D8C81 for ; Tue, 21 Apr 2020 08:02:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B9B5E2071C for ; Tue, 21 Apr 2020 08:02:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WcW3KsID"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="Elj3xI5m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9B5E2071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iU8b4YL6tvDvlBRkb+ABbdyewaxzZYEd6z5CCbfZF2Q=; b=WcW3KsIDIbvpGH J3XOioXKjBVBECzaKnU/u97g+RSH134GSv/rgPriyUlM5Yr8SOjjBjYCUzhXyxgBLJU6ZjVt6ZlNg AES5vnhOYQnoo7Z4ryN1e1Eqh4eyrOzlVMETS3XzPkYAsB6sxHuGa2PGLuerDSprDwYoFIEK28Jro gtBDkiFaHkRoE+8vqr0bvGbASH4ZveOojRZQtZl1x7+9WP3Vl5mwdVVG4BJ+1Fo0sERGjWz01lArV K1Ysd0ZGcjxa5ROsfpTfhQA1HRH60yUelgMmTmtqcoyHTiJh8zZed9sqCgHpyVMR7QXp6rOTtZtB3 xI8B46ufZnzPf4xwDXMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnrA-00021U-1Z; Tue, 21 Apr 2020 08:02:12 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqB-00017q-2t for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:15 +0000 Received: by mail-wr1-x444.google.com with SMTP id k1so15354667wrx.4 for ; Tue, 21 Apr 2020 01:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FfLgbV8JxCX0+O1S1urP+VjTlHc4+FfJzM+tdEpjLV4=; b=Elj3xI5mjVQ3ug2wf24xQ5kaXskWZPJwRv6tY3MHlcn7oBGeM5KRvWcNPIXK+ubIxY UB/aHZTNkkUvu9UoUadUHuvP9kiKzKN8YFMheDO8z/2iQD9Tm5TwYeJaBgRmA0nzqP23 Klyb+tY37Qyd798zjQdQ08XkRef3VSol12zMsJYzIIpo7TrsqWbaNmniVuHqrgVsO4hr m1Jp5NQmZHTxlr+PmzXcAYhHyuErTUc82VeyFzkOz1NzkOxjJCe//EwHZLPfR8GtHAcp fzGLLVFJt8ZE8XtDyoFbY9GFWH7iWlrmaZV43gN9sYnx0zAB5gVUatslQMcfeP4Bh0EQ ct3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FfLgbV8JxCX0+O1S1urP+VjTlHc4+FfJzM+tdEpjLV4=; b=ISLc0EDlAzeIIdQwVzcZlLM3ayRAxjnIn9pTaXCiXmn9SwP4zMUuwWfdDW1r5Sdku9 UTCa+7x/FHE2eAyjIfWPNUH6hA6PAhP/FfvjI38cdH3BiMXIJehG5v/C86iwVFZjSohc nkwkwgiyRXGcML/42UtInWIALjONdkx8jeS6DrxqaUt/4IDuHWTcJnkgvBgOcYtlfMd0 j3x1VXZUD3tiWchqtla5DdplOAHGLzZj31tlgfPZ+1pXsZfSg152JrvG5StDH/mY0Dzn NawSLAplb+nKr8BUUAVwBEk46OnQeI/51ZgRmd0KXG8deUmmYlfphKVoQdLqA0HhBC6t zUhg== X-Gm-Message-State: AGi0PuaZGS8/4v+kqbBoRFQ/E3zRONuzUwuUutK9teiVmgVqKLL4915P ZccvTcaMonDvpI+6pQwCMldhLA== X-Google-Smtp-Source: APiQypJ0rc4XvwGYb/1Kf6rty3Sttnr0+3eLGr+uUkpd1JslYShQgchzfVod7OCV4dGhcHBmmO+1tA== X-Received: by 2002:a5d:4d50:: with SMTP id a16mr25068374wru.219.1587456069652; Tue, 21 Apr 2020 01:01:09 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:09 -0700 (PDT) From: Neil Armstrong To: lee.jones@linaro.org, jdelvare@suse.com, linux@roeck-us.net, srinivas.kandagatla@linaro.org Subject: [RFC 2/8] mfd: add support for the Khadas System control Microcontroller Date: Tue, 21 Apr 2020 10:00:56 +0200 Message-Id: <20200421080102.22796-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010111_159315_D44CB654 X-CRM114-Status: GOOD ( 16.80 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org This Microcontroller is present on the Khadas VIM1, VIM2, VIM3 and Edge boards. It has multiple boot control features like password check, power-on options, power-off control and system FAN control on recent boards. This implements a very basic MFD driver with the fan control and User NVMEM cells. Signed-off-by: Neil Armstrong --- drivers/mfd/Kconfig | 14 ++++ drivers/mfd/Makefile | 1 + drivers/mfd/khadas-mcu.c | 143 +++++++++++++++++++++++++++++++++ include/linux/mfd/khadas-mcu.h | 91 +++++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 drivers/mfd/khadas-mcu.c create mode 100644 include/linux/mfd/khadas-mcu.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 0a59249198d3..b95091397052 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -2003,6 +2003,20 @@ config MFD_WCD934X This driver provides common support WCD934x audio codec and its associated Pin Controller, Soundwire Controller and Audio codec. +config MFD_KHADAS_MCU + tristate "Support for Khadas System control Microcontroller" + depends on I2C + depends on OF || COMPILE_TEST + select MFD_CORE + select REGMAP_I2C + help + Support for the Khadas System control Microcontroller interface present + on their VIM and Edge boards. + + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the functionality + of the device. + menu "Multimedia Capabilities Port drivers" depends on ARCH_SA1100 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index f935d10cbf0f..0f1633b096bb 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -257,5 +257,6 @@ obj-$(CONFIG_MFD_ROHM_BD70528) += rohm-bd70528.o obj-$(CONFIG_MFD_ROHM_BD71828) += rohm-bd71828.o obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o obj-$(CONFIG_MFD_STMFX) += stmfx.o +obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c new file mode 100644 index 000000000000..6d08fa2e373a --- /dev/null +++ b/drivers/mfd/khadas-mcu.c @@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for Khadas System control Microcontroller + * + * Copyright (C) 2020 BayLibre SAS + * Author(s): Neil Armstrong + */ +#include +#include +#include +#include +#include +#include + +static bool khadas_mcu_reg_volatile(struct device *dev, unsigned int reg) +{ + if (reg >= KHADAS_MCU_USER_DATA_0_REG && + reg < KHADAS_MCU_PWR_OFF_CMD_REG) + return true; + + switch (reg) { + case KHADAS_MCU_PWR_OFF_CMD_REG: + case KHADAS_MCU_PASSWD_START_REG: + case KHADAS_MCU_CHECK_VEN_PASSWD_REG: + case KHADAS_MCU_CHECK_USER_PASSWD_REG: + case KHADAS_MCU_WOL_INIT_START_REG: + case KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG: + return true; + default: + return false; + } +} + +static bool khadas_mcu_reg_writeable(struct device *dev, unsigned int reg) +{ + switch (reg) { + case KHADAS_MCU_PASSWD_VEN_0_REG: + case KHADAS_MCU_PASSWD_VEN_1_REG: + case KHADAS_MCU_PASSWD_VEN_2_REG: + case KHADAS_MCU_PASSWD_VEN_3_REG: + case KHADAS_MCU_PASSWD_VEN_4_REG: + case KHADAS_MCU_PASSWD_VEN_5_REG: + case KHADAS_MCU_MAC_0_REG: + case KHADAS_MCU_MAC_1_REG: + case KHADAS_MCU_MAC_2_REG: + case KHADAS_MCU_MAC_3_REG: + case KHADAS_MCU_MAC_4_REG: + case KHADAS_MCU_MAC_5_REG: + case KHADAS_MCU_USID_0_REG: + case KHADAS_MCU_USID_1_REG: + case KHADAS_MCU_USID_2_REG: + case KHADAS_MCU_USID_3_REG: + case KHADAS_MCU_USID_4_REG: + case KHADAS_MCU_USID_5_REG: + case KHADAS_MCU_VERSION_0_REG: + case KHADAS_MCU_VERSION_1_REG: + case KHADAS_MCU_DEVICE_NO_0_REG: + case KHADAS_MCU_DEVICE_NO_1_REG: + case KHADAS_MCU_FACTORY_TEST_REG: + case KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG: + return false; + default: + return true; + } +} + +static const struct regmap_config khadas_mcu_regmap_config = { + .reg_bits = 8, + .reg_stride = 1, + .val_bits = 8, + .max_register = KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, + .volatile_reg = khadas_mcu_reg_volatile, + .writeable_reg = khadas_mcu_reg_writeable, + .cache_type = REGCACHE_RBTREE, +}; + +static struct mfd_cell khadas_mcu_fan_cells[] = { + /* Feature supported only on VIM1/2 Rev13+ and VIM3 */ + { .name = "khadas-mcu-fan-ctrl", }, +}; + +static struct mfd_cell khadas_mcu_cells[] = { + /* Features supported on all board revisions */ + { .name = "khadas-mcu-user-mem", }, +}; + +static int khadas_mcu_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct device *dev = &client->dev; + struct khadas_mcu *khadas_mcu; + int ret; + + khadas_mcu = devm_kzalloc(dev, sizeof(*khadas_mcu), GFP_KERNEL); + if (!khadas_mcu) + return -ENOMEM; + + i2c_set_clientdata(client, khadas_mcu); + + khadas_mcu->dev = dev; + + khadas_mcu->map = devm_regmap_init_i2c(client, + &khadas_mcu_regmap_config); + if (IS_ERR(khadas_mcu->map)) { + ret = PTR_ERR(khadas_mcu->map); + dev_err(dev, "Failed to allocate register map: %d\n", ret); + return ret; + } + + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, + khadas_mcu_cells, + ARRAY_SIZE(khadas_mcu_cells), + NULL, 0, NULL); + if (ret) + return ret; + + if (of_find_property(dev->of_node, "#cooling-cells", NULL)) + return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, + khadas_mcu_fan_cells, + ARRAY_SIZE(khadas_mcu_fan_cells), + NULL, 0, NULL); + + return 0; +} + +static const struct of_device_id khadas_mcu_of_match[] = { + { .compatible = "khadas,mcu", }, + {}, +}; +MODULE_DEVICE_TABLE(of, khadas_mcu_of_match); + +static struct i2c_driver khadas_mcu_driver = { + .driver = { + .name = "khadas-mcu-core", + .of_match_table = of_match_ptr(khadas_mcu_of_match), + }, + .probe = khadas_mcu_probe, +}; +module_i2c_driver(khadas_mcu_driver); + +MODULE_DESCRIPTION("Khadas MCU core driver"); +MODULE_AUTHOR("Neil Armstrong "); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/khadas-mcu.h b/include/linux/mfd/khadas-mcu.h new file mode 100644 index 000000000000..2e68af21735c --- /dev/null +++ b/include/linux/mfd/khadas-mcu.h @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Khadas System control Microcontroller Register map + * + * Copyright (C) 2020 BayLibre SAS + * Author(s): Neil Armstrong + */ + +#ifndef MFD_KHADAS_MCU_H +#define MFD_KHADAS_MCU_H + +#define KHADAS_MCU_PASSWD_VEN_0_REG 0x0 /* RO */ +#define KHADAS_MCU_PASSWD_VEN_1_REG 0x1 /* RO */ +#define KHADAS_MCU_PASSWD_VEN_2_REG 0x2 /* RO */ +#define KHADAS_MCU_PASSWD_VEN_3_REG 0x3 /* RO */ +#define KHADAS_MCU_PASSWD_VEN_4_REG 0x4 /* RO */ +#define KHADAS_MCU_PASSWD_VEN_5_REG 0x5 /* RO */ +#define KHADAS_MCU_MAC_0_REG 0x6 /* RO */ +#define KHADAS_MCU_MAC_1_REG 0x7 /* RO */ +#define KHADAS_MCU_MAC_2_REG 0x8 /* RO */ +#define KHADAS_MCU_MAC_3_REG 0x9 /* RO */ +#define KHADAS_MCU_MAC_4_REG 0xa /* RO */ +#define KHADAS_MCU_MAC_5_REG 0xb /* RO */ +#define KHADAS_MCU_USID_0_REG 0xc /* RO */ +#define KHADAS_MCU_USID_1_REG 0xd /* RO */ +#define KHADAS_MCU_USID_2_REG 0xe /* RO */ +#define KHADAS_MCU_USID_3_REG 0xf /* RO */ +#define KHADAS_MCU_USID_4_REG 0x10 /* RO */ +#define KHADAS_MCU_USID_5_REG 0x11 /* RO */ +#define KHADAS_MCU_VERSION_0_REG 0x12 /* RO */ +#define KHADAS_MCU_VERSION_1_REG 0x13 /* RO */ +#define KHADAS_MCU_DEVICE_NO_0_REG 0x14 /* RO */ +#define KHADAS_MCU_DEVICE_NO_1_REG 0x15 /* RO */ +#define KHADAS_MCU_FACTORY_TEST_REG 0x16 /* R */ +#define KHADAS_MCU_BOOT_MODE_REG 0x20 /* RW */ +#define KHADAS_MCU_BOOT_EN_WOL_REG 0x21 /* RW */ +#define KHADAS_MCU_BOOT_EN_RTC_REG 0x22 /* RW */ +#define KHADAS_MCU_BOOT_EN_EXP_REG 0x23 /* RW */ +#define KHADAS_MCU_BOOT_EN_IR_REG 0x24 /* RW */ +#define KHADAS_MCU_BOOT_EN_DCIN_REG 0x25 /* RW */ +#define KHADAS_MCU_BOOT_EN_KEY_REG 0x26 /* RW */ +#define KHADAS_MCU_KEY_MODE_REG 0x27 /* RW */ +#define KHADAS_MCU_LED_MODE_ON_REG 0x28 /* RW */ +#define KHADAS_MCU_LED_MODE_OFF_REG 0x29 /* RW */ +#define KHADAS_MCU_SHUTDOWN_NORMAL_REG 0x2c /* RW */ +#define KHADAS_MCU_MAC_SWITCH_REG 0x2d /* RW */ +#define KHADAS_MCU_MCU_SLEEP_MODE_REG 0x2e /* RW */ +#define KHADAS_MCU_IR_CODE1_0_REG 0x2f /* RW */ +#define KHADAS_MCU_IR_CODE1_1_REG 0x30 /* RW */ +#define KHADAS_MCU_IR_CODE1_2_REG 0x31 /* RW */ +#define KHADAS_MCU_IR_CODE1_3_REG 0x32 /* RW */ +#define KHADAS_MCU_USB_PCIE_SWITCH_REG 0x33 /* RW */ +#define KHADAS_MCU_IR_CODE2_0_REG 0x34 /* RW */ +#define KHADAS_MCU_IR_CODE2_1_REG 0x35 /* RW */ +#define KHADAS_MCU_IR_CODE2_2_REG 0x36 /* RW */ +#define KHADAS_MCU_IR_CODE2_3_REG 0x37 /* RW */ +#define KHADAS_MCU_PASSWD_USER_0_REG 0x40 /* RW */ +#define KHADAS_MCU_PASSWD_USER_1_REG 0x41 /* RW */ +#define KHADAS_MCU_PASSWD_USER_2_REG 0x42 /* RW */ +#define KHADAS_MCU_PASSWD_USER_3_REG 0x43 /* RW */ +#define KHADAS_MCU_PASSWD_USER_4_REG 0x44 /* RW */ +#define KHADAS_MCU_PASSWD_USER_5_REG 0x45 /* RW */ +#define KHADAS_MCU_USER_DATA_0_REG 0x46 /* RW 56 bytes */ +#define KHADAS_MCU_PWR_OFF_CMD_REG 0x80 /* WO */ +#define KHADAS_MCU_PASSWD_START_REG 0x81 /* WO */ +#define KHADAS_MCU_CHECK_VEN_PASSWD_REG 0x82 /* WO */ +#define KHADAS_MCU_CHECK_USER_PASSWD_REG 0x83 /* WO */ +#define KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG 0x86 /* RO */ +#define KHADAS_MCU_WOL_INIT_START_REG 0x87 /* WO */ +#define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG 0x88 /* WO */ + +/* Boards */ +enum { + KHADAS_BOARD_VIM1 = 0x1, + KHADAS_BOARD_VIM2, + KHADAS_BOARD_VIM3, + KHADAS_BOARD_EDGE = 0x11, + KHADAS_BOARD_EDGE_V, +}; + +/** + * struct khadas_mcu_data - Khadas MCU MFD structure + * @device: device reference used for logs + * @map: register map + */ +struct khadas_mcu { + struct device *dev; + struct regmap *map; +}; + +#endif /* MFD_KHADAS_MCU_H */ From patchwork Tue Apr 21 08:00:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500715 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 023B892C for ; Tue, 21 Apr 2020 08:02:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8CA22071C for ; Tue, 21 Apr 2020 08:02:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="j8158wl9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="XvQH49c9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8CA22071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cJQqPJWtHD9z/yspAxDeBnOsrIR1TyjLp/30aKnXVEY=; b=j8158wl9MHPQ85 fwsTWjqgiOM1mU8g1S0Q4hXn0LLrvPQ9gz1ASPcSOggJ5H+nZQjDkNchyCHipZu1NW4lAjnoTCmdy ESUaM3SXgJ0/UWY2NiUWrpTZe7uIl42EdPuBvHzi2fnvJ741AiIs2TUOGfNyA4G60Ozi0LC5zU0E4 CxBjUvD8BqkwfzG2KsAhJ3+EHkiEV/3IwweHs/XXR3K2UVZsaO3+f+FRWD8y4h7iDpgH0xOJvCiNY hzmRUMiflNsKZcFKh2JkK7UaeUcIouAKSghTxfhO5hr69op5YpuqamBtgaHidC7XL4oe93CP3pQ5W yYCAAIEpuPDqLptueLeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnrU-0002Oz-Tr; Tue, 21 Apr 2020 08:02:32 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqD-00019I-7g for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:17 +0000 Received: by mail-wm1-x342.google.com with SMTP id 188so2471084wmc.2 for ; Tue, 21 Apr 2020 01:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QFz1UvHaf/QwvjUq4hk9gw50wQAtgMfi03pcCrPMxNo=; b=XvQH49c9pFBXB3qYvYNT0CIcRCWl82CkItDkzQiHosZ5ZQq3KCoglWEUw6Zdrn4QNs mPJY8YFllOVEQdw8tGrk+DtWrSk4b6mO6VI2aLk/nE/HUD1B2e4+ogwFpoIR+xBZ7hV6 QlwR0wKOiI1hkO3kUNyOW4YebTAv+U6SMEkdn1blLetMF8iyMoCqNq/fonMhp8BJNceQ SsFOtW5a8nghdMREXzTMLXVH7mv1IgeUIMb2eyoX0yXhyagQqoIyCmjobTRMmz/bpBRd KWnIhpVGJINBOeGz14jpT8qX7E+rfXNwziaCayzIphchzygTxhtqXNyiVvR55LTt/O3N Vpcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QFz1UvHaf/QwvjUq4hk9gw50wQAtgMfi03pcCrPMxNo=; b=jK96ECD+nUuYLarJviv7ZekeQuK3ITeWOK0l4xcP8/qIp0LC50PFp4oUIcQZMN8gbN rd6n3Jt91Eq7Q3bx3q/NWz/yL110fst4evNnS2lqq3jDWwJKjKcWqz2bgtQVWtmJGeIC SqBA8+o2LCG7lLhvSispNAUCiZsKKlKQeZHoUUfi//OWphrTZGdbbUyXmCpMz6ltZvu4 xLwrbz2slp9qfEspFpJpjqVOwFFh91b6yN172f2MrouNvu1MzsijX2qh4U24xwTVx3qa nfN/TkBJH6iUAZe6QzDc01lVLuaUxq1wa+UgIl+qPKw78st6m26divOf2HfE60JneVuq sSUg== X-Gm-Message-State: AGi0PubDe/X1zmUNkiW7/yvt0DdyWCt1y1HRMPoMHkUX6svBlLOJIh7N iTbRvJxlndndyo1pA1AJ/XOtOw== X-Google-Smtp-Source: APiQypL1PXqIzzVcGO5TnXV9TKqnzS1pDGnW/BLBAQOsbzCxixg5uCIe3U5SBR1IJu+LqSNOqTp2ZA== X-Received: by 2002:a7b:c755:: with SMTP id w21mr3450621wmk.120.1587456071301; Tue, 21 Apr 2020 01:01:11 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:10 -0700 (PDT) From: Neil Armstrong To: lee.jones@linaro.org, jdelvare@suse.com, linux@roeck-us.net, srinivas.kandagatla@linaro.org Subject: [RFC 3/8] hwmon: add support for the MCU controlled FAN on Khadas boards Date: Tue, 21 Apr 2020 10:00:57 +0200 Message-Id: <20200421080102.22796-4-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010113_301089_EE4B2354 X-CRM114-Status: GOOD ( 16.91 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The new Khadas VIM2 and VIM3 boards controls the cooling fan via the on-board microcontroller. This implements the FAN control as HWMON devices as cell of the Khadas MCU MFD driver. Signed-off-by: Neil Armstrong --- drivers/hwmon/Kconfig | 9 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/khadas-mcu-fan.c | 230 +++++++++++++++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 drivers/hwmon/khadas-mcu-fan.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4c62f900bf7e..7f63ff7bb732 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1997,6 +1997,15 @@ config SENSORS_XGENE If you say yes here you get support for the temperature and power sensors for APM X-Gene SoC. +config SENSORS_KHADAS_MCU_FAN + tristate "Khadas MCU controller FAN driver" + depends on OF || COMPILE_TEST + select MFD_CORE + select REGMAP + help + If you say yes here you get support for the FAN controlled + by the Microcontroller found on the Khadas VIM boards. + if ACPI comment "ACPI drivers" diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index b0b9c8e57176..20db40f6d57f 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -185,6 +185,7 @@ obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o +obj-$(CONFIG_SENSORS_KHADAS_MCU_FAN) += khadas-mcu-fan.o obj-$(CONFIG_SENSORS_OCC) += occ/ obj-$(CONFIG_PMBUS) += pmbus/ diff --git a/drivers/hwmon/khadas-mcu-fan.c b/drivers/hwmon/khadas-mcu-fan.c new file mode 100644 index 000000000000..dd92b2bcb7e3 --- /dev/null +++ b/drivers/hwmon/khadas-mcu-fan.c @@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Khadas MCU Controlled FAN driver + * + * Copyright (C) 2020 BayLibre SAS + * Author(s): Neil Armstrong + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_LEVEL 3 + +struct khadas_mcu_fan_ctx { + struct khadas_mcu *mcu; + unsigned int level; + struct thermal_cooling_device *cdev; +}; + +static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx, + unsigned int level) +{ + int ret; + + ret = regmap_write(ctx->mcu->map, KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG, + level); + if (ret) + return ret; + + ctx->level = level; + + return 0; +} + +static ssize_t level_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); + unsigned long level; + int ret; + + if (kstrtoul(buf, 10, &level) || level > MAX_LEVEL) + return -EINVAL; + + ret = khadas_mcu_fan_set_level(ctx, level); + if (ret < 0) + return ret; + + return count; +} + +static ssize_t level_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); + + return sprintf(buf, "%u\n", ctx->level); +} + +static SENSOR_DEVICE_ATTR_RW(level1, level, 0); + +static struct attribute *khadas_mcu_fan_attrs[] = { + &sensor_dev_attr_level1.dev_attr.attr, + NULL, +}; + +static const struct attribute_group khadas_mcu_fan_group = { + .attrs = khadas_mcu_fan_attrs, +}; + +static const struct attribute_group *khadas_mcu_fan_groups[] = { + &khadas_mcu_fan_group, + NULL, +}; + +/* thermal cooling device callbacks */ +static int khadas_mcu_fan_get_max_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + struct khadas_mcu_fan_ctx *ctx = cdev->devdata; + + if (!ctx) + return -EINVAL; + + *state = MAX_LEVEL; + + return 0; +} + +static int khadas_mcu_fan_get_cur_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + struct khadas_mcu_fan_ctx *ctx = cdev->devdata; + + if (!ctx) + return -EINVAL; + + *state = ctx->level; + + return 0; +} + +static int +khadas_mcu_fan_set_cur_state(struct thermal_cooling_device *cdev, + unsigned long state) +{ + struct khadas_mcu_fan_ctx *ctx = cdev->devdata; + + if (!ctx || (state > MAX_LEVEL)) + return -EINVAL; + + if (state == ctx->level) + return 0; + + return khadas_mcu_fan_set_level(ctx, state); +} + +static const struct thermal_cooling_device_ops khadas_mcu_fan_cooling_ops = { + .get_max_state = khadas_mcu_fan_get_max_state, + .get_cur_state = khadas_mcu_fan_get_cur_state, + .set_cur_state = khadas_mcu_fan_set_cur_state, +}; + +static int khadas_mcu_fan_probe(struct platform_device *pdev) +{ + struct khadas_mcu *mcu = dev_get_drvdata(pdev->dev.parent); + struct thermal_cooling_device *cdev; + struct device *dev = &pdev->dev; + struct khadas_mcu_fan_ctx *ctx; + struct device *hwmon; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + ctx->mcu = mcu; + platform_set_drvdata(pdev, ctx); + + hwmon = devm_hwmon_device_register_with_groups(dev, "khadas-mcu-fan", + ctx, + khadas_mcu_fan_groups); + if (IS_ERR(hwmon)) { + dev_err(dev, "Failed to register hwmon device\n"); + return PTR_ERR(hwmon); + } + + if (IS_ENABLED(CONFIG_THERMAL)) { + cdev = devm_thermal_of_cooling_device_register(dev->parent, + dev->parent->of_node, "khadas-mcu-fan", ctx, + &khadas_mcu_fan_cooling_ops); + if (IS_ERR(cdev)) { + ret = PTR_ERR(cdev); + dev_err(dev, + "Failed to register khadas-mcu-fan as cooling device: %d\n", + ret); + return ret; + } + ctx->cdev = cdev; + thermal_cdev_update(cdev); + } + + return 0; +} + +static int khadas_mcu_fan_disable(struct device *dev) +{ + struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); + unsigned int level_save = ctx->level; + int ret; + + ret = khadas_mcu_fan_set_level(ctx, 0); + if (ret) + return ret; + + ctx->level = level_save; + + return 0; +} + +static void khadas_mcu_fan_shutdown(struct platform_device *pdev) +{ + khadas_mcu_fan_disable(&pdev->dev); +} + +#ifdef CONFIG_PM_SLEEP +static int khadas_mcu_fan_suspend(struct device *dev) +{ + return khadas_mcu_fan_disable(dev); +} + +static int khadas_mcu_fan_resume(struct device *dev) +{ + struct khadas_mcu_fan_ctx *ctx = dev_get_drvdata(dev); + + return khadas_mcu_fan_set_level(ctx, ctx->level); +} +#endif + +static SIMPLE_DEV_PM_OPS(khadas_mcu_fan_pm, khadas_mcu_fan_suspend, + khadas_mcu_fan_resume); + +static const struct platform_device_id khadas_mcu_fan_id_table[] = { + { .name = "khadas-mcu-fan-ctrl", }, + {}, +}; +MODULE_DEVICE_TABLE(platform, khadas_mcu_fan_id_table); + +static struct platform_driver khadas_mcu_fan_driver = { + .probe = khadas_mcu_fan_probe, + .shutdown = khadas_mcu_fan_shutdown, + .driver = { + .name = "khadas-mcu-fan-ctrl", + .pm = &khadas_mcu_fan_pm, + }, + .id_table = khadas_mcu_fan_id_table, +}; + +module_platform_driver(khadas_mcu_fan_driver); + +MODULE_AUTHOR("Neil Armstrong "); +MODULE_DESCRIPTION("Khadas MCU FAN driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Apr 21 08:00:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500713 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08A4692C for ; Tue, 21 Apr 2020 08:02:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D9B5F2071C for ; Tue, 21 Apr 2020 08:02:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PeBmBCWS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="ha1EhZTr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9B5F2071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QGbxJXf7nWOqIbUKolIJm95B6yTdhJEFaizEUwdye8w=; b=PeBmBCWSnwkYuG O0SGKdWOCgaQ6yD6Ar3spzzEnU2POhgx5NlCFBVW3B+QQ0GrWBfUpW8YeSscl/KjLa84L5dS4vHNe ME0KKq9pnW3i9U3uR5mz09jb82ouhZO+gzNy/g/V7Y6bbyN8ixfkPh2cMytARrI2RhMBTQDGCZll+ jab/okE+Ll+obV6YRK1xgOeeh0pLAFADT1KwJGWdstxcJzsQUyHptZNY4lgqmNuudYsqfDefMUSpL MG6u0l8O5OlR1HGdE7/fzi7S+ou8iXm/u2XVl6h67uLfvCzIiebMpNUR5gQ8d25OI/tZd6nQ3aoUh 9UlzkcIRF64PkOopQ3tg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnrS-0002M6-DG; Tue, 21 Apr 2020 08:02:30 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqE-0001BD-PE for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:17 +0000 Received: by mail-wm1-x341.google.com with SMTP id 188so2471209wmc.2 for ; Tue, 21 Apr 2020 01:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y7Fjt5IgWK4L8ZaTfnqiN9Z1czwHhj1bMsFl3W8CxoM=; b=ha1EhZTrXKUsj9NuoE1itCGNDmEaBBo2GjdzWF1OreI69GTM5lZk1hhpO3kvkHk8zo XjzrWBZsnN/Q8csthmQWV8hqRkw7PAFdh9WA8CFGKGcm7Qx3CctudF2FJK+9jEbKLCmo WZ7G0mjBe6gC3cCM93lviLhkWCB8ERrs8nuM92Mv1EQl4kzIVKRfbGoF5MkiAgzWa1Pn u3DNLUregN0KvcmooXOT+11ND8dzJwMBb0MyZUas5vapR17S8iul5NLQxhJc7+yJh8vH 2BUhqjgru0JXOrPbkLFaoHeHgwX28Z+BTa6l1iyHwSYywkm/ym8wUOm9uAbqvQsPbfGu 2rsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y7Fjt5IgWK4L8ZaTfnqiN9Z1czwHhj1bMsFl3W8CxoM=; b=GTXA/AP+85Ta0P3cNQDGnpRTk3u7uu9U6CD0gLO+ruDYVHKF51q2ZcdApO7NFnu/KB NtbKRaYZ7HN/md0BAyx6ZPcPMvSwH9b70mqOdW0ezlhyKn7re/1GioA4kr5cX4ooO6oL ZIiGgCFbrm+9I9qbtgsnkaunAnDofGhYGAayQn50TBTmBQlb/Ti3MpenBRdRcOFAQbgc Al4/R6t3psmOdOUGgHr3jlxOncJrY19tk1wPFybPVisAaEzj9Rl8VocoyIznV1Rz7sDo X4wFmZFLHKPN4HfLLooubPrkVGeunL16XsyAH4RKn5tuwyUFFcbCoU4EUidrNo0E2vdQ SLcA== X-Gm-Message-State: AGi0Pubk07i5uCZF3u38gjMTD9qXn4bNrJe0KLZ9Oqr/2Vi+qKTt/VBG bLR4e1tQ/S1aZNhhgRgP2p6U4A== X-Google-Smtp-Source: APiQypKUJ/cjTU5KdVOCEhHx4v5y/Sf1RAOTdDgskIOOCXQ8YXmV5MGxkoDqUwhWM+8v+GBo+qgS1Q== X-Received: by 2002:a1c:ed18:: with SMTP id l24mr3481548wmh.122.1587456073043; Tue, 21 Apr 2020 01:01:13 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:12 -0700 (PDT) From: Neil Armstrong To: lee.jones@linaro.org, jdelvare@suse.com, linux@roeck-us.net, srinivas.kandagatla@linaro.org Subject: [RFC 4/8] nvmem: add support for the Khadas MCU Programmable User Memory Date: Tue, 21 Apr 2020 10:00:58 +0200 Message-Id: <20200421080102.22796-5-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010114_934222_2A2699FD X-CRM114-Status: GOOD ( 17.26 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The new Khadas VIM2, VIM3 and Edge boards embeds an on-board microcontroller offering a 56bytes User Programmable NVMEM array. This array needs a password to be writable, thus a password sysfs file has been added on the device node to unlock the NVMEM. The default 6bytes password id: "Khadas" This implements the user NVMEM devices as cell of the Khadas MCU MFD driver. Signed-off-by: Neil Armstrong --- drivers/nvmem/Kconfig | 8 ++ drivers/nvmem/Makefile | 2 + drivers/nvmem/khadas-mcu-user-mem.c | 128 ++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 drivers/nvmem/khadas-mcu-user-mem.c diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index d7b7f6d688e7..92cd4f6aa931 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -67,6 +67,14 @@ config JZ4780_EFUSE To compile this driver as a module, choose M here: the module will be called nvmem_jz4780_efuse. +config NVMEM_KHADAS_MCU_USER_MEM + tristate "Khadas MCU User programmable memory support" + depends on MFD_KHADAS_MCU + depends on REGMAP + help + This is a driver for the MCU User programmable memory + available on the Khadas VIM and Edge boards. + config NVMEM_LPC18XX_EEPROM tristate "NXP LPC18XX EEPROM Memory Support" depends on ARCH_LPC18XX || COMPILE_TEST diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index a7c377218341..0516a309542d 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -17,6 +17,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o obj-$(CONFIG_JZ4780_EFUSE) += nvmem_jz4780_efuse.o nvmem_jz4780_efuse-y := jz4780-efuse.o +obj-$(CONFIG_NVMEM_KHADAS_MCU_USER_MEM) += nvmem-khadas-mcu-user-mem.o +nvmem-khadas-mcu-user-mem-y := khadas-mcu-user-mem.o obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o diff --git a/drivers/nvmem/khadas-mcu-user-mem.c b/drivers/nvmem/khadas-mcu-user-mem.c new file mode 100644 index 000000000000..a1d5ae9a030c --- /dev/null +++ b/drivers/nvmem/khadas-mcu-user-mem.c @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for Khadas MCU User programmable Memory + * + * Copyright (C) 2020 BayLibre SAS + * Author(s): Neil Armstrong + */ + +#include +#include +#include +#include +#include +#include +#include + +static int khadas_mcu_user_mem_read(void *context, unsigned int offset, + void *val, size_t bytes) +{ + struct khadas_mcu *khadas_mcu = context; + + return regmap_bulk_read(khadas_mcu->map, + KHADAS_MCU_USER_DATA_0_REG + offset, + val, bytes); +} + +static int khadas_mcu_user_mem_write(void *context, unsigned int offset, + void *val, size_t bytes) +{ + struct khadas_mcu *khadas_mcu = context; + + return regmap_bulk_write(khadas_mcu->map, + KHADAS_MCU_USER_DATA_0_REG + offset, + val, bytes); +} + +static ssize_t password_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct khadas_mcu *khadas_mcu = dev_get_drvdata(dev); + int i, ret; + + if (count < 6) + return -EINVAL; + + ret = regmap_write(khadas_mcu->map, KHADAS_MCU_PASSWD_START_REG, 1); + if (ret) + return ret; + + for (i = 0 ; i < 6 ; ++i) { + ret = regmap_write(khadas_mcu->map, + KHADAS_MCU_CHECK_USER_PASSWD_REG, + buf[i]); + if (ret) + goto out; + } + + ret = regmap_write(khadas_mcu->map, KHADAS_MCU_PASSWD_START_REG, 0); + if (ret) + return ret; + + return count; +out: + regmap_write(khadas_mcu->map, KHADAS_MCU_PASSWD_START_REG, 0); + + return ret; +} + +static DEVICE_ATTR_WO(password); + +static struct attribute *khadas_mcu_user_mem_sysfs_attributes[] = { + &dev_attr_password.attr, + NULL, +}; + +static const struct attribute_group khadas_mcu_user_mem_sysfs_attr_group = { + .attrs = khadas_mcu_user_mem_sysfs_attributes, +}; + +static int khadas_mcu_user_mem_probe(struct platform_device *pdev) +{ + struct khadas_mcu *khadas_mcu = dev_get_drvdata(pdev->dev.parent); + struct device *dev = &pdev->dev; + struct nvmem_device *nvmem; + struct nvmem_config *econfig; + + econfig = devm_kzalloc(dev, sizeof(*econfig), GFP_KERNEL); + if (!econfig) + return -ENOMEM; + + econfig->dev = pdev->dev.parent; + econfig->name = dev_name(pdev->dev.parent); + econfig->stride = 1; + econfig->word_size = 1; + econfig->reg_read = khadas_mcu_user_mem_read; + econfig->reg_write = khadas_mcu_user_mem_write; + econfig->size = 56; + econfig->priv = khadas_mcu; + + platform_set_drvdata(pdev, khadas_mcu); + + nvmem = devm_nvmem_register(&pdev->dev, econfig); + if (IS_ERR(nvmem)) + return PTR_ERR(nvmem); + + return sysfs_create_group(&pdev->dev.kobj, + &khadas_mcu_user_mem_sysfs_attr_group); +} + +static const struct platform_device_id khadas_mcu_user_mem_id_table[] = { + { .name = "khadas-mcu-user-mem", }, + {}, +}; +MODULE_DEVICE_TABLE(platform, khadas_mcu_user_mem_id_table); + +static struct platform_driver khadas_mcu_user_mem_driver = { + .probe = khadas_mcu_user_mem_probe, + .driver = { + .name = "khadas-mcu-user-mem", + }, + .id_table = khadas_mcu_user_mem_id_table, +}; + +module_platform_driver(khadas_mcu_user_mem_driver); + +MODULE_AUTHOR("Neil Armstrong "); +MODULE_DESCRIPTION("Khadas MCU User MEM driver"); +MODULE_LICENSE("GPL v2"); From patchwork Tue Apr 21 08:00:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500733 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C44981 for ; Tue, 21 Apr 2020 08:03:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE1822071C for ; Tue, 21 Apr 2020 08:03:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PxoHIzRb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="dGTNCcnG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE1822071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KrIs+aEmW4FLFaWLSC5vofvqGi7KyV5NqbNS2QH/DT4=; b=PxoHIzRblqZyJe H2pia5LqKH5WylEjwwKXrRQHsuC8Ff6ekRTeZ3ecwL1waXkgO/SICam2pReku39Aae3IYM2aie5tR YcmK5lz1xjyL3ltENwbF00FOJ+wkbKNybGEfHfp+5fES8RKtwVysrnvM+2FwJxmZ+svNi0kcqRJi4 66yDvHOynxBuu4y9ibcihl+Ru8XLGZ9Lm6RaqgI2LwHKcszMjuUoQY5dGdn/rdYZkTbPsBpVmG1qZ mjhi/E23Ly0uVhsfkFu8fnLZdoGBsqoW1fYhNcuOi8Ll5Wd1+gCNhBdVwiVRxb3ALM5CvOl93Q+nF gkV+nvPERPZBZLFlereA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnry-0002zJ-Aw; Tue, 21 Apr 2020 08:03:02 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqG-0001Cg-RM for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:18 +0000 Received: by mail-wr1-x441.google.com with SMTP id i10so15300637wrv.10 for ; Tue, 21 Apr 2020 01:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8x2qbrmvJrvzLhSdZyiezkJo4hKvmqVH04B778IZt90=; b=dGTNCcnGr7YtPFf7J6XDaRYOU2CiBaCJhYNx09RmlAPeojd7c14ojBOwblaGyqje5J WlHC8CdEZ5ZGd2aGNslxywnwSLnzXx66X945Y1gGFesYLDy7pTBXaZVH2xHQ2llnHRJE vDYT9lWrKI+Xl6GV5za29OV/+p9Lnm7qhD7moZpHDPwhUYzF301asuOKHkFSC0FrJ5eb 8Coh7+dbLi4ywxt7d0Wxl/e2rvqbPOGO+/6LRv7cJrOZkSqXFinuBl0ytSHkNtPqWvOM sTPL5jKQ/j4QtCgLNgZYIl92+Xf5k0fU8Bdgrv98mdvjRzX4hbDwRD5PWihG8IOAlhAA UdBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8x2qbrmvJrvzLhSdZyiezkJo4hKvmqVH04B778IZt90=; b=ZZU4r94qYOvFzqomoEU4McsXwIuq6FE8hxRMy3AzbZ1jw53+KDDs/DVHk5ArR3TP/4 jYhlZekPQ0dxuoUwODHM54H9O4EvQjKiF4tn97rPA4aSZLVZlwkv4IGQyr+jT6g186tQ rri8jhbsL75QED4PeV6f3UR3BG33UcipwbqmvsOdXCf4dMrGbZEBPsEct3lBNmNELRBl vqWMum93BnFqvea1dw6SUAbzHWrBqdFVKD552aa5BPXxtcOVUFBXzuShHKauDaNYJpL+ pFByS5TpcKv+h8+mdQrRw2fWCgkInK5i3okA8leE0fF2bzjbi16cqnuJZhnf+/P4V2Eh kK/A== X-Gm-Message-State: AGi0PuaFBxPg/4imvxPepux5jNnS1Asu7PSlQuCwKLUCks2BRamGXaDt EgtUUBjy2SLujf1ocZukJm9tHQ== X-Google-Smtp-Source: APiQypIiWqXPmC/5mQtYcIdPcfFDsrYy87KwONuuyBh3FM0Eo21Qb7uC8L4gifzvCSJ9ml9PyD7LFQ== X-Received: by 2002:a5d:4381:: with SMTP id i1mr22202504wrq.194.1587456074451; Tue, 21 Apr 2020 01:01:14 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:13 -0700 (PDT) From: Neil Armstrong To: lee.jones@linaro.org, jdelvare@suse.com, linux@roeck-us.net, srinivas.kandagatla@linaro.org Subject: [RFC 5/8] MAINTAINERS: add myself as maintainer for Khadas MCU drivers Date: Tue, 21 Apr 2020 10:00:59 +0200 Message-Id: <20200421080102.22796-6-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010116_995284_D69A4FC6 X-CRM114-Status: UNSURE ( 7.91 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org Add the HWMON and NVMEM drivers along the MFD drivers and header as Maintained by myself. Signed-off-by: Neil Armstrong --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index b816a453b10e..4484fa568d42 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9431,6 +9431,17 @@ F: include/linux/kdb.h F: include/linux/kgdb.h F: kernel/debug/ +KHADAS MCU MFD DRIVER +M: Neil Armstrong +L: linux-amlogic@lists.infradead.org +S: Maintained +F: Documentation/devicetree/bindings/mfd/khadas,mcu.yaml +F: drivers/mfd/khadas-mcu.c +F: include/linux/mfd/khadas-mcu.h +F: drivers/hwmon/khadas-mcu-fan.c +F: drivers/nvmem/khadas-mcu-user-mem.c + KMEMLEAK M: Catalin Marinas S: Maintained -- 2.22.0 From patchwork Tue Apr 21 08:01:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500751 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E509E81 for ; Tue, 21 Apr 2020 08:03:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6672720679 for ; Tue, 21 Apr 2020 08:03:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FWyCD9cb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="Md9y6ssM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6672720679 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pb6GKlSAH1rZ3hugx+8n30b9oBCiAFvRkseWouxuL1U=; b=FWyCD9cbfL+iVI IL/cSkMItw67taV0/fdQVtLZ9E/i0vZbIgSCH/DwTmm4KEWrN+gJqkUJFqTTeOi4RNyanjIFG6C/B ph8/DO6UH0cX5qckux2IBjnCWVLKAQLX0It5y0ehf3CwTeAJYGFdIp14z5x7Iwd/P14ikDWm/dJZP cas45CblfiQ4pemiRw5sR+VNf4Uk/6aJPoRmQwxPv6ddhU3bCvazh2DLSdO9emWYpL6VmICGwp5di SJkFWm2gO/HOwHZnYVmlsmu+GsbjyNbFetVGESQBIQqpje71fn0X+i4pHPEjv+WsNxNh6PtiVOlVt 3U66/5yV8uHpBfPcLYug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnss-0003rR-64; Tue, 21 Apr 2020 08:03:58 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqI-0001E2-30 for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:20 +0000 Received: by mail-wr1-x42d.google.com with SMTP id d17so15295071wrg.11 for ; Tue, 21 Apr 2020 01:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PW/4clGD+cpV/fhovnrun++NoVB5+LjULUtHoJY62Ro=; b=Md9y6ssMrmxnRFOzwDtyc3RnxZm3nSdhd7K9l4xzl4/VWbFceYuflIerAN7he2TWFR oNTsfEn2Q6Xkb3ecjkbJckzrNkaSGdUuulC6mufGJ0jAlNBQOajgMkfnBBYE58ikB4r1 ISX+etHAS7QP2Uc9I/db4Odza0EoQwgn5DeeShK/I0SQKdFqU3zsuRnlUXGV2Cj/sSeC ei2xrxhha8RcR2Fu5PDtUnOPbzmaKYNFRcNmSArTvonErYUEP4N0gFApNgUGVf+xoAki c/Wi3kdy5iDqG9ZoiKx3UYAhlH7T0vOITbplT1K4cn1POCpdoRtyeeZFvedC054JqDc/ gDQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PW/4clGD+cpV/fhovnrun++NoVB5+LjULUtHoJY62Ro=; b=eZcMK29k982Nbt32aXhLpwVWD5rHnRxYmnj4EZFo8KYbWjPL0W46P528rYupkZOz/x L6WDLvf4gMev5c5N5WjxAjjNXA7IERo31/RFX9uR2+Pi/ujoNG1XdV0qn182kfyAPyyt wfBxOSvb0otITSQ18Tkp/+qxmvhYHaIP2EHnw4ndqp36MiXAHPkqp9o8fd0diQvrPUax Au+GZzOVWjLeNPCGZVRdtRksVkBpd5uDrueUXPgh+pbAMMY7A696nwyh5lvgWraoVRDh ugJ3YyidJlJADDRJG2gH/Na8JoKo+QQ8sxT7f3NJlv00Al5wKgW78fPNaIiZsQNeKnLm 5uHQ== X-Gm-Message-State: AGi0PubEBwgQOCNDbaEe2Go1PvgZHUc01HIwM9VRLbFTgRAPaFXhRfYO t/GBFta0qTcSq9kBT7I/MiEM+Q== X-Google-Smtp-Source: APiQypL3utEsf7dB2jih1sknlBtO+Mz3QtokX8dpUitlTh5nRmGcN9zA3N6rmgcof9M+WmyytjSehg== X-Received: by 2002:a5d:4a4b:: with SMTP id v11mr21989927wrs.32.1587456075927; Tue, 21 Apr 2020 01:01:15 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:15 -0700 (PDT) From: Neil Armstrong To: khilman@baylibre.com Subject: [RFC 6/8] arm64: dts: meson-g12b: move G12B thermal nodes to meson-g12b.dtsi Date: Tue, 21 Apr 2020 10:01:00 +0200 Message-Id: <20200421080102.22796-7-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010118_201175_80A7A340 X-CRM114-Status: UNSURE ( 9.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The G12B thermal nodes should be in the meson-g12b.dtsi file. Signed-off-by: Neil Armstrong --- arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 23 --------------------- arch/arm64/boot/dts/amlogic/meson-g12b.dtsi | 22 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi index 783e5a397f86..e932205badea 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi @@ -355,29 +355,6 @@ }; }; -&cpu_thermal { - cooling-maps { - map0 { - trip = <&cpu_passive>; - cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; - }; - map1 { - trip = <&cpu_hot>; - cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; - }; - }; -}; - ðmac { power-domains = <&pwrc PWRC_G12A_ETH_ID>; }; diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi index 6dbc3968045b..9b8548e5f6e5 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b.dtsi @@ -113,3 +113,25 @@ compatible = "amlogic,g12b-clkc"; }; +&cpu_thermal { + cooling-maps { + map0 { + trip = <&cpu_passive>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu_hot>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; From patchwork Tue Apr 21 08:01:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9ACE492C for ; Tue, 21 Apr 2020 08:03:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A99420679 for ; Tue, 21 Apr 2020 08:03:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TzGz6U/j"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="masfNwGS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A99420679 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dfYqjfvgeC4aaGdS8j2CZ9umlo/N4p5f81HVKY+NIwY=; b=TzGz6U/jng/yTL xxYfWZcRpHk0PoRUk3Kaurz++pUPt/Wo8WvhxarXG9qsAFtKHE65n7K2N1s6NcUbyifJdzuYUjaWT NCXllZP02Aw99DdVGa91hTk35Soh6NT6BuYkJbBN9wgmjqQYHz1t9i62CBQ4nE3qL7YAo6O3jyC6t WsYgbDaO0drQHpnTUSwkAca0CmkPPnaSPUf59tuylXq0fexRwrz2Q2AVLd8pRIdbErG+wJkHGgbYt gc+S4XVTIYJsS87n0E8idNqw2G3DK5yAkgdb7p39WZKzqsuH76e0gOxExYYlKhrq9rw315Rh5gvq/ NeThFeKE67UXTK/m5PTQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnsn-0003nr-1U; Tue, 21 Apr 2020 08:03:53 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqI-0001FR-QM for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:20 +0000 Received: by mail-wm1-x341.google.com with SMTP id 188so2471466wmc.2 for ; Tue, 21 Apr 2020 01:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=exntrZVDrpNC4LfoF62zE8ED3Dungiic5pvW3+dqcrE=; b=masfNwGS8IZQ2541J1dwhk8GqCR2J55vlrTQssHEbTO9xZSvKw4jZzjNLJV4v1DYeg ubBwEzmaUyKD/nAjdgA2nIZ319L0eXWUFqw/8EGufNzLxABbA23/YIVLCBbCfBHqn1h1 I8SnrdHtfrIDDG340w1zg/i66dRkz3EJ3pQzdTFMN65wwpFiUkRb6Mpfim9Dcx+6InWS hT8QIS2zrVKTrr9+5cLP7YFB2d0W2BN9mko24jNiwAw1B7b9/521qmpA/S+8J7fcAhDK SNd1tyts0TZBlubdtb8U1OEkIt8DMPHul1Lmd+0eiBGcfKaIooeFH0AiLWhFp+u2O3U6 Yw4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=exntrZVDrpNC4LfoF62zE8ED3Dungiic5pvW3+dqcrE=; b=DZzQXdsOQGqiQqSPJJwoG7nx5orbYSZTHMnAgm4JiTpO63ej/Nk40QuLQlqKM6kQcE QDndNAL2neBjWIiGYCBLkGmYS2GOwouIubAmms6k5s5Fm7j04I1kjNCNncBExRwZNMV8 CD/kHZ1Xda/4TQrf6h9FaLVRo+CX8Frkhoe8yzletKTJicjtaOWVm/0KYXB7y0EAFc8m GUu4ACPBrm7tChEnltFB36TaPLI/m+6CRT1iPUY68Ocf8p9Djiw26uM2Y+woVsaMf+4v Hu30X11gxElrT9TOBkDtcPqn82BN+SxbgYCsoOIxcSjGM+V46dVR5EAAABmXnuZ/bl/F Aq+A== X-Gm-Message-State: AGi0PuYraPG1aiEggZ50tVvBBYsA281klayh+4KR2ZV8CSHKkX7tYp65 FBsLfoyd1Gmoox2wj3f6WX1heA== X-Google-Smtp-Source: APiQypI9h94l+CZXcEb1aZ/OgizCqV8es3Sa3eybeGWtzOeDjtlLjSkfJia1v7tSyR5sX8sej1M55w== X-Received: by 2002:a1c:96c6:: with SMTP id y189mr3785930wmd.106.1587456077312; Tue, 21 Apr 2020 01:01:17 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:16 -0700 (PDT) From: Neil Armstrong To: khilman@baylibre.com Subject: [RFC 7/8] arm64: dts: meson-sm1: add cpu thermal nodes Date: Tue, 21 Apr 2020 10:01:01 +0200 Message-Id: <20200421080102.22796-8-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010118_919128_5965D9AE X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org Add thermal nodes for the Amlogic SM1 SoCs based on the G12A and G12B thermal nodes. Signed-off-by: Neil Armstrong --- arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi index d4ec735fb1a5..71317f5aada1 100644 --- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi @@ -56,6 +56,7 @@ reg = <0x0 0x0>; enable-method = "psci"; next-level-cache = <&l2>; + #cooling-cells = <2>; }; cpu1: cpu@1 { @@ -64,6 +65,7 @@ reg = <0x0 0x1>; enable-method = "psci"; next-level-cache = <&l2>; + #cooling-cells = <2>; }; cpu2: cpu@2 { @@ -72,6 +74,7 @@ reg = <0x0 0x2>; enable-method = "psci"; next-level-cache = <&l2>; + #cooling-cells = <2>; }; cpu3: cpu@3 { @@ -80,6 +83,7 @@ reg = <0x0 0x3>; enable-method = "psci"; next-level-cache = <&l2>; + #cooling-cells = <2>; }; l2: l2-cache0 { @@ -466,6 +470,26 @@ compatible = "amlogic,sm1-clkc"; }; +&cpu_thermal { + cooling-maps { + map0 { + trip = <&cpu_passive>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&cpu_hot>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + ðmac { power-domains = <&pwrc PWRC_SM1_ETH_ID>; }; From patchwork Tue Apr 21 08:01:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 11500753 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC61B81 for ; Tue, 21 Apr 2020 08:04:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A0702071C for ; Tue, 21 Apr 2020 08:04:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PHBL2BxQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="2P4upNIc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A0702071C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dLbhSBh0JLLie4NGY3kjYuSqmB9r0UE9pu5zdMtkN2k=; b=PHBL2BxQtd491c GJEShq4yNTv+Q8OZIyUmelRzL1C8KeFEB2/RDUQGLxZLxG6yV+os/y1i/5SKpaSBrQM9XDU7RtJwz sky2NWrRU9DGTgHZoKk76cAxbeHAGulU62DQoY4EO3uLr8VMTCqO4AjEcGQdIkwqEtLg5LOzEX2EY 0HGMObIUmz5W7NVlyA57X0EWtT4eonDb1jRRv+96fx8Qbz/mfanZN63/CHeJ8JG6WXMNGhbSPo90g xr1eDjg15dcm9cGIYZn23PlERFpNcT0OvJKyGrWqPyztuEmjjkedAtVWddmGFmcl0ykxQPyP8KhMs Axcmij+YOQZD9r2+QutA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnsv-0003ut-Lb; Tue, 21 Apr 2020 08:04:01 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQnqK-0001HN-J2 for linux-amlogic@lists.infradead.org; Tue, 21 Apr 2020 08:01:22 +0000 Received: by mail-wr1-x443.google.com with SMTP id j1so9907519wrt.1 for ; Tue, 21 Apr 2020 01:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=itZ8nYpO9rVwAB+XOSiZ1Zaz+WlUMeN8KYJbRrgai8w=; b=2P4upNIcIwgvXsINcNwMKuLoNxfbr7DA+Jnu8ANYIWyy5/smGGvO2txOPebp357SyM 9xtX+ZfPGfwrIPzvc5j36V2tN3+T1D+q3dwpBGFE7VWJMfZzVUcqeB+umjUadUUjSCq4 dATQNiLI4T751oM+fcu4U/Y5XgsSygl4fgAYRVtuCQrFEXrvrVqsI9pgHO4pzjVa1d2T x/g46FT49QfIbn30BHst4ECbSzYAcH8x1/3QHciYWeaJJLSUi9kpiF14nf+kIFgFYPdr z7RlPTlHlYTEHzsbmqAs+tXOYt5s2M3tLDtDiyBpBUbkaQQNjDkzXMclSxyyLuFi0kbu iiBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=itZ8nYpO9rVwAB+XOSiZ1Zaz+WlUMeN8KYJbRrgai8w=; b=W5h8SgAWvI1bLjDLEE/puV5MynzsdXuUuzzD7RPGIG6PPINdP68CImFOWLqT/QwWG9 UI55QBXG32U96gSmFRekT+1oyVByy3AaGlev7EDbCMKbSaJCxUK3YTPSL7TAYBJU2kCm VnzpMQvGdvhl8LxjGgbKwoqupkb61EvydCsGY1I54Ejoyn7cdc2ps0pI5zDS4u80Y0iw 6cur5DvxY1p741kEQHNGdWUYsIE/a/tHy2kArXn69LYHMFFIT98K1djzdlh1TpAxK5Bx ixwMGDzKCJG9Ay4lZcDEvQ/H/tlyH8RZxioomnoDvlsA4paiLVo0wEyRtYdg1OxKSLTp 7csQ== X-Gm-Message-State: AGi0PubHmpv/V1kPyU5r4aQuEQO+JYzOc5BFHEkZy5QKHx/ePR/oC24v wz3gUToBHr9TattnyW2jpWmH9Q== X-Google-Smtp-Source: APiQypJ7I94NWf5qVdER06WU1+s/LCyUTU03msM+BLEEdT8t06/AWQHMkHiC71sCWlgXL4pKvRiNdw== X-Received: by 2002:adf:db41:: with SMTP id f1mr21790458wrj.13.1587456078705; Tue, 21 Apr 2020 01:01:18 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:39cc:a07:8b48:cc56]) by smtp.gmail.com with ESMTPSA id x132sm2561552wmg.33.2020.04.21.01.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 01:01:18 -0700 (PDT) From: Neil Armstrong To: khilman@baylibre.com Subject: [RFC 8/8] arm64: dts: meson-khadas-vim3: add Khadas MCU nodes Date: Tue, 21 Apr 2020 10:01:02 +0200 Message-Id: <20200421080102.22796-9-narmstrong@baylibre.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200421080102.22796-1-narmstrong@baylibre.com> References: <20200421080102.22796-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200421_010120_701098_FD8A6B16 X-CRM114-Status: GOOD ( 10.50 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, Neil Armstrong , linux-kernel@vger.kernel.org, nick@khadas.com, linux-amlogic@lists.infradead.org, art@khadas.com, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org Add the Khadas MCU node with active FAN thermal nodes for all the Khadas VIM3 variants. Signed-off-by: Neil Armstrong --- .../boot/dts/amlogic/meson-khadas-vim3.dtsi | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi index 094ecf2222bb..3325e54ea690 100644 --- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi @@ -183,6 +183,23 @@ hdmi-phandle = <&hdmi_tx>; }; +&cpu_thermal { + trips { + cpu_active: cpu-active { + temperature = <80000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + &ext_mdio { external_phy: ethernet-phy@0 { /* Realtek RTL8211F (0x001cc916) */ @@ -222,6 +239,12 @@ pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; pinctrl-names = "default"; + khadas_mcu: system-controller@18 { + compatible = "khadas,mcu"; + reg = <0x18>; + #cooling-cells = <2>; + }; + gpio_expander: gpio-controller@20 { compatible = "ti,tca6408"; reg = <0x20>;