[PATCH] arm64: dts: rk3399-pinephone-pro: Add support for volume keys
Ondřej Jirman
megi at xff.cz
Mon Apr 17 07:48:33 PDT 2023
On Mon, Apr 17, 2023 at 04:36:55PM +0200, Heiko Stübner wrote:
> 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?
My suggestion was 600 mV so 600000. :) Otherwise, yes.
kind regards,
o.
> 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
> >
>
>
>
>
More information about the Linux-rockchip
mailing list