From patchwork Sat Oct 9 11:50:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16C24C433F5 for ; Sat, 9 Oct 2021 11:52:53 +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 DDD7A60EE9 for ; Sat, 9 Oct 2021 11:52:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DDD7A60EE9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a10kolWcJd/xqd9OhB1NSowaut3lfO4/+hwgwwyD/0s=; b=Z3qpH9qe11KFck Ig5K/OG+dzQqy+dO4mJJ2G3qyL7HJ1Q7JGlV5P9RzNmdhEfUijt/jkNJ4waMoEm4MNumNMHcp6GFl sZZCgzTCBeIGVz9qKiXAbsjRQ8FQCWt9NmBqE6qc9SsGf1SjW91XXVBujGeErO8dsUfZ0bKxbMws1 hsZ1A94xkwAcovflg4XWdkqLtBFe5u1iOefwp8Wff7aPbiBYI/77KsSiQ0Bw3pbuG/D9K+2iMKZrT JCEsI3QPWFrXCdY7p8scOnsSewFIU+ghqIW2Jv+2PtFLHWqCZBjd9u1CGchUZBtZ9qEDl0QM306kx cbj7qKHM8RW1lWo1NziQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsZ-005VpG-50; Sat, 09 Oct 2021 11:51:03 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsP-005Vmr-K9 for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:50:55 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 07E59580A0F; Sat, 9 Oct 2021 07:50:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 09 Oct 2021 07:50:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=DiwHj+vaHXUQK XyQ9BUo+GIG90hR4W/o3+wsmuFsT8o=; b=G9otH0hTuvTBZrKLrU12TNBbLBBfZ lPN/4q0bSZPeqP3kp0fKB/TC/07R7GrozvMxP+uzTIKmNmrfjkiPoaM06LmNKPIr QEo4Vfhz1MVSO+3iOkrQgr2saTM3zwawxi2FJrVCHHYiy5HfpRZNYaB/CHAp98xQ 5IKTYnYrFKGBLKaanFFbm7gdjh5aaFqUqeq38CHSSqqKwiDGVktUlT/Keq20ewBf qdDM39e8WPWiQLqjbqMGInvPB/rCBaxTphqTAOzUAeeDxrPj0ibiGk0TMRuaCOTN +HHygzwyIj/Sd98FZF25ZGKfZe/VSrNM2S0hMxlKnpTx3GM5CWJzMOx4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=DiwHj+vaHXUQKXyQ9BUo+GIG90hR4W/o3+wsmuFsT8o=; b=eQnjtpS0 TMgJuue4gg5PRYwwN4aTwiCyY8u0ftuBklXqUpF9HQqV60bSUqT41KfFwAObEza8 A7g9LQUjlmboh/XNRXlUCGKctsBH3HWi2S7NZfgaHvdA3L691j5Gj2mnq9vlrdGm 4VO19MyzDqRWWiNyqUNdg+h3SSLFueBFW1tAtu8gFBqjz8w4+LHG2Om6cotkbeRn d8n3ZUwHLQE4cTAU+CXKoC2YB4HqDAew/Nyv9gb35W22QAqQ+VNwvqjBto6yvMzt W44kLb6InjRL9ZuX/w29hkJc4vBvzlkWdeavdWJ6NOhA9OUA+L5Bcs9CHzSWRCyk Fo+7OhDEqfL+rQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetlhhishht rghirhcuhfhrrghntghishcuoegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg eqnecuggftrfgrthhtvghrnhepffdthffggefglefgkeejhfekiefgleelfefhtefhheef teelgeeggefgfeffvddtnecuffhomhgrihhnpeguvghvihgtvghtrhgvvgdrohhrghenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishht rghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:50:46 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis , Rob Herring Subject: [PATCH v12 01/10] dt-bindings: mfd: Initial commit of silergy, sy7636a.yaml Date: Sat, 9 Oct 2021 21:50:20 +1000 Message-Id: <20211009115031.18392-2-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045053_760449_99A7DBBE X-CRM114-Status: GOOD ( 10.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Initial support for the Silergy SY7636A Power Management chip and regulator. Signed-off-by: Alistair Francis Reviewed-by: Rob Herring --- .../bindings/mfd/silergy,sy7636a.yaml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml diff --git a/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml new file mode 100644 index 000000000000..0566f9498e2f --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/silergy,sy7636a.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: silergy sy7636a PMIC + +maintainers: + - Alistair Francis + +properties: + compatible: + const: silergy,sy7636a + + reg: + description: + I2C device address. + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + '#thermal-sensor-cells': + const: 0 + + epd-pwr-good-gpios: + description: + Specifying the power good GPIOs. + maxItems: 1 + + regulators: + type: object + + properties: + compatible: + const: silergy,sy7636a-regulator + + vcom: + type: object + $ref: /schemas/regulator/regulator.yaml# + properties: + regulator-name: + const: vcom + + additionalProperties: false + +required: + - compatible + - reg + - '#thermal-sensor-cells' + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@62 { + compatible = "silergy,sy7636a"; + reg = <0x62>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_epdpmic>; + #thermal-sensor-cells = <0>; + + regulators { + reg_epdpmic: vcom { + regulator-name = "vcom"; + regulator-boot-on; + }; + }; + }; + }; +... From patchwork Sat Oct 9 11:50:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6075DC433EF for ; Sat, 9 Oct 2021 11:52:57 +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 2DA9E60EE9 for ; Sat, 9 Oct 2021 11:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2DA9E60EE9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EiS4KJEk5RGHdsqYHLmyXWSC0ZroqcT0F7jNNo6ztQs=; b=4gv7TxR+8qry/p HDJi8oagw8G2l+/SDWBGKb69TKHBJwd+mLpTm+9XUj7dSNnTth4z+Lq7N84ANtmpjjM3kpgijr/v6 3ItArgIV5Olx/xJecYq/V2vdzpM7Xxm3fcnGkCIaSS3Pdum/3lFUpbRLP9ENz/leE9I0eML5HpbVL aPgYBdnmN0517oQfId1UgNqds/tSaas2iwSr4bZRnHPeoxwdKXFPJWkPLWwrSvW0NrnspI85ccIvI hVkOYmtsMXDoIDLhWAQddaiYQInqakegpUa5e3he+T7yV1fYUJKAFOYlPwblcrNGJSW2EN9Nke222 bGCBfUp2zdK6RzmKWcdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsm-005VtT-8V; Sat, 09 Oct 2021 11:51:16 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsU-005Vno-Ss for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:00 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 48388580A0F; Sat, 9 Oct 2021 07:50:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 09 Oct 2021 07:50:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=yw1VucPUQqdpZ mHA25svfKcp/yBBqIjEZdlG3rBe/yc=; b=VhYRKkdx7DcdszfNteoa9Xa8hsMlS XqxhE3K7qotylN0ggV3loYPlyMsaunVjeb19/XLGFOAPgFNUj00dWcesRQoa0Ypa 0Pw1Q+qOwgsrl2XsfZs90Ks6Ce3wrOjiuDqgD48c1t9adTyaHd2R/hIfctSttz/v xC33lfvil+OzQJ1aTow6y8pJ/XyQeAVTeZ2pmA1atzsg5MRjLb2Cjc4feE4l1Aq2 gfGSDuE26JjzvorX29i2im0zYyycceSitQ/GnEUUdVTnd0U3rwLLmlTefp4jnu7E qwHiQASwokUyc1RP1Eqm87WhFVxGsbnb/UGz8HiUMiGdlcSWMhRb0QXhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=yw1VucPUQqdpZmHA25svfKcp/yBBqIjEZdlG3rBe/yc=; b=nyEOGtz5 LUAmLPcxf8pP7CRlzUeYRSwonTXpbpk+gXCP1MQMY0lAu02kBBlRKHAn2utI0jmG zDWFCgChDNvkG/jH5dQdS71hxo3P0JLqi/Jcf5ggcOAp4OCh9gecaUH+e9kUdPOa cg57uG3cJizONmOTREQjKGvfa0R6GrpcheNXbzkYlFC5eV9znqsBmlcH7MpBT8yO JwrNIm2zs/s+AwnfFHICYAxqKMLJnURTc62OgZvL5JeJYCTTqrWpIkSzCJm11So+ qCk4MfZr6dkveZNzyc9bnqBA6ZmRWYg6KMcL8NpQUfoEkjPdqDS1Z2vVIbgT7JRk ZIC2fm02m0xHwQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:50:53 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH v12 02/10] mfd: simple-mfd-i2c: Add a Kconfig name Date: Sat, 9 Oct 2021 21:50:21 +1000 Message-Id: <20211009115031.18392-3-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045059_035101_3746023F X-CRM114-Status: UNSURE ( 8.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a Kconfig name to the "Simple Multi-Functional Device support (I2C)" device so that it can be enabled via menuconfig. Signed-off-by: Alistair Francis --- drivers/mfd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ca0edab91aeb..e465ddd9ee77 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1192,7 +1192,7 @@ config MFD_SI476X_CORE module will be called si476x-core. config MFD_SIMPLE_MFD_I2C - tristate + tristate "Simple Multi-Functional Device support (I2C)" depends on I2C select REGMAP_I2C help From patchwork Sat Oct 9 11:50:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCF8AC433EF for ; Sat, 9 Oct 2021 11:53:45 +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 A65E760F6F for ; Sat, 9 Oct 2021 11:53:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A65E760F6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=St5yFZvw/uhvd2dNTUl/aGmnG10zGf6DlDYfDRJiQPI=; b=W1ZJEbLubh3qWT stvpG8Wxq1kiUvkkz6k2ytgznFu8/iy9N7EvOKKRIV/6w/ug2X0cqP4Xf+z/pfRqRUEoIutEDpXu/ UDHhUJ8Wt8Aqr2DGE7xudzvTx7xuRcKLuzl7XFxfti4wMrpLFJkvi3B0K7w8YsjpuwBt7wsE+RI8v nqfeJ8INke+xzVQYT00sE5J+BVoyHcDbik1/UNj6HXL3mxJ9moTkg2Rw8jiDi3avP/uqLwArt/QcR HgK/BL7277h5XSr693RPc5SaSjaeSxJ7uvJ7zPwtU3ncpGkoRxxLzLfBph6nSszSQY7AqYAr80SWp 2mnmp3Tp/IMP9+85QHVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAt7-005W1w-RA; Sat, 09 Oct 2021 11:51:38 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsa-005VqD-KR for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:07 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 055FF580542; Sat, 9 Oct 2021 07:51:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 09 Oct 2021 07:51:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=7oUy5FVjT9iAK qFIxT+XtiIGQTMJHnJ02eLfXVTDuKk=; b=JuEFxeR8pA8RO+DJ9Hb5Q0RcGWRlB 8cbuhdArZm6D6WgFDf34iizeJ+5zFbdRRQWiELo8lt6Nj5k/iHwcdOQrpIVOcIph +K5dnceU194uJedaiJCcOr2LV4uJwyduW7aPzTvBBtuMAM9rRRWlyY7u7oE8wwJ+ hlsvuzzTrBPHFHbGQQCK+qjbJwaGetSwkxD3jcxHvy6ab3tM0QMgio6bsefajJ0I M4/XaSQk3J62AZPwuXmHPlKid1cPSM/htdFJQ3mmjRDbbsAaz69NyMbxVPTiYnKh TLRy4nIkq7ludVToJrmjo6xCekp0IqCRGk4yPuJbjPla1JCCW0RauQmjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=7oUy5FVjT9iAKqFIxT+XtiIGQTMJHnJ02eLfXVTDuKk=; b=HlwJMmtD EUF6aJrNu6AOYUWTuA6rPX9e+LkrKpmu4dPSbwR93KjdGsXumg4zcq09MKuN/1zw //uqpT3IrzfclHRGK+u2USzORm10op+w4zozkOog6vAbcfY9pwAC8+Sz9jBizrhr Pmiaka00xYlTGPs+6I0U9UMC5JJy+hGjIzR1n4b7GFArdxJSXc6eAEQc6pMFukGm +6bkKTeOcZeysLATaLMztuVar8L5/FbmDVJMIzLK8z+r7WYqiQe2dmEQ/M8SqF4N 8MF/ld1y9SfzPkccV7mqNkfvxzva5bhxrGnjZOoASxQtk7iNh1xJRssOyq2NH38U 6kjYGGXhv2Gmiw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpedvveduleefje fgudfggeevkefhgeffteejhfejieelieeileefuddtfeevveevvdenucffohhmrghinhep rghpphhiugdrmhgrphdpghgvthdrihhsnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:50:58 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH 3/7] capsules: symmetric_encryption/aes: Reduce code size Date: Sat, 9 Oct 2021 21:50:22 +1000 Message-Id: <20211009115031.18392-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045104_921495_CC372281 X-CRM114-Status: GOOD ( 10.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alistair Francis Signed-off-by: Alistair Francis --- capsules/src/symmetric_encryption/aes.rs | 587 ++++++++++++----------- 1 file changed, 300 insertions(+), 287 deletions(-) diff --git a/capsules/src/symmetric_encryption/aes.rs b/capsules/src/symmetric_encryption/aes.rs index ed3bf74e6..1aa736ce0 100644 --- a/capsules/src/symmetric_encryption/aes.rs +++ b/capsules/src/symmetric_encryption/aes.rs @@ -90,21 +90,25 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta key[..static_buffer_len] .copy_to_slice(&mut buf[..static_buffer_len]); - match app.aes_operation.as_ref().unwrap() { - AesOperation::AES128Ctr(_) - | AesOperation::AES128CBC(_) - | AesOperation::AES128ECB(_) => { - if let Err(e) = AES128::set_key(self.aes, buf) { - return Err(e); + if let Some(op) = app.aes_operation.as_ref() { + match op { + AesOperation::AES128Ctr(_) + | AesOperation::AES128CBC(_) + | AesOperation::AES128ECB(_) => { + if let Err(e) = AES128::set_key(self.aes, buf) { + return Err(e); + } + Ok(()) } - Ok(()) - } - AesOperation::AES128CCM(_) => { - if let Err(e) = AES128CCM::set_key(self.aes, buf) { - return Err(e); + AesOperation::AES128CCM(_) => { + if let Err(e) = AES128CCM::set_key(self.aes, buf) { + return Err(e); + } + Ok(()) } - Ok(()) } + } else { + Err(ErrorCode::FAIL) } }) }) @@ -125,21 +129,25 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta iv[..static_buffer_len] .copy_to_slice(&mut buf[..static_buffer_len]); - match app.aes_operation.as_ref().unwrap() { - AesOperation::AES128Ctr(_) - | AesOperation::AES128CBC(_) - | AesOperation::AES128ECB(_) => { - if let Err(e) = self.aes.set_iv(buf) { - return Err(e); + if let Some(op) = app.aes_operation.as_ref() { + match op { + AesOperation::AES128Ctr(_) + | AesOperation::AES128CBC(_) + | AesOperation::AES128ECB(_) => { + if let Err(e) = self.aes.set_iv(buf) { + return Err(e); + } + Ok(()) } - Ok(()) - } - AesOperation::AES128CCM(_) => { - if let Err(e) = self.aes.set_nonce(&buf[0..13]) { - return Err(e); + AesOperation::AES128CCM(_) => { + if let Err(e) = self.aes.set_nonce(&buf[0..13]) { + return Err(e); + } + Ok(()) } - Ok(()) } + } else { + Err(ErrorCode::FAIL) } }) }) @@ -149,58 +157,65 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta .enter(|source| { let mut static_buffer_len = 0; - match app.aes_operation.as_ref().unwrap() { - AesOperation::AES128Ctr(_) - | AesOperation::AES128CBC(_) - | AesOperation::AES128ECB(_) => { - self.source_buffer.map_or(Err(ErrorCode::NOMEM), |buf| { - // Determine the size of the static buffer we have - static_buffer_len = buf.len(); + if let Some(op) = app.aes_operation.as_ref() { + match op { + AesOperation::AES128Ctr(_) + | AesOperation::AES128CBC(_) + | AesOperation::AES128ECB(_) => { + self.source_buffer.map_or( + Err(ErrorCode::NOMEM), + |buf| { + // Determine the size of the static buffer we have + static_buffer_len = buf.len(); - if static_buffer_len > source.len() { - static_buffer_len = source.len() - } + if static_buffer_len > source.len() { + static_buffer_len = source.len() + } - // Copy the data into the static buffer - source[..static_buffer_len] - .copy_to_slice(&mut buf[..static_buffer_len]); + // Copy the data into the static buffer + source[..static_buffer_len] + .copy_to_slice(&mut buf[..static_buffer_len]); - self.data_copied.set(static_buffer_len); + self.data_copied.set(static_buffer_len); - Ok(()) - })?; - } - AesOperation::AES128CCM(_) => { - self.dest_buffer.map_or(Err(ErrorCode::NOMEM), |buf| { - // Determine the size of the static buffer we have - static_buffer_len = buf.len(); + Ok(()) + }, + )?; + } + AesOperation::AES128CCM(_) => { + self.dest_buffer.map_or(Err(ErrorCode::NOMEM), |buf| { + // Determine the size of the static buffer we have + static_buffer_len = buf.len(); - if static_buffer_len > source.len() { - static_buffer_len = source.len() - } + if static_buffer_len > source.len() { + static_buffer_len = source.len() + } - // Copy the data into the static buffer - source[..static_buffer_len] - .copy_to_slice(&mut buf[..static_buffer_len]); + // Copy the data into the static buffer + source[..static_buffer_len] + .copy_to_slice(&mut buf[..static_buffer_len]); - self.data_copied.set(static_buffer_len); + self.data_copied.set(static_buffer_len); - Ok(()) - })?; + Ok(()) + })?; + } } - } - if let Err(e) = self.calculate_output( - app.aes_operation.as_ref().unwrap(), - app.aoff.get(), - app.moff.get(), - app.mlen.get(), - app.mic_len.get(), - app.confidential.get(), - ) { - return Err(e); + if let Err(e) = self.calculate_output( + op, + app.aoff.get(), + app.moff.get(), + app.mlen.get(), + app.mic_len.get(), + app.confidential.get(), + ) { + return Err(e); + } + Ok(()) + } else { + Err(ErrorCode::FAIL) } - Ok(()) }) .unwrap_or(Err(ErrorCode::RESERVE))?; @@ -223,40 +238,49 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta AesOperation::AES128Ctr(_) | AesOperation::AES128CBC(_) | AesOperation::AES128ECB(_) => { - if let Some((e, source, dest)) = AES128::crypt( - self.aes, - Some(self.source_buffer.take().unwrap()), - self.dest_buffer.take().unwrap(), - 0, - AES128_BLOCK_SIZE, - ) { - // Error, clear the appid and data - self.aes.disable(); - self.appid.clear(); - self.source_buffer.replace(source.unwrap()); - self.dest_buffer.replace(dest); + if let Some(dest_buf) = self.dest_buffer.take() { + if let Some((e, source, dest)) = AES128::crypt( + self.aes, + self.source_buffer.take(), + dest_buf, + 0, + AES128_BLOCK_SIZE, + ) { + // Error, clear the appid and data + self.aes.disable(); + self.appid.clear(); + if let Some(source_buf) = source { + self.source_buffer.replace(source_buf); + } + self.dest_buffer.replace(dest); - return e; + return e; + } + } else { + return Err(ErrorCode::FAIL); } } AesOperation::AES128CCM(encrypting) => { - let buf = self.dest_buffer.take().unwrap(); - if let Err((e, dest)) = AES128CCM::crypt( - self.aes, - buf, - aoff, - moff, - mlen, - mic_len, - confidential, - *encrypting, - ) { - // Error, clear the appid and data - self.aes.disable(); - self.appid.clear(); - self.dest_buffer.replace(dest); + if let Some(buf) = self.dest_buffer.take() { + if let Err((e, dest)) = AES128CCM::crypt( + self.aes, + buf, + aoff, + moff, + mlen, + mic_len, + confidential, + *encrypting, + ) { + // Error, clear the appid and data + self.aes.disable(); + self.appid.clear(); + self.dest_buffer.replace(dest); - return Err(e); + return Err(e); + } + } else { + return Err(ErrorCode::FAIL); } } } @@ -291,7 +315,9 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta Client<'static> for AesDriver<'static, A> { fn crypt_done(&'a self, source: Option<&'static mut [u8]>, destination: &'static mut [u8]) { - self.source_buffer.replace(source.unwrap()); + if let Some(source_buf) = source { + self.source_buffer.replace(source_buf); + } self.dest_buffer.replace(destination); self.appid.map(|id| { @@ -384,22 +410,24 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta // Update the amount of data copied self.data_copied.set(copied_data + static_buffer_len); - if self - .calculate_output( - app.aes_operation.as_ref().unwrap(), - app.aoff.get(), - app.moff.get(), - app.mlen.get(), - app.mic_len.get(), - app.confidential.get(), - ) - .is_err() - { - // Error, clear the appid and data - self.aes.disable(); - self.appid.clear(); - self.check_queue(); - return; + if let Some(op) = app.aes_operation.as_ref() { + if self + .calculate_output( + op, + app.aoff.get(), + app.moff.get(), + app.mlen.get(), + app.mic_len.get(), + app.confidential.get(), + ) + .is_err() + { + // Error, clear the appid and data + self.aes.disable(); + self.appid.clear(); + self.check_queue(); + return; + } } // Return as we don't want to run the digest yet @@ -526,40 +554,35 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta allow_num: usize, mut slice: ReadOnlyProcessBuffer, ) -> Result { - let res = match allow_num { - // Pass buffer for the key to be in - 0 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.key, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), - - // Pass buffer for the IV to be in - // This also contains the nonce when doing AES CCM - 1 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.iv, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + let res = self + .apps + .enter(appid, |app, _| { + match allow_num { + // Pass buffer for the key to be in + 0 => { + mem::swap(&mut app.key, &mut slice); + Ok(()) + } - // Pass buffer for the source to be in - // If doing a CCM operation also set the mlen - 2 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.source, &mut slice); - app.mlen.set(app.source.len()); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + // Pass buffer for the IV to be in + // This also contains the nonce when doing AES CCM + 1 => { + mem::swap(&mut app.iv, &mut slice); + Ok(()) + } + // Pass buffer for the source to be in + // If doing a CCM operation also set the mlen + 2 => { + mem::swap(&mut app.source, &mut slice); + app.mlen.set(app.source.len()); + Ok(()) + } - // default - _ => Err(ErrorCode::NOSUPPORT), - }; + // default + _ => Err(ErrorCode::NOSUPPORT), + } + }) + .unwrap_or(Err(ErrorCode::FAIL)); match res { Ok(()) => Ok(slice), @@ -622,77 +645,76 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta } }); - match command_num { - // check if present - 0 => CommandReturn::success(), + // Try the commands where we want to start an operation *not* entered in + // an app grant first. + if match_or_empty_or_nonexistant + && (command_num == 2 || command_num == 2 || command_num == 4) + { + if command_num == 2 { + self.appid.set(appid); + let ret = self.run(); - // set_algorithm - 1 => self - .apps - .enter(appid, |app, _| match data1 { - 0 => { - app.aes_operation = Some(AesOperation::AES128Ctr(data2 != 0)); - CommandReturn::success() - } - 1 => { - app.aes_operation = Some(AesOperation::AES128CBC(data2 != 0)); - CommandReturn::success() - } - 2 => { - app.aes_operation = Some(AesOperation::AES128ECB(data2 != 0)); - CommandReturn::success() - } - 3 => { - app.aes_operation = Some(AesOperation::AES128CCM(data2 != 0)); - CommandReturn::success() - } - _ => CommandReturn::failure(ErrorCode::NOSUPPORT), - }) - .unwrap_or_else(|err| err.into()), + return if let Err(e) = ret { + self.aes.disable(); + self.appid.clear(); + self.check_queue(); + CommandReturn::failure(e) + } else { + CommandReturn::success() + }; + } + } - // setup - // Copy in the key and IV and run the first encryption operation - // This will trigger a callback - 2 => { - if match_or_empty_or_nonexistant { - self.appid.set(appid); - let ret = self.run(); + let ret = self + .apps + .enter(appid, |app, upcalls| { + match command_num { + // check if present + 0 => CommandReturn::success(), + + // set_algorithm + 1 => match data1 { + 0 => { + app.aes_operation = Some(AesOperation::AES128Ctr(data2 != 0)); + CommandReturn::success() + } + 1 => { + app.aes_operation = Some(AesOperation::AES128CBC(data2 != 0)); + CommandReturn::success() + } + 2 => { + app.aes_operation = Some(AesOperation::AES128ECB(data2 != 0)); + CommandReturn::success() + } + 3 => { + app.aes_operation = Some(AesOperation::AES128CCM(data2 != 0)); + CommandReturn::success() + } + _ => CommandReturn::failure(ErrorCode::NOSUPPORT), + }, - if let Err(e) = ret { - self.aes.disable(); - self.appid.clear(); - self.check_queue(); - CommandReturn::failure(e) - } else { - CommandReturn::success() + // setup + // Copy in the key and IV and run the first encryption operation + // This will trigger a callback + 2 => { + // Some app is using the storage, we must wait. + if app.pending_run_app.is_some() { + // No more room in the queue, nowhere to store this + // request. + CommandReturn::failure(ErrorCode::NOMEM) + } else { + // We can store this, so lets do it. + app.pending_run_app = Some(appid); + CommandReturn::success() + } } - } else { - // There is an active app, so queue this request (if possible). - self.apps - .enter(appid, |app, _| { - // Some app is using the storage, we must wait. - if app.pending_run_app.is_some() { - // No more room in the queue, nowhere to store this - // request. - CommandReturn::failure(ErrorCode::NOMEM) - } else { - // We can store this, so lets do it. - app.pending_run_app = Some(appid); - CommandReturn::success() - } - }) - .unwrap_or_else(|err| err.into()) - } - } - // crypt - // Generate the encrypted output - // Multiple calls to crypt will re-use the existing state - // This will trigger a callback - 3 => { - if app_match { - self.apps - .enter(appid, |app, upcalls| { + // crypt + // Generate the encrypted output + // Multiple calls to crypt will re-use the existing state + // This will trigger a callback + 3 => { + if app_match { if let Err(e) = app .source .enter(|source| { @@ -714,17 +736,21 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta Ok(()) })?; - if let Err(e) = self.calculate_output( - app.aes_operation.as_ref().unwrap(), - app.aoff.get(), - app.moff.get(), - app.mlen.get(), - app.mic_len.get(), - app.confidential.get(), - ) { - return Err(e); + if let Some(op) = app.aes_operation.as_ref() { + if let Err(e) = self.calculate_output( + op, + app.aoff.get(), + app.moff.get(), + app.mlen.get(), + app.mic_len.get(), + app.confidential.get(), + ) { + return Err(e); + } + Ok(()) + } else { + Err(ErrorCode::FAIL) } - Ok(()) }) .unwrap_or(Err(ErrorCode::RESERVE)) { @@ -735,87 +761,74 @@ impl<'a, A: AES128<'static> + AES128Ctr + AES128CBC + AES128ECB + AES128CCM<'sta ) .ok(); } - }) - .unwrap(); - CommandReturn::success() - } else { - // We don't queue this request, the user has to call - // `setup` first. - CommandReturn::failure(ErrorCode::OFF) - } - } + CommandReturn::success() + } else { + // We don't queue this request, the user has to call + // `setup` first. + CommandReturn::failure(ErrorCode::OFF) + } + } - // Finish - // Complete the operation and reset the AES - // This will not trigger a callback and will not process any data from userspace - 4 => { - if app_match { - self.apps - .enter(appid, |_app, _upcalls| { + // Finish + // Complete the operation and reset the AES + // This will not trigger a callback and will not process any data from userspace + 4 => { + if app_match { self.aes.disable(); self.appid.clear(); - }) - .unwrap(); - self.check_queue(); - CommandReturn::success() - } else { - // We don't queue this request, the user has to call - // `setup` first. - CommandReturn::failure(ErrorCode::OFF) - } - } - // Set aoff for CCM - // This will not trigger a callback and will not process any data from userspace - 5 => { - self.apps - .enter(appid, |app, _upcalls| { + CommandReturn::success() + } else { + // We don't queue this request, the user has to call + // `setup` first. + CommandReturn::failure(ErrorCode::OFF) + } + } + + // Set aoff for CCM + // This will not trigger a callback and will not process any data from userspace + 5 => { app.aoff.set(data1); - }) - .unwrap(); - self.check_queue(); - CommandReturn::success() - } + CommandReturn::success() + } - // Set moff for CCM - // This will not trigger a callback and will not process any data from userspace - 6 => { - self.apps - .enter(appid, |app, _upcalls| { + // Set moff for CCM + // This will not trigger a callback and will not process any data from userspace + 6 => { app.moff.set(data1); - }) - .unwrap(); - self.check_queue(); - CommandReturn::success() - } + CommandReturn::success() + } - // Set mic_len for CCM - // This will not trigger a callback and will not process any data from userspace - 7 => { - self.apps - .enter(appid, |app, _upcalls| { + // Set mic_len for CCM + // This will not trigger a callback and will not process any data from userspace + 7 => { app.mic_len.set(data1); - }) - .unwrap(); - self.check_queue(); - CommandReturn::success() - } + CommandReturn::success() + } - // Set confidential boolean for CCM - // This will not trigger a callback and will not process any data from userspace - 8 => { - self.apps - .enter(appid, |app, _upcalls| { + // Set confidential boolean for CCM + // This will not trigger a callback and will not process any data from userspace + 8 => { app.confidential.set(data1 > 0); - }) - .unwrap(); - self.check_queue(); - CommandReturn::success() - } + CommandReturn::success() + } - // default - _ => CommandReturn::failure(ErrorCode::NOSUPPORT), + // default + _ => CommandReturn::failure(ErrorCode::NOSUPPORT), + } + }) + .unwrap_or_else(|err| err.into()); + + if command_num == 4 + || command_num == 5 + || command_num == 6 + || command_num == 7 + || command_num == 8 + { + self.check_queue(); } + + ret } fn allocate_grant(&self, processid: ProcessId) -> Result<(), kernel::process::Error> { From patchwork Sat Oct 9 11:50:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBA10C433F5 for ; Sat, 9 Oct 2021 11:54:08 +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 9B27F60F6F for ; Sat, 9 Oct 2021 11:54:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9B27F60F6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MtfWIrgVqEjurkDICuxzEJh74ZRgpfd1YewLMrG/bKM=; b=YAduZXWEnBZyP2 5/qdQGcKjt7jOiTVLtT/OduEcKV8AM0VWJbehUDv6OLD0HH8/+PXfD+juKo9BaUi7d6cftFonmbXx JjawFZ4LfX7cm4QcP/qgskTY6DcIU3B3pRUzK/ia6XOSO+87ylpZTR6ydbNioHBzq/+LCah8atozs VaAzwfGZmVgyTTUrsMNNY4be+xFXjS0ja445kql7o0swnN4g148Q0VXVliQvNCwy6CY2CIAkNOjkm rfEuRQQ4zJJTpa46zpn1j3U6boLZGMuRVGbN+uCwoUmENoX0L914tzITRIS3SboDyrsDUuSm5TSxQ GBsHCWkhNciK9Z4gkTCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAtk-005WML-Fw; Sat, 09 Oct 2021 11:52:16 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsl-005VtS-5s for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:16 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 8DD47580542; Sat, 9 Oct 2021 07:51:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 09 Oct 2021 07:51:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=5B7osALGkMq4z 6TfUD8C4USTTOHwH17luAiTHWn99ns=; b=Vb1pAROwysxO4IATx/iEZxsvwJA3K zVf3Y8AmAgrzke2OPYeoJtZBQ3c4bA2hy6EJ86Nb3x7XEv++Utltwyb4IUnHFGQs R45VP2ZcAZutb8HjavRxyrvVhe1Zq72Dk2UowYHQofEsP3wYjZbTUPdouibDB9Ng 17N2CUIyWepxC/CkJnd9ZwFxf0XSv9lytcpFbgjDxOeeOgLpt4rPs8pbPWqFSIvQ WUkFHkmAgK81tLE4TmJlTgDp4qQbJrL8HL1hODmrB83nN+V/qIE/mEPTeh0Sz+Xd +/GJpzmXXSDWYma0IvzWm+x5fjTDAmqYcBN8dFsk4SVOMEIlM2K6CFIQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=5B7osALGkMq4z6TfUD8C4USTTOHwH17luAiTHWn99ns=; b=gUEfmhWg mplpy4yPWtX1gOtKXYj5x9xafH1A7COtvZBzLSzZcvLxl2Oc1sQYUfvivpTcFsvE AuiHyRoWUIfR+s8XgrCvruautCr8DCLApokLOHvq/CLBz1g3d/+G1b796UETCnXe bxASw6IX1AkdD0q80LVfRsiIxKqkGLKxRruW8QH8Vgp3uR8za5fcsV6r2+cL32wB wIKOOvsbwI+VqSmPjpYMQ7gQfdifXCxpY/XThdw+hP0k/lngAuFl6X9RGysSJ3V2 OlAlEna0q9QWWh50nKma3H+20pMnUhutQHsUON6M6hEcuCBoKZKwoCwSTWQMq2ne j/k/yOzJGdiT5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:51:09 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH 4/7] capsules: sha: Continue reducing code size Date: Sat, 9 Oct 2021 21:50:24 +1000 Message-Id: <20211009115031.18392-6-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045115_320457_B1594581 X-CRM114-Status: UNSURE ( 7.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alistair Francis Signed-off-by: Alistair Francis --- capsules/src/sha.rs | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/capsules/src/sha.rs b/capsules/src/sha.rs index a296bc6bc..0d2667e22 100644 --- a/capsules/src/sha.rs +++ b/capsules/src/sha.rs @@ -443,28 +443,27 @@ impl< allow_num: usize, mut slice: ReadOnlyProcessBuffer, ) -> Result { - let res = match allow_num { - // Pass buffer for the data to be in - 1 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.data, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + let res = self + .apps + .enter(appid, |app, _| { + match allow_num { + // Pass buffer for the data to be in + 1 => { + mem::swap(&mut app.data, &mut slice); + Ok(()) + } - // Compare buffer for verify - 2 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.compare, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + // Compare buffer for verify + 2 => { + mem::swap(&mut app.compare, &mut slice); + Ok(()) + } - // default - _ => Err(ErrorCode::NOSUPPORT), - }; + // default + _ => Err(ErrorCode::NOSUPPORT), + } + }) + .unwrap_or(Err(ErrorCode::FAIL)); match res { Ok(()) => Ok(slice), From patchwork Sat Oct 9 11:50:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BBBAC433F5 for ; Sat, 9 Oct 2021 11:55:06 +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 653A260EE9 for ; Sat, 9 Oct 2021 11:55:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 653A260EE9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1Mc84PEMDzI2fB+hrp7AAL5nbilVO+nZJHUpwySiGEg=; b=XUGJ+CEAZ92Kxk tjQcPaagScLJWWPfW7HLpxFeLznGIjz4TIFITURFrS9Kw2XYZUe8wth8G1Om20Qno48YGG2ufS+tp 5iaKcFzH8A9YN+jNF1sJLUGZkrpBRuh3EwE5eO/9VRynohiPupEf79PnmCcnpLXU4edN0ZUm/Ob56 UuiM7Qe0hf8PBowleUdR+4/WexeV3vdzTDQYBuCcNylb5ARYT9rXPUPrnNCN2rbWTswlU7dZKEpPm aOvd/VVBaGWu3WuHLP21axnunUAbtHTrzmCUKStPAvd0kdS84X2SlDYa2CiZ4iCBGL4vZFIwpqYTB rlvzkaW4+Cc8O9fZbwXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAuZ-005WnA-Cc; Sat, 09 Oct 2021 11:53:07 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAsv-005VxA-SO for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:27 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 3B3C458055A; Sat, 9 Oct 2021 07:51:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 09 Oct 2021 07:51:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=JmrAk6lslDeRq 3HtNAosrHiHpleBbi7+FujnFXzxuU0=; b=a9jASffo+ouzTcQbMF/wWeyVROh29 Eq8LUJxa0ujsDLXo7W7UqO7LsGhSeJcIazKOG5Cua58Lk56XEy5kk1KDNQGFyHuw 4ZQ4L+p9nnrCrR/redQsfd7++ZObqJX8IN6yOn9oXgA+I3Ms2QbZ++C/P6YU9MCM GWpKN9+KfeIcpFzHuSXhR9artJaEwIBXPywUeDXDm94Bxy37JqYzOZK4lmB0voSK t+QbUg46GnCQRIzwny4qg/p04Fxp/0vUIpPxlUzi/BkPveu2d6+uArgFnS3DMK3r BNv2/c7xFc+G4+HcCJAQrUK9VroD0kQkx3gZxwU+ki2HbIG/li0VY1WqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=JmrAk6lslDeRq3HtNAosrHiHpleBbi7+FujnFXzxuU0=; b=jifjRidy 6ivREx2qZJVJnYB/SDTETrCzc0E6gNKxNGEmaLunPXlJH/NcaOfgE22JhTIZ65yh P5j12PxlXaHsCsdKlqUj4XEN+YEjEmpnmSebPZyCVGEUHWpZ09dNKELycPtNS0/N b60stEAEfwQ9vZQaPfffauAjkPYTyTg68K28DwXWyJDyEbIGBEo4f3/ZSI/7ZLze 2aiY70HsZ+0qMtWrY4SSkF+8LkL5yLye7Tod34MV26ClKDargu5p9TES12FT41RQ HxtCVZKoWuXOHx9ZbrhFK4nkNXzc/6vu18FqNtLRbyQ3pIu3g6UaSD87oNXiojzf 5tveUnbnRALvOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:51:20 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH 5/7] capsules: hmac: Continue reducing code size Date: Sat, 9 Oct 2021 21:50:26 +1000 Message-Id: <20211009115031.18392-8-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045126_050902_7F0300BE X-CRM114-Status: UNSURE ( 7.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alistair Francis Signed-off-by: Alistair Francis --- capsules/src/hmac.rs | 52 ++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/capsules/src/hmac.rs b/capsules/src/hmac.rs index 83d1e5ea5..0ea30635b 100644 --- a/capsules/src/hmac.rs +++ b/capsules/src/hmac.rs @@ -478,37 +478,33 @@ impl< allow_num: usize, mut slice: ReadOnlyProcessBuffer, ) -> Result { - let res = match allow_num { - // Pass buffer for the key to be in - 0 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.key, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + let res = self + .apps + .enter(appid, |app, _| { + match allow_num { + // Pass buffer for the key to be in + 0 => { + mem::swap(&mut app.key, &mut slice); + Ok(()) + } - // Pass buffer for the data to be in - 1 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.data, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + // Pass buffer for the data to be in + 1 => { + mem::swap(&mut app.data, &mut slice); + Ok(()) + } - // Compare buffer for verify - 2 => self - .apps - .enter(appid, |app, _| { - mem::swap(&mut app.compare, &mut slice); - Ok(()) - }) - .unwrap_or(Err(ErrorCode::FAIL)), + // Compare buffer for verify + 2 => { + mem::swap(&mut app.compare, &mut slice); + Ok(()) + } - // default - _ => Err(ErrorCode::NOSUPPORT), - }; + // default + _ => Err(ErrorCode::NOSUPPORT), + } + }) + .unwrap_or(Err(ErrorCode::FAIL)); match res { Ok(()) => Ok(slice), From patchwork Sat Oct 9 11:50:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A45EC433EF for ; Sat, 9 Oct 2021 11:56:28 +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 4E75E60EE9 for ; Sat, 9 Oct 2021 11:56:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4E75E60EE9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E/p+W1hMXEdbQ1SCD3PGGqqQ4pAUREppwdAZreoXNJs=; b=yaDx5NsE7M44gU AKGpHZFOvLM6EQ3xffBOjvvdQvvaDbbE43lwJWGeB7fFo8xi+qcrT7mnmVkkYVLJbymuha2Z2j8Wm Np+QYao+AGIqNh20ovbdD6d3bk97tjrISaGlWYtVsL5Ksqpi/qPF5Qgh7/hGh2aVwcx90PckeG4ms I1A0c3/2KwnIqfgqMp3e3A+63+u+Sz+Ur/VbUfZSXRcRsQvZ6JTlKSL5zjCxK3MmWsX27luAXvNCI XVJq0wFCM/ZrJ8/24qIoZxLAXW5ce2LHOXon8Yq+ky+a1yseOR42oJT1J1ZDPCnVAe8tjbEvW6fzn zoDRrqTwa5wRgX6UXsqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAvr-005XUY-Qm; Sat, 09 Oct 2021 11:54:28 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAt6-005W2G-FK for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:38 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id D0FB4580542; Sat, 9 Oct 2021 07:51:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 09 Oct 2021 07:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=ZfeDL5nl1NIgK gueOXQ9S8l3j9f7cNPcD1eW3HuqJ6c=; b=nTXuGOHjcfMv7uAOFLSmxDkxDpm8D Kx3TNYqjiqc4Ny9d3iM41Se7kAihs0ZuJyLzGofN+KySwf3h6V+ZSO/p+OA1tZsG 1AGU3USqL6SFEc+ICPLYVxJ5vsRMXF6bwJo8L2ckyqoRuSx5HbzWJ2Vbwhatc2/6 N3HRU15p/Y3fbgle+sllPmAbMLBRC4xODsfmnC2aBnVIkYQuQOZg16XVTWFPrnsM MQCbJMeGk+N7G4S1jD4zqy8JaSLHrETXpao6Nxshi9cDZmCYj9WTu4JpxJ5HDMTd SY7/aTFjeGg1WxazrSJQ5mDHP8XDIyZFU49LpcWG5d98tu3nTjcvs4lPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ZfeDL5nl1NIgKgueOXQ9S8l3j9f7cNPcD1eW3HuqJ6c=; b=jngZVZ83 3ukS+OUgvzzRP3rbqs17nVXjYnRsI9eZxNWHf+kH7ZqAnsifoEuVlzyZ+pxKn9rT xUBCG63Exp12DaTSxb4sLVanRDYvtiiOJhHqzgBHm4Yr99ScWRMO7v0lPAEGNHdX EAHE+aLVkp1Nt9954jNtzw3Y5j5kwWbZHvOmsoVsBUBWc9CY8rqSnKXUYf/4i17N x21u5FvHmXh2LMHAeViSzdnlj+N9KcibHVemWKT2WnvU4W2lsIA+37jsfxs0hfvC /8+BJLoZzuC1xuI7ISemQhwOomDHWN+XNmcfzn8XtLEdUbgKnlj2KL/S0+jsy3JM qIPlZ2qSKTzO9Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeehffejteette ekfffhvdeghfegvedvvdeujeehheefveefudefgeeitdehueejleenucffohhmrghinhep rhgvmhgrrhhkrggslhgvrdgtohhmnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrg hmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:51:30 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH v12 06/10] hwmon: sy7636a: Add temperature driver for sy7636a Date: Sat, 9 Oct 2021 21:50:28 +1000 Message-Id: <20211009115031.18392-10-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045136_706929_8520204E X-CRM114-Status: GOOD ( 17.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a multi-function device to interface with the sy7636a EPD PMIC chip from Silergy. Signed-off-by: Alistair Francis --- arch/arm/configs/imx_v6_v7_defconfig | 1 + drivers/hwmon/Kconfig | 10 ++++ drivers/hwmon/Makefile | 1 + drivers/hwmon/sy7636a-hwmon.c | 77 ++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 drivers/hwmon/sy7636a-hwmon.c diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 8a54a4d0181a..b87adf823e44 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -228,6 +228,7 @@ CONFIG_RN5T618_POWER=m CONFIG_SENSORS_MC13783_ADC=y CONFIG_SENSORS_GPIO_FAN=y CONFIG_SENSORS_IIO_HWMON=y +CONFIG_SENSORS_SY7636A=y CONFIG_THERMAL_STATISTICS=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_CPU_THERMAL=y diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index c4578e8f34bb..59f358293202 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1651,6 +1651,16 @@ config SENSORS_SIS5595 This driver can also be built as a module. If so, the module will be called sis5595. +config SENSORS_SY7636A + tristate "Silergy SY7636A" + depends on I2C + help + If you say yes here you get support for the thermistor readout of + the Silergy SY7636A PMIC. + + This driver can also be built as a module. If so, the module + will be called sy7636a-hwmon. + config SENSORS_DME1737 tristate "SMSC DME1737, SCH311x and compatibles" depends on I2C && !PPC diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 162940270661..1355ffdb1481 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -181,6 +181,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o +obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o obj-$(CONFIG_SENSORS_TC74) += tc74.o obj-$(CONFIG_SENSORS_THMC50) += thmc50.o diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c new file mode 100644 index 000000000000..e0204278339b --- /dev/null +++ b/drivers/hwmon/sy7636a-hwmon.c @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functions to access SY3686A power management chip temperature + * + * Copyright (C) 2019 reMarkable AS - http://www.remarkable.com/ + * + * Authors: Lars Ivar Miljeteig + * Alistair Francis + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static ssize_t show_temp(struct device *dev, + struct device_attribute *attr, char *buf) +{ + unsigned int reg_val; + struct regmap *regmap = dev_get_drvdata(dev); + int ret; + + ret = regmap_read(regmap, + SY7636A_REG_TERMISTOR_READOUT, ®_val); + if (ret) + return ret; + + return snprintf(buf, PAGE_SIZE, "%d\n", reg_val); +} + +static SENSOR_DEVICE_ATTR(temp0, 0444, show_temp, NULL, 0); + +static struct attribute *sy7636a_attrs[] = { + &sensor_dev_attr_temp0.dev_attr.attr, + NULL +}; + +ATTRIBUTE_GROUPS(sy7636a); + +static int sy7636a_sensor_probe(struct platform_device *pdev) +{ + struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL); + struct device *hwmon_dev; + int err; + + if (!regmap) + return -EPROBE_DEFER; + + hwmon_dev = devm_hwmon_device_register_with_groups(&pdev->dev, + "sy7636a_temperature", regmap, sy7636a_groups); + + if (IS_ERR(hwmon_dev)) { + err = PTR_ERR(hwmon_dev); + dev_err(&pdev->dev, "Unable to register hwmon device, returned %d", err); + return err; + } + + return 0; +} + +static struct platform_driver sy7636a_sensor_driver = { + .probe = sy7636a_sensor_probe, + .driver = { + .name = "sy7636a-temperature", + }, +}; +module_platform_driver(sy7636a_sensor_driver); + +MODULE_DESCRIPTION("SY7636A sensor driver"); +MODULE_LICENSE("GPL"); From patchwork Sat Oct 9 11:50:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58C78C433EF for ; Sat, 9 Oct 2021 11:57:04 +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 25B9A600CC for ; Sat, 9 Oct 2021 11:57:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 25B9A600CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mtDmybNCOexevLDOXZVSFCtEqf/AOFx89tLhy70+qL8=; b=tqe1uMwNQPp8RI O7CxqGBYZ0l43iJ5bq60P9pHgMmlapUoZAgy7+z+xh07KRRcyqN1kzsAGHCL+RkOyALW5NizSxodz +GN94zr37RYaPho1kCGPHGrZTv399/+0yP0SpcREXCBTKwNhUGWc0NvALoaOQOnM5HfWytSlmCVF/ nUQBNj4KHOwKpFWq5PwWtN/ZUMsxWMK64+IX/db5Abm9EBPj6wgpQHBRxSGf3fOjV/2MjYndBM4U/ 8IOZbAt1GaRUa1YepEMLE0ePQQoL2MEtQBo09699zbGuAQQJJEbm71KnfHZ16sv+nmxIe0ExbPtvT 57wbpiqxmRR+Co1BiuLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAwb-005Xpx-2w; Sat, 09 Oct 2021 11:55:13 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAtB-005W51-Pc for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:43 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 26A09580542; Sat, 9 Oct 2021 07:51:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 09 Oct 2021 07:51:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=SfTCPrBXtXpiG gTbdqeWVHIPqy46+Y5IyiDSgZKSQDY=; b=1rQCWKJEot/fFQgxw8gLyO0NTmfsB vgCatKYCV5LKay5Jt9tIouF0BspSZ7gBH67QdQFE/yptY/aibyPML8tq511KpYBA GAOkgh/cBGs8MmluBHrRjoj45c6AZHT/+WCfjNeyX2ZPC8w+NykYcoow7f0mXRnU ROX3ZXZ+w3dR5VPG+j2UuOzOQdjBhFwoBc/+jRK6Bh+nGwVvuA++hHYq+yePxubO NriVOPnHDzCinZkIgbGSq7Ydr4vYnLTiwefe1h+UejjycUfvurzV8CVvlLyJfXMv CABGNKLCOdQ8nhGeBmg2oLt0kvgyOoFBJLOukca+ZcfPihhbgVYEQlo4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=SfTCPrBXtXpiGgTbdqeWVHIPqy46+Y5IyiDSgZKSQDY=; b=Ncp64Xvw yB9DxDHQSvT3CdHMCRT2BjlYaYGOgmZyZZapB7Jb+2qiakNoKDF51dXI1IZizswZ KFvdq0sp0P/dLsyf92L5o25rWYn4Z+14ahv3Tftnp53XBKR6qCfu1hM3ewNoExvm S9nUB/AOREIVrV5Dlx6PWFXD78KaqEOyJJHrWVAdQKj7b6dBxp+kydi3EEO99hnX g141xRJPu900J65Itor/x7cuUlQnATeL1I9bhidIUOHgGWemo2g6unfNRjzLfp6X DLFRZzk3KheqkExoMKuyrX2hnS9dZLEOcdU4vGD58tvzkfYailz+o8PovjXObRt9 JVcZtBv6R1Zh/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:51:36 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH v12 07/10] ARM: imx_v6_v7_defconfig: Enable silergy,sy7636a Date: Sat, 9 Oct 2021 21:50:29 +1000 Message-Id: <20211009115031.18392-11-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045141_934004_60A2C34B X-CRM114-Status: UNSURE ( 6.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the silergy,sy7636a and silergy,sy7636a-regulator for the reMarkable2. Signed-off-by: Alistair Francis --- arch/arm/configs/imx_v6_v7_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index b87adf823e44..507ab17cfcd8 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -233,6 +233,7 @@ CONFIG_THERMAL_STATISTICS=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_CPU_THERMAL=y CONFIG_IMX_THERMAL=y +CONFIG_SY7636A_THERMAL=y CONFIG_WATCHDOG=y CONFIG_DA9062_WATCHDOG=y CONFIG_DA9063_WATCHDOG=m @@ -248,6 +249,7 @@ CONFIG_MFD_RN5T618=y CONFIG_MFD_STMPE=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_MFD_SIMPLE_MFD_I2C=y CONFIG_REGULATOR_ANATOP=y CONFIG_REGULATOR_DA9052=y CONFIG_REGULATOR_DA9062=y @@ -258,6 +260,7 @@ CONFIG_REGULATOR_MC13783=y CONFIG_REGULATOR_MC13892=y CONFIG_REGULATOR_PFUZE100=y CONFIG_REGULATOR_RN5T618=y +CONFIG_REGULATOR_SY7636A=y CONFIG_RC_CORE=y CONFIG_RC_DEVICES=y CONFIG_IR_GPIO_CIR=y From patchwork Sat Oct 9 11:50:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29ED2C433F5 for ; Sat, 9 Oct 2021 11:58:01 +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 E3C2060F6F for ; Sat, 9 Oct 2021 11:58:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E3C2060F6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2E5VuXjvBsHrfrAsxb053K/bOXv8vXdJOEsZFwDC7ho=; b=rDmqpVIL96kvGp 8mRp81GGn1Qb87vUuxHRESepQ5/+HJwXRCC7HHkhW8oRz1EOuVvn+dICfQpBFxTyMvO8hFVpxcaZ+ tsGjNDDFeFePVsOq6Ju+V0doFd0W762iGMg7kY+dsxfmPILEjHOa2vDTPJ10jc0my8kM7OizTMYK0 MTQEwgSsbbQC/Zi2o8kLUM3bagYOBIND6JCJ2SZCyU218YVv78a8zV9h4bXEP4tpk5W5UwRDA16aq YcPauOZDGFPU4E2XJKxnr5C/o29Y8UU21BH59ZWcmlEVkmfMstKVLqHef3PBcOrQ34YIYg/tWAtc0 rDbJEwnsqF7o4Z4KRkEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAx7-005Y3d-ET; Sat, 09 Oct 2021 11:55:46 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAtH-005W7M-3n for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:48 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 643AE58055A; Sat, 9 Oct 2021 07:51:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 09 Oct 2021 07:51:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=XiqTZKl1McPns kC+dsf8QVzxlqYLoghf8xc3andbQlc=; b=qRFtx2kR06CVDRGF+zN8ihSZfCIjW YuSf37CnflE31Q+lNI2bPmCQpjkKKjej6zER92QOvJp82OA4d22Jyu1R1UeiSOEx SAv1niYx+SCPP6Q1IymldzRRLcYNLIV0T+1o+YEk4L0OzKOuVZRDrFJLfO96gHrK I7nP2+5Op52LfmQI4+H67gjE6CQffSKlQ5oy+38pt1qJIBISakED2dJWXLgOkIfn 2ueH2gGnT0uwyof7JU2/pnXndgiyNK3jwTv3PSHoc3P/kmnloCZDUAYBh6iUXJKD //+5hmZPCqvb6HJ+x1hqVG8geiXnjf3b7E1XTwMDP7phuH1soOdmrI4uw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=XiqTZKl1McPnskC+dsf8QVzxlqYLoghf8xc3andbQlc=; b=MCZu76iT StWrmP0VJoW7XiwAsIo0zlFjgqZlHu31p1pl2zQDURXcSzoIta/hdFm+girT32Yn kPvq9kB/UjNejbKsPm6MbYZZChQe1r14o+Eaqm4snbPq+A7Ph7MAnPo3Vg3xi/E+ KxHfiE40T9Q37kRugnMabhBRQ5gHjDcFTkRTf4Te2rdWn9EBQrHJzdhyLjQuYIpq xQ7xJoNLfYaYytu7dF106zuMtSEa9sI/Ej7R9I8Z6DWxz/l46ryGT7+2O8sZzE6g yqArghXjsLoCd0P4CSGjsyg6UcXUS5WC5OspxtpgRx4E0vt0ZrKvGig25sogyp5i if7bartooPycZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:51:41 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH v12 08/10] ARM: dts: imx7d: remarkable2: Enable silergy, sy7636a Date: Sat, 9 Oct 2021 21:50:30 +1000 Message-Id: <20211009115031.18392-12-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045147_263011_A3E4E141 X-CRM114-Status: UNSURE ( 7.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable the silergy,sy7636a and silergy,sy7636a-regulator on the reMarkable2. Signed-off-by: Alistair Francis --- arch/arm/boot/dts/imx7d-remarkable2.dts | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts index 2099784d6515..1b49c26816cd 100644 --- a/arch/arm/boot/dts/imx7d-remarkable2.dts +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts @@ -87,6 +87,33 @@ wacom_digitizer: digitizer@9 { }; }; +&i2c4 { + clock-frequency = <100000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_i2c4>; + pinctrl-1 = <&pinctrl_i2c4>; + status = "okay"; + + epd_pmic: sy7636a@62 { + compatible = "silergy,sy7636a"; + reg = <0x62>; + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_epdpmic>; + #address-cells = <1>; + #size-cells = <0>; + #thermal-sensor-cells = <0>; + + epd-pwr-good-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>; + regulators { + reg_epdpmic: vcom { + regulator-name = "vcom"; + regulator-boot-on; + }; + }; + }; +}; + &snvs_pwrkey { status = "okay"; }; @@ -180,6 +207,13 @@ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13 0x14 >; }; + pinctrl_epdpmic: epdpmicgrp { + fsl,pins = < + MX7D_PAD_SAI2_RX_DATA__GPIO6_IO21 0x00000074 + MX7D_PAD_ENET1_RGMII_TXC__GPIO7_IO11 0x00000014 + >; + }; + pinctrl_i2c1: i2c1grp { fsl,pins = < MX7D_PAD_I2C1_SDA__I2C1_SDA 0x4000007f @@ -187,6 +221,13 @@ MX7D_PAD_I2C1_SCL__I2C1_SCL 0x4000007f >; }; + pinctrl_i2c4: i2c4grp { + fsl,pins = < + MX7D_PAD_I2C4_SDA__I2C4_SDA 0x4000007f + MX7D_PAD_I2C4_SCL__I2C4_SCL 0x4000007f + >; + }; + pinctrl_uart1: uart1grp { fsl,pins = < MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79 From patchwork Sat Oct 9 11:50:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12547617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 382FEC433F5 for ; Sat, 9 Oct 2021 11:58:46 +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 E93D160F6F for ; Sat, 9 Oct 2021 11:58:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E93D160F6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m5KLb/LyqJJVY6QlRRC62UtIXDpo3k8g00pkdZjPMzY=; b=TWCyRJFVsrnn8k GgBY5+92POH9A20J6pCgb8myPTJwSZ+vrrIjfA4JoyONZL5aCz7MKvD4TzPg65bhkvbRttl5wcCjT xvCt1IW0RPWLz1ydiiDPfkgFXUYn6P52VZceBPOQDIDf8TYBO6IATLkfCoBMf7BDGptimb9p+T/ca 8lyhvvhtdWIUVPq0beTbtM+biUsRZIOO5t1pSXCMtxCIZpBOr+tPWicBiu55uRVOKvpRF88V26oPg H3mAW4T72ssmuQ/p/3N0fSus/ox0d1L/79DOXaP2PIILX+aw2HzMMLLKbQjzJUyCq6YdU/kEYkXCI ypVPyBppcT3rLCGx7fSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAxt-005YP2-RQ; Sat, 09 Oct 2021 11:56:35 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZAtM-005WA3-Ao for linux-arm-kernel@lists.infradead.org; Sat, 09 Oct 2021 11:51:53 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id B002158055A; Sat, 9 Oct 2021 07:51:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 09 Oct 2021 07:51:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=VqCaXYMs9oVz4 wTwqKZPPKhhsXOGl6f0l2zOxe7iOCk=; b=EeZUxiWmaJgEQmBaYdEGuYQn7OQLw w2iIhKOiPm5cZqOnzcwHMLYpjg/UamqBZ2utXCoa5pyJFAmsVPcRKkM/PQWL0BXM P2/k/QKh435qihn0pG39B7lMM9Ar0htAeyQshj2GRCsF6w58PBHb5w1uYfBIdSCY eQz9zZFcIs1Mk74xP07oOEaFx4MUU+0/cjz6madRUO/3X4uQ4DEiMdHlnlzaKKnK wZtZLjRwIvZzNpQ/5MK35nqnsThi2SF007Pnc0TsLIbBw8KJ8vgLHTIS6XrpWjw8 YC93Ar06TyZRHniPwXB3Zoh4aQejZOUg6GLY35KIJyjSkZFNRYcFxFs/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=VqCaXYMs9oVz4wTwqKZPPKhhsXOGl6f0l2zOxe7iOCk=; b=K80+mcUm k1u00sCjTCaIVbsC4SP/tstP8mJWzDMa8AaD+FwtCEEQqBS0LekJAXx3gCBqi5RW nyasRG8QxQjEQysvfKrrW9m+K0ybG/devR0MZqF+tuFuO59H+RtOwCmSN+DCIEZ9 IlssKF/3ozlVUyT+9QuwAkmAKcIIOC9Wr2cNk0Qjw8QjVdmbhCduZcpA7Jp9r23U hlsIuFRpoTBNc6IcV0wljHA2KZe4Wl8n49MxU92dPT14kJOYd9x+aEtTXSQkqdzK ESvKeT0O+KhhuqnX/owFegGlkaDVDVTkgWoFlMoxw2LHA+1W3NrO8cjXn+PdGYbg E/HZpcjxib4Uug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 Oct 2021 07:51:46 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH v12 09/10] ARM: imx_v6_v7_defconfig: Enable backlight class devices Date: Sat, 9 Oct 2021 21:50:31 +1000 Message-Id: <20211009115031.18392-13-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211009115031.18392-1-alistair@alistair23.me> References: <20211009115031.18392-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211009_045152_471382_39F51A10 X-CRM114-Status: UNSURE ( 6.20 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The BACKLIGHT_CLASS_DEVICE config is required for the already enabled DRM_SIMPLE_PANEL to work so let's enable BACKLIGHT_CLASS_DEVICE. This allows the mxsfb probe to complete successfully on the reMarkable 2. Signed-off-by: Alistair Francis --- arch/arm/configs/imx_v6_v7_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 507ab17cfcd8..6b3744e6379b 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -300,6 +300,7 @@ CONFIG_FB_MODE_HELPERS=y CONFIG_LCD_CLASS_DEVICE=y CONFIG_LCD_L4F00242T03=y CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_PWM=y CONFIG_BACKLIGHT_GPIO=y CONFIG_FRAMEBUFFER_CONSOLE=y