test: add a simple test for the adc-keys button driver

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 <m.szyprowski@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Marek Szyprowski
2021-02-18 11:33:18 +01:00
committed by Neil Armstrong
parent a638fba9fc
commit 289d0ead28
3 changed files with 76 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/sandbox-gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pinctrl/sandbox-pinmux.h>
#include <dt-bindings/mux/mux.h>
@@ -69,6 +70,30 @@
};
};
buttons2 {
compatible = "adc-keys";
io-channels = <&adc 3>;
keyup-threshold-microvolt = <3000000>;
button-up {
label = "button3";
linux,code = <KEY_F3>;
press-threshold-microvolt = <1500000>;
};
button-down {
label = "button4";
linux,code = <KEY_F4>;
press-threshold-microvolt = <1000000>;
};
button-enter {
label = "button5";
linux,code = <KEY_F5>;
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>;
};