From patchwork Thu Feb 18 10:33:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 384388 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3559572jao; Thu, 18 Feb 2021 02:34:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdWJevfJMM2InTeXwX0IPUJG3nOPQmI5Yla9ZKytBKClr+wj4qfNoQpwxItUfk/oIsxZ7/ X-Received: by 2002:a17:906:6095:: with SMTP id t21mr3367834ejj.384.1613644498165; Thu, 18 Feb 2021 02:34:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613644498; cv=none; d=google.com; s=arc-20160816; b=SZcCvhw+UX6jKBdI/m1sjumOF4MRkoMwqPtgcFPxIRjMG0PyCsWnB3wH0eEf8vEX1p hMJCVJrbJ/IrvYEErq/FaO3r4ZD4vFjscDf5TOz9ky22Lpi9+wi2RQgkZyaPG+Cq+e5s kBtXbpj8J7ftHa/PyJ2qHAzt8cq9P6D5/R6/V9d+pDxOUC9WIoEB0vLMYj2Y34XpLteA 6eAgpcvqTULxF1z7Z0JaMtPapbLsRn9LI7mZVwZTIrJkn/69kOJm4sruTNTzTkFxnV/m XNeZQxqdFTWexydYIf3Ux7iLOV4wUojopuUK7QV8GPSifLHAPtFGwSOvNo4CUL1d3gtz 3JDg== 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=wfA2z/C+GCh1PKZrNawax9HfDxInv/dYbcWz4VS5XWkLkXQB6Aa6FZOHHpHBuD9lFD TJwJQOeSmw7ceWvTOeqTqMntap7R4cqLGMZzTH39nbEC92UlESRC5ZjgJzC1yFOnqYir cyL6hls2LydvsFai3yMmy3Hs/Nmg7J4WT5n1A/rsgjChGe34VSD/AQshcMctlbHSYZ2q pJJG7A6mANP3K3aYf1efOHe5cTjEITb8kQ+IO+wUtcqygdNBJwt+GN6Z0e52nNi3nhC8 7b5FkqbX9MjWlcP6DcR8xZ+5VLB/MPlDOe+x8RHLwt560B+6zEPzcF/FzycePOVl8xmx DZcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cvEo7On8; 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 u5si2709722edy.35.2021.02.18.02.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:34:58 -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=cvEo7On8; 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 49ED08276E; Thu, 18 Feb 2021 11:34:36 +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="cvEo7On8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5762826FB; Thu, 18 Feb 2021 11:33:55 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 F140C82656 for ; Thu, 18 Feb 2021 11:33:44 +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 20210218103329euoutp02555f6968f2312d5c4c5671a925f63946~k0QphuUb92955829558euoutp02f for ; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20210218103329euoutp02555f6968f2312d5c4c5671a925f63946~k0QphuUb92955829558euoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613644409; bh=D47RA9MzNM4nc/l88JXosw7tAT3dRhcZFuVE29Hw6E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvEo7On8IkdXQDdOySXe22VXTYSUi5Mjetd1c5cuosNMR5cv85GieHv0Cj+xMs2lc OQ1KXlzuh0XdFk3428jJ1TSlfB7mVpHsNrbytxKL8Z8WMCpKgyG/2FRWrx8P4FkFST 6gsvDIRW7ohQpluzeiOSYadDFFjL+A1bw6Dnh6xo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210218103328eucas1p2a47ecc6c0f9325e640e3110ae9c93ef5~k0QpFlKEh0858108581eucas1p2F; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id D3.F7.44805.8724E206; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210218103328eucas1p1f19a277901e86fd56c4c336fc9f861b5~k0Qoqbmgu2292022920eucas1p1I; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210218103328eusmtrp22f067b186594e227e58e124dad5570ee~k0QopkH3X2025120251eusmtrp2m; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) X-AuditID: cbfec7f4-b4fff7000000af05-0f-602e4278e54d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 36.56.16282.7724E206; Thu, 18 Feb 2021 10:33:27 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210218103327eusmtip29b2391a927e638d193494ed5ca364b58~k0QoKEj982851728517eusmtip2f; Thu, 18 Feb 2021 10:33:27 +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 v7 1/5] dt-bindings: input: adc-keys bindings documentation Date: Thu, 18 Feb 2021 11:33:14 +0100 Message-Id: <20210218103318.18915-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218103318.18915-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduzned0KJ70Eg30bJSw2zljPanHjVxur xfN3l5ks1h65y25xqC/aouOwssW3LdsYLSZN+MVm8XZvJ7vF4akfGB24PN7faGX3mN1wkcVj 3qwTLB4fPsZ5zO/8zuRx9s4ORo++LasYPTYuO8AcwBHFZZOSmpNZllqkb5fAldG29T17wXWx ileP5rI1MF4U6mLk5JAQMJGYNe0bexcjF4eQwApGibYDl1khnC+MEktXHIVyPjNK7Lt0mgmm pXXvNCaIxHJGiStt59jhWjZc6garYhMwlOh628UGYosIGElcatrBAlLELHCHSaJrcgMLSEJY wFvixueDYEUsAqoS3xf/AbN5BWwljnw/zA6xTl5i9YYDzCA2p4CdxJOz81kg4kc4JPpfm0LY LhIbZsyFqheWeHV8C5QtI/F/53ywUyUEmhklHp5byw7h9DBKXG6awQhRZS1x59wvoM0cQOdp SqzfpQ8RdpS4OO8GK0hYQoBP4sZbQZAwM5A5adt0Zogwr0RHGzQg1SRmHV8Ht/bghUvMELaH xNTbT8BOFhKYyCjx4XrBBEb5WQi7FjAyrmIUTy0tzk1PLTbKSy3XK07MLS7NS9dLzs/dxAhM L6f/Hf+yg3H5q496hxiZOBgPMUpwMCuJ8LJ/1koQ4k1JrKxKLcqPLyrNSS0+xCjNwaIkzpu0 ZU28kEB6YklqdmpqQWoRTJaJg1OqgYmv+fqS5c+MBbOWLxG7rnrk4vyAWxo55UvWK82TVtVo KfCzUNzn/PNBlMAG7Sd3Xu26cdzqsa71cc0L1V232+TCW+yfhr84e7jxYLbnzoqXEecPn1TQ 8wk/H2285t5yd4NHnEqLri1Z6SARIVtzM2Xt6VtRwstPC8473ZY+yYA9a4ZFg67Iui+vtOSP Xf/tX3+Hg+n6CZOkrWzztplZC3e3xTnyM20L2h/1a5lSyGOfH+LhV3XWeR+VZHolOL3iVv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TOAxP zJhZWFtq/Xvzk3ijoJCUzsoNnZ98A5zOfNS9NOXGXf5ov8zra90XJqfym/hsDldiKc5INNRi LipOBAARRSsVAAMAAA== X-CMS-MailID: 20210218103328eucas1p1f19a277901e86fd56c4c336fc9f861b5 X-Msg-Generator: CA X-RootMTR: 20210218103328eucas1p1f19a277901e86fd56c4c336fc9f861b5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210218103328eucas1p1f19a277901e86fd56c4c336fc9f861b5 References: <20210218103318.18915-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 18 10:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 384385 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3559249jao; Thu, 18 Feb 2021 02:34:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPpY3ifvfqWucecVHr5M18/++3s6rudaQ4r2ge0Ttwtmpf3j6nBQz0mWaNcR4mpjAVuOoN X-Received: by 2002:a05:6402:541:: with SMTP id i1mr3522924edx.36.1613644462506; Thu, 18 Feb 2021 02:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613644462; cv=none; d=google.com; s=arc-20160816; b=cdlJXyXr8GqhEkX2Pi2/n58HKo4Q0CxMp9CdIatUft7K7H7aIsHMhWTvt3bEfvvqNf +k3GyUfDpmZVgrCrwjCHIPyAmLQSP+y9jNnM1lWhl7VlUcWq2/2TU1I6xvKPDeH3j/c4 pzuzNcl6yTxrrcCY/ECxs4+wYJQ8ip2MFTTzn10+TX5yGVVXzSNRuTv5r447NpRpyjWf Ss02Bkmlcs108w5Xo9cAjbg247CGZi+EZDq4UaEnf9weEVXLgJqxxpTuBVfKWIzWg51a +quJOdsYlgomlG5xRp4MrFyuYtwOU81xllHTJOgdtYbK8vbr8S4IYDhQxrrUrIbSSOB5 mGPA== 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=rnt/EdI0agJZ1KatsV6fzxiwEiTIekgMqXPesRPDTyI=; b=F+pK5cBribw/h/ic534RcfjhBUtZieuFImSVLjUmnSlr4ZLWis2GOD7MZ2KUO7hI49 xbCJBBoBTp+P0ebbLnZFwIfCnfhWS6uv8iK9xaAtRf+uNxYqmmrqcXrqVR6WE60S+w3W /4x+9plzPacfzA4wKj+8Kh7RHk1mXeFRZO7mU26Vu3bWotmIgftO/I56YlC5nvexeIh9 nH6IATU7uqVOFsRsapmYPRVQAYMmhU3WD8cTUb3cEF41NJjj2F28o61OE1Rrz5DsPOVL xq527GzDe/a4oKqz42uNE8pDz8o/bIOS5Yetnshmio9/GWmG8zlxJzIx6fRLRAf/r9/i 8y9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="I/h3s3PR"; 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 j10si3926735edj.128.2021.02.18.02.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:34:22 -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="I/h3s3PR"; 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 17E60826FB; Thu, 18 Feb 2021 11:34:11 +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="I/h3s3PR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 45B09826D4; Thu, 18 Feb 2021 11:33:54 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 BA61882540 for ; Thu, 18 Feb 2021 11:33:44 +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 20210218103334euoutp01d8d9640ef5cde65f11ab16c89bff0ea8~k0QukUSGN1175211752euoutp01i for ; Thu, 18 Feb 2021 10:33:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210218103334euoutp01d8d9640ef5cde65f11ab16c89bff0ea8~k0QukUSGN1175211752euoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613644414; bh=rnt/EdI0agJZ1KatsV6fzxiwEiTIekgMqXPesRPDTyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I/h3s3PRB54AHh80uo0DVQDXNCasaU2wCrq+8EdDW3yKuDwsT5yd7l/l7TJE0I9fC UGy2vXVuv/WU0qRSs9lrec2gNKKPCvi7Tm4yZr9/K2UucZ7wWAC1JlBZK0Bvt47/hZ S+ORP3LMSdnrbGqkUmvTcTDsCuDh3eGzrI4GL9oI= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20210218103329eucas1p146678e6e3a5aa984a30751ebe0f5ee27~k0QppDNyJ2707327073eucas1p1O; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 7D.69.27958.8724E206; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20210218103328eucas1p2cade8a776557736d66c3d9b67ada64cb~k0QpHhJkL2030720307eucas1p23; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210218103328eusmtrp242c19881fa08a539ec6c20de4f01da20~k0QpGJ46S2025120251eusmtrp2o; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-c7-602e427849fa Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D5.73.21957.8724E206; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210218103327eusmtip274ab80db964ed0d0fe920b3093349c7b~k0QokB8Kk0363403634eusmtip2j; Thu, 18 Feb 2021 10:33:27 +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 v7 2/5] button: add a simple Analog to Digital Converter device based button driver Date: Thu, 18 Feb 2021 11:33:15 +0100 Message-Id: <20210218103318.18915-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218103318.18915-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduznOd1KJ70Eg2ZHi40z1rNa3PjVxmrx /N1lJou1R+6yWxzqi7boOKxs8W3LNkaLSRN+sVm83dvJbnF46gdGBy6P9zda2T1mN1xk8Zg3 6wSLx4ePcR7zO78zeZy9s4PRo2/LKkaPjcsOMAdwRHHZpKTmZJalFunbJXBlHFnwlLVgkWbF gRNTmBsYtyh2MXJySAiYSEy9/42xi5GLQ0hgBaPEj7vL2CGcL4wS67u7mCCcz4wSt2+uZoVp mdd5hgUisZxRYlFjKxNcy+vm42wgVWwChhJdb7vAbBEBI4lLTTvAOpgF7jBJdE1uYAFJCAuk SkyZsIUdxGYRUJXoam1kArF5BWwlDrRNYYNYJy+xesMBZhCbU8BO4snZ+SwQ8SMcEosPpUPY LhJXrm9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pskLJAs8efYFrAGFgFVia7WRjCbV8BW4kDbFDaIDfISqzcc YAaxOQXsJJ6cnc8CYgsB1SxonMA+gZFvASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMBw 33bs5+YdjPNefdQ7xMjEwXiIUYKDWUmEl/2zVoIQb0piZVVqUX58UWlOavEhRlOgOyYyS4km 5wMjLq8k3tDMwNTQxMzSwNTSzFhJnHfr3DXxQgLpiSWp2ampBalFMH1MHJxSDUyWRpETzrqv fNvio3xQRzV73v4tl+a+sa9959NYIMIQfO7J8tN+z9e/ZKh80h7lfvNfV/iDmBVfHK4cPvJn 4T/HWeIrw4Wdwh61zOv6uNpAqtXfV+HNuRNHF31cr6z7IObeJ8v3Ex7Hz9ZK3PpP7krohK57 PTUuyXPz/xyz+NW3RHVq74OCl3xRvea6qyV4fK12b3Va//FeKm/dOu0XBVcWXIl91XTnap90 xobd0i1JXrYbV01krcxPzZ9/PMXz282dexfzOAmu47KZXe5YUlQsfHrpZ57Jn5/u2PW99J5K ldGMMIeowOklbY/neKbN6f+b/195Q50dY8zeV1N0WX7IO5rbn13fsksj2I3n777LSizFGYmG WsxFxYkA9DM0dgADAAA= X-CMS-MailID: 20210218103328eucas1p2cade8a776557736d66c3d9b67ada64cb X-Msg-Generator: CA X-RootMTR: 20210218103328eucas1p2cade8a776557736d66c3d9b67ada64cb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210218103328eucas1p2cade8a776557736d66c3d9b67ada64cb References: <20210218103318.18915-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 Reviewed-by: Simon Glass --- 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 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 18 10:33:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 384386 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3559352jao; Thu, 18 Feb 2021 02:34:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIEvjC74PEdVz2j+BfoBWJLpueTFVxXBayotaumgYeDB8nMQWPPqoD/l4v+oIP0CvoGP+X X-Received: by 2002:a05:6402:17b6:: with SMTP id j22mr3358986edy.325.1613644473775; Thu, 18 Feb 2021 02:34:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613644473; cv=none; d=google.com; s=arc-20160816; b=TzEEZCauB8eTZgQJvzYQS3gUkw9WHHvW6ilbZ+JbvIPMXrx65lCg7JY4vGhGkWrj5a 1Ph5Uy3FcXmF3m2bz2yjG80T899q1pfZwlX0LBcmcPvGI5t3KlsxCHPG9X5qCgHSnfQs vL39H2tJ9KTsttJsIPidR/nNzjoO3SymJGaPjVstGPXqEZhFSnAej+FKu46ko5SorWKM GGRXI58WVo0psIVsE+NqO/USHTTLV/gtOw3bEjV4XLUMbtlSUbijoMpN6iyK+T+LtAfF l/ROekIOgAiSkAiB7/jq5xsbsFJ9tw/oGLwCZRkESGa98ZEA3gLZ0HH695j2xJZOP058 HKyA== 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=sANhULPmpE4aip3F1UvdbIVuvxEOqimn2weUXyeZpZdOplrf6F0LgpwtcYE/tRihxS S+nUo4B0aE66Rv8TVEEc5PrD7sXatoRDztXS7QT0IopO6CVViU+GHuXgNae7BvyzN8Q6 v5jFKya6VW9pWo+DixeFJOnwCU9Gyc9xyGVjmxxPyO/ck7e7e5t0Sm5Ar38pJCF5xHbL iBr0+qOJR9ZsuvUsvaK9UVZJubTEXH1IY9erIA4JaoKI339nB4A2AXsOenPv0SLYaMS7 b/oQl8p6n1+Iz6wTQgt0oX4HP7sLg0DRTeJuTRSLivx+eLyyhXlqv0x79534HagJ9IxD ShpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Fmayxpe9; 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 a20si3671986ejg.257.2021.02.18.02.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:34:33 -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=Fmayxpe9; 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 6A40282764; Thu, 18 Feb 2021 11:34: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="Fmayxpe9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B784826F2; Thu, 18 Feb 2021 11:33:53 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 7613182675 for ; Thu, 18 Feb 2021 11:33:45 +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 20210218103335euoutp015819ad614d45d3c393b3e29b7bd5e602~k0QvPH5hh1511415114euoutp01o for ; Thu, 18 Feb 2021 10:33:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210218103335euoutp015819ad614d45d3c393b3e29b7bd5e602~k0QvPH5hh1511415114euoutp01o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613644415; bh=+mQOJRUfPEgamOlpRSpMQF1NyKixEJUJ0c4gNG61Ouo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fmayxpe9qhSp9zWggLsqZ9B/W2KGl+48ebxSI2EYbxIu9TLBMTki8ceVb/I/p/Nb/ ehIqZsUl2hDDBAzMm2m0iVCpxTnMM7cjR+1VPC2nUi9+F5rYCiqId1/4pV20Vn7Q2s i7DL0I9eR9hRCkHz/xgHQX2U7xEs98GWd5hbO1Gc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210218103329eucas1p2516a793cc2b0f706b797eae4b1b83af5~k0QqDgijG2030720307eucas1p24; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 77.6A.45488.9724E206; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210218103328eucas1p1f330ac7505f755e8ed903c060d31a178~k0QpextZw2707327073eucas1p1N; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210218103328eusmtrp2ca90e1cb11c418ac8cf13d8a640bd265~k0QpeF3_U2025120251eusmtrp2q; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-e9-602e42792ea1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 96.73.21957.8724E206; Thu, 18 Feb 2021 10:33:28 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210218103328eusmtip27c1d3f020332a8461d6df1d193a1b295~k0Qo-3aWU0440504405eusmtip2R; Thu, 18 Feb 2021 10:33:28 +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 v7 3/5] adc: meson-saradc: add support for getting reference voltage value Date: Thu, 18 Feb 2021 11:33:16 +0100 Message-Id: <20210218103318.18915-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218103318.18915-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplleLIzCtJLcpLzFFi42LZduznOd1KJ70Eg01rFSw2zljPanHjVxur xfN3l5ks1h65y25xqC/aouOwssW3LdsYLSZN+MVm8XZvJ7vF4akfGB24PN7faGX3mN1wkcVj 3qwTLB4fPsZ5zO/8zuRx9s4ORo++LasYPTYuO8AcwBHFZZOSmpNZllqkb5fAldF38DNTwTHe irY9b9gaGGdwdzFyckgImEisnT+FtYuRi0NIYAWjRNPNZ1DOF0aJf3M2MkI4nxkl1i7oY4Zp aZzxkAkisZxR4vjKPoSWYw/WMIFUsQkYSnS97WIDsUUEjCQuNe1gASliFrjDJNE1uYEFJCEs ECPRffg5I4jNIqAqseDMUlYQm1fAVuLv6Q4miHXyEqs3HABbzSlgJ/Hk7HywQRICRzgk2nev hbrJReLC3MksELawxKvjW9ghbBmJ/zvnM0E0NDNKPDy3lh3C6WGUuNw0gxGiylrizrlfQLdy AN2nKbF+lz5E2FHi3/1vYGEJAT6JG28FQcLMQOakbdOZIcK8Eh1tQhDVahKzjq+DW3vwwiWo 0zwkLt9dzA4JoYmMEpf2P2GfwCg/C2HZAkbGVYziqaXFuempxcZ5qeV6xYm5xaV56XrJ+bmb GIEp5vS/4193MK549VHvECMTB+MhRgkOZiURXvbPWglCvCmJlVWpRfnxRaU5qcWHGKU5WJTE eXdtXRMvJJCeWJKanZpakFoEk2Xi4JRqYJITc1nx19OsaLUyj55dJJfLochHdcrL7QX9lXXt mPRvOi8wlxH5sK4ggWvWsojwznWTw02mOkzLVnvDuktr8cb7SuXxcqu+2Cq7lR1QFrz51WJi VNCNfTbPt7Ee+hafzMrQq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DohiYMGjz8Wlk+eY85t8L3sX1GSxaRm9cBM5WJLfp4pbQ5TBd9+eHhZOHTr o9XuV5dukDke/tlM8cfF8/v+rV/8Q22v8p+gcxz3bQ/qsO2U3DdZyu9jgZGont5XKwvl9YrX RKu9p8z02R/DMDGkRqs7sXiJfLLbOu19emFy8eWFi9eKs0ZM3XhOUuqznNvcH0uUWIozEg21 mIuKEwFj2yROAAMAAA== X-CMS-MailID: 20210218103328eucas1p1f330ac7505f755e8ed903c060d31a178 X-Msg-Generator: CA X-RootMTR: 20210218103328eucas1p1f330ac7505f755e8ed903c060d31a178 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210218103328eucas1p1f330ac7505f755e8ed903c060d31a178 References: <20210218103318.18915-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 18 10:33:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 384384 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3559137jao; Thu, 18 Feb 2021 02:34:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzp7/7gwMc9ANLlaSqo95Vu1JBzDXKT2PKIIJc6kFr35nyMXBWRZO0Lqq+h8TjKGsnfDOC8 X-Received: by 2002:a17:907:20e3:: with SMTP id rh3mr3389583ejb.510.1613644450717; Thu, 18 Feb 2021 02:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613644450; cv=none; d=google.com; s=arc-20160816; b=sOWVV+3pRvenJlYavL5cR2lszex/p7ikclAjmLyMVhX7o7g7BT3qw+oudwVrjigKYO tfSJishBLIIZGKmMUUs0hb6aZjGpoGHdiI+fF7NpU30mVcPwcFw6OIEwni6Q+guJWMUk Wy9VkgITyYAbiqBoPLwrP1pbQqdjMBku+kFqEv0PR2GPTt4VKjEu34/Q9BDw140aupEX uXdf8C7blK88QBTgq1MvbLhbuj+vD7SgUB9WO0zjpJF0ovzOBbsNYNCqz5L3M2OiN/cq d16HECsoMP4bnYUIfusBqSf1BrK8Xl58EgAboATZrL/8tu5JzZio1B3rwkAbtkbwUzA4 sopQ== 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=PwLD8A8kpkvxqU1lAw1kepXvBUmOZ+yMwu1A6Y6GrAZkv3nPPb1GJsfPgeMjuAhvo0 weiUPSRQO++ZyyVjyBA07jYo2NzXSEbLdj4hggPqqBcqaBUA9rkZf/z3xnqSPHfUPLZ4 IsApghjHR3SYStLOc9sn6wq0BC9pYriYOT8fTF9njZkLSSFsNEoKQgG4CfSb+yhAs/9I 9GrLH2IKSLEQCBXFJlY1jtQzVEPGIQNlMW0MgGM1YqNezAv0q5VCr26BEiiLGHfFvYsq x0iIl7akP2BjhI0+fJ3KU72Y4GZKIBsSMrJcrpuEf/fG1Bz1SsSP6IsN4of707VM2/Aj Aakg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=N+PDYu5U; 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 q7si3101685edt.579.2021.02.18.02.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:34:10 -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=N+PDYu5U; 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 E8E0F82709; Thu, 18 Feb 2021 11:33:54 +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="N+PDYu5U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5279B826D4; Thu, 18 Feb 2021 11:33:46 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 0565E82385 for ; Thu, 18 Feb 2021 11:33:41 +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 20210218103330euoutp01c3f612fd9d2adabfe35fd89791ff1ec5~k0QqvTiFh1104711047euoutp01g for ; Thu, 18 Feb 2021 10:33:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210218103330euoutp01c3f612fd9d2adabfe35fd89791ff1ec5~k0QqvTiFh1104711047euoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613644410; bh=t7Ximx8YxR9eUZTuSzHnGTVVQVi87eVXbtpcgmrIjMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+PDYu5UfQTeunnzdGVQGA9suxFL1/tSfMez5+owF3n9+Ekic62l0qZn4ah38ngzf 2kJ/qhfq59+KF/Mzcg91XtoM3r30Ry4nhsEQYAhK9gjoKj/mjovFOvaMDsbk47hxf7 un4jAS1eyaekndeY0pbvks/qK7s5TaDt+FDbaonQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210218103329eucas1p26050b7b659f07733f9f1c271e61ad8a7~k0QqTMNRS2310223102eucas1p2s; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 35.F7.44805.9724E206; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20210218103329eucas1p29605bd51f093567e6e50058aa032a162~k0Qp8caDz2030120301eucas1p2o; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210218103329eusmtrp2be328d514b01584e4d4bf916687cb3bf~k0Qp73Jb52029320293eusmtrp2N; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) X-AuditID: cbfec7f4-b37ff7000000af05-14-602e4279b8a5 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 77.73.21957.9724E206; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210218103328eusmtip24c28e93600379d8841b3410424a9b2cb~k0QpaHQib0440604406eusmtip2T; Thu, 18 Feb 2021 10:33:28 +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 v7 4/5] configs: khadas-vim3(l): enable Function button support Date: Thu, 18 Feb 2021 11:33:17 +0100 Message-Id: <20210218103318.18915-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218103318.18915-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduznOd1KJ70Eg39HDCw2zljPanHjVxur xfN3l5ks1h65y25xqC/aouOwssW3LdsYLSZN+MVm8XZvJ7vF4akfGB24PN7faGX3mN1wkcVj 3qwTLB4fPsZ5zO/8zuRx9s4ORo++LasYPTYuO8AcwBHFZZOSmpNZllqkb5fAldGz+wJbwSOO ikk9a5kbGK+zdzFyckgImEh0v1jC2sXIxSEksIJRYsuZ/WwgCSGBL4wS185VQiQ+M0rc2PqS EaZj671JzBCJ5YwSX05OYYJwgDrev/jHDFLFJmAo0fW2C2yUiICRxKWmHSwgRcwCd5gkuiY3 sIAkhAUCJQ52HGUFsVkEVCUOdd0Gi/MK2Eo8mNrBArFOXmL1hgNgQzkF7CSenJ0PNkhC4ACH xK3TR6G+cJH4vqcbqkFY4tXxLVBxGYn/O+czQTQ0M0o8PLeWHcLpYZS43DQD6iNriTvnfgHd ygF0n6bE+l36EGFHiavNM1lBwhICfBI33gqChJmBzEnbpjNDhHklOtqEIKrVJGYd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uJkZguG87 9nPzDsZ5rz7qHWJk4mA8xCjBwawkwsv+WStBiDclsbIqtSg/vqg0J7X4EKMp0B0TmaVEk/OB EZdXEm9oZmBqaGJmaWBqaWasJM67de6aeCGB9MSS1OzU1ILUIpg+Jg5OqQYmd86A2bfFbT/O i0muubR12nn5QrWUzUXq2pcvrPp64+aMw4IFK89dPWjVEcVlvCbG1HfL1ILbx7Nef7v9ec4b hwybkyW++R+/VZ4RdFntIbA0ffOSpTNeOW87tqPJ0XuhAc++rQEFa6z27H9/wZ79xrxNTPe2 7dzNP9V91fv1f1Yt5ugx6xWZEcHvZx65/51cWE33wy1nA3hNO5fFhmeE2CbscVK6Ij6pMEtt xuvjgZzeFQ+817pdTl8Vxb2lcVlsT692IwNHaJLkhi23XovvzdSxkWnuKp7EUmv24d7M6r9v 1ooU73lZ9qm+5tfGW3zsP0027s775iveWTT17OLL2ZXcMQutd/6rZ79ufSIyUomlOCPRUIu5 qDgRAGKBXmEAAwAA X-CMS-MailID: 20210218103329eucas1p29605bd51f093567e6e50058aa032a162 X-Msg-Generator: CA X-RootMTR: 20210218103329eucas1p29605bd51f093567e6e50058aa032a162 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210218103329eucas1p29605bd51f093567e6e50058aa032a162 References: <20210218103318.18915-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 18 10:33:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 384383 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3558981jao; Thu, 18 Feb 2021 02:33:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIDrSlS3bkZwAEUVYrlN1n4xFKHYvW9foidhtsaai/tKQY622RQNGW/9XZ9QaJfmmBwAYG X-Received: by 2002:a17:906:b357:: with SMTP id cd23mr3329975ejb.307.1613644436614; Thu, 18 Feb 2021 02:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613644436; cv=none; d=google.com; s=arc-20160816; b=XEMoHCN3Q0j0LVTNiLQ3NC1R1oNaHUKxSWUkYmFI7Yg9pbM/aTILXauXGVC4digGLl cBxH9YnPS57cZXWQUKn6AYywUVYOBi7IuoSVrzrGLmqiyF3Fr+tPHN3NiooSPRWDX7SH PS0TASBqHnpsDsO6jFkS9mvLI0HkHW9Z3WjP73QIlyMddHCCwsVEzID6lbEtx1d30TEM +/Guk5sQF8IbdepmCDObmfYRfl2oIrYLLson5Z/e+FXhKiIHhTGhINYOH50JxNBYaYCa noV2nVTXxCYIRL1pr2mMGRmZm5KerQJsYxtUxGSUKyyOozTwu6smY4kSGt0SpFQbb2Bc aYIQ== 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=tuQsUpq5/OlVBER2QAMSd+0JI4Kda1qrTRbP1LAD5vQ=; b=Mt/L31JDz2l/SAUEjVMxUvstBsECfAT79u1t066WTItLvGqvEoYq93WDq19IIObbNF HCcHHCF61y7g/MTnDzXxuC17H/sSxyuK4WEvXxPogrR7KcJjLMmaRZEXhEE2YH1uw2oh HcaEbiJeh80LW/UQCwDY380l6wClzQNHEPuZbLO0wnUSDGPrgWsH4//SQ4DsyAS0wFF5 6NPZvXgejyUdxqZPyUBtLBellHYR1kgyR2ZR083c4jxtUo5/G6ge6shc7lRerFaGIzaI 84K1xvvNtWaBGpGSfGzMdPI++1jkwNKNML/5DghDe5dQVUa3MHf0k0QMsN5wGkenpe5F osew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=mywYpeqa; 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 i3si319206ejy.226.2021.02.18.02.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 02:33:56 -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=mywYpeqa; 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 88B4C82385; Thu, 18 Feb 2021 11:33:49 +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="mywYpeqa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 18A098268D; Thu, 18 Feb 2021 11:33:47 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 F3EDC801D8 for ; Thu, 18 Feb 2021 11:33:41 +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 20210218103330euoutp018943e1ef878adb2d1449e805c2b3f78d~k0QrTG10J1511615116euoutp01y for ; Thu, 18 Feb 2021 10:33:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20210218103330euoutp018943e1ef878adb2d1449e805c2b3f78d~k0QrTG10J1511615116euoutp01y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1613644410; bh=tuQsUpq5/OlVBER2QAMSd+0JI4Kda1qrTRbP1LAD5vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mywYpeqarpl0L0RqBWVnjeET529vt9y9jxLDxiQOTKnGlnNbbVzjcCZ1iRfJsGR5P e2kibOcs2uu3Fmp/BXXWlTEQXlWfzfTOszsBQ1MSZ054Ay35k7XULYPHuvMXqe9ysX OZxOo9zGw4xEN1qeoaVNMDqOjDMfExQweSoMFYqY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210218103330eucas1p220e36251e227664d358c554f31e3dd1d~k0Qq3Qki91548715487eucas1p2E; Thu, 18 Feb 2021 10:33:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id F5.F7.44805.A724E206; Thu, 18 Feb 2021 10:33:30 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210218103329eucas1p1d03a2bddc8712a3993ec52f95c9a3c5d~k0QqUmslH2705627056eucas1p1E; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210218103329eusmtrp2a7222ebfb8c476615e72e8eba4c70714~k0QqT2baY2025120251eusmtrp2u; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) X-AuditID: cbfec7f4-b37ff7000000af05-16-602e427a899a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 58.73.21957.9724E206; Thu, 18 Feb 2021 10:33:29 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210218103329eusmtip2ea01c55f98301d497e143d624aa5a4e4~k0Qp27J813210932109eusmtip2w; Thu, 18 Feb 2021 10:33:29 +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 v7 5/5] test: add a simple test for the adc-keys button driver Date: Thu, 18 Feb 2021 11:33:18 +0100 Message-Id: <20210218103318.18915-6-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218103318.18915-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmleLIzCtJLcpLzFFi42LZduznOd0qJ70EgyuvRCw2zljPanHjVxur xfN3l5ks1h65y25xqC/aouOwssW3LdsYLSZN+MVm8XZvJ7vF4akfGB24PN7faGX3mN1wkcVj 3qwTLB4fPsZ5zO/8zuRx9s4ORo++LasYPTYuO8AcwBHFZZOSmpNZllqkb5fAlbHqymbGgrlq FZ1vz7A3MLYqdDFyckgImEice3CVrYuRi0NIYAWjxJaORmYI5wujRPOVViYI5zOjxPKz84Ey HGAty1o1IeLLGSU+L9zODtdx+fgaFpC5bAKGEl1vu9hAbBEBI4lLTTtYQIqYBe4wSXRNbgAr EhYIkNjQ8JwRxGYRUJV4P2E6K4jNK2Ar0THlAzPEgfISqzccALM5BewknpydDzZIQuAIh8TD 7+/ZIIpcJH7090DZwhKvjm9hh7BlJP7vnM8E0dDMKPHw3Fp2CKcH6NamGYwQVdYSd879YgN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CVW bzgAZnMK2Ek8OTufBcQWAqpZ0DiBfQIj3wJGhlWMIqmlxbnpucWGesWJucWleel6yfm5mxiB wb7t2M/NOxjnvfqod4iRiYPxEKMEB7OSCC/7Z60EId6UxMqq1KL8+KLSnNTiQ4ymQHdMZJYS Tc4HxlteSbyhmYGpoYmZpYGppZmxkjjv1rlr4oUE0hNLUrNTUwtSi2D6mDg4pRqYVALZj2u9 LHZ+KJ/KeKbfbfK+s9LXYhcfllmqbv7yg0L6hqtLLV1O5SivnujucvxL4vYsp/L4w7Yh3QGR M1QuVWlP/2fNWBFzmG3pj5U1mqHP7cUmJmr6vl1+bk/U4Ss8HzOtazOrrRwcvZZMYPe59+Xc vx9Rz6TWLHFrviP5tHzZifA/OS+kpE/s0O2uyNfbknHBz+B0PsP31xM15dcU161f9VF5zhu5 vxnXspKmezKu2BW2rGZG705Ttv23vr7SqLkUe3K/hEPX3djm4vtLgidbGqvPXMC33SaZZd7f 7U85nzx7cL3ymfIqLWv33c1W8tXzY/rmlObMEOAsWvVc7O9zYZtZ/+5s0dE+6XibV4mlOCPR UIu5qDgRAPl+mc7/AgAA X-CMS-MailID: 20210218103329eucas1p1d03a2bddc8712a3993ec52f95c9a3c5d X-Msg-Generator: CA X-RootMTR: 20210218103329eucas1p1d03a2bddc8712a3993ec52f95c9a3c5d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210218103329eucas1p1d03a2bddc8712a3993ec52f95c9a3c5d References: <20210218103318.18915-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 Reviewed-by: Simon Glass --- arch/sandbox/dts/test.dts | 28 +++++++++++++++++++++- configs/sandbox_defconfig | 1 + test/dm/button.c | 50 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 76 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index e95f4631bf..202e091841 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -69,6 +70,30 @@ }; }; + buttons2 { + compatible = "adc-keys"; + io-channels = <&adc 3>; + keyup-threshold-microvolt = <3000000>; + + button-up { + label = "button3"; + linux,code = ; + press-threshold-microvolt = <1500000>; + }; + + button-down { + label = "button4"; + linux,code = ; + press-threshold-microvolt = <1000000>; + }; + + button-enter { + label = "button5"; + linux,code = ; + press-threshold-microvolt = <500000>; + }; + }; + cros_ec: cros-ec { reg = <0 0>; compatible = "google,cros-ec-sandbox"; @@ -587,8 +612,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);