1# Copyright (c) 2024 Chen Xingyu <hi@xingrz.me> 2# SPDX-License-Identifier: Apache-2.0 3 4description: | 5 Input driver for ADC attached resistor ladder buttons. 6 7 The driver itself does not calculate each possible combination of resistor 8 values. Instead, users are required to specify the voltage for each single 9 key press or for combinations of key presses. 10 11 Example: 12 13 #include <dt-bindings/input/input-event-codes.h> 14 15 / { 16 buttons { 17 compatible = "adc-keys"; 18 io-channels = <&adc 2>; 19 keyup-threshold-mv = <0>; 20 21 key_0 { 22 press-thresholds-mv = <1650>, /* KEY0 */ 23 <2536>; /* KEY0 + KEY1 */ 24 zephyr,code = <INPUT_KEY_0>; 25 }; 26 27 key_1 { 28 press-thresholds-mv = <2300>, /* KEY1 */ 29 <2536>; /* KEY0 + KEY1 */ 30 zephyr,code = <INPUT_KEY_1>; 31 }; 32 }; 33 }; 34 35compatible: "adc-keys" 36 37include: base.yaml 38 39properties: 40 io-channels: 41 type: phandle-array 42 required: true 43 description: Phandle to an ADC channel. 44 45 sample-period-ms: 46 type: int 47 default: 20 48 description: | 49 Sample period in milliseconds. 50 If not specified defaults to 20. 51 52 keyup-threshold-mv: 53 type: int 54 required: true 55 description: | 56 Millivolt value to which all the keys are considered up. 57 58child-binding: 59 description: ADC KEYS child node. 60 properties: 61 press-thresholds-mv: 62 type: array 63 required: true 64 description: | 65 Array of millivolt values to consider a key pressed. 66 67 zephyr,code: 68 type: int 69 required: true 70 description: Key code to emit. 71