From patchwork Thu Apr 14 00:23:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812807 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 34988C433F5 for ; Thu, 14 Apr 2022 00:25:14 +0000 (UTC) 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: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:In-Reply-To:References: List-Owner; bh=2qWXn/3CT4AOkp1EYwq5ACo9bb7qO9CJWL6RFGQf+yo=; b=w8774tzfdG6sgi 7mYu0GFMaPvj0qrlxTIkYsh5Q6ltoJREosWpsOol3GmeiAPcDqF4hjt+Zd+OvyppxNyVgRIHwCTk5 m/3ODZkMaR1U4UykzsW7vZv7+Wu4HLwH60LqvP93HlIgy/W1Gl0HCR6HL9eg17JxGuSbsVTasqvXS tiIIHCxKPwNjY6fWLIlg5lik6branvE1yYegsjaodMbwF4dsU55NYV5cyAblzA+was63lIpZhpCIQ KAsbAKxZUVNTAXLdq6KBSMeqSCR9iJLiH79fZn8mWoTUr0MNSmsjy2Mpbiu5EK2ft9onCT/It7sZb QJJogD0ERcIhn5ASa9tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nenHF-003AGx-GK; Thu, 14 Apr 2022 00:24:01 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nenHB-003AEu-PB for linux-arm-kernel@lists.infradead.org; Thu, 14 Apr 2022 00:23:59 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3210E5C024E; Wed, 13 Apr 2022 20:23:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Apr 2022 20:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1649895832; x=1649982232; bh=cmioWZ70r/nopRjrVq9ahyQq5 MHB3bUw7EtLQ9BSxDw=; b=PW7yyMSR4S2D4Pt1omShjLjhE9/jqPee13xqDl2iE /V8MnfIoEeK1X2tnyLEYclOZTq3xXUONCJOiaakyRZsRYsLffH9ezwIl5KNBqZRw ANbw5AkcuKbmVBEbKG7Vwi8q2t8aMad7d4xA46y68Rdh40BAqKTosHI1MCxWUqpJ TId1YSDpMqKFBzfVPdHBW5au/bzjZG5nhsbGzA28KNSbqQXqSOPXrMbH7+oafdd/ zQANGMYXLQvRGWSFERUTVf5S8F3XsL2CjtSwiybU7yupar5/lZ/epSNSYo/vJ5F8 pfPCINqhyHOvGoGcODB2EflFI/Ad5jnFHs3Oogsi7KGMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1649895832; x=1649982232; bh=c mioWZ70r/nopRjrVq9ahyQq5MHB3bUw7EtLQ9BSxDw=; b=awOiwnMwOlD5E8IPf 11niZhS7h7vNWK7kaIuoFd6rinND0EcRIDgWZVWOeBxMuY8BiM96BKyskgijHxSW ePzE+Fb8IHENHvMkvX8wSuqdNJD+LofGNA013sFGM7/bMB3DVIepbrFVcPPGn3zZ 8tSkvF3kHR8wKIobO61rYap3KPpN63XAubudWJeNzvchCyqATY3VHXI5JwADAFXH G6sPX3CWixhMialSbuhhmsh1NuSsGddFnldesloKedvwPAlBwYqGvLcFv0HjOnxu tG0A/CtrQplkCHpv0/8WM8yvX7D8Y9NShTq6HCPoeDXraZTnj9rwwiXPbQ7ac2EG 0hvaw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtffrrg htthgvrhhnpeeiteekhfehuddugfeltddufeejjeefgeevheekueffhffhjeekheeiffdt vedtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 20:23:50 -0400 (EDT) From: Samuel Holland To: Dmitry Torokhov , Hans de Goede Cc: Samuel Holland , Maxime Ripard , Rob Herring , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Maxime Ripard , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 1/3] dt-bindings: input: sun4i-lradc-keys: Add R329 and D1 compatibles Date: Wed, 13 Apr 2022 19:23:46 -0500 Message-Id: <20220414002349.24332-1-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_172357_914274_C78823B9 X-CRM114-Status: UNSURE ( 8.94 ) 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 R329 and D1 SoCs each contain an LRADC with a programming interface compatible to earlier LRADCs. However, the LRADC now has its own clock gate and reset line, instead of being always active. To support this, add clock/reset properties to the binding, and require them for the variant in the new SoCs. Acked-by: Maxime Ripard Reviewed-by: Rob Herring Signed-off-by: Samuel Holland --- (no changes since v1) .../input/allwinner,sun4i-a10-lradc-keys.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml b/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml index d74f2002409e..3399fc288afb 100644 --- a/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml +++ b/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml @@ -18,10 +18,20 @@ properties: - items: - const: allwinner,sun50i-a64-lradc - const: allwinner,sun8i-a83t-r-lradc + - const: allwinner,sun50i-r329-lradc + - items: + - const: allwinner,sun20i-d1-lradc + - const: allwinner,sun50i-r329-lradc reg: maxItems: 1 + clocks: + maxItems: 1 + + resets: + maxItems: 1 + interrupts: maxItems: 1 @@ -68,6 +78,18 @@ required: - interrupts - vref-supply +if: + properties: + compatible: + contains: + enum: + - allwinner,sun50i-r329-lradc + +then: + required: + - clocks + - resets + additionalProperties: false examples: From patchwork Thu Apr 14 00:23:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812809 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2334BC433EF for ; Thu, 14 Apr 2022 00:25:21 +0000 (UTC) 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=OdShFI2o2nG1fsdyK+DJLxD3TIaN9v7XnqeV6Hqs2oQ=; b=KGw+2Aryn6agwq 0gTkOwzqI6u5W8+CA065PZGcO31NjBb3qDUFX9CFMo95PRCEVQbZx/gYTfqm3b/aGhknRJ0Bwtm6O p3IafMHH6kV8/iFXClQgYWxj/p5wDyXiV4ajC7JsRrnmNI3sxhWplY6kZFsreGfjM6hFWVCLoZzuI E/Etp8CsBJ0ZBaiavyok7q5xvzYpSq95VJxA9f4dB7BbJsFrDwmweeP0VON0gjUtSalm7LIxTj5Om ukENMF2upebMyzVBsm4VAhTdhdUnI60pfiygwmQ3A811AMyZB08bxi7vzOMCV9VM0yQekhDwBMTNL ga1gVKvXelEZZVpx41fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nenHX-003AM6-Db; Thu, 14 Apr 2022 00:24:19 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nenHB-003AEv-PC for linux-arm-kernel@lists.infradead.org; Thu, 14 Apr 2022 00:24:00 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A77305C02D9; Wed, 13 Apr 2022 20:23:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Apr 2022 20:23:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649895834; x=1649982234; bh=UX 20EKkihaXFR6pu5BIT9N5isu1yVemyQBEm7qLnXTM=; b=tlIfJ8zhf44HVqPslI tmi6bD4D8Z/oy9dnNqpGqRAbI1cvqmVi+17zGR29X+Qz+9JtWHmquBgNO11GQsDv dbsXyqhwab/xcr5XmJLe290aq9Hy+vQ4N6zDWhgEiDMgWE3WpRE3WaPTdq/ofGZk HlFSVxc3cSXDaSLuoF/v+fvM/WX2XOXNKwNIOxcbdqSjIdcEiFInTBRUN8kQuLwC Io8J3tZsAwMDg1CquG+yNpAIoo02lOV8aloZZ8ZxL6hMtpOjbXPzqwfUt6ehfB1q Hba6Kq2f6hBqFm1l4GfPHJVa4Eup3Pg8h9HWqycOcrYGI/yovLficthOKafy2sdY Ln+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649895834; x=1649982234; bh=UX20EKkihaXFR6pu5BIT9N5isu1yVemyQBE m7qLnXTM=; b=dkenoMvsI7QjPiyaUzBeHoLYbRgzMX3BdkzHKcnms+wY76m4ULu GN3ijxMGOPw9MJSPB0V3S1WG1GWabBW+5CqgduIsBfrcpSKI311pvZbC9PWg6Fge biNuKA9kegpO/gdcp8vMp3MJ9L9pWKFVo7XOj2/adub6ZaK/9bQkTGTXzv/atwak yquaOtkeJQrXjpTreb8Lj0TmgrxVqWnmdu4sLOrNXoAyEaCuoXcTS/4fAFok4IiK toFrGbDJA6tuK7nGPLAf512qlzHJEwu+KzjDbDF29393U+YMQb9fB3lxl9EbM2AD 1uhh0Wk2UNo0AzJvNGz7VqWp6wVQoRqlxVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 20:23:53 -0400 (EDT) From: Samuel Holland To: Dmitry Torokhov , Hans de Goede Cc: Samuel Holland , Maxime Ripard , Rob Herring , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Maxime Ripard , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Philipp Zabel Subject: [PATCH v2 2/3] Input: sun4i-lradc-keys: Add optional clock/reset support Date: Wed, 13 Apr 2022 19:23:47 -0500 Message-Id: <20220414002349.24332-2-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414002349.24332-1-samuel@sholland.org> References: <20220414002349.24332-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_172357_976138_FED880AE X-CRM114-Status: GOOD ( 17.96 ) 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 Until the R329, the LRADC hardware was always active. Now it requires enabling a clock gate and deasserting a reset line. Add support for this variant of the hardware. Signed-off-by: Samuel Holland Acked-by: Jernej Skrabec --- Changes in v2: - Guard the code with a flag instead of using "_optional" variants. drivers/input/keyboard/sun4i-lradc-keys.c | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c index 4a796bed48ac..5630334a6c09 100644 --- a/drivers/input/keyboard/sun4i-lradc-keys.c +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -14,6 +14,7 @@ * there are no boards known to use channel 1. */ +#include #include #include #include @@ -23,6 +24,7 @@ #include #include #include +#include #include #define LRADC_CTRL 0x00 @@ -58,10 +60,12 @@ /* struct lradc_variant - Describe sun4i-a10-lradc-keys hardware variant * @divisor_numerator: The numerator of lradc Vref internally divisor * @divisor_denominator: The denominator of lradc Vref internally divisor + * @has_clock_reset: If the binding requires a clock and reset */ struct lradc_variant { u8 divisor_numerator; u8 divisor_denominator; + bool has_clock_reset; }; static const struct lradc_variant lradc_variant_a10 = { @@ -83,6 +87,8 @@ struct sun4i_lradc_data { struct device *dev; struct input_dev *input; void __iomem *base; + struct clk *clk; + struct reset_control *reset; struct regulator *vref_supply; struct sun4i_lradc_keymap *chan0_map; const struct lradc_variant *variant; @@ -140,6 +146,14 @@ static int sun4i_lradc_open(struct input_dev *dev) if (error) return error; + error = reset_control_deassert(lradc->reset); + if (error) + goto err_disable_reg; + + error = clk_prepare_enable(lradc->clk); + if (error) + goto err_assert_reset; + lradc->vref = regulator_get_voltage(lradc->vref_supply) * lradc->variant->divisor_numerator / lradc->variant->divisor_denominator; @@ -153,6 +167,13 @@ static int sun4i_lradc_open(struct input_dev *dev) writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); return 0; + +err_assert_reset: + reset_control_assert(lradc->reset); +err_disable_reg: + regulator_disable(lradc->vref_supply); + + return error; } static void sun4i_lradc_close(struct input_dev *dev) @@ -164,6 +185,8 @@ static void sun4i_lradc_close(struct input_dev *dev) SAMPLE_RATE(2), lradc->base + LRADC_CTRL); writel(0, lradc->base + LRADC_INTC); + clk_disable_unprepare(lradc->clk); + reset_control_assert(lradc->reset); regulator_disable(lradc->vref_supply); } @@ -243,6 +266,16 @@ static int sun4i_lradc_probe(struct platform_device *pdev) return -EINVAL; } + if (lradc->variant->has_clock_reset) { + lradc->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lradc->clk)) + return PTR_ERR(lradc->clk); + + lradc->reset = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(lradc->reset)) + return PTR_ERR(lradc->reset); + } + lradc->vref_supply = devm_regulator_get(dev, "vref"); if (IS_ERR(lradc->vref_supply)) return PTR_ERR(lradc->vref_supply); From patchwork Thu Apr 14 00:23:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12812808 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 77B6AC433F5 for ; Thu, 14 Apr 2022 00:25:16 +0000 (UTC) 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=3SHy8f55a6MKkgrwdGXFmfW0oh+y/l7JumRLcibMqBk=; b=n53rigtSNNOvF7 YSnbJjaX21TAiVu1UBlSDeScPgtLlgppKoN4OO9rZHOCVLWs8YR5qS3wnLw+nYxLR55Bqw7k8JpTP QGURERJEDaMcoI7UvcPlFhaOXFrZ0LnOamnNumD9g26AvPsPKSPo8P9SWbJMix19sVaDz7b+0BDXi TT1cYM1cqD47pp7WuDE3V0cLkReugv8Kx7MlkLBk9GN9Ax/Zq9ynDoEHm3cxN04B38tz0ZjIkr5M4 ge19u1cLEs+gm+2Xb3mjZiIZ4hhowDYyxmSRC8mWcXAQXosnm2+tdAqopDRN5dyr5lws7sSubbsYm tEDioVAD4g1Uv+CYvT0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nenHO-003AJy-Jp; Thu, 14 Apr 2022 00:24:10 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nenHB-003AFA-PD for linux-arm-kernel@lists.infradead.org; Thu, 14 Apr 2022 00:24:00 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 417705C02EE; Wed, 13 Apr 2022 20:23:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Apr 2022 20:23:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1649895836; x=1649982236; bh=sm LbHwGYtdmSDiKEj6LIJXKXjSMVo9Cyx4CzsqmRG0s=; b=kVU7oOEndcoeC/wDNm WIG/OFvtDRkrJgXrlDD5gXDjHyQrsgmbMR/lpl5pvOwp+5pDnVf+xMIeAkvNesWC Lo/gUVyS1SHoWT4EbbENN3anlwolpci1F5EzpCnTQJFYuk3u0rUrr/73qdHCChOk JM6oKIP4JZ9Ez2PLe76sJ78Wg6I3iJPujTfv/dbAzcuvjMX3Jy7b7rvaeouZ+u0c iyfDjfXTxOpFITa86oUWKwXkDJzvaY31nCDIWNDmbFZGpd8gJokDvltKy+O9AIWO c1bDLLcVXBZWbntMwGBNocCCsf2V53n955SwaC0YxJSVW73uS6F0wR6x0HHbdIr6 whzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1649895836; x=1649982236; bh=smLbHwGYtdmSDiKEj6LIJXKXjSMVo9Cyx4C zsqmRG0s=; b=rmD1yK6cd4LWEVBuWox9ngsZHkdSQWVFAXL2oaHNOYu0i8DE+0l +Cu51dE8lNsPimZ5w7reuORkr8m3nWrwke86WuAgb0qlbOZVQ1iNvMXH9FH/NHdh EOtjdHSkbiYTj1RJoooC1z494h6+M/6XlTjOktW6AK1ph9XlZhQLDXs0LkEPBGwG bNCprVgUgyxZTYRWx66l5Lwl+RFAmITGdAFwyZdKU8lQxixhq8pBEWOSp+4Za1oB xMyuX8aKw0r/LvjUR3hAsiXXTxn7m6aDIC8S637/sEwzlGYeFTNCf8GwCxgMFNFh YA6Xlj5824Be1pI44rSqR3TF9bkZdQieA5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelvddgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 20:23:55 -0400 (EDT) From: Samuel Holland To: Dmitry Torokhov , Hans de Goede Cc: Samuel Holland , Maxime Ripard , Rob Herring , Chen-Yu Tsai , Jernej Skrabec , Krzysztof Kozlowski , Maxime Ripard , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 3/3] Input: sun4i-lradc-keys: Add support for R329 and D1 Date: Wed, 13 Apr 2022 19:23:48 -0500 Message-Id: <20220414002349.24332-3-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414002349.24332-1-samuel@sholland.org> References: <20220414002349.24332-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220413_172357_974105_F6E32A35 X-CRM114-Status: GOOD ( 13.44 ) 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 LRADC variant uses the same 3/4*AVCC reference voltage as the A83T variant. The R329 and D1 LRADCs appear to be identical, so D1 support is accomplished through having the R329 LRADC as a fallback compatible. Signed-off-by: Samuel Holland Acked-by: Jernej Skrabec --- Changes in v2: - Set the new flag for the R329 variant. drivers/input/keyboard/sun4i-lradc-keys.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c index 5630334a6c09..8f9bfb05244d 100644 --- a/drivers/input/keyboard/sun4i-lradc-keys.c +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -78,6 +78,12 @@ static const struct lradc_variant r_lradc_variant_a83t = { .divisor_denominator = 4 }; +static const struct lradc_variant lradc_variant_r329 = { + .divisor_numerator = 3, + .divisor_denominator = 4, + .has_clock_reset = true, +}; + struct sun4i_lradc_keymap { u32 voltage; u32 keycode; @@ -323,6 +329,8 @@ static const struct of_device_id sun4i_lradc_of_match[] = { .data = &lradc_variant_a10 }, { .compatible = "allwinner,sun8i-a83t-r-lradc", .data = &r_lradc_variant_a83t }, + { .compatible = "allwinner,sun50i-r329-lradc", + .data = &lradc_variant_r329 }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match);