arm64: dts: rockchip: convert rk-keys to adc-keys/gpio-keys for rk3399 board
To convert saradc value to voltage, we have the following formula: voltage = (raw saradc value * saradc voltage ref voltage) / 1024 Take RK3399 excavator as an example, the saradc voltage reg voltage is 1800000uv, the formula can simplify to : voltage = raw saradc value * 1750 uv Change-Id: I8703bcdc2e2b0305118dd9f5777533e8fac7c5a1 Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
parent
c4e657e5ac
commit
52dffbede7
2 changed files with 41 additions and 23 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include <dt-bindings/display/drm_mipi_dsi.h>
|
||||
#include <dt-bindings/display/media-bus-format.h>
|
||||
#include "rk3399-vop-clk-set.dtsi"
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
/ {
|
||||
compatible = "rockchip,android", "rockchip,rk3399";
|
||||
|
|
@ -104,53 +105,63 @@
|
|||
};
|
||||
};
|
||||
|
||||
rk_key: rockchip-key {
|
||||
compatible = "rockchip,key";
|
||||
status = "okay";
|
||||
|
||||
adc-keys {
|
||||
compatible = "adc-keys";
|
||||
io-channels = <&saradc 1>;
|
||||
io-channel-names = "buttons";
|
||||
keyup-threshold-microvolt = <1800000>;
|
||||
poll-interval = <100>;
|
||||
|
||||
vol-up-key {
|
||||
linux,code = <115>;
|
||||
label = "volume up";
|
||||
rockchip,adc_value = <1>;
|
||||
linux,code = <KEY_VOLUMEUP>;
|
||||
press-threshold-microvolt = <1750>;
|
||||
};
|
||||
|
||||
vol-down-key {
|
||||
linux,code = <114>;
|
||||
label = "volume down";
|
||||
rockchip,adc_value = <170>;
|
||||
};
|
||||
|
||||
power-key {
|
||||
gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <116>;
|
||||
label = "power";
|
||||
gpio-key,wakeup;
|
||||
linux,code = <KEY_VOLUMEDOWN>;
|
||||
press-threshold-microvolt = <297500>;
|
||||
};
|
||||
|
||||
menu-key {
|
||||
linux,code = <59>;
|
||||
label = "menu";
|
||||
rockchip,adc_value = <746>;
|
||||
linux,code = <KEY_MENU>;
|
||||
press-threshold-microvolt = <1305500>;
|
||||
};
|
||||
|
||||
home-key {
|
||||
linux,code = <102>;
|
||||
label = "home";
|
||||
rockchip,adc_value = <355>;
|
||||
linux,code = <KEY_HOME>;
|
||||
press-threshold-microvolt = <621250>;
|
||||
};
|
||||
|
||||
back-key {
|
||||
linux,code = <158>;
|
||||
label = "back";
|
||||
rockchip,adc_value = <560>;
|
||||
linux,code = <KEY_BACK>;
|
||||
press-threshold-microvolt = <980000>;
|
||||
};
|
||||
|
||||
camera-key {
|
||||
linux,code = <212>;
|
||||
label = "camera";
|
||||
rockchip,adc_value = <450>;
|
||||
linux,code = <KEY_CAMERA>;
|
||||
press-threshold-microvolt = <787500>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
autorepeat;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pwrbtn>;
|
||||
|
||||
power {
|
||||
debounce-interval = <100>;
|
||||
gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
||||
label = "GPIO Key Power";
|
||||
linux,code = <KEY_POWER>;
|
||||
wakeup-source;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -425,5 +436,11 @@
|
|||
<1 3 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
buttons {
|
||||
pwrbtn: pwrbtn {
|
||||
rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -529,6 +529,7 @@
|
|||
|
||||
&saradc {
|
||||
status = "okay";
|
||||
vref-supply = <&vcc_1v8>;
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue