| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
- /*
- * Example for a board device tree (not an overlay): the panel (U1, 0x74),
- * the key expander (U2, 0x76) and the 13 keys on i2c1 of an Orange Pi Zero
- * (Allwinner H2+). Running on real hardware, built into the board DTB.
- *
- * Include it after the mainline board file, e.g.
- *
- * #include "sun8i-h2-plus-orangepi-zero.dts"
- * #include "orangepi-zero-i2c1.dtsi"
- *
- * For another board: change the bus (&i2c1, its pinctrl) and the INT pin
- * (PA6 here, in &pio and in the interrupts of gpio@76). Without INT wired,
- * drop the interrupt properties and use "gpio-keys-polled" with
- * poll-interval = <20> instead of "gpio-keys".
- *
- * The key table matches dts/radio-panel.dts. Keep the two the same.
- */
- #include <dt-bindings/gpio/gpio.h>
- #include <dt-bindings/input/input.h>
- #include <dt-bindings/interrupt-controller/irq.h>
- / {
- aliases {
- i2c1 = &i2c1; /* keep /dev/i2c-1 */
- };
- };
- /*
- * PA18 (SCL) / PA19 (SDA). 400 kHz relies on the pull-ups on the panel
- * board; the SoC's internal ones are too weak for that speed.
- */
- &i2c1 {
- pinctrl-names = "default";
- pinctrl-0 = <&i2c1_pins>;
- clock-frequency = <400000>;
- status = "okay";
- /* "k4be" is not a registered vendor prefix: dtbs_check warns here */
- panel@74 {
- compatible = "k4be,s1d13700-tca9539";
- reg = <0x74>;
- };
- /* U2: A1=H, A0=L. INT is open drain, active low, on PA6. */
- radio_u2: gpio@76 {
- compatible = "ti,tca9539";
- reg = <0x76>;
- pinctrl-names = "default";
- pinctrl-0 = <&radio_u2_int_pin>;
- gpio-controller;
- #gpio-cells = <2>;
- interrupt-controller;
- #interrupt-cells = <2>;
- interrupt-parent = <&pio>;
- interrupts = <0 6 IRQ_TYPE_LEVEL_LOW>; /* PA6 */
- };
- };
- &pio {
- radio_u2_int_pin: radio-u2-int-pin {
- pins = "PA6";
- function = "irq";
- bias-pull-up;
- };
- };
- / {
- /*
- * Keys are active high: one pin each to the supply, with an external
- * pull-down. Pins 0-7 are P0.0-7, 8-15 are P1.0-7; P0.0-2 unused.
- */
- radio-keys {
- compatible = "gpio-keys";
- label = "radio-keys";
- autorepeat;
- key-next { label = "next"; gpios = <&radio_u2 3 GPIO_ACTIVE_HIGH>; linux,code = <KEY_NEXTSONG>; debounce-interval = <20>; };
- key-left { label = "left"; gpios = <&radio_u2 4 GPIO_ACTIVE_HIGH>; linux,code = <KEY_LEFT>; debounce-interval = <20>; };
- key-down { label = "down"; gpios = <&radio_u2 5 GPIO_ACTIVE_HIGH>; linux,code = <KEY_DOWN>; debounce-interval = <20>; };
- key-up { label = "up"; gpios = <&radio_u2 6 GPIO_ACTIVE_HIGH>; linux,code = <KEY_UP>; debounce-interval = <20>; };
- key-right { label = "right"; gpios = <&radio_u2 7 GPIO_ACTIVE_HIGH>; linux,code = <KEY_RIGHT>; debounce-interval = <20>; };
- key-esc { label = "esc"; gpios = <&radio_u2 8 GPIO_ACTIVE_HIGH>; linux,code = <KEY_ESC>; debounce-interval = <20>; };
- key-ok { label = "ok"; gpios = <&radio_u2 9 GPIO_ACTIVE_HIGH>; linux,code = <KEY_OK>; debounce-interval = <20>; };
- key-menu { label = "menu"; gpios = <&radio_u2 10 GPIO_ACTIVE_HIGH>; linux,code = <KEY_MENU>; debounce-interval = <20>; };
- key-list { label = "list"; gpios = <&radio_u2 11 GPIO_ACTIVE_HIGH>; linux,code = <KEY_LIST>; debounce-interval = <20>; };
- key-stop { label = "stop"; gpios = <&radio_u2 12 GPIO_ACTIVE_HIGH>; linux,code = <KEY_STOPCD>; debounce-interval = <20>; };
- key-pause { label = "pause"; gpios = <&radio_u2 13 GPIO_ACTIVE_HIGH>; linux,code = <KEY_PAUSECD>; debounce-interval = <20>; };
- key-play { label = "play"; gpios = <&radio_u2 14 GPIO_ACTIVE_HIGH>; linux,code = <KEY_PLAYCD>; debounce-interval = <20>; };
- key-prev { label = "prev"; gpios = <&radio_u2 15 GPIO_ACTIVE_HIGH>; linux,code = <KEY_PREVIOUSSONG>; debounce-interval = <20>; };
- };
- };
|