From patchwork Thu Sep 24 19:24:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798171 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 579AF59D for ; Thu, 24 Sep 2020 19:32:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 270FC221EB for ; Thu, 24 Sep 2020 19:32:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bukrKyaR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="IA0Ine8k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 270FC221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=UWqvmCEyGkY6QfrFdpl0UcVHTmsj7hUaPn6qru0jyZM=; b=bukrKyaRiyvVK8bEjlA6FIpu9 PHc1ImiwHL3LM+oY2FMQjW+I2WP3q7Y7wghzbjtquc+iGNJozjf2BHT5rjSjSmmh/tgruJuOloRLW 9LxcXBGu4yyfuBxq2XykoIWWY60lotzCSNKwtLOqMZ7nNrmVbB7jm1rHRxts07EniVhUnaUpb4W0M D7Pz3obTRe4V8m4jW5SzmocGc0YhNCiPat+u0Kwk4FMLbiCcvYkwIJt3I9zrtSZ3kEVsOIJeyP4p4 UrZUxd8bvx2ol/KGS6JZ/KiSstv8KyXejyFjIuFrhGCAoGLHcc6Bz4xEoNasKNfQptEwWgHf1CQTU opnSfgvUg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWyk-0002kj-H7; Thu, 24 Sep 2020 19:32:30 +0000 Received: from mout.gmx.net ([212.227.15.19]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWyi-0002jf-5C for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 19:32:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600975941; bh=vG7ZTA0jFRagSSV8QIx/+2jeo4eFW8MwsHCZasCdkYU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IA0Ine8kPURWFok2bCa74GJ3T1/cmmaXFFtTcX4wbrTqJqpJQafmd+07AYvdZWjRf cragT9tXLu/k7n56pHOrCkFAK9LjLF21BZb6Zm1EUdrCwUr8Vpkx27LpkL+DoOkbwu CKvFy8lhz+xJZpJ+GKzE+9SjR/wn+CWCFQmAU3qA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MFbRs-1kEL4535oc-00H8PV; Thu, 24 Sep 2020 21:25:19 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 1/7] dt-bindings: Add vendor prefix for Netronix, Inc. Date: Thu, 24 Sep 2020 21:24:49 +0200 Message-Id: <20200924192455.2484005-2-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:pO47K7lhh+4oAX8Mbuu5NKAh+EJN9++GyAeiyO9lsB21FUmXQYx rFfydoOf6MUnID6L3WLSmqOamk2MdB/3iPI8iEfwtNwXWgjHWQa65+txeiz2Jk6QOQLH1hM fm0iUBLS4LoiI+nQ7Go+ivm8qfyV/lHBX9hj8/7P07+7HVhEJ4mTO2r/WeHDXjj9V933QZc hKduv/t8JopCHJaYU+D0A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:oobTMOt3D6g=:sPXVm8O1nT3F+WmpnrnCzS zfMcGa7uZ/gFyQ5WIK3y437NRLK7NnBhxpEWQBklyNstZy39zJOQR2GxhLU5j2yIaHueo6nmu u/NiRG/ypRDm3XjEYIGej78ZktyX668v875Pe6ZfVOMBxbtOLJPnFeT/55TtjLtkQWkbXfQ3g loEUF/9gqYBJ7emkK8O7Axx9y79Wq6hcwvr1lNKH2EUl529bnIZ6XWiHLSZhz0X1jn/l+nye7 dm4ToyFwjUGNYBrnj8yhZmSNn4UbVjW+jZdUCE5KxVDlHkoyLnY1ML6pZw2CDWbvwuaknx50S gTqtzNhUcjHCiuc3vvcbh0mPuxruJzkuQM6GoWHP3aZ4uBtQSqnGgX08CWmeVdKe2VjXNhoZ0 HQrhhzhsppBpGpPcdBAgX0gfi9m+XBc80UsAbShI1f4A6wzIXsFW59QjGa5I40u26tb60WRaK jGWrtpCvzXpvGssAakRFkviTSucyFsqVYw/08wsZ5fE6HAvo7GElDWYXWHnZFSXqTiz8eCV9g YhJO/fmpNKHZluk6tQGev5BnWZ+E0LwzlIQcUtsJ7Uef+WTCf8n+nmZ53qar3yuQtcigvDqyp GiAvIo45OZSGRQe3vG+NuU/twkl+ffdoE0A64Snem8kV5pcS2b00U2CiAt86NU7Iqt7x10fpf q2OcvZ5MLXZEc+EI/PCVjlEzLXrT4ORBVAlDL2LfWOlkjhqT5cb343d4o2s3EJWkvcizlXeo/ b5l+IU0b0LJTJLzakqVheLs0SEp1WE4BfZx4slbD3kSqKbj5y7X9zMHcy/4SNMYr0y4O52tGv 5oAEaPIrcRIOHtR+F/kpx9nd/sWuZf9v/K38OKGMRMuRqEq+aFphTPT7PWYJmj1o605RHZLT1 lA+lrKW9g0z15trZaFiN2IOprFlmg4UmmmUYxcA8v0bU22s3HhFJOvBohdPEtY9i2hyLiU/tq X264FxEw6LBJvRdfxkOA/aVDvX6HCtSKDIvX+IOIz2VDMrAjTBAuyRnmSd8vFNzWnwdo9Wb0d 6HuXcvwNkPcfhmWVbp2sP6rdu6NlVKmpHoAbQmbC1aY1YB0h366sDAMamnFP6zwSjpiw2n30G ZUoFg8r7CdOv1cYkXXqlKMou3d/wqvBuDzAsEnCbCjNtkvLIDTcuTS0vPWV4fmlSqo3T2x6le yix3z4kIxJTGVn6L0yfztJpeehawqhiq5JOzIHD5p+r4Ltc6QI7b2XbBb9j/yhe2h2dLdTohx 9g3gownuPDeisZSPaOQNCN9X86ykdwuU7lFzF6A== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_153228_416092_C10B76BD X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.15.19 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.15.19 listed in wl.mailspike.net] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , Geert Uytterhoeven , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Rob Herring , Kuninori Morimoto , Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Netronix, Inc. (http://www.netronixinc.com/) makes ebook reader board designs, which are for example used in Kobo and Tolino devices. An alternative prefix for Netronix would be "ntx", which is already used in code released by Netronix. It is shorter, but perhaps less clear. Signed-off-by: Jonathan Neuschäfer Acked-by: Rob Herring --- v3: - Add Acked-by tag v2: - No changes --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) -- 2.28.0 diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 63996ab035217..fa173802000a0 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -712,6 +712,8 @@ patternProperties: description: Broadcom Corporation (formerly NetLogic Microsystems) "^netron-dy,.*": description: Netron DY + "^netronix,.*": + description: Netronix, Inc. "^netxeon,.*": description: Shenzhen Netxeon Technology CO., LTD "^neweast,.*": From patchwork Thu Sep 24 19:24:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798151 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 58519112C for ; Thu, 24 Sep 2020 19:26:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 02C8E221EB for ; Thu, 24 Sep 2020 19:26:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XvQE9/15"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="hsSQXm0O" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02C8E221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=j25h68Mz2AegngWLR8cmO3fHJ/emOaKRQaqy5tBYfrA=; b=XvQE9/15NPgHH+6IogccPFAzW ePqES0QhCuEZMc8LY8qize4a/EXQxmw7qycDwh2ZvxgcDB5oMXPCuaHZAGeVzsHPjQoNvqbbgVjFS 4T609/VsePKLrLFXNjy92i77z5+/MbbC8IojQJuP3qnqFok8kxy26F9m2o48zaRNOvCb/lj1eOjDp Ft4czX2TAt3ddl0Y28VKmr3Rr17EGnhaILndRUhOPvbGri1hcb3kb5AA0xv7IORmiWN/6K2j7l5OV Xtd15MraI3iZcKc+pLhHQt3yV4Ym1gmhKfCNFrwaJPQkO1+J/cI+k/aIvEYO6O8F1XtSNOSxhTiCb Q8G9Bg+1A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWt7-0000XW-Mb; Thu, 24 Sep 2020 19:26:41 +0000 Received: from mout.gmx.net ([212.227.17.22]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWt4-0000Wi-Bo for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 19:26:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600975562; bh=4RP05Hxu1YyFCz7+DB7beV9x6hPWq+uDXnTvDpZdY6k=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=hsSQXm0Oq6VogrOInBGGpvEucQOQbIzFwmoIikwUhl9YtvqFJWXti50juDgryWoxv mdbUNoIbQib3Zb/qBt2P6tnjB/NTqCZ73ecMj5LmyMVFeeeAb5EqT+PGljsKcHQEvc Gwcyt6wUf5OaDgrfAIoJlKlQNQQ9iF6IFn6Ew9SI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Md6Mt-1kvPez1hel-00aA47; Thu, 24 Sep 2020 21:26:02 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 2/7] dt-bindings: mfd: Add binding for Netronix embedded controller Date: Thu, 24 Sep 2020 21:24:50 +0200 Message-Id: <20200924192455.2484005-3-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:qIN3ysCKzKV3E5U7e0Zvu94KfThse5uh01FGd94RNlLA36XGY8l Y1vNOclGmg8YGMfZO+sqyDVFSUMVMtr2YvjymT4L8q2Xk/YfkQoNim4gVLoCPVe2CXuZZS1 h4YG4QJsgnwg/wR0GoJ4PM1kFUyfAq9cy4P5UTu8eFV4SzakZ7JCPjDt3sfIayylmpAnlEl 1ptuHS16ONJ7Qqyk98g+w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:q1gx0ANm+Fk=:Uz6o9t87EdUULbT26pkTS4 I2waJcKQPiiBL+aMyrZLnMslGbyFapvEowFE29Kbj0xBkefSUaokU0YVpDDt8Ot2yJpiH5h+0 +N+BEIAL+QpRD7/yTAk5kK3F0rs3nbHTrIPMrDUQ7mYJAUK+h9sklqLqYB7gZR0ivPDvTzqnE Uk0c4Jt5cQHsq6oCppD1stKsvUv5IQ6VZguMe41uhzfbBL83NTtKwUY6TKs+fyREVrLEvPU2B UL6bbIDrvxcn8ecJ91i63WrqT1YITn0xpqEPX8Xpg5f/S5irZXY8idtSkxgejmg50vSnXDhpw Q7YRvWa/CHE0oBhWQ/bXC4ikgYgvComa7VlPBOiyHSUcJ2LVi3RDFCTdFoqHRAvAQgLSlXeSr Dg36yzFFYnzCB7pILOfXHe4C7KWvdfQcqsryrEH7lmb96LVFGaxy1PAIzv+P2FG+xgWXE29lg y/ghHP7QZv9sUNWSJAv0Unj/rDTV1P+JHxDg3SZ2n/x3m8W+tjwUvVDN6WByYKmKq3ATaZkdX PVaztpDYMD87WK7RRpM5Ek+FfgJRW1rH55Qh75MOovC0aRG1gvttKXrNdqHWKa67rPVnzkzYW ryY5R5En9JMF1Q2yD2u49MJ6hy1Jp1rQjvr2JvjxdIQVyuqhEfXj5SV9MIPliFg85dbTDDKcO GZm2F66mRhZycfdoShPZC38S/lKZ86Hd4aLEAnnfFQyUHNr76/unKOBBQvhTO/FWbNA0Cu3iP yujRNLKPbPovjXylO57SNtWxylRPegneu66g7WHsNkK2vQ8DNaIjH6m6UkKPdUyBUNXZybP7Z tRSHcFGKkPUAP558qGOLFP0y4oTF9iYN7kB8QuEXYj50fg6eMGAhwzsIi7X0T5jQ2QSI1J3ND /kr0FdfaGTWUIBCx7lVtdMaHgu0OkldW74W4B2mAv0l4xv4EdOxFDrFoMAMwTkcmoIYRiA7x5 sFIDZjzxEz5mHQOo/0Ga2kYuv0u3/aKyp0N0reVdW7frfHIXh+LiDEowctzYT3w9/l7bhlb9F FRYAdrzngHBVxOcnRhqw3tjiJ0dVOHJQNx/Uvrj1SvLBOropC3Ib5Bl36s/wcakT1oRzcCikL bENd1KNA1xCi7axkN8JAuR23JGyAHDslFfuWho4xOcgJxZBCEBjIuxQbeRZTS2ZMhCkXiUVsC FeQPqlc49m9S4Q7LBqCxGuuUVQ8n63fb9GfEStPB9StFA09GuN32TesFa81l+ULgMrgz8/aw1 3uZsePsDv1RezN1dCSk0NmYpM+Q9/17jdJ2craw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_152638_615055_42C1A2B9 X-CRM114-Status: GOOD ( 18.14 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.22 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.22 listed in wl.mailspike.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This EC is found in e-book readers of multiple brands (e.g. Kobo, Tolino), and is typically implemented as a TI MSP430 microcontroller. It controls different functions of the system, such as power on/off, RTC, PWM for the backlight. The exact functionality provided can vary between boards. Signed-off-by: Jonathan Neuschäfer Reviewed-by: Rob Herring --- v3: - Remove binding in text form patch description again - Add additionalProperties: false - Remove interrupt-controller property from example - Merge pwm/rtc nodes into main node v2: - https://lore.kernel.org/lkml/20200905133230.1014581-3-j.neuschaefer@gmx.net/ - Add the plaintext DT binding for comparison --- .../bindings/mfd/netronix,ntxec.yaml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml -- 2.28.0 diff --git a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml new file mode 100644 index 0000000000000..59a630025f52f --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/netronix,ntxec.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Netronix Embedded Controller + +maintainers: + - Jonathan Neuschäfer + +description: | + This EC is found in e-book readers of multiple brands (e.g. Kobo, Tolino), and + is typically implemented as a TI MSP430 microcontroller. + +properties: + compatible: + const: netronix,ntxec + + reg: + items: + - description: The I2C address of the EC + + system-power-controller: + type: boolean + description: See Documentation/devicetree/bindings/power/power-controller.txt + + interrupts: + minItems: 1 + description: + The EC can signal interrupts via a GPIO line + + "#pwm-cells": + const: 2 + description: | + Number of cells in a PWM specifier. + + The following PWM channels are supported: + - 0: The PWM channel controlled by registers 0xa1-0xa7 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + ec: embedded-controller@43 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ntxec>; + + compatible = "netronix,ntxec"; + reg = <0x43>; + system-power-controller; + interrupt-parent = <&gpio4>; + interrupts = <11 IRQ_TYPE_EDGE_FALLING>; + #pwm-cells = <2>; + }; + }; + + backlight { + compatible = "pwm-backlight"; + pwms = <&ec 0 50000>; + power-supply = <&backlight_regulator>; + }; + + backlight_regulator: regulator-dummy { + compatible = "regulator-fixed"; + regulator-name = "backlight"; + }; From patchwork Thu Sep 24 19:24:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798153 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 6C60859D for ; Thu, 24 Sep 2020 19:27:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 2B7EA221EB for ; Thu, 24 Sep 2020 19:27: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="EDk7odV8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="PauaGvg+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B7EA221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=sG23oaKpfXXIc7sSX4vbogj7d6r2F74vZlztoD1Xj4g=; b=EDk7odV8Hb6RqaiVRc+FL1Z7L rsCsCtTBPQQjhpyNfsUVR4H6+YkIJgSzxIVe+LJEHUd/0jV+Rqi8SxsbCqrl+Rkb0XSejUBYXThpQ 9oQP3eHTPh33BtWnFmctHOymxZ5PsiUTmGw6GmLu2XYURQ/YOSJQ+nxPlfkBVT0fPbgkeq9MvQMB8 bMKRTaBxTtipQxAc+E7QMrpbZLPJ/WxUQ3Gqef5FBMuo0Xlfn7M/HkfJ+RbTdH95LsuWsFTKoQmri xWWd2mS7kElox7BWhz53MU1TWi6+O9DwAI9ek+MDmi0XOpb9dBT9pXkP7xNznt/sQyE6YTKbsy/S+ eaaROxHZA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWtE-0000Z5-TX; Thu, 24 Sep 2020 19:26:48 +0000 Received: from mout.gmx.net ([212.227.15.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWt6-0000X7-5a for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 19:26:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600975568; bh=ryafog9o9EYAigK/QILvakc48q9JWXrf1x8ta4Cd9NE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PauaGvg+ZaP1l1iygBOq/z2lbo9A0OPi/4BEctJPRszoVsS0vUdIYUEcMQx8ui00m wYtVF61MaEf568sVa3DFahuDTOazR9EuRz4W0Lie3TpfC1NkM5QoTaJTuoHm0gUoGj BuTPJT3tkRGFmzGutTVjCpuO3dmNxbTYk7tHioec= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MWASe-1jxlbh3XT8-00XesV; Thu, 24 Sep 2020 21:26:08 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 3/7] mfd: Add base driver for Netronix embedded controller Date: Thu, 24 Sep 2020 21:24:51 +0200 Message-Id: <20200924192455.2484005-4-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:2/sqEliv+PQ0uN2Fo4ra2eRrVTl8o/Sf3HWGB8zZ60Z2X3NTHQt yeDk+anplblmj7G5BB89xLmR9C23HI+mIvNDa/OcdMixx+J3Nc/Oy4Biyy16X3CGA4cAB5H hOePproobbVdyIU8zIyp7QtCD2K08q9+4urGmp5tvD3jPZiEWkQu0ACNogFsYyyQRpJzp8Q odoOATePEkLWDVa8xZffA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:j69ta80NZrE=:Ny0rWmCQF7G6B5zUJgwpVi h6QNlCb29XBEpAIQl78KC0fKYDD9KlPCf8hwu8ibI4H8CUf7oyWVv90dVJ1xFuUcAkUjPxyAS 7SyxtreYjV2fVyfS2lAt+WyDvXBm5opYVaT2L07c/ePbJfVlv4o1aBHpgKeEIj8I24UHMLo9n cX51XmeyFrCFNpnPk5JuqBr7QkyHX/hB6eU+UWqhwfgcMjfNnpZuAW+Bq4ACbEmkYbOwtcjJB 2W1mlOyQGtPG1Ns2dXK6XSgqxQpVaWSauHgLh7wk9+Ik7F7/XtV7jsD2UgFnUxKuuh+IMxRVU hgk6fp+1nYLWQqq0MinPhsNPgkknwLs4UXoewabFyWcE/0Lg9NeDiJ4jGXuUbnl5sV8e9HYzc Qyu0S2Q3D/IdM23tttQFp1UqHEObzQUsCf3IUuODpR8BDtJZmrnCaTJ4vswl/MqICBeYRozZa ObXS6sNRmVSjQV0M4a8qKfecaIvrsJOVqxKceMJNuPTeslnudm14sULt1DfQfJ9r1esTTlfic o19jOL97uwdsY4SFisDE3fjA8CvTRBwXpCKO9J4cQ8pvFiDZaS1oMtqWsHlkFH1UhhtoCfCI2 +yHoPyrOdwTEwyQ9qhx7tIFyqhZ6tx0zzwUCFOdVMhus5yaLydxCf5s94GuX9ddez2GTH2IhH OPjmkGjoblzXwCVmQZ7XjB85pMy5/4cNQJ9kh5NZF2LgNMPCxI5+8wV9ea5p1Y1CaOlhokqAx OFs/YOGZDImRsbQ0xO19I7C66Pm7wf/duyCqA623URiUEzusZWNGdgtLHiBcGQcwHh9xlLZwb KmeW8PkFV8ZkCExo+J05A59PBFwFTe5+V6eMs+f445yGH8cMt3tQgIKBlI4xk/vsWXZ1DTHCC v0XF6cdMOl8kR/E4UoK3Cck0hZY0SdaPU1pgxoPEe/p0r3t7m1bVPfEdSwCPVH5swBfMLjBac AelFL+tKx7C93v9oFexE5YJWclECKpjXB3cmYDHG8qIUo/wQCyNGfW0z+jk5QcN7V/BHHGaTy dckX5wQ6LtcwJaRxm99O+K8kWQiMeyjh4U0ukwXbpTBUYFnlDIbNpLFreY675M8iv6UTp05mv +JS9Hiu8ggOhMz/SlWK9FdHp/ot7Bp4TlFyWDcUBs88yBMkZ5BOGS0ShWRkXaockHIzyf8uSz s59Gj3wms6ICmss15zjbGiFNDvhEyLWmDf/MmTGuWGXWHhHtwDEdYUpQu49n8Jl1yRZapOI0l lpDhAABKu8rKfQqkr5uV7BSlozaBlTTIBKCS9Yg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_152640_435429_D85BA7E7 X-CRM114-Status: GOOD ( 35.50 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.15.15 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.15.15 listed in wl.mailspike.net] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The Netronix embedded controller is a microcontroller found in some e-book readers designed by the ODM Netronix, Inc. It contains RTC, battery monitoring, system power management, and PWM functionality. This driver implements register access and version detection. Third-party hardware documentation is available at: https://github.com/neuschaefer/linux/wiki/Netronix-MSP430-embedded-controller The EC supports interrupts, but the driver doesn't make use of them so far. Signed-off-by: Jonathan Neuschäfer --- v3: - Add (EC) to CONFIG_MFD_NTXEC prompt - Relicense as GPLv2 or later - Add email address to copyright line - remove empty lines in ntxec_poweroff and ntxec_restart functions - Split long lines - Remove 'Install ... handler' comments - Make naming of struct i2c_client parameter consistent - Remove struct ntxec_info - Rework 'depends on' lines in Kconfig, hard-depend on I2C, select REGMAP_I2C and MFD_CORE - Register subdevices via mfd_cells - Move 8-bit register conversion to ntxec.h v2: - https://lore.kernel.org/lkml/20200905133230.1014581-4-j.neuschaefer@gmx.net/ - Add a description of the device to the patch text - Unify spelling as 'Netronix embedded controller'. 'Netronix' is the proper name of the manufacturer, but 'embedded controller' is just a label that I have assigned to the device. - Switch to regmap, avoid regmap use in poweroff and reboot handlers. Inspired by cf84dc0bb40f4 ("mfd: rn5t618: Make restart handler atomic safe") - Use a list of known-working firmware versions instead of checking for a known-incompatible version - Prefix registers with NTXEC_REG_ - Define register values as constants - Various style cleanups as suggested by Lee Jones - Don't align = signs in struct initializers [Uwe Kleine-König] - Don't use dev_dbg for an error message - Explain sleep in poweroff handler - Remove (struct ntxec).client - Switch to .probe_new in i2c driver - Add .remove callback - Make CONFIG_MFD_NTXEC a tristate option --- drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/ntxec.c | 206 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/ntxec.h | 31 ++++++ 4 files changed, 248 insertions(+) create mode 100644 drivers/mfd/ntxec.c create mode 100644 include/linux/mfd/ntxec.h -- 2.28.0 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 33df0837ab415..b313103151508 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -978,6 +978,16 @@ config MFD_VIPERBOARD You need to select the mfd cell drivers separately. The drivers do not support all features the board exposes. +config MFD_NTXEC + tristate "Netronix embedded controller (EC)" + depends on OF || COMPILE_TEST + depends on I2C + select REGMAP_I2C + select MFD_CORE + help + Say yes here if you want to support the embedded controller found in + certain e-book readers designed by the ODM Netronix. + config MFD_RETU tristate "Nokia Retu and Tahvo multi-function device" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index a60e5f835283e..236a8acd917a0 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -217,6 +217,7 @@ obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o +obj-$(CONFIG_MFD_NTXEC) += ntxec.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o obj-$(CONFIG_MFD_RK808) += rk808.o obj-$(CONFIG_MFD_RN5T618) += rn5t618.o diff --git a/drivers/mfd/ntxec.c b/drivers/mfd/ntxec.c new file mode 100644 index 0000000000000..93611b85a32e0 --- /dev/null +++ b/drivers/mfd/ntxec.c @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * The Netronix embedded controller is a microcontroller found in some + * e-book readers designed by the ODM Netronix, Inc. It contains RTC, + * battery monitoring, system power management, and PWM functionality. + * + * This driver implements register access, version detection, and system + * power-off/reset. + * + * Copyright 2020 Jonathan Neuschäfer + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NTXEC_REG_VERSION 0x00 +#define NTXEC_REG_POWEROFF 0x50 +#define NTXEC_REG_POWERKEEP 0x70 +#define NTXEC_REG_RESET 0x90 + +#define NTXEC_POWEROFF_VALUE 0x0100 +#define NTXEC_POWERKEEP_VALUE 0x0800 +#define NTXEC_RESET_VALUE 0xff00 + +static struct i2c_client *poweroff_restart_client; + +static void ntxec_poweroff(void) +{ + int res; + u8 buf[] = { + NTXEC_REG_POWEROFF, + (NTXEC_POWEROFF_VALUE >> 8) & 0xff, + NTXEC_POWEROFF_VALUE & 0xff, + }; + struct i2c_msg msgs[] = { + { + .addr = poweroff_restart_client->addr, + .flags = 0, + .len = sizeof(buf), + .buf = buf + } + }; + + res = i2c_transfer(poweroff_restart_client->adapter, msgs, ARRAY_SIZE(msgs)); + if (res < 0) + dev_alert(&poweroff_restart_client->dev, + "Failed to power off (err = %d)\n", res); + + /* + * The time from the register write until the host CPU is powered off + * has been observed to be about 2.5 to 3 seconds. Sleep long enough to + * safely avoid returning from the poweroff handler. + */ + msleep(5000); +} + +static int ntxec_restart(struct notifier_block *nb, + unsigned long action, void *data) +{ + int res; + /* + * NOTE: The lower half of the reset value is not sent, because sending + * it causes an error + */ + u8 buf[] = { + NTXEC_REG_RESET, + (NTXEC_RESET_VALUE >> 8) & 0xff, + }; + struct i2c_msg msgs[] = { + { + .addr = poweroff_restart_client->addr, + .flags = 0, + .len = sizeof(buf), + .buf = buf + } + }; + + res = i2c_transfer(poweroff_restart_client->adapter, msgs, ARRAY_SIZE(msgs)); + if (res < 0) + dev_alert(&poweroff_restart_client->dev, + "Failed to restart (err = %d)\n", res); + + return NOTIFY_DONE; +} + +static struct notifier_block ntxec_restart_handler = { + .notifier_call = ntxec_restart, + .priority = 128 +}; + +static const struct regmap_config regmap_config = { + .name = "ntxec", + .reg_bits = 8, + .val_bits = 16, + .cache_type = REGCACHE_NONE, + .val_format_endian = REGMAP_ENDIAN_BIG, +}; + +static const struct mfd_cell ntxec_subdevices[] = { + { .name = "ntxec-rtc" }, + { .name = "ntxec-pwm" }, +}; + +static int ntxec_probe(struct i2c_client *client) +{ + struct ntxec *ec; + unsigned int version; + int res; + + ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL); + if (!ec) + return -ENOMEM; + + ec->dev = &client->dev; + + ec->regmap = devm_regmap_init_i2c(client, ®map_config); + if (IS_ERR(ec->regmap)) { + dev_err(ec->dev, "Failed to set up regmap for device\n"); + return res; + } + + /* Determine the firmware version */ + res = regmap_read(ec->regmap, NTXEC_REG_VERSION, &version); + if (res < 0) { + dev_err(ec->dev, "Failed to read firmware version number\n"); + return res; + } + dev_info(ec->dev, + "Netronix embedded controller version %04x detected.\n", + version); + + /* Bail out if we encounter an unknown firmware version */ + switch (version) { + case 0xd726: /* found in Kobo Aura */ + break; + default: + return -ENODEV; + } + + if (of_device_is_system_power_controller(ec->dev->of_node)) { + /* + * Set the 'powerkeep' bit. This is necessary on some boards + * in order to keep the system running. + */ + res = regmap_write(ec->regmap, NTXEC_REG_POWERKEEP, + NTXEC_POWERKEEP_VALUE); + if (res < 0) + return res; + + WARN_ON(poweroff_restart_client); + poweroff_restart_client = client; + if (pm_power_off) + dev_err(ec->dev, "pm_power_off already assigned\n"); + else + pm_power_off = ntxec_poweroff; + + res = register_restart_handler(&ntxec_restart_handler); + if (res) + dev_err(ec->dev, + "Failed to register restart handler: %d\n", res); + } + + i2c_set_clientdata(client, ec); + + res = devm_mfd_add_devices(ec->dev, PLATFORM_DEVID_NONE, ntxec_subdevices, + ARRAY_SIZE(ntxec_subdevices), NULL, 0, NULL); + if (res) + dev_warn(ec->dev, "Failed to add subdevices: %d\n", res); + + return res; +} + +static int ntxec_remove(struct i2c_client *client) +{ + if (client == poweroff_restart_client) { + poweroff_restart_client = NULL; + pm_power_off = NULL; + unregister_restart_handler(&ntxec_restart_handler); + } + + return 0; +} + +static const struct of_device_id of_ntxec_match_table[] = { + { .compatible = "netronix,ntxec", }, + {} +}; + +static struct i2c_driver ntxec_driver = { + .driver = { + .name = "ntxec", + .of_match_table = of_ntxec_match_table, + }, + .probe_new = ntxec_probe, + .remove = ntxec_remove, +}; +module_i2c_driver(ntxec_driver); diff --git a/include/linux/mfd/ntxec.h b/include/linux/mfd/ntxec.h new file mode 100644 index 0000000000000..a39c85978f61b --- /dev/null +++ b/include/linux/mfd/ntxec.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright 2020 Jonathan Neuschäfer + * + * Register access and version information for the Netronix embedded + * controller. + */ + +#ifndef NTXEC_H +#define NTXEC_H + +#include + +struct ntxec { + struct device *dev; + struct regmap *regmap; +}; + +/* + * Some registers, such as the battery status register (0x41), are in + * big-endian, but others only have eight significant bits, which are in the + * first byte transmitted over I2C (the MSB of the big-endian value). + * This convenience function converts an 8-bit value to 16-bit for use in the + * second kind of register. + */ +static inline u16 ntxec_reg8(u8 value) +{ + return value << 8; +} + +#endif From patchwork Thu Sep 24 19:24:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798159 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 4A95C59D for ; Thu, 24 Sep 2020 19:27:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 095D6221EB for ; Thu, 24 Sep 2020 19:27:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xe/Xs5WF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="CnuJOq1P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 095D6221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=80bot0EX3wPQqdSogQUDBekhl1aI03JSTwb+5zODel4=; b=xe/Xs5WF0tN+rnG+VRQuXgUze IssxoQQ9k31/2PucF+CtvWDckylif8/D8cwfzkmiyS+BuBZN7/ZbHcnbw81tC2JonrjoD/fiSn8ej LPPSOffuFVwzaZSqZ3fYh0TToWKvHbrgGdIrIPgwInm+qRetOmRsJyOyfx95pj7ApUTw2XJQwGHW6 QkaJ0rfG8Rx2oFJTvrPq9eyo95vbETCNO/QEEkC/dRs7M8W7OR83VHuMUztJ595s9lbQajU99GfXT x/5Xlt5WBhVHjDV3buSN31FzX93lqkMkNBYBTLXPyzg54ZCaSTv+h4ctaKc5kOvVReD0Cixekui33 ziaufDFUA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWtt-0000jg-VB; Thu, 24 Sep 2020 19:27:29 +0000 Received: from mout.gmx.net ([212.227.17.22]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWtq-0000iu-Ux for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 19:27:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600975615; bh=kPZl/L/V+lSOt6mdHEUfQyfNZV+P9p8a2y5WBNQYGEY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=CnuJOq1PXtORLWkaiIZ4QmI99dW2FHYWzW06NlKEat5l5gU2bNrFlwTdbcdomeOQZ XsoiyuPtx3Te0JCEZDVplBzV/JD/bJ33Z+rmnYZcxGVO4zER+PJLJsaCzbzI447Bos tGA9z8CeZsRUD7pTNBG/ywaKY2lxIkY5gpstQAdM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mt79F-1kb0RK27mT-00tSos; Thu, 24 Sep 2020 21:26:55 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 4/7] pwm: ntxec: Add driver for PWM function in Netronix EC Date: Thu, 24 Sep 2020 21:24:52 +0200 Message-Id: <20200924192455.2484005-5-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:mA3DG95xvQs2E54phiN9UBrtsp5UQWCBcYtK0cDi5xTJIhrE7ca vOEVh1mJnsGPvkFa0F5MikCjzc8AwjM4UI8W8Vmgrxyu8QJiYq/N7gvynIzFtFChzWaruhW ZBXLRIYiD57d7jEONSAXLmkBXa2WEHh32mKgHDZlItmSli1saRUm0NiQPmmforFMoZBX94V ZZYKSV0uM/rfexOlRbbRA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:WYsN+KbUPa4=:n/AuxUCEn0gediIuwxzYTw IU9V261xJuG28lzmMETl5WXmTtBlhHN96Lhs8K9w90KnbEBbPo6tbcR93PH3Jnbb9NOvAgRRG +hfcPwwbHwrp7y6G0fdNkLKOA6xNvxnOQTCcULB4//6Hfq/Nq/PcGmKR/qweowraNOr12dtXt ZNbEg6iuTe7iHgBn0y1yDzx10Pc39Ty3fqjBvtTzW0pypGWfqF9ct8w1UjrlbdBFVrUK5DxgZ aQ5AMkl5I+SptjFFab/T88CR2+cQvbVzjIAljsZYaW1wcGCKhUi+NhA8e4Ni185gmdbeem8FB Xmp0lId9WZbioquUhvDNcrznEdN8SyEwFcOas1chAPRLASKtNdy+S+Gz7vzSG3AqId0vuJskT QZ260hFBnHQmkkXsF2/wJi5hiplr20SIH+BIBp7HYIohnDAlorkpnlMd87fNSMX49ajllRhuh AOGtZxCutuWTVbE5f2t0PtbxLAehn6VCXy29GDXBFShlT8/+mMk7unb6oidFJxGUuxAGdeW9G gD8bbfGm8zGqhExrqtoTQ8TrsLwrlkD7PDE7yPI94EWYY3YdG88p+opZkJEehytnbvPahUe2+ wa7SeDmv5n86l3mtmzK7+307h3VwiDI3XRSFTgMVlbQGs7Mfvk94Tih/M5AFJ1MXdqLIycWZA kZvU9ujSi+PLjOSFTQ/kdV94S0pJnoyfpgsS0ahXh2UotQHwJt9dwxbfFEcvhi1XW9qVWorIJ K+xfz5HLm23fPTB3DkVWfuEx8c+67hXBfyebxYIYQbKMbh+R1dviJsLjsXFt01mHxleoHlP77 hLVcMoI41UCm4OmI/j5obNsdRLhY14nCOJeF5biRLRb+eQowd34ruNN1kgA9DL8TnUToBn7U4 IFnSnAU1F38j7SO7Nv1nD3T97MEFGlN63AyFejPVcqPuWeXTEBG3j3VuFzzOAipR85AfGKlsh wuHpaJWaS9eO4VbeUW1CD9xbQyMAHa7AJupqmJ2GYiqUaXaKf1B9Eg39NuSVh7EMjXTWeqGie kxtQ2iHCNW/rPdBol56kwQlr6W/dwCKspCH1o7B/kxcrWbXMNvwiCXYTnp9g4i//F2yYxi/JN esFXVvfjvTqK8DcZVcjY4xXjKbiZWN53q6aI8WFEfJI4Sfuq/WO7vM+HStH/TJTUsKQzM8NwR 4MhvoS9qbDMYH5kHwGsjPAvWUtNFgup0toUdvGuJdJXrM9uQBeIpnWg2i+gWn0sfUCmvblTKx 5QUG/ARAZkqs6C5QIIchQ026KIvxFLSLFDXK5bw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_152727_193010_7769168F X-CRM114-Status: GOOD ( 32.10 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.22 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.22 listed in wl.mailspike.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The Netronix EC provides a PWM output which is used for the backlight on some ebook readers. This patches adds a driver for the PWM output. The .get_state callback is not implemented, because the PWM state can't be read back from the hardware. Signed-off-by: Jonathan Neuschäfer --- v3: - Relicense as GPLv2 or later - Add email address to copyright line - Remove OF compatible string and don't include linux/of_device.h - Fix bogus ?: in return line - Don't use a comma after sentinels - Avoid ret |= ... pattern - Move 8-bit register conversion to ntxec.h v2: - https://lore.kernel.org/lkml/20200905133230.1014581-6-j.neuschaefer@gmx.net/ - Various grammar and style improvements, as suggested by Uwe Kleine-König, Lee Jones, and Alexandre Belloni - Switch to regmap - Prefix registers with NTXEC_REG_ - Add help text to the Kconfig option - Use the .apply callback instead of the old API - Add a #define for the time base (125ns) - Don't change device state in .probe; this avoids multiple problems - Rework division and overflow check logic to perform divisions in 32 bits - Avoid setting duty cycle to zero, to work around a hardware quirk --- drivers/pwm/Kconfig | 8 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-ntxec.c | 161 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 drivers/pwm/pwm-ntxec.c -- 2.28.0 diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 7dbcf6973d335..530dfda38d65e 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -350,6 +350,14 @@ config PWM_MXS To compile this driver as a module, choose M here: the module will be called pwm-mxs. +config PWM_NTXEC + tristate "Netronix embedded controller PWM support" + depends on MFD_NTXEC + help + Say yes here if you want to support the PWM output of the embedded + controller found in certain e-book readers designed by the ODM + Netronix. + config PWM_OMAP_DMTIMER tristate "OMAP Dual-Mode Timer PWM support" depends on OF diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 2c2ba0a035577..1cc50dba22d1b 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_PWM_MESON) += pwm-meson.o obj-$(CONFIG_PWM_MEDIATEK) += pwm-mediatek.o obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o obj-$(CONFIG_PWM_MXS) += pwm-mxs.o +obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o obj-$(CONFIG_PWM_PXA) += pwm-pxa.o diff --git a/drivers/pwm/pwm-ntxec.c b/drivers/pwm/pwm-ntxec.c new file mode 100644 index 0000000000000..50da2dc14bb03 --- /dev/null +++ b/drivers/pwm/pwm-ntxec.c @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * The Netronix embedded controller is a microcontroller found in some + * e-book readers designed by the ODM Netronix, Inc. It contains RTC, + * battery monitoring, system power management, and PWM functionality. + * + * This driver implements PWM output. + * + * Copyright 2020 Jonathan Neuschäfer + */ + +#include +#include +#include +#include +#include +#include + +struct ntxec_pwm { + struct device *dev; + struct ntxec *ec; + struct pwm_chip chip; +}; + +static struct ntxec_pwm *pwmchip_to_pwm(struct pwm_chip *chip) +{ + return container_of(chip, struct ntxec_pwm, chip); +} + +#define NTXEC_REG_AUTO_OFF_HI 0xa1 +#define NTXEC_REG_AUTO_OFF_LO 0xa2 +#define NTXEC_REG_ENABLE 0xa3 +#define NTXEC_REG_PERIOD_LOW 0xa4 +#define NTXEC_REG_PERIOD_HIGH 0xa5 +#define NTXEC_REG_DUTY_LOW 0xa6 +#define NTXEC_REG_DUTY_HIGH 0xa7 + +/* + * The time base used in the EC is 8MHz, or 125ns. Period and duty cycle are + * measured in this unit. + */ +#define TIME_BASE_NS 125 + +/* + * The maximum input value (in nanoseconds) is determined by the time base and + * the range of the hardware registers that hold the converted value. + * It fits into 32 bits, so we can do our calculations in 32 bits as well. + */ +#define MAX_PERIOD_NS (TIME_BASE_NS * 0x10000 - 1) + +static int ntxec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm_dev, + const struct pwm_state *state) +{ + struct ntxec_pwm *pwm = pwmchip_to_pwm(pwm_dev->chip); + unsigned int duty = state->duty_cycle; + unsigned int period = state->period; + int res = 0; + + if (period > MAX_PERIOD_NS) { + dev_warn(pwm->dev, + "Period is not representable in 16 bits after division by %u: %u\n", + TIME_BASE_NS, period); + return -ERANGE; + } + + period /= TIME_BASE_NS; + duty /= TIME_BASE_NS; + + res = regmap_write(pwm->ec->regmap, NTXEC_REG_PERIOD_HIGH, ntxec_reg8(period >> 8)); + if (res) + return res; + + res = regmap_write(pwm->ec->regmap, NTXEC_REG_PERIOD_LOW, ntxec_reg8(period)); + if (res) + return res; + + res = regmap_write(pwm->ec->regmap, NTXEC_REG_DUTY_HIGH, ntxec_reg8(duty >> 8)); + if (res) + return res; + + res = regmap_write(pwm->ec->regmap, NTXEC_REG_DUTY_LOW, ntxec_reg8(duty)); + if (res) + return res; + + /* + * Writing a duty cycle of zone puts the device into a state where + * writing a higher duty cycle doesn't result in the brightness that it + * usually results in. This can be fixed by cycling the ENABLE register. + * + * As a workaround, write ENABLE=0 when the duty cycle is zero. + */ + if (state->enabled && duty != 0) { + res = regmap_write(pwm->ec->regmap, NTXEC_REG_ENABLE, ntxec_reg8(1)); + if (res) + return res; + + /* Disable the auto-off timer */ + res = regmap_write(pwm->ec->regmap, NTXEC_REG_AUTO_OFF_HI, ntxec_reg8(0xff)); + if (res) + return res; + + return regmap_write(pwm->ec->regmap, NTXEC_REG_AUTO_OFF_LO, ntxec_reg8(0xff)); + } else { + return regmap_write(pwm->ec->regmap, NTXEC_REG_ENABLE, ntxec_reg8(0)); + } +} + +static struct pwm_ops ntxec_pwm_ops = { + .apply = ntxec_pwm_apply, + .owner = THIS_MODULE, +}; + +static int ntxec_pwm_probe(struct platform_device *pdev) +{ + struct ntxec *ec = dev_get_drvdata(pdev->dev.parent); + struct ntxec_pwm *pwm; + struct pwm_chip *chip; + int res; + + pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); + if (!pwm) + return -ENOMEM; + + pwm->ec = ec; + pwm->dev = &pdev->dev; + + chip = &pwm->chip; + chip->dev = &pdev->dev; + chip->ops = &ntxec_pwm_ops; + chip->base = -1; + chip->npwm = 1; + + res = pwmchip_add(chip); + if (res < 0) + return res; + + platform_set_drvdata(pdev, pwm); + + return 0; +} + +static int ntxec_pwm_remove(struct platform_device *pdev) +{ + struct ntxec_pwm *pwm = platform_get_drvdata(pdev); + struct pwm_chip *chip = &pwm->chip; + + return pwmchip_remove(chip); +} + +static struct platform_driver ntxec_pwm_driver = { + .driver = { + .name = "ntxec-pwm", + }, + .probe = ntxec_pwm_probe, + .remove = ntxec_pwm_remove, +}; +module_platform_driver(ntxec_pwm_driver); + +MODULE_AUTHOR("Jonathan Neuschäfer "); +MODULE_DESCRIPTION("PWM driver for Netronix EC"); +MODULE_LICENSE("GPL"); From patchwork Thu Sep 24 19:24:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798161 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 1E05D59D for ; Thu, 24 Sep 2020 19:28:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 CECCD22208 for ; Thu, 24 Sep 2020 19:28:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EL7vjg4L"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dBq5Tsn8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="YCZuTDlO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CECCD22208 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=AlSD3TGFZOqUMwMi4069qZ0ZBIqMpmeWL4+K89AmwFE=; b=EL7vjg4LxdL96qngfEM2myVOq u10Ii5b33NeB/XduNtBgl+MFKHtGJTIwcoPF2sXWbqe/jvpaSG6RuQEhjyUWXlKRZel8uGLCfY+ik amSOCzo6z5JCB+TlsCDlZ8I1W9PphfQR8HFD4onVpZ39OC+CmI0eLQZ/nCEguNIiUGrG2mP8ICKvh qpje0i5D9I4i6VvUbuyzP6RcaWG3cFkh9FHFHyMONMNmR8Q0ZByEEdW0NsastOb3Q1vikeC0rSySw FRFLZVgB6jDrK0LZ+u/raYZM+cWXmxv25KYKpYuFodc57LEmfoRYZc1OSbc2agwbHuWk2wCXXwG73 5rsXA8TOw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWuJ-0000qB-VL; Thu, 24 Sep 2020 19:27:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWuI-0000pa-6m for linux-arm-kernel@merlin.infradead.org; Thu, 24 Sep 2020 19:27:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=ty2KFZNQQwYSgHmDAhflVxhiZUjT5CSswXwRUyPP57Q=; b=dBq5Tsn8PQXXfhQBngmxV+a7lG ZOIFlcNfXNbT9BsibOnejra0s8nKx+LrJnrrs1JSnR4nemofSQCLUwUHWU1DEoVGzcbpRz6fBSCKp vGryIc2sCHzCVxbywBSlhnic/WacA1dbcOkMjLe3ImOxXkhQDPd+GSGU2Cs2Uy4U63xG5VWgrD1hj 6UOlTHD2IPIddm/KqOf7k1rR0dvZaCw2R9BkFIqnRw8MIAlgWr/GdxMCAqAKP4Vr+f+wk18xatcxN /VXkLrz3Hu/VLDulqBFrrWAi0KwGCzSQ8Uqe0ci12K23CFSjWhxwszpYyg1Nxs2QNljdb9Mg9EBSX iKE4cDDw==; Received: from mout.gmx.net ([212.227.15.18]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWuD-0007GD-Rl for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 19:27:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600975618; bh=zSDHJBM6de05hZPfx230oe82AjsNdZNJxFzhYwgfDFE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=YCZuTDlO6lrqRKblbacCMKYxMjIts9jb1hdPbo7ll72ct3UszOjFfxuhsx0MVDYzc PCnWHUFLBDkJ9i4+9TNGhtKuU3TIfAKv9/UsH4L74e1HSTjq3ZcJFzObxh7LSEI69o 1zSfWfSLAkAah0TiIqKbYXoPw3xyfDYypD1ktDd8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M5QJD-1kKhwl2ASb-001UUX; Thu, 24 Sep 2020 21:26:58 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 5/7] rtc: New driver for RTC in Netronix embedded controller Date: Thu, 24 Sep 2020 21:24:53 +0200 Message-Id: <20200924192455.2484005-6-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:+L1FJx1oQ6x7VaPQrKFafs4nq4JlwRFRv3sXkEEUwJWc0oPbt6L sSRCF1xO+U7ERbK4pZtzhg8y0/pV9YuUf1GfIKaUrFSt7xB6hSc5TTn5zO64GdDfSKgfHPn IV6Tb28pfgTVdctL+InU5U3ktU8xEW2j/bBb4OWv0dLpxXhDooD70jkp7g0LkNAzqwVeXzB 3iZa0jhjuoz5LvJ9oIDEA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:iW/DyQ1umCw=:OXkRLwVhupzITPyaadNByY DNzWrDCUOgfWuRGBNdXuC7L/Pu9Fgj4AcowCxscdAQHQlXO4Ylhf39QyifLje/XLyTeHRYv6K kL/WOkr/3COkS7B40qgzZWPeef0xVBVeUZQdqGGvnDP7U0wsmGJUcDEiuWPRKgY61cPzmL72h klVt5x6mNy13eVmXTPqWXXWxPHak5ZvJ1uHCF8qYOTCieJ5S0VlVauLfUO9DsyueDG/52iAlg sta2KoEBXFcgrPiOsSe5Wj2E4ObiGHVwau+42eRKhSded+/3RMKrb2PmYp+i+3VvQq4borxJK OzzpCW6uPU7AYUJ+f2xxOHaI16w9hT/VuBDlMiLsDfU5MDvPcaa7VsPog/lBnwTxHlnInl6bV 9cJk0Oef6Y5m1RQO5dHjMLY33g+qbK4eGf/zJ/+dJ0njVctgs1W3Jjemo7x27d+lN3fkuEZrK b7qoeL2XsMK0BIqid6qgld2y5ft6LfGgALDli8ef5S1q+nq5JSvgZbnWHWzde7f0UBPicBvxa MBHX6ZrthQGrH+2R0lmHPwOgD96CzWusaWUKQUTzj4tFrXULvgjEk8EOgd1HzlUEV81/soqiP L3bLwUIfC6hjgN5XKnmNWqraMQjeu3ugMcpwRkvHYMfILqIiyTJSzQj/bLV7rVSNLjdGftlT1 31DKj8Z9i5Y0dLv244NTZqcxTOZXD0bTOfOjk9ct86iBIbIN6i2Uy9zMwG1dRhT6QPS7GKrqd EfVPnJIYUZW46UJZYFKaS4FIA41T4E2X1s+q9J8DTfZkykuLXKugo9YxqBUCGZZg1U7DYVHu9 ioGJ7AR4bni0Sl0FpoX01jf8fZiifA4lJJ7iCaWvPHTTHNMOk7+E4T3aC7RzmAwA6iAxqCziY GzVY+5BT2T2JUXdpow33XFgsiwXxYzMyUE6uQbVQaKToiI4qWl9vNGqF7IYqoMsHBPRYLyNBP I3cJaM8GiDkR4JQbbwjQQ/7+NZHONOpl+s5dDEme/kOVKbuOhj6Sq3OKZ35M+Lb3va7RQIOoH Q/rT1NruFoORXrTjZZr3hTiw5ZZd25YvwgeJshot2kqy7e7kNg+99GFywmPMUy/G8BWqEMDM2 D9k5fhuiTO685aIKlbUymllYcz5UD2tn1++o1+uFJ/oVyZAZvIMI0sptUfq7riPIQCbYF0zk0 63fpC1EAHiz4UfF6kC/rDjMMCTyAqUudmg+0xCFY1og0YL+kdyPJIu5iS2HDMyNRF/LzVz1wW KSngbCpA0/IdPFdAtYS/sNvrb3k8TVDz8hpMsFw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_202750_095632_F55806C2 X-CRM114-Status: GOOD ( 28.40 ) X-Spam-Score: -2.8 (--) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-2.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.15.18 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.15.18 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With this driver, mainline Linux can keep its time and date in sync with the vendor kernel. Advanced functionality like alarm and automatic power-on is not yet supported. Signed-off-by: Jonathan Neuschäfer --- v3: - Add email address to copyright line - Remove OF compatible string and don't include linux/of_device.h - Don't use a comma after sentinels - Avoid ret |= ... pattern - Move 8-bit register conversion to ntxec.h - Relicense as GPLv2 or later v2: - https://lore.kernel.org/lkml/20200905133230.1014581-7-j.neuschaefer@gmx.net/ - Rework top-of-file comment [Lee Jones] - Sort the #include lines [Alexandre Belloni] - don't align = signs in struct initializers [Uwe Kleine-König] - Switch to regmap - Fix register number used to read minutes and seconds - Prefix registers with NTXEC_REG_ - Add help text to the Kconfig option - Use devm_rtc_allocate_device and rtc_register_device, set ->range_min and ->range_max --- drivers/rtc/Kconfig | 8 +++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-ntxec.c | 132 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 drivers/rtc/rtc-ntxec.c -- 2.28.0 diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 48c536acd777f..ae8f3dc36c9a3 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1301,6 +1301,14 @@ config RTC_DRV_CROS_EC This driver can also be built as a module. If so, the module will be called rtc-cros-ec. +config RTC_DRV_NTXEC + tristate "Netronix embedded controller RTC driver" + depends on MFD_NTXEC + help + Say yes here if you want to support the RTC functionality of the + embedded controller found in certain e-book readers designed by the + ODM Netronix. + comment "on-CPU RTC drivers" config RTC_DRV_ASM9260 diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 880e08a409c3d..733479db18896 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -111,6 +111,7 @@ obj-$(CONFIG_RTC_DRV_MT7622) += rtc-mt7622.o obj-$(CONFIG_RTC_DRV_MV) += rtc-mv.o obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o obj-$(CONFIG_RTC_DRV_MXC_V2) += rtc-mxc_v2.o +obj-$(CONFIG_RTC_DRV_NTXEC) += rtc-ntxec.o obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o obj-$(CONFIG_RTC_DRV_PALMAS) += rtc-palmas.o diff --git a/drivers/rtc/rtc-ntxec.c b/drivers/rtc/rtc-ntxec.c new file mode 100644 index 0000000000000..af23c7cc76544 --- /dev/null +++ b/drivers/rtc/rtc-ntxec.c @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * The Netronix embedded controller is a microcontroller found in some + * e-book readers designed by the ODM Netronix, Inc. It contains RTC, + * battery monitoring, system power management, and PWM functionality. + * + * This driver implements access to the RTC time and date. + * + * Copyright 2020 Jonathan Neuschäfer + */ + +#include +#include +#include +#include +#include +#include + +struct ntxec_rtc { + struct device *dev; + struct ntxec *ec; +}; + +#define NTXEC_REG_WRITE_YEAR 0x10 +#define NTXEC_REG_WRITE_MONTH 0x11 +#define NTXEC_REG_WRITE_DAY 0x12 +#define NTXEC_REG_WRITE_HOUR 0x13 +#define NTXEC_REG_WRITE_MINUTE 0x14 +#define NTXEC_REG_WRITE_SECOND 0x15 + +#define NTXEC_REG_READ_YM 0x20 +#define NTXEC_REG_READ_DH 0x21 +#define NTXEC_REG_READ_MS 0x23 + +static int ntxec_read_time(struct device *dev, struct rtc_time *tm) +{ + struct ntxec_rtc *rtc = dev_get_drvdata(dev); + unsigned int value; + int res; + + res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_YM, &value); + if (res < 0) + return res; + + tm->tm_year = (value >> 8) + 100; + tm->tm_mon = (value & 0xff) - 1; + + res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_DH, &value); + if (res < 0) + return res; + + tm->tm_mday = value >> 8; + tm->tm_hour = value & 0xff; + + res = regmap_read(rtc->ec->regmap, NTXEC_REG_READ_MS, &value); + if (res < 0) + return res; + + tm->tm_min = value >> 8; + tm->tm_sec = value & 0xff; + + return 0; +} + +static int ntxec_set_time(struct device *dev, struct rtc_time *tm) +{ + struct ntxec_rtc *rtc = dev_get_drvdata(dev); + int res = 0; + + res = regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_YEAR, ntxec_reg8(tm->tm_year - 100)); + if (res) + return res; + + res = regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_MONTH, ntxec_reg8(tm->tm_mon + 1)); + if (res) + return res; + + res = regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_DAY, ntxec_reg8(tm->tm_mday)); + if (res) + return res; + + res = regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_HOUR, ntxec_reg8(tm->tm_hour)); + if (res) + return res; + + res = regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_MINUTE, ntxec_reg8(tm->tm_min)); + if (res) + return res; + + return regmap_write(rtc->ec->regmap, NTXEC_REG_WRITE_SECOND, ntxec_reg8(tm->tm_sec)); +} + +static const struct rtc_class_ops ntxec_rtc_ops = { + .read_time = ntxec_read_time, + .set_time = ntxec_set_time, +}; + +static int ntxec_rtc_probe(struct platform_device *pdev) +{ + struct rtc_device *dev; + struct ntxec_rtc *rtc; + + rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); + if (!rtc) + return -ENOMEM; + + rtc->dev = &pdev->dev; + rtc->ec = dev_get_drvdata(pdev->dev.parent); + platform_set_drvdata(pdev, rtc); + + dev = devm_rtc_allocate_device(&pdev->dev); + if (IS_ERR(dev)) + return PTR_ERR(dev); + + dev->ops = &ntxec_rtc_ops; + dev->range_min = RTC_TIMESTAMP_BEGIN_2000; + dev->range_max = 9025257599LL; /* 2255-12-31 23:59:59 */ + + return rtc_register_device(dev); +} + +static struct platform_driver ntxec_rtc_driver = { + .driver = { + .name = "ntxec-rtc", + }, + .probe = ntxec_rtc_probe, +}; +module_platform_driver(ntxec_rtc_driver); + +MODULE_AUTHOR("Jonathan Neuschäfer "); +MODULE_DESCRIPTION("RTC driver for Netronix EC"); +MODULE_LICENSE("GPL"); From patchwork Thu Sep 24 19:24:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798163 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 920D959D for ; Thu, 24 Sep 2020 19:29:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5914323899 for ; Thu, 24 Sep 2020 19:29:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OlTLUtDM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="bZ6WnrDD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="HGaKRk2K" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5914323899 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=HZg3VScwFnAgG7N/rfoGVkxQUBA7beZgI+AymSB1nOA=; b=OlTLUtDMnFWLiOgPHNJ5/GS7X S4uCScrL4QFMnGZqPjJ6JKy3v7Uuyg2+WBFCtXjkxjDqkUxXnqVGY8QGVHrrakONRGO20f/b7pBBP pvJhu9DgdM8xxzLrgdC8BckZbnI7KgVkXXxRHE0QSXqd7hCMZ+EbjYq0I4Ur5SP2JCvHtp3QzpzK0 bXkguI2rqh13cRJdwvXl3UKlF5RxfdTKkLt2W1N7BNdi+a4UE2CmKfWhN8h6+f41qRpALAwF2AKDm xYG/vIBpljsRugFsyT4jJDRb26tLY3mY9+866xFCMCb5oyiRytyPAZKc/4O6YIfxeFaEvjGH+ASwi yE3Fj6Mfg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWvL-0001Co-Ji; Thu, 24 Sep 2020 19:28:59 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWvJ-0001Bn-LR for linux-arm-kernel@merlin.infradead.org; Thu, 24 Sep 2020 19:28:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=t+UAxQA0zFF4g0oa7j7HgX6VdakF4lrcBNqBHB+JdGs=; b=bZ6WnrDDQFKJkLgBzh97E7mPYy RBYw6nLw3xNEcUOYy9CnveVNoa8Rp+845LSgjluAMqW998t7GpSP2fhoXBnWRNmGXqETVz2vDdZZW XpAURoQ/xKLgUKFmEIURhbsRtXz7K/9P/iHynEvIIdKtnJpzz6pgf7UZIRBltG6hTsC4QMJqNqceg 12FFbfeaSsk9bg1uD0ocnU4bzxq0fpMgx2hqRog6gjgpzsd8R3z7Vqzf54WCWt1GIjbtbCjJaiaHc doaYbmM691Lufv5REfJOOS4YpA0j3NwNu1K+f3wpFYbFmSyWmEh3amYq9PrT4GLs6e5olky5Kajnp XJj9HjjA==; Received: from mout.gmx.net ([212.227.17.21]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLWvG-0007JL-51 for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 19:28:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600975685; bh=tkswMYiJHuOplMgXDoI19/wmwW33bJ9gmJGG21R3n4w=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=HGaKRk2KHWR20nSbmPKPbY1q496x43THCZkb4nHA7JSyK6IMkbgKhTetYVPExS0GY 6Evce2FbGghEpzHQ/iq1dSiuSss5CJ1oSZlfSmeeQKq0cXV44hZqAg6jVyaJt6PlcF iI0DCIzefv/MLCube39V7aQoDt3Gd0pL2T4EXf8E= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MsHru-1kbHNX0NUg-00tjzO; Thu, 24 Sep 2020 21:28:05 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 6/7] MAINTAINERS: Add entry for Netronix embedded controller Date: Thu, 24 Sep 2020 21:24:54 +0200 Message-Id: <20200924192455.2484005-7-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:GaOsMeCsmwQHEurNROd7IPeF1FHhthoSmqsJTawoxATBVyBahAA bONZSpwDuTCJZGbi6MVEP+O0flWzyLon2GFMElwSbdRwhwHilneAYc9XRJpoODdnNg9sWR1 2ah325YQJfDqoKOiHNMGo/3U9H04VICPV710ptbLoZDt56Kd7mh2d6uFCouqVmmPYWZI2/e rP1Kq9F9nH5XaOHF2QcHA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:aBK5xLr6xz4=:8wC3tSy7LNU0RZZkzosbRd mrgoBR0OAwqs+e0ai0eXhkwGRKeKw29e/39DJTqptGOyLXG6fp1g3v9y3VQmoH4OcSDOgV9DW qoWdYFInWqWBvIVFlBDX5sgOk77q6+JAx7zT7Q4C/0ptrbQhf1sT9QmaBdzYceEzJVkr6P8Ma YuC+GW0AZOpJrfCUYcdmToqC0wxxzb1fstuPdpfflYqhof6FLuWQ7wrt2LtXLOBIQrhH+g5QN oaNYnXGXclrf/LP1N1nP5K8+zanvx/1SRNAyLRuv8Np91m8VgFPCJ8x8xFyi+OBNC2Uvs24U5 Lh/g5xel0meyPB/IOtew5cl30lqRyNROBdM3N1m0CQKH838uyDlBza2QX4tNuUvLvfcTYf3HC W8KXgOR6Cy/5MfQi2+xQV0TjNDd9w1FkMeNf1rm9PQyCE8Y65XljfodKaYPgTXN3hYGp/MlFE cDwZa7k68v790Hcqq3FaRXSUTPIQLZUYUM9T7uy6D/HT3C76eoHp8OkFLgTNbkVMWi2etvsFG hl0oKUmMEW419EB+GYJaPaIwUygfZ2+t6qirGWPdI3mSQZPdYGohBN7uLsXRA+niNOerSD7kx qZztazSfdt/VEUMabkMUEXBkbVVbdaXXr42AFmCoNvW5Z0DdBAT+Y8NOFxtDGms1SWAdEY8ux 6hME/d7WZUZcG86lfYq48bYsA70joiQAw5yvF+XDL96Xg4pI0eYiPgt9zCzE+FMPk8XUtW1g3 Yfja2phvSEWS1c9Z4K60/5+lKnveZMkf+bwb3qVZGOqocs5RwbmmoZrmgzLLatI+9ZZzaEGhc 3vY+HtMBTVfRFfkMyWXeggIIqExdSxbU4fghLvBVZNT45i17g6ZfBX3B4z9QASXF4e4MAT9hJ WqqjMv9FyjrdihSE4Cv/Nq0RUrEmiuWVobe8cE7vNUWLvhclmUtWjIa0MeBm/60B3mKCBfI3Y Zig6MAk8V/Qm3JJHx0VFmb8WNt+qsOGc4wzfCyW3cywqJROj/laCHGuWlJ2kN8RdhBZ+e2dvs RYNLtf3CXNlr7n8N7WhDx8oEgpAX5kX6QYx4WhWSeOwG5uPakcSW25n8G0gkfPd+D3QlVphu3 UvzRf0x2QNKhQGC6w9Idxs5IbEBL4+FWshAhK9m6WRqXWXisHQgh2gRaXMa7B7VWNNXGbEMIP Rg05kPv/DZrCTh3hruiMpy9Rq0XUWng0xYJeAWE8KJs3xz/lno3MZed7ZENqBkBb+W5WbkfMm h8sh0GWadlO8HFzU76SLJQvqIyQniHhjXKZnjpw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_202854_370538_CDE1181F X-CRM114-Status: GOOD ( 12.40 ) X-Spam-Score: -2.8 (--) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-2.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.21 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.21 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Rob Herring , Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Let's make sure I'll notice when there are patches for the NTXEC drivers. Signed-off-by: Jonathan Neuschäfer --- v3: - Remove pwm and rtc bindings v2: - https://lore.kernel.org/lkml/20200905144503.1067124-2-j.neuschaefer@gmx.net/ - No changes --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.28.0 diff --git a/MAINTAINERS b/MAINTAINERS index d746519253c3a..f28f7cb890d05 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12019,6 +12019,15 @@ F: include/net/netrom.h F: include/uapi/linux/netrom.h F: net/netrom/ +NETRONIX EMBEDDED CONTROLLER +M: Jonathan Neuschäfer +S: Maintained +F: Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml +F: drivers/mfd/ntxec.c +F: drivers/pwm/pwm-ntxec.c +F: drivers/rtc/rtc-ntxec.c +F: include/linux/mfd/ntxec.h + NETRONOME ETHERNET DRIVERS M: Simon Horman R: Jakub Kicinski From patchwork Fri Sep 25 05:08:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 11798929 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 BAA3B112E for ; Fri, 25 Sep 2020 05:26:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 7BB392137B for ; Fri, 25 Sep 2020 05:26:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ds0c0lRd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="XNpGH8m/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BB392137B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=a8RV5jAcsu771/6DBgg6ZtHMQOHUV64+YWsgQFCkpZ0=; b=Ds0c0lRdDy5H/d6OWAmUnN/4R oaVCjcDNVzCwBwg7e0wB4VXNXaiLubVQLg/NvPOTjByHbA95Kr2299Hwfl/Vlc29RSvxYLv5HJY+w XkjjZ/NmU9mpf47ddtpZpA051+tPIudjMl/BVuRJFtcNU/Dan+V1m0uL43x4pN4LU/nGN6jlc+fVT OpE/CXGVArer6SOvZyJNp/Pk/IUq9kY30/rcdZMXZprTLJgHE74IT0M0gfEcSmNUzP5aH2YjkMgOU 6o9MKTQiIOcH9X088ztwI6AX9o3p64warYQiU1cD2JiIotKQA9RJzVup17ogR/SJtRcPW0z12l6zC vw/LCoAzw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLgDn-0003Xd-EL; Fri, 25 Sep 2020 05:24:39 +0000 Received: from mout.gmx.net ([212.227.17.21]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLgDk-0003X9-S8 for linux-arm-kernel@lists.infradead.org; Fri, 25 Sep 2020 05:24:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1601011465; bh=HlgnC3df/tJycBpbEiuMsr+Bt4rnu2osQrbv2JddJP0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=XNpGH8m/7IWzoSPtsGt4Jtq3IzvIwZ87RXTskiaIMjLQz44WGJIUkr6nuEvWG42DM l6hiiXr24B5dO6gOyab2RfOb1vKtmRfP/hPOlzDKnFrUrC8FwzdeMyR5jM3V0Ogog0 Aq29+w4+GkmPjkdkQDezwhob+Zl0iHkGRVes/8Sg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mwfac-1kg4922a1S-00yB85; Fri, 25 Sep 2020 07:08:58 +0200 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 7/7] ARM: dts: imx50-kobo-aura: Add Netronix embedded controller Date: Fri, 25 Sep 2020 07:08:18 +0200 Message-Id: <20200925050818.2512375-1-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924192455.2484005-1-j.neuschaefer@gmx.net> References: <20200924192455.2484005-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:nFSbCxYo1nlk4h1TGxOTycwOxGsiVBkLTP+jxKBPubrqFtoiXOt UhgfLQwcAL7GuTFPSvGVq/uyUN89Cz4VHuv9YGqdwFN3ATncYCB2rNDcfDyaJDoPnvAu+wv dKrwRZvpGHgo7HH3vaodHF9te1ugFsggudcQm4G29a75qCzjTHthOaV8CsFgwLn9NAeKD7N G/NyBCqBjMS7Ivz6inXgg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:hwXGMnPUfEU=:VQGNci8f/2GmaYWcXpDeyj 1vBAXvWC7hyO2mlpTYHsuxNWi14e+zufZRqF7+oVzOI7u1RtIWilgrAKMdFqjhOk2UmMV0qyD IvvykVYHxeqCdc09ryJFPjT281XGyL+abIcD57Cl8avKc+D2ZHXiljxk1DXOES+Q31vAK/P9h 21CYORJgN73J1Lvl0KDl1hurzZs7ZpyctZb2K098z/FqVeaemPtySeUx2h6Vnz+VwYk6DzJR7 Cb/89uY71cfc0jUxkoWyw/l/N28AIWzGCgXTNtTAKvK2CebTDZO8CBIjRnZjB8qMbh/CqZJoq IDYkXLQR/hRXXJs8A7jpAccYw5CmGajgLOeTs0WxeBi/alsoXAozzlVfVDZFGCtfCJ0qSITuh 2IEmLyFzGZBw9ma25IYqkXFSRHBLvhlDMtxu9Z53W4kioEONb57qSsDfCCe+5HNU6kTdTYxrM 5lqdYmyF2WctjuBMXqCnGguIR/XdJAeDPXnHGtavDPH2VwPbkzfNVJmZZmGg90ubsi0JbwtH2 IoQUnfWAC8U7pVFSCs4g9wTz0R3OanLQ1jP3lqUjos4ngCORNrVvsB8B/9HipXGT18fK49O9m MLdn/kRFZSu80o2v+Kk+oA8txgTulrzSVTUKTcE3C6lAezhBOUGCuHkV2PdpJvovVb++KuOWM 9rAGYqWC4f/KDIrCcb+4wg5thV0ylnA1KxvlTTpSt1HYzM+/JAzQ+zoSL2NWh2Er5FjIVGru+ AwmW3aesbFaLxixMnYW97FKqGi+z3Uz/4zDLZLK3bQy4xwgAOBaTTede1SmAruwDN7VNk44oi XLZWIlc042/+O6+UhYOOtEiK7eSAdmohly9iJvQskQtlI9J1nW8uTRgVzNmom/OsWiQa5J4Ve JR+KIow8sFIGV+bGwSqKQB6mDxN6LiyeKHeVxhx1Hgv5bg/pYAMqD0BfsqMVsRUUQmeDDbZco P6gkOh5Bu5/eci49gmyn57axvMkAPSRJp9KkJJefvDpM8otVCHzq22nSMxHS2nN7NIL+tZ5+F YC4ZjKcYb1htaPwRwp13a91uesVGE4SBSUFsULozP5dPv6ImA5aTgCPP9ed94WqGscP2jMiV0 VluOdrm+GKuZFLrO9uEwrJsAXgiiKqnVHIH0p134iDFtlGej4DrF5mOA/VstreZ8tRFYBh1hR rNiPVOwtgcBJZ7Tywe1i3fRqKUU6yp5gv8qBSulbuHR+PhE5ay3pbB786ZSciB4Q+K7RpzPdy 9k0T5j136boh2eRGge4y2DvKwk9ejVrvPxlVrwg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200925_012437_105783_5C7A5952 X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.227.17.21 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.21 listed in wl.mailspike.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [j.neuschaefer[at]gmx.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Heiko Stuebner , linux-pwm@vger.kernel.org, Linus Walleij , Thierry Reding , Fabio Estevam , linux-rtc@vger.kernel.org, Arnd Bergmann , Mauro Carvalho Chehab , Sam Ravnborg , Daniel Palmer , Andy Shevchenko , Andreas Kemnade , NXP Linux Team , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, Stephan Gerhold , allen , Sascha Hauer , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Lubomir Rintel , Rob Herring , Lee Jones , linux-arm-kernel@lists.infradead.org, Alessandro Zummo , Mark Brown , Pengutronix Kernel Team , Heiko Stuebner , Josua Mayer , Shawn Guo , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Enable the Netronix EC on the Kobo Aura ebook reader. Several features are still missing: - Frontlight/backlight. The vendor kernel drives the frontlight LED using the PWM output of the EC and an additional boost pin that increases the brightness. - Battery monitoring - Interrupts for RTC alarm and low-battery events Signed-off-by: Jonathan Neuschäfer --- v3: - Remove interrupt-controller property from embedded-controller node - subnodes of embedded-controller node in to the main node v2: - https://lore.kernel.org/lkml/20200905144503.1067124-3-j.neuschaefer@gmx.net/ - Fix pwm-cells property (should be 2, not 1) --- arch/arm/boot/dts/imx50-kobo-aura.dts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 2.28.0 diff --git a/arch/arm/boot/dts/imx50-kobo-aura.dts b/arch/arm/boot/dts/imx50-kobo-aura.dts index a0eaf869b9135..2d1a59091a37c 100644 --- a/arch/arm/boot/dts/imx50-kobo-aura.dts +++ b/arch/arm/boot/dts/imx50-kobo-aura.dts @@ -6,6 +6,7 @@ /dts-v1/; #include "imx50.dtsi" #include +#include / { model = "Kobo Aura (N514)"; @@ -135,10 +136,24 @@ &i2c3 { pinctrl-0 = <&pinctrl_i2c3>; status = "okay"; - /* TODO: embedded controller at 0x43 */ + embedded-controller@43 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ec>; + compatible = "netronix,ntxec"; + reg = <0x43>; + system-power-controller; + interrupts-extended = <&gpio4 11 IRQ_TYPE_EDGE_FALLING>; + #pwm-cells = <2>; + }; }; &iomuxc { + pinctrl_ec: ec { + fsl,pins = < + MX50_PAD_CSPI_SS0__GPIO4_11 0x0 /* INT */ + >; + }; + pinctrl_gpiokeys: gpiokeys { fsl,pins = < MX50_PAD_CSPI_MISO__GPIO4_10 0x0