From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F9F7C77B70 for ; Mon, 17 Apr 2023 14:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229940AbjDQOhL convert rfc822-to-8bit (ORCPT ); Mon, 17 Apr 2023 10:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbjDQOhK (ORCPT ); Mon, 17 Apr 2023 10:37:10 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D350D8A49 for ; Mon, 17 Apr 2023 07:37:05 -0700 (PDT) Received: from ip4d1634d3.dynamic.kabel-deutschland.de ([77.22.52.211] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1poPyS-0004Nw-FW; Mon, 17 Apr 2023 16:36:56 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: =?utf-8?B?T25kxZllag==?= Jirman , Peter Robinson , Rob Herring , Krzysztof Kozlowski , Tom Fitzhenry , Martijn Braam , Caleb Connolly , Jarrah Gosbell , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH] arm64: dts: rk3399-pinephone-pro: Add support for volume keys Date: Mon, 17 Apr 2023 16:36:55 +0200 Message-ID: <3377280.SvYEEZNnvj@diego> In-Reply-To: <20230417123716.c23izju4ezjrzytn@core> References: <20230405123813.2272919-1-pbrobinson@gmail.com> <4152389.RUnXabflUD@diego> <20230417123716.c23izju4ezjrzytn@core> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Am Montag, 17. April 2023, 14:37:16 CEST schrieb Ondřej Jirman: > Hello Heiko, > > On Mon, Apr 17, 2023 at 10:34:20AM +0200, Heiko Stübner wrote: > > Hi Peter, Ondrej, > > > > Am Mittwoch, 5. April 2023, 15:53:39 CEST schrieb Ondřej Jirman: > > > [...] > > > > > > (I have to press quite hard to get bellow 300 and to get reliable detection > > > of volume down key press) > > > > > > On development version of the phone, the value returned by sardac is less > > > variable. Basically either 298.828125 or 300.5859375 but it's also on > > > the edge. > > > > > > I suggest raising the threshold to something like 600 and to do your own > > > testing, to get more data points. Unpressed value is ~1791.2109375 on both > > > phones, so 400 still gets a lot of headroom. And volume up is always < 15 > > > in my tests. > > > > did this get more attention meanwhile? > > > > I don't have a Pinephone Pro myself, so you'll need to decide between you > > about the value and the concern Ondrej raised here for the value. > > It's safe and needed to use a higher value. so in a nutshell, if I change "Volume Down" to say 400000 instead of the current 300000, the patch is good to go? I.e. that was my main question :-), as you raised the objection to the value in your initial reply Thanks Heiko > SAR ADC input is pulled high to 1.8V unless some key is pressed, so unpressed > value will always be around 1800 on all Pinephones, and pressed value will > depend on contact quality and tolerances. For volume down, SAR ADC input is fed > from a resistor divider of (10kOhm + 2kOhm) from 1.8V power rail. So that gives > 2/12*1.8 = 0.3V. We can't have the press detection threshold right at this > voltage, because: > > 1) these resistors have tolerances that will randomly result in measured voltage > being above or below the 0.3V on real devices (-1% on 10k and +1% on 2k = > 2*1.01/(10*0.99+2*1.01)*1.8 = 305 mV - already too high even without > considering switch contact quality), and > > 2) those piddly membrane switches apparently have their own random resistance > that is added to the bottom leg of the resistor divider, and depends on > strenght of the press on some devices (and switches may develop higher > resistance with age/use). > > Schematic: https://megous.com/dl/tmp/1125d9248a8213b3.png > > kind regards, > o. > > > Thanks > > Heiko >