From patchwork Thu Feb 11 08:47:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 380889 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1884961jah; Thu, 11 Feb 2021 00:48:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqmZFDwMO4fJhpqzWmywsCv0aMNF543H5wmOTZL7SbE1Yyo6CGz8AIi8OU94i0F3/eKhhf X-Received: by 2002:a50:9f4e:: with SMTP id b72mr7544711edf.4.1613033310934; Thu, 11 Feb 2021 00:48:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613033310; cv=none; d=google.com; s=arc-20160816; b=lzBoAvyNOzao3sMp3SmQaZJB+L454riI3Woqp/cG9pwQLw9/CP04AmlRO/ayAPCs1E qTr3Y5J4thzLvggR+VeT24lA/PM+qiDEVTK8B3aTdnMtyqR/Kq2hf8xnNMdmI129DPzE TSzebhGIYMYgTRWoAu6evRyspV3zocuzfN5WcZQm9imGEBH9mp3fRB7aHC0BY6q1PL4X 2uEaMqoLfa3yph7gUFJntlP6tJugC9cqaLFtTp1S8bWFBRlL015Q8/N5O9DcW2uDosCz Odd3cA+aWo+jF1R9a365hKr3KygRvx3hwL8zr+ISK4Y0FmlEMbwO5bNe7uGCvtQDNIj0 nXUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=D47RA9MzNM4nc/l88JXosw7tAT3dRhcZFuVE29Hw6E8=; b=C/lhj7YoRXqcpQB7hy7/hluS936VzPFeq8TXI4Opfe4SGnffKVoFSXYcmAKhsAtUo2 PT3yFVIC9R+CGaozq1L+IEKjTAStOlqYOgZuJcoIjOlbt32MzMaRxsYWRX9B7u97BPu8 CnRnV45FgPp5kA678UJyUZe9QFZJqXrsJxnj7oehCQnc3TwxBJd3cBXpn5O/dOjbUde2 pJNZUyMKZmLFDuIkA9m3RpA6MTKKWLmsl8jYsPPf/KFwg5FmGIRxR3BVt0MaOfzsph7k KLmoyxpxKdWpKyuc2Qc2Gxd17QFfS8dj9OeYW8xcfvzMeHKID9LKVFBoyloTabfN/8rF Nx7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="po5sE1V/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id x22si3443632edl.456.2021.02.11.00.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 00:48:30 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="po5sE1V/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3EBEF8268C; Thu, 11 Feb 2021 09:48:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="po5sE1V/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A4A2582673; Thu, 11 Feb 2021 09:48:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1BB0E82657 for ; Thu, 11 Feb 2021 09:48:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20210211084806euoutp024ef157cdafbd1a8c230087796eb5ecfc~ipTpBqfrC2291222912euoutp02t for ; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20210211084806euoutp024ef157cdafbd1a8c230087796eb5ecfc~ipTpBqfrC2291222912euoutp02t DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613033286; bh=D47RA9MzNM4nc/l88JXosw7tAT3dRhcZFuVE29Hw6E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=po5sE1V/BV9J2jdxthBk9MLf/AEDiBWuLq6l4RWI+7ZUQ6bcHZp2ZRni/rT4dHoBS AiBhBkoepDRjA/bXwCLA0xpveV3ETRP99lJwE+cRmXBAFTogfAHceq9QN6rsct2Oqc aOW2atL/z1h4050njfjgG9nORLM5BER46vWG1tUU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210211084805eucas1p2c061749e5a9fc2065b905c968a9e9405~ipTolNOyV1135811358eucas1p2g; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3D.94.45488.54FE4206; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20210211084805eucas1p2a9c601311c97458a3435e3fec49e331b~ipToNIGIr1359613596eucas1p2O; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210211084805eusmtrp1c6e9bb6e4dfc578a887a2c9701d1ad77~ipToMePM83224632246eusmtrp1T; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-84-6024ef451e6f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id BD.56.16282.54FE4206; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210211084804eusmtip13d652f7f21a298564ed7b18c6e190630~ipTnugX5M2072020720eusmtip1s; Thu, 11 Feb 2021 08:48:04 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Lukasz Majewski , Philippe Reynes , Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 1/5] dt-bindings: input: adc-keys bindings documentation Date: Thu, 11 Feb 2021 09:47:53 +0100 Message-Id: <20210211084757.22759-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210211084757.22759-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42LZduzneV3X9yoJBs+mq1hsnLGe1eLGrzZW i+fvLjNZrD1yl93iUF+0RcdhZYtvW7YxWkya8IvN4u3eTnaLw1M/MDpweby/0cruMbvhIovH vFknWDw+fIzzmN/5ncnj7J0djB59W1YxemxcdoA5gCOKyyYlNSezLLVI3y6BK6Nt63v2guti Fa8ezWVrYLwo1MXIySEhYCJx49pipi5GLg4hgRWMEhu/PGOFcL4wSky6ewQq85lRYu+5R8ww LVd6lrNBJJYzSmx6eJodrmXf+h9MIFVsAoYSXW+72EBsEQEjiUtNO1hAipgF7jBJdE1uYAFJ CAt4S/SfmsMOYrMIqEpcWHoOrIFXwFZi8+RpLBDr5CVWbzgAtppTwE5i3547YAdKCBzgkLh6 /gITRJGLxMfF/9khbGGJV8e3QNkyEqcn97BANDQzSjw8t5YdwulhlLjcNIMRospa4s65X0Cr OYDu05RYv0sfIuwosax9DzNIWEKAT+LGW0GQMDOQOWnbdKgwr0RHGzQk1SRmHV8Ht/bghUvQ 4PKQmLr5LlhcSGAio8Tcg9UTGOVnIexawMi4ilE8tbQ4Nz212DgvtVyvODG3uDQvXS85P3cT IzDBnP53/OsOxhWvPuodYmTiYDzEKMHBrCTCy9+qkiDEm5JYWZValB9fVJqTWnyIUZqDRUmc d9fWNfFCAumJJanZqakFqUUwWSYOTqkGppbviearuHbxuZ27L6fMe2KFjlTSi+4L4Y9fp607 VNLUkfaoir17Je9hif6Jf5ZZ1fq5yHuctjrx9OSNLW87fszOnHnF7/HsDWJb4hxPsxburL0c XKqUrGi7/tDMlfGf30z12f2xlnem6S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7Jt8ihM//XzD/oMuXGwdsW9qUhYWvruLbMvfbTOeFwXLXPGKUmz+H2ruf SQv+w6/aq77GNeNvzUFb38S0DKPknl/frjw1nGSkdi3OyEFfa9bUhNrEH/mfVism7fsW92qu xLxzmh2pld/cTd+XlnYwLtLKe8nXWPEq/X91830Tz3tKKTO3/pwjfMav95ESS3FGoqEWc1Fx IgCiwpcKAAMAAA== X-CMS-MailID: 20210211084805eucas1p2a9c601311c97458a3435e3fec49e331b X-Msg-Generator: CA X-RootMTR: 20210211084805eucas1p2a9c601311c97458a3435e3fec49e331b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210211084805eucas1p2a9c601311c97458a3435e3fec49e331b References: <20210211084757.22759-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Dump adc-keys bindings documentation from Linux kernel source tree from commit 698dc0cf9447 ("dt-bindings: input: adc-keys: clarify description"). Signed-off-by: Marek Szyprowski Reviewed-by: Simon Glass --- doc/device-tree-bindings/input/adc-keys.txt | 67 +++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 doc/device-tree-bindings/input/adc-keys.txt -- 2.17.1 diff --git a/doc/device-tree-bindings/input/adc-keys.txt b/doc/device-tree-bindings/input/adc-keys.txt new file mode 100644 index 0000000000..6c8be6a9ac --- /dev/null +++ b/doc/device-tree-bindings/input/adc-keys.txt @@ -0,0 +1,67 @@ +ADC attached resistor ladder buttons +------------------------------------ + +Required properties: + - compatible: "adc-keys" + - io-channels: Phandle to an ADC channel + - io-channel-names = "buttons"; + - keyup-threshold-microvolt: Voltage above or equal to which all the keys are + considered up. + +Optional properties: + - poll-interval: Poll interval time in milliseconds + - autorepeat: Boolean, Enable auto repeat feature of Linux input + subsystem. + +Each button (key) is represented as a sub-node of "adc-keys": + +Required subnode-properties: + - label: Descriptive name of the key. + - linux,code: Keycode to emit. + - press-threshold-microvolt: voltage above or equal to which this key is + considered pressed. + +No two values of press-threshold-microvolt may be the same. +All values of press-threshold-microvolt must be less than +keyup-threshold-microvolt. + +Example: + +#include + + adc-keys { + compatible = "adc-keys"; + io-channels = <&lradc 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <2000000>; + + button-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <1500000>; + }; + + button-down { + label = "Volume Down"; + linux,code = ; + press-threshold-microvolt = <1000000>; + }; + + button-enter { + label = "Enter"; + linux,code = ; + press-threshold-microvolt = <500000>; + }; + }; + ++--------------------------------+------------------------+ +| 2.000.000 <= value | no key pressed | ++--------------------------------+------------------------+ +| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed | ++--------------------------------+------------------------+ +| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed | ++--------------------------------+------------------------+ +| 500.000 <= value < 1.000.000 | KEY_ENTER pressed | ++--------------------------------+------------------------+ +| value < 500.000 | no key pressed | ++--------------------------------+------------------------+ From patchwork Thu Feb 11 08:47:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 380893 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1885327jah; Thu, 11 Feb 2021 00:49:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUXEkzEuf/3pwod/ADqwGQgtSLu3HSEkToEtPT2n062qoK1aOUZl2CQI3RRo3Cz64GIPV+ X-Received: by 2002:a17:906:547:: with SMTP id k7mr7361786eja.273.1613033354216; Thu, 11 Feb 2021 00:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613033354; cv=none; d=google.com; s=arc-20160816; b=d0NRmNRq7dOZf+ZXYZuDjJL1SZ4xoZCOduRZwgwE6Zxg0C8R6xsv2KK/CrANCeLdgK OhYZlOBQQlCu1+w0LmGNZDdaJWlSCpAe6iPIGXrLb2NXKpfDyhLlAusZc7M2kWiCvyHb b9c4d4izf8gd+O/NHaakcEhEaZbr7eDTU6ZeEtC6puJJbpBYxiObSzCNzF2swbTV3sw/ iUNV0gksok09dxoePokMHZPvM7cexIML+EOeGMXngmNUjeH3nlpakPW4ezX9dJQU5sx2 cuoQHxLPnzSh819BTY+tX+gtRLjwbw+LNdyTwLeXA4+0XEJn07UDoURBluWr1+F5HglU fv0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=oQfjYXHghB4xbJZAiJsoSIqJafJmtfhm4dNf5R1O3pU=; b=QBbWDpQVChFFW/ZIlpX09pYjSvDPwGlwSVaJiVobaXPoaof1rij3UViTHn0UGWxIil W++i0qpBLktucDHRMSMxoZdpRhVvHBWihOyxgsRdQL3Y9pCl6VgBCbg9gmJqONCNK9iu kDLK38reNxaZJB+Ep3CwSVmVKphlkoSzQkM+IpMhTfiqSsdB8wZi/kXbwdfQeQYhSdfl ARnwy9lujQiYEo27HhiqaSpCXIxpPiZZtvvYCOJtL1WHCqUB+8pFBLoNXqskIMs1xuqf uAjtG1zbHIxsa6FpeA5ydH153a9iJuEBFZWgeb+66DT3k4FemZEiraDuUDDBb5XI5Oet Lgvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IU8zgorh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f5si3107041ejd.104.2021.02.11.00.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 00:49:14 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=IU8zgorh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0EED1826D4; Thu, 11 Feb 2021 09:48:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="IU8zgorh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 840B88268D; Thu, 11 Feb 2021 09:48:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1239082604 for ; Thu, 11 Feb 2021 09:48:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20210211084806euoutp01c9af1e436a9e33221b9fbcc5ea797626~ipTpQJg9e1444414444euoutp01k for ; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210211084806euoutp01c9af1e436a9e33221b9fbcc5ea797626~ipTpQJg9e1444414444euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613033286; bh=oQfjYXHghB4xbJZAiJsoSIqJafJmtfhm4dNf5R1O3pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IU8zgorhFW2mHdXHxedD+ByEcB13mhujrbAbV0mrPhIenHznktHpuRlQvsT6oqj+4 uIc2DzBU3YRzfePWJ5JgYZMIIlGpQkWhRHFNFTaJz3R1VbNvKm310j/tk2NA2TSe3M uh8T2ju9rOX06EpAiIPELee9/IO58yDVFCrj1r98= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20210211084806eucas1p16def12e6390419e660be0b7bf79039a1~ipTo_ksAX1433514335eucas1p1p; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 1D.11.27958.64FE4206; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210211084805eucas1p19dd298b9466769d0ea8827b6d239d4d8~ipTopI0by1433514335eucas1p1o; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210211084805eusmtrp20afeb14ea39b80c9c75fdb402e2fdd14~ipTooXOJC2424724247eusmtrp2X; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-9d-6024ef46b135 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 91.75.21957.54FE4206; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210211084805eusmtip136f0f30df8b9bb7d2900ee3062dd9b75~ipToJiKNa2024620246eusmtip1a; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Lukasz Majewski , Philippe Reynes , Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 2/5] button: add a simple Analog to Digital Converter device based button driver Date: Thu, 11 Feb 2021 09:47:54 +0100 Message-Id: <20210211084757.22759-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210211084757.22759-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduznOV239yoJBtN3M1tsnLGe1eLGrzZW i+fvLjNZrD1yl93iUF+0RcdhZYtvW7YxWkya8IvN4u3eTnaLw1M/MDpweby/0cruMbvhIovH vFknWDw+fIzzmN/5ncnj7J0djB59W1YxemxcdoA5gCOKyyYlNSezLLVI3y6BK+PzbOGCrxoV D17eYWxg7FHsYuTgkBAwkbj5zb+L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PH2Ts7GD36tqxi9Ni47ABzAEeUnk1RfmlJqkJGfnGJrVK0oYWRnqGl hZ6RiaWeobF5rJWRqZK+nU1Kak5mWWqRvl2CXsbn2cIFXzUqHry8w9jA2KPYxcjJISFgIrHr 9wO2LkYuDiGBpYwSB+5sYIZIyEicnNbACmELS/y51gVV9IlRYu7JZWwgCTYBQ4mut11gtgjQ pJNdl1hBipgFHjFJPO1qZgdJCAskSzxbsgWsiEVAVWLOjJdgNq+ArcShH1PZITbIS6zecABs M6eAncS+PXfANgsB1SxqecI0gZFvASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMBg33bs 5+YdjPNefdQ7xMjEwXiIUYKDWUmEl79VJUGINyWxsiq1KD++qDQntfgQoynQHROZpUST84Hx llcSb2hmYGpoYmZpYGppZqwkzrt17pp4IYH0xJLU7NTUgtQimD4mDk6pBqblvFzaU6yaWLRM jU0YHik/j9TMP7mWY82baxn62b1X1wZOkWBbmnppit1/i2WGa9h7tdjCljck+2yc+HDN5slv PTdt9Xq2aXlRwVu/QJHLDipNckFKL27V8ZR8XP/v4yYvn+/1Znu/7hI6tfHN/lTPtA2/rhfN 2eh6KIdj/Zlj9u6m+/g6qtc8ktp+ZlP2PLE5N/9N+xgcGK2r4v6CU64rZUPRS9dZnKrea/Yv Pbb6B4PQPwOj7HPlzMGv9KJnBypW7mVhctKZvb7NwkRAfs7RprN7Gl/96lSpkXm+8MZy9TW3 2Vi8tVytpZc2VP0QvMzFzNK7OOnHMo3lNpFFLY/8uZuVuX6auh7LOsWwwkaJpTgj0VCLuag4 EQDJmclT/wIAAA== X-CMS-MailID: 20210211084805eucas1p19dd298b9466769d0ea8827b6d239d4d8 X-Msg-Generator: CA X-RootMTR: 20210211084805eucas1p19dd298b9466769d0ea8827b6d239d4d8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210211084805eucas1p19dd298b9466769d0ea8827b6d239d4d8 References: <20210211084757.22759-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add a simple Analog to Digital Converter device based button driver. This driver binds to the 'adc-keys' device tree node. Signed-off-by: Marek Szyprowski --- drivers/button/Kconfig | 8 ++ drivers/button/Makefile | 1 + drivers/button/button-adc.c | 146 ++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 drivers/button/button-adc.c -- 2.17.1 Reviewed-by: Simon Glass diff --git a/drivers/button/Kconfig b/drivers/button/Kconfig index 6b3ec7e55d..6db3c5e93a 100644 --- a/drivers/button/Kconfig +++ b/drivers/button/Kconfig @@ -9,6 +9,14 @@ config BUTTON can provide access to board-specific buttons. Use of the device tree for configuration is encouraged. +config BUTTON_ADC + bool "Button adc" + depends on BUTTON + help + Enable support for buttons which are connected to Analog to Digital + Converter device. The ADC driver must use driver model. Buttons are + configured using the device tree. + config BUTTON_GPIO bool "Button gpio" depends on BUTTON diff --git a/drivers/button/Makefile b/drivers/button/Makefile index fcc10ebe8d..bbd18af149 100644 --- a/drivers/button/Makefile +++ b/drivers/button/Makefile @@ -3,4 +3,5 @@ # Copyright (C) 2020 Philippe Reynes obj-$(CONFIG_BUTTON) += button-uclass.o +obj-$(CONFIG_BUTTON_ADC) += button-adc.o obj-$(CONFIG_BUTTON_GPIO) += button-gpio.o diff --git a/drivers/button/button-adc.c b/drivers/button/button-adc.c new file mode 100644 index 0000000000..eed86564fb --- /dev/null +++ b/drivers/button/button-adc.c @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * Author: Marek Szyprowski + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * struct button_adc_priv - private data for button-adc driver. + * + * @adc: Analog to Digital Converter device to which button is connected. + * @channel: channel of the ADC device to probe the button state. + * @min: minimal uV value to consider button as pressed. + * @max: maximal uV value to consider button as pressed. + */ +struct button_adc_priv { + struct udevice *adc; + int channel; + int min; + int max; +}; + +static enum button_state_t button_adc_get_state(struct udevice *dev) +{ + struct button_adc_priv *priv = dev_get_priv(dev); + unsigned int val; + int ret, uV; + + ret = adc_start_channel(priv->adc, priv->channel); + if (ret) + return ret; + + ret = adc_channel_data(priv->adc, priv->channel, &val); + if (ret) + return ret; + + ret = adc_raw_to_uV(priv->adc, val, &uV); + if (ret) + return ret; + + return (uV >= priv->min && uV < priv->max) ? BUTTON_ON : BUTTON_OFF; +} + +static int button_adc_of_to_plat(struct udevice *dev) +{ + struct button_uc_plat *uc_plat = dev_get_uclass_plat(dev); + struct button_adc_priv *priv = dev_get_priv(dev); + struct ofnode_phandle_args args; + u32 treshold, up_treshold, t; + ofnode node; + int ret; + + /* Ignore the top-level button node */ + if (!uc_plat->label) + return 0; + + ret = dev_read_phandle_with_args(dev->parent, "io-channels", + "#io-channel-cells", 0, 0, &args); + if (ret) + return ret; + + ret = uclass_get_device_by_ofnode(UCLASS_ADC, args.node, &priv->adc); + if (ret) + return ret; + + ret = ofnode_read_u32(dev_ofnode(dev->parent), + "keyup-threshold-microvolt", &up_treshold); + if (ret) + return ret; + + ret = ofnode_read_u32(dev_ofnode(dev), "press-threshold-microvolt", + &treshold); + if (ret) + return ret; + + dev_for_each_subnode(node, dev->parent) { + ret = ofnode_read_u32(node, "press-threshold-microvolt", &t); + if (ret) + return ret; + + if (t > treshold) + up_treshold = t; + } + + priv->channel = args.args[0]; + priv->min = treshold; + priv->max = up_treshold; + + return ret; +} + +static int button_adc_bind(struct udevice *parent) +{ + struct udevice *dev; + ofnode node; + int ret; + + dev_for_each_subnode(node, parent) { + struct button_uc_plat *uc_plat; + const char *label; + + label = ofnode_read_string(node, "label"); + if (!label) { + debug("%s: node %s has no label\n", __func__, + ofnode_get_name(node)); + return -EINVAL; + } + ret = device_bind_driver_to_node(parent, "button_adc", + ofnode_get_name(node), + node, &dev); + if (ret) + return ret; + uc_plat = dev_get_uclass_plat(dev); + uc_plat->label = label; + } + + return 0; +} + +static const struct button_ops button_adc_ops = { + .get_state = button_adc_get_state, +}; + +static const struct udevice_id button_adc_ids[] = { + { .compatible = "adc-keys" }, + { } +}; + +U_BOOT_DRIVER(button_adc) = { + .name = "button_adc", + .id = UCLASS_BUTTON, + .of_match = button_adc_ids, + .ops = &button_adc_ops, + .priv_auto = sizeof(struct button_adc_priv), + .bind = button_adc_bind, + .of_to_plat = button_adc_of_to_plat, +}; From patchwork Thu Feb 11 08:47:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 380888 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1884884jah; Thu, 11 Feb 2021 00:48:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwj1dYblWQ6dh24ur1Jd44iRmAVbg22GBAt43rHsiHDHAULSlQFf1WhS7m8xGgt96ukVkxd X-Received: by 2002:a17:906:b055:: with SMTP id bj21mr7471301ejb.355.1613033300293; Thu, 11 Feb 2021 00:48:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613033300; cv=none; d=google.com; s=arc-20160816; b=Qya0F9XiC4rHFaZ4vsdM5zSmCJ/BWcSq8hHmjzAec3DfaaX7K/KYaMTJfE9OXcDNQ2 IOiiDYebRbWOju+GTN36DTY+xP1NGKClo4di1zuapJak/dOZTK+syo7nHGfi/+STx7DL s7hMT6CzJ/+aFw3jOiTGnbU8nsXJlNwqvQj6gerAK3nRoxawCP4cxYVf2RvH0EgAS5Zo FieovBC6oIQsyhinP9yTlDzKiAZsgN/37IMKDQrqlZQHOt5EaYPnrjzgF/oVFySaNYPd gSbOiUD9hTV83Motr0PsMPQuNDI7CQFufaZMeSDBpfDMZUG0+MpOqd7iv5gXc73w+b2x Ghcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=+mQOJRUfPEgamOlpRSpMQF1NyKixEJUJ0c4gNG61Ouo=; b=PSFO66c1CVc4qpsujE28LJTtDNADCMTx+mC4KhSiYEaf5utxscMCGL6l4DcmxQyyeI JiQGPODV//NaJU95pm551Hn9RsHy6tZvAQc0nOjz40qN5skiWPlGoWymqqTg9vgOWwXr OHPTg1Jnh4wUIyTzLnuaxQjL2hTc/fl1zY41hwYXpdzH7mZ6ITEpsIS4Fvz95fLSeC+J p+qx4kue8gUR/S8sj0m79fCwCZ6jPR4FyF0FvQb2Ej8VahikvvbDweiFugn1F52bHkcv rspHSKIK5pTms7Nbd4+WCpskf9P/nkn+xoBMtvg1qP/BSUlarRUwhXxh0460b+a7Lmd7 wK4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CTxZsrUt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id g24si3389091edu.329.2021.02.11.00.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 00:48:20 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CTxZsrUt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE59F82657; Thu, 11 Feb 2021 09:48:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="CTxZsrUt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B79082675; Thu, 11 Feb 2021 09:48:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9AD5882627 for ; Thu, 11 Feb 2021 09:48:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20210211084807euoutp020ddf35ab1e6e771839663de111a70fc2~ipTp8Wh_R2343623436euoutp02c for ; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20210211084807euoutp020ddf35ab1e6e771839663de111a70fc2~ipTp8Wh_R2343623436euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613033287; bh=+mQOJRUfPEgamOlpRSpMQF1NyKixEJUJ0c4gNG61Ouo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CTxZsrUtr+59s8xluXoH6FaRjvuC2dHCZXrfbOp+l+NcL24PfIPd8Lw4t/CuzK2WY mDxDVqNCzfDyJTrVBQ9GsY2AFTOOkbdMFEoWsEwVugyj7CtLBZ87QuS1kZzUcAzlEl QO4/k7BWurguU09T3GvOxsr8IwfD64ATEjJlzUNc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210211084806eucas1p236fd3ccc0e7fb7ba6f27b29547b8dc7e~ipTphn7x21131511315eucas1p2d; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id CE.94.45488.64FE4206; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210211084806eucas1p1ddadaa9bf4eb0f0b4f0acd1dd06113d7~ipTpJmwVa1432314323eucas1p1x; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210211084806eusmtrp139c3e371bb90b570b1aa930773fa430c~ipTpIyaIr3224632246eusmtrp1V; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-88-6024ef46d926 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1F.56.16282.64FE4206; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210211084805eusmtip186c1fe5498e473b593b66cf69e2d46c7~ipTokhg4p2072020720eusmtip1t; Thu, 11 Feb 2021 08:48:05 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Lukasz Majewski , Philippe Reynes , Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 3/5] adc: meson-saradc: add support for getting reference voltage value Date: Thu, 11 Feb 2021 09:47:55 +0100 Message-Id: <20210211084757.22759-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210211084757.22759-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSe0hTURzu3Hu3XWebtxl4UDNYWmZor4G3l9iDuj2goCAty628ONPN3N16 +E/qUHTW0lRcK5Ya2rKHWkvMR8wpU1qZVuoqpSJCsqxJ2WiB5fX2+O/7ft/3+75zDgdHJQZe MJ6m1tIatSJDyhdizc4ffdFbv4TLV7z+FE42mRp4pNtXwCPHPj9DyFvdowLSYTxIFnYtIr/b mgF5ocTHJyc6igRkV4UHxAupL+58AXUpZwCjLOZejPJMHqauFHkR6vFIC6CMtnpANdXZ0T34 AeH6FDoj7QStWR4nFyqNnV+R407RqYL2T/wcYPI3AByHhAza7582ACEuIawAGqueowbgN0O+ AVhhPcIJXwF0tlkwVmAX6jpeCzjhGoBd014+R2Y2vD0uwLr4xEpomDDwWTyfWAWf5rVgrAkl RhBoKMuZjQokkmBN97lZE0ZEwHfTRQIWi4gN0O17Ari6hfBGo332TH5EHHzQPsJjgyBhx+HU g0mEu8QWOHae5vyBcLzHJuBwKHSVncU4vx7At323BBw5C+CzPNOfhnVwpM/HZ4NQYilsaF3O jTfCttwBPpcvhu6JeewYnYEXmitRbiyChQUSzr0Ymntu/6vt7H+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xsiq1KD++qDQntfgQoynQHROZpUST 84ERl1cSb2hmYGpoYmZpYGppZqwkzmtyZE28kEB6YklqdmpqQWoRTB8TB6dUA5Nf/yp+Z886 ZTefjLzZ7J+rdphGbpKwFbkddSPj1anOOa4bhY5+83lTtfld1vXlkRseSlVV7Z89YetzPpkz AvVMnhPPvEnqNCkXMOi837zVbnLmkvCABrWl6RsM5ZlZOXf7G5Q9TJc4WL3mm7F0x5Gni/TN E+X/L924794aZ84rj71vzDbXLwwtMhcUza82Yj3M5ntu+3/Ws2ZbLrJ/vm+hb3+oib1p9au/ FYbGQuUnxT/UhWolXZnffYV1g/n3eREionYFUTydS5L6nTL8jpW9aRSv4mk/OWtXWLCf0LfI H/EH3zypK3yXzrfmbvzGZXHfDod80ddaOdv67ENTqa5fEckhEXpe0jvvX9Xap8RSnJFoqMVc VJwIADMHwCkAAwAA X-CMS-MailID: 20210211084806eucas1p1ddadaa9bf4eb0f0b4f0acd1dd06113d7 X-Msg-Generator: CA X-RootMTR: 20210211084806eucas1p1ddadaa9bf4eb0f0b4f0acd1dd06113d7 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210211084806eucas1p1ddadaa9bf4eb0f0b4f0acd1dd06113d7 References: <20210211084757.22759-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support for getting the 'vref-supply' regulator and register it as ADC's reference voltage regulator, so clients can translate sampled ADC values to the voltage. Signed-off-by: Marek Szyprowski Reviewed-by: Simon Glass --- drivers/adc/meson-saradc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.17.1 diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c index 21db55831d..1a45a3a265 100644 --- a/drivers/adc/meson-saradc.c +++ b/drivers/adc/meson-saradc.c @@ -18,6 +18,7 @@ #include #include #include +#include #define MESON_SAR_ADC_REG0 0x00 #define MESON_SAR_ADC_REG0_PANEL_DETECT BIT(31) @@ -656,7 +657,10 @@ static int meson_saradc_stop(struct udevice *dev) static int meson_saradc_probe(struct udevice *dev) { + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev); struct meson_saradc_priv *priv = dev_get_priv(dev); + struct udevice *vref; + int vref_uv; int ret; ret = regmap_init_mem(dev_ofnode(dev), &priv->regmap); @@ -675,6 +679,23 @@ static int meson_saradc_probe(struct udevice *dev) priv->active_channel = -1; + ret = device_get_supply_regulator(dev, "vref-supply", &vref); + if (ret) { + printf("can't get vref-supply: %d\n", ret); + return ret; + } + + vref_uv = regulator_get_value(vref); + if (vref_uv < 0) { + printf("can't get vref-supply value: %d\n", vref_uv); + return vref_uv; + } + + /* VDD supplied by common vref pin */ + uc_pdata->vdd_supply = vref; + uc_pdata->vdd_microvolts = vref_uv; + uc_pdata->vss_microvolts = 0; + return 0; } From patchwork Thu Feb 11 08:47:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 380891 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1885146jah; Thu, 11 Feb 2021 00:48:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8u/3/LhfIhxWWb8GkGxgYvb9SNwrf8aBzbCtkSvpnICTGv5AuM86Cwjn6SpbJMfgZnM6Q X-Received: by 2002:a17:907:1629:: with SMTP id hb41mr7115038ejc.197.1613033333085; Thu, 11 Feb 2021 00:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613033333; cv=none; d=google.com; s=arc-20160816; b=CYtp5dt1gyobgBIOm32iPRLfp1+B6mN3sgFd3ce+nvB6qA05o2DLMSHxVm2s3R2ftX SJfjbiE5jyPqQAcFqvDrR1YtgLSM1QH6J4Aq0opqeOZXi295bdGojcwoJRlBzdU0YoWn 1/yzSvTYgiSoITiccd6mM7La/OEzd37boD8kfrdtYYRHj1NMtIByuzxfZx6ybBZnBzBH X32U80LFtiwI7ZHQhINGMXuKRYMAFJx3jrOFwzEU20zVgY+lzSQVYed7gdZjuxlN2EHO 6aJ4TMNbIqvn97zCuXVIuYUSBPzTM0Jr4jD9gXJxKXGtbMJ+mxPQR2BXSyH6WjpkZ3zd idEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=t7Ximx8YxR9eUZTuSzHnGTVVQVi87eVXbtpcgmrIjMc=; b=wp5HwlyFGwn8sZoIG2zeN8AF0glSFhgTy/2xIHDXJ3dBh5EjTyQCLa6lUMNKexwGok KNABgUSmr+OSycc0zOFhrY75KDxePIQQj0zmLNLFe1qSr7oJ/fFsgTh6MpLBfApMsGjX 8zYB63n8lQchrFMZL5nGx2LfwS6XqhHv9D7uSUIgiZhjfmj85RMnLWagnrrgI5JCXOic a1YNTDUllV8CFHLn6d3l6WEmXrknS/p/qrap2eHPEmyv1adX3SYrEGJ0a1p2IKbTNx8+ YiejCCQ2PpYvWD5ZMFlSO3kpGIIiUOKiCHskhJeigidXCYgM7WwqQC/AiMQbwmC8I5cB alHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="sqX/Pjmh"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id jx25si3251341ejb.12.2021.02.11.00.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 00:48:53 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="sqX/Pjmh"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 71AEC82687; Thu, 11 Feb 2021 09:48:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="sqX/Pjmh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A08C82687; Thu, 11 Feb 2021 09:48:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D6B8882636 for ; Thu, 11 Feb 2021 09:48:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20210211084807euoutp015eba2ae03923ea6259b080d24f7882ae~ipTqKNANl1444414444euoutp01n for ; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210211084807euoutp015eba2ae03923ea6259b080d24f7882ae~ipTqKNANl1444414444euoutp01n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613033287; bh=t7Ximx8YxR9eUZTuSzHnGTVVQVi87eVXbtpcgmrIjMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqX/PjmhBB+kNp/w0iQV0JA19kkX6G+bdgwMuOjdXTDout9kYfCRDT9LuVXaX8TVN CltP0H//KXum6slbTIyY/mFRuLZYM4ALiUdMoYmMZWjkXafeFySyoHIetU4RlLvrQx U9vHTIH2/9a8TVhNizq1xkKENfIHy6h1CBvqyFmw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210211084807eucas1p2a6415fc6124cfad612a70510820f5fbc~ipTp3fPyZ1135811358eucas1p2m; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 6D.F1.44805.64FE4206; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210211084806eucas1p12459ec4f4d9871e8abba678a8589165a~ipTpjxlWt1572715727eucas1p1W; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210211084806eusmtrp235e7d6d019179888e6327b4b1c5cbfa2~ipTpjIgk62424724247eusmtrp2c; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) X-AuditID: cbfec7f4-b4fff7000000af05-f7-6024ef467cb4 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 13.75.21957.64FE4206; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210211084806eusmtip1d5608371e5345a2b169121f79dba2665~ipTpAzsxL1945819458eusmtip14; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Lukasz Majewski , Philippe Reynes , Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 4/5] configs: khadas-vim3(l): enable Function button support Date: Thu, 11 Feb 2021 09:47:56 +0100 Message-Id: <20210211084757.22759-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210211084757.22759-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42LZduznOV339yoJBk2LGS02zljPanHjVxur xfN3l5ks1h65y25xqC/aouOwssW3LdsYLSZN+MVm8XZvJ7vF4akfGB24PN7faGX3mN1wkcVj 3qwTLB4fPsZ5zO/8zuRx9s4ORo++LasYPTYuO8AcwBHFZZOSmpNZllqkb5fAldGz+wJbwSOO ikk9a5kbGK+zdzFyckgImEjs7P3IDGILCaxglDh7vqyLkQvI/sIocW7xGRYI5zOjxI6vU9lg O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l hZ6RiaWeobF5rJWRqZK+nU1Kak5mWWqRvl2CXkbP7gtsBY84Kib1rGVuYLzO3sXIySEhYCIx 68JPxi5GLg4hgaWMEnv7JkMlZCROTmtghbCFJf5c62KDKPrEKDHhz3awBJuAoUTXW5AEJ4cI 0KSTXZdYQYqYBR4xSTztagabJCzgL/HnZy8TiM0ioCqx5/luFhCbV8BW4s2JOUwQG+QlVm84 wAxicwrYSezbcwdsgRBQzaKWJ0wTGPkWMDKsYhRJLS3OTc8tNtQrTswtLs1L10vOz93ECAz3 bcd+bt7BOO/VR71DjEwcjIcYJTiYlUR4+VtVEoR4UxIrq1KL8uOLSnNSiw8xmgLdMZFZSjQ5 HxhxeSXxhmYGpoYmZpYGppZmxkrivFvnrokXEkhPLEnNTk0tSC2C6WPi4JRqYFI+H9J0pM63 6LviQZ9Jqy7FtevueNHuLPx99VpDxsq61XPXbi6xSLD8PHHLjJ15m2TfhrK8XhJqUPF54nK+ JTyt1VM0L+6wNFpyjTfZw+WTMquzgdwDpQ7zrmjBSRaZfEr8L3+lHj8QcfTtT9V1k06tXHDe 6X/E7+fFn4zi1/5zv2fAfdSkc/XtdO1JG8pORq23X/Hufc2RmtlLY8vOXS24prgyXnpDJP/d b095jLwmVzemn7p+7FS+exHrTe+3ufOO7FF7f2GfyrL/rbL7lJ+WsYUVyZ8U+323L/JMRLCD z48r5osueDy8fERwv0XAku8rtSK3OB0xyW1c+V5jOsshQZ/XAU8UY1/x/bg3W8BSiaU4I9FQ i7moOBEAXVoYSgADAAA= X-CMS-MailID: 20210211084806eucas1p12459ec4f4d9871e8abba678a8589165a X-Msg-Generator: CA X-RootMTR: 20210211084806eucas1p12459ec4f4d9871e8abba678a8589165a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210211084806eucas1p12459ec4f4d9871e8abba678a8589165a References: <20210211084757.22759-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add options required to check the 'Function' button state. Signed-off-by: Marek Szyprowski Reviewed-by: Simon Glass --- configs/khadas-vim3_defconfig | 2 ++ configs/khadas-vim3l_defconfig | 2 ++ 2 files changed, 4 insertions(+) -- 2.17.1 diff --git a/configs/khadas-vim3_defconfig b/configs/khadas-vim3_defconfig index 5d16652fd6..bc17430569 100644 --- a/configs/khadas-vim3_defconfig +++ b/configs/khadas-vim3_defconfig @@ -31,6 +31,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_ADC=y CONFIG_SARADC_MESON=y +CONFIG_BUTTON=y +CONFIG_BUTTON_ADC=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MESON=y CONFIG_DM_MMC=y diff --git a/configs/khadas-vim3l_defconfig b/configs/khadas-vim3l_defconfig index 6b13ce045c..c1877922c7 100644 --- a/configs/khadas-vim3l_defconfig +++ b/configs/khadas-vim3l_defconfig @@ -31,6 +31,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_ADC=y CONFIG_SARADC_MESON=y +CONFIG_BUTTON=y +CONFIG_BUTTON_ADC=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MESON=y CONFIG_DM_MMC=y From patchwork Thu Feb 11 08:47:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 380892 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1885241jah; Thu, 11 Feb 2021 00:49:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoDin+2FPHgMx8i4wX8Tks90aOWYawe80i6X68WHps0u/ZbCa6pOSkvGloWJBV989oS+NU X-Received: by 2002:a17:906:3c0f:: with SMTP id h15mr6615270ejg.295.1613033343958; Thu, 11 Feb 2021 00:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613033343; cv=none; d=google.com; s=arc-20160816; b=kp7ZRPRBTLNyBjp4nPPYLjDQbZmGQ9MYqQSERB5IKB1QamEvq2U+vfoQOoZMmr+U4u 5jjMmygChgqE6SVmUC7z8I7lkWk+nSIAYc4dt0XBJSXtug1+78HgWZRsJfg6tyqXds1O mGWlzMzSbkVsOLM4GWy3+VQ3hbOyPycHrGXYXz0mQScvw9Nfajvk/yIE7e3U8ERjd8da EgMSstxvnr3YzJ7jabDJ8rMmWU8SSziI/JNx/3wE696giuZiQLLcd2WjWJxjQT+y+2Wo GNLzq2pBsxQcLUh1IjHLEM55uNj249Uq2ea09yDh42+ajigvg1ZNjLtlFBCnLVbfD/N0 0yoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=oDnB7YE84RYcuHJnMgbwYk+6MOvdpACHdTK/rReaxjM=; b=Cnv4wWHCdMSqeiB3v+1vhvxUhJfUWBe7OJPdSKxcDquOxnOyYPBqAqWrpEUdmqM4b8 u5bSFs2xBsnnuaWoIIaKQ9ysIFKTXiZXc4zrsl2LG9pdJM4Ww+NlhxuXBG17Av8IS3BO +DFCnlQ2gDLe/uuZL0miVNYzUPP4B46Areb//DVXhQTAKSB6RiUdW+MtsdMnoMS5ER7g GkSlDHfuF+GJRim0OXbcuiYxo6VAKIEF/r6lkHyMB26y266p33eer5+1C94BxaYDM813 YQXVf79+mptaiwCmVqVAQTGVK+BrEz/4JPYF9znqXErH0kpjWY8sWtFSkOUBP60er2sZ QONA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cWfr4rER; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r21si3753759ejo.123.2021.02.11.00.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 00:49:03 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cWfr4rER; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4126C826B2; Thu, 11 Feb 2021 09:48:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="cWfr4rER"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 13C0082604; Thu, 11 Feb 2021 09:48:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B042882663 for ; Thu, 11 Feb 2021 09:48:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20210211084808euoutp02f6b224b59b976da1646f47cd0276f2ae~ipTrE64Ui2343823438euoutp02b for ; Thu, 11 Feb 2021 08:48:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20210211084808euoutp02f6b224b59b976da1646f47cd0276f2ae~ipTrE64Ui2343823438euoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613033288; bh=oDnB7YE84RYcuHJnMgbwYk+6MOvdpACHdTK/rReaxjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cWfr4rERt/kQA2uHm2zp7GGKrIE7pKwabzetJCywl3IeLEUGPYpEYgMyeRm5+KIPH O9PACKvEOan+0ukgmXWXarGYZjoKwa2rn3KVpMYN++5j0+BUNeI4Qp7pBiHBqXSeXc T0zz3JJ/QBP426XVnzENfUQO3ndK3CLKxkjo2veE= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210211084807eucas1p29870879d922d67ae9528c4927d42546a~ipTqmz5o31146611466eucas1p2i; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 50.A4.45488.74FE4206; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20210211084807eucas1p2e9e5d1fe99d98130649d97ebcd82d854~ipTp9lcVw1131511315eucas1p2h; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210211084807eusmtrp11acdf5ebe8e0412606ec2205d9e11c97~ipTp8vy7H3224132241eusmtrp1f; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-8e-6024ef470726 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id DF.56.16282.74FE4206; Thu, 11 Feb 2021 08:48:07 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210211084806eusmtip1bd482e205bee4c15de719f0e7c3c9a50~ipTpd2-zw2079920799eusmtip1d; Thu, 11 Feb 2021 08:48:06 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Lukasz Majewski , Philippe Reynes , Simon Glass , Heinrich Schuchardt , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v6 5/5] test: add a simple test for the adc-keys button driver Date: Thu, 11 Feb 2021 09:47:57 +0100 Message-Id: <20210211084757.22759-6-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210211084757.22759-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduznOV339yoJBreuG1psnLGe1eLGrzZW i+fvLjNZrD1yl93iUF+0RcdhZYtvW7YxWkya8IvN4u3eTnaLw1M/MDpweby/0cruMbvhIovH vFknWDw+fIzzmN/5ncnj7J0djB59W1Yxemxc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du9newWh6d+YHTg8nh/o5XdY3bDRRaP ebNOsHh8+BjnMb/zO5PH2Ts7GD36tqxi9Ni47ABzAEeUnk1RfmlJqkJGfnGJrVK0oYWRnqGl hZ6RiaWeobF5rJWRqZK+nU1Kak5mWWqRvl2CXsarxqusBVuUKy7/qGxgvCLbxcjJISFgItH9 5S5rFyMXh5DAUkaJnruNrBAJGYmT0xqgbGGJP9e62EBsIYFPjBI3lomA2GwChhJdbyHiIkCD TnZdAhvELPCISeJpVzM7SEJYwE/i+Pk/LCA2i4CqxLmTh8FsXgFbiTNHrzNBLJCXWL3hADOI zSlgJ7Fvzx1WiGW2EotanjBNYORbwMiwilEktbQ4Nz232EivODG3uDQvXS85P3cTIzDUtx37 uWUH48pXH/UOMTJxMB5ilOBgVhLh5W9VSRDiTUmsrEotyo8vKs1JLT7EaAp0x0RmKdHkfGC0 5ZXEG5oZmBqamFkamFqaGSuJ85ocWRMvJJCeWJKanZpakFoE08fEwSnVwCStpm/5y0J5ytuN mx6u459X4XJNjat907UalnSDF51fVgot3R32ynPrllVpc7bcm3bY56i83P++WzuDc0+cc4lJ MrJkKrku4XV2ddqkVKkTFbM/JM1mfVhhVlXi1DTjws2UQ/uvtK4PUFbJWRW1Iuamw62cteU3 101/lMhw8lFhc4V4So1SUmHjgZVPrHoWlXG9fXw1kdfyyoudTxanaU/9tlzir+LnU96GMhKc XUc0hG29erq+xSRtnVK8wU34gFrbKTtn8Xd6BzjdlbwVZ8ZtX9jms4rp0NUXDBOqvksuPLXc 7jmLnPZZt+5+9gLfaccadNpeXax0ZJjEyLtI8fKP67K7ZhfOePbJlXX7j1QlluKMREMt5qLi RAB3+5ax/gIAAA== X-CMS-MailID: 20210211084807eucas1p2e9e5d1fe99d98130649d97ebcd82d854 X-Msg-Generator: CA X-RootMTR: 20210211084807eucas1p2e9e5d1fe99d98130649d97ebcd82d854 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210211084807eucas1p2e9e5d1fe99d98130649d97ebcd82d854 References: <20210211084757.22759-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add adc-keys device to the sandbox/test.dts and connect it to the channel #3 of the sandbox_adc driver. The default values sampled by sandbox_adc driver determines that button3 and button4 are released and button5 is pressed. Signed-off-by: Marek Szyprowski --- arch/sandbox/dts/test.dts | 24 ++++++++++++++++++- configs/sandbox_defconfig | 1 + test/dm/button.c | 50 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 72 insertions(+), 3 deletions(-) -- 2.17.1 Reviewed-by: Simon Glass diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index e95f4631bf..a32b019ae7 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -69,6 +69,27 @@ }; }; + buttons2 { + compatible = "adc-keys"; + io-channels = <&adc 3>; + keyup-threshold-microvolt = <3000000>; + + button-up { + label = "button3"; + press-threshold-microvolt = <1500000>; + }; + + button-down { + label = "button4"; + press-threshold-microvolt = <1000000>; + }; + + button-enter { + label = "button5"; + press-threshold-microvolt = <500000>; + }; + }; + cros_ec: cros-ec { reg = <0 0>; compatible = "google,cros-ec-sandbox"; @@ -587,8 +608,9 @@ i2c-eeprom = <&bootcount_i2c>; }; - adc@0 { + adc: adc@0 { compatible = "sandbox,adc"; + #io-channel-cells = <1>; vdd-supply = <&buck2>; vss-microvolts = <0>; }; diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 0c7674efc9..3731bf05ff 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -122,6 +122,7 @@ CONFIG_DM_BOOTCOUNT=y CONFIG_DM_BOOTCOUNT_RTC=y CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y CONFIG_BUTTON=y +CONFIG_BUTTON_ADC=y CONFIG_BUTTON_GPIO=y CONFIG_CLK=y CONFIG_CLK_COMPOSITE_CCF=y diff --git a/test/dm/button.c b/test/dm/button.c index ecaa47cf5f..f8a7fab61d 100644 --- a/test/dm/button.c +++ b/test/dm/button.c @@ -7,7 +7,10 @@ #include #include +#include #include +#include +#include #include #include #include @@ -17,11 +20,20 @@ static int dm_test_button_base(struct unit_test_state *uts) { struct udevice *dev; - /* Get the top-level device */ + /* Get the top-level gpio buttons device */ ut_assertok(uclass_get_device(UCLASS_BUTTON, 0, &dev)); + /* Get the 2 gpio buttons */ ut_assertok(uclass_get_device(UCLASS_BUTTON, 1, &dev)); ut_assertok(uclass_get_device(UCLASS_BUTTON, 2, &dev)); - ut_asserteq(-ENODEV, uclass_get_device(UCLASS_BUTTON, 3, &dev)); + + /* Get the top-level adc buttons device */ + ut_assertok(uclass_get_device(UCLASS_BUTTON, 3, &dev)); + /* Get the 3 adc buttons */ + ut_assertok(uclass_get_device(UCLASS_BUTTON, 4, &dev)); + ut_assertok(uclass_get_device(UCLASS_BUTTON, 5, &dev)); + ut_assertok(uclass_get_device(UCLASS_BUTTON, 6, &dev)); + + ut_asserteq(-ENODEV, uclass_get_device(UCLASS_BUTTON, 7, &dev)); return 0; } @@ -72,3 +84,37 @@ static int dm_test_button_label(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_button_label, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +/* Test adc-keys driver */ +static int dm_test_button_keys_adc(struct unit_test_state *uts) +{ + struct udevice *supply; + struct udevice *dev; + int uV; + + ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc@0", &dev)); + + ut_assertok(regulator_get_by_devname(SANDBOX_BUCK2_DEVNAME, &supply)); + ut_assertok(regulator_set_value(supply, SANDBOX_BUCK2_SET_UV)); + ut_asserteq(SANDBOX_BUCK2_SET_UV, regulator_get_value(supply)); + /* Update ADC plat and get new Vdd value */ + ut_assertok(adc_vdd_value(dev, &uV)); + ut_asserteq(SANDBOX_BUCK2_SET_UV, uV); + + /* + * sandbox-adc returns constant value on channel 3, is used by adc-keys: + * SANDBOX_ADC_CHANNEL3_DATA * SANDBOX_BUCK2_SET_UV / SANDBOX_ADC_DATA_MASK = + * 0x3000 * 3300000 / 0xffff = 618759uV + * This means that button3 and button4 are released and button5 + * is pressed. + */ + ut_assertok(button_get_by_label("button3", &dev)); + ut_asserteq(BUTTON_OFF, button_get_state(dev)); + ut_assertok(button_get_by_label("button4", &dev)); + ut_asserteq(BUTTON_OFF, button_get_state(dev)); + ut_assertok(button_get_by_label("button5", &dev)); + ut_asserteq(BUTTON_ON, button_get_state(dev)); + + return 0; +} +DM_TEST(dm_test_button_keys_adc, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);