radio-keys.dts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  2. /*
  3. * Device tree overlay for the radio front panel keys on an Allwinner board:
  4. * the key expander U2 (TCA9539 at 0x76) and a gpio-keys device with the 13
  5. * keys, named "radio-keys".
  6. *
  7. * Plain numbers instead of #include, so it also works with armbian-add-overlay.
  8. *
  9. * TO CHECK against the actual board before use:
  10. * - root compatible, and the i2c bus in fragment@0 (i2c0)
  11. * - the U2 INT line: placeholder PA6 (<0 6 ...> = bank A, pin 6). Without
  12. * INT (the USB test board), gpio-keys cannot work: use compatible
  13. * "gpio-keys-polled" with poll-interval = <20>, or `radio-ui i2c`, which
  14. * polls U2 itself and must then not have this overlay loaded.
  15. *
  16. * The panel (U1, 0x74) on the same bus has its own overlay, radio-panel.dts
  17. * in the s1d13700-tca repository.
  18. */
  19. /dts-v1/;
  20. /plugin/;
  21. / {
  22. compatible = "allwinner,sun8i-h3";
  23. fragment@0 {
  24. target = <&i2c0>;
  25. __overlay__ {
  26. #address-cells = <1>;
  27. #size-cells = <0>;
  28. clock-frequency = <400000>;
  29. status = "okay";
  30. radio_u2: gpio@76 {
  31. compatible = "ti,tca9539";
  32. reg = <0x76>;
  33. gpio-controller;
  34. #gpio-cells = <2>;
  35. interrupt-controller;
  36. #interrupt-cells = <2>;
  37. interrupt-parent = <&pio>;
  38. interrupts = <0 6 8>; /* PA6, level low: PLACEHOLDER */
  39. };
  40. };
  41. };
  42. fragment@1 {
  43. target-path = "/";
  44. __overlay__ {
  45. /*
  46. * Keys are active high and read directly: one pin each to
  47. * the supply, with an external pull-down. Pins 0-7 are
  48. * P0.0-7, pins 8-15 are P1.0-7; P0.0-P0.2 are unused. Flag
  49. * 0 = GPIO_ACTIVE_HIGH. Same table as radio-ui's
  50. * radio/keypad.py.
  51. */
  52. radio-keys {
  53. compatible = "gpio-keys";
  54. autorepeat;
  55. next { label = "next"; gpios = <&radio_u2 3 0>; linux,code = <163>; debounce-interval = <20>; };
  56. left { label = "left"; gpios = <&radio_u2 4 0>; linux,code = <105>; debounce-interval = <20>; };
  57. down { label = "down"; gpios = <&radio_u2 5 0>; linux,code = <108>; debounce-interval = <20>; };
  58. up { label = "up"; gpios = <&radio_u2 6 0>; linux,code = <103>; debounce-interval = <20>; };
  59. right { label = "right"; gpios = <&radio_u2 7 0>; linux,code = <106>; debounce-interval = <20>; };
  60. esc { label = "esc"; gpios = <&radio_u2 8 0>; linux,code = <1>; debounce-interval = <20>; };
  61. ok { label = "ok"; gpios = <&radio_u2 9 0>; linux,code = <352>; debounce-interval = <20>; };
  62. menu { label = "menu"; gpios = <&radio_u2 10 0>; linux,code = <139>; debounce-interval = <20>; };
  63. list { label = "list"; gpios = <&radio_u2 11 0>; linux,code = <395>; debounce-interval = <20>; };
  64. stop { label = "stop"; gpios = <&radio_u2 12 0>; linux,code = <166>; debounce-interval = <20>; };
  65. pause { label = "pause"; gpios = <&radio_u2 13 0>; linux,code = <201>; debounce-interval = <20>; };
  66. play { label = "play"; gpios = <&radio_u2 14 0>; linux,code = <200>; debounce-interval = <20>; };
  67. prev { label = "prev"; gpios = <&radio_u2 15 0>; linux,code = <165>; debounce-interval = <20>; };
  68. };
  69. };
  70. };
  71. };