^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ROCKCHIP ADC attached resistor ladder buttons
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Required properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) - compatible: "rockchip,key"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) - io-channels: Phandle to an ADC channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) Each button (key) is represented as a sub-node of "rockchip,key":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Required subnode-properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) - label: Descriptive name of the key.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) - linux,code: Keycode to emit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) - rockchip,adc_value:: Voltage ADC input when this key is pressed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <dt-bindings/input/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) rk_key: rockchip-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) compatible = "rockchip,key";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) status = "okay";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) io-channels = <&saradc 1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) vol-up-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) linux,code = <115>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) label = "volume up";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) rockchip,adc_value = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) vol-down-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) linux,code = <114>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) label = "volume down";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) rockchip,adc_value = <170>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) power-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) linux,code = <116>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) pinctrl-names = "default";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) pinctrl-0 = <&pwrbtn>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) label = "power";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) gpio-key,wakeup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) menu-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) linux,code = <59>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) label = "menu";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) rockchip,adc_value = <355>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) home-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) linux,code = <102>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) label = "home";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) rockchip,adc_value = <746>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) back-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) linux,code = <158>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) label = "back";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) rockchip,adc_value = <560>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) camera-key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) linux,code = <212>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) label = "camera";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) rockchip,adc_value = <450>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) };