sun8i-h2-plus-orangepi-zero-radio.dts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  2. /*
  3. * Orange Pi Zero (original, H2+) as used in the radio: the mainline board
  4. * file plus what the Armbian setup enabled through overlays
  5. * (analog-codec, usbhost2, usbhost3, i2c1, user overlay i2c1-400k), the
  6. * binding the out-of-tree xradio driver needs for the XR819 Wi-Fi, and the
  7. * radio front panel on i2c1: S1D13700 panel (U1, 0x74) and keys (U2, 0x76).
  8. *
  9. * Built by build-kernel.sh inside the kernel tree, with symbols (-@), so
  10. * extra overlays can still be applied by U-Boot (extlinux "fdtoverlays").
  11. */
  12. #include "sun8i-h2-plus-orangepi-zero.dts"
  13. / {
  14. model = "Xunlong Orange Pi Zero (radio)";
  15. /*
  16. * Without an alias Linux numbers I2C adapters in probe order, so the
  17. * only enabled controller (i2c1) would be /dev/i2c-0. Pin it to
  18. * /dev/i2c-1 as under Armbian; dynamic buses (i2c-tiny-usb) start at 2.
  19. */
  20. aliases {
  21. i2c1 = &i2c1;
  22. };
  23. };
  24. /* Line out / mic on the 13-pin header (was overlay "analog-codec"). */
  25. &codec {
  26. status = "okay";
  27. };
  28. /* USB2/USB3 on the 13-pin header (were overlays "usbhost2", "usbhost3"). */
  29. &ehci2 {
  30. status = "okay";
  31. };
  32. &ohci2 {
  33. status = "okay";
  34. };
  35. &ehci3 {
  36. status = "okay";
  37. };
  38. &ohci3 {
  39. status = "okay";
  40. };
  41. /*
  42. * I2C1 on PA18 (SCL) / PA19 (SDA), pins 5/3 of the 26-pin header, carrying
  43. * the panel and key expanders; 400 kHz (was "i2c1" + user "i2c1-400k").
  44. * 400 kHz relies on the pull-ups on the panel board: i2c1_pins enables no
  45. * SoC bias, and the internal ~100 kOhm pull-ups would be too weak anyway.
  46. */
  47. &i2c1 {
  48. pinctrl-names = "default";
  49. pinctrl-0 = <&i2c1_pins>;
  50. clock-frequency = <400000>;
  51. status = "okay";
  52. /*
  53. * Radio panel: S1D13700 behind U1, TCA9539 at 0x74. The driver is
  54. * built in, so fbcon shows the boot log here. Without the panel the
  55. * probe stops at "expander not responding" and nothing else happens.
  56. * "k4be" is not in the kernel's vendor-prefixes.yaml and the binding
  57. * has no schema, so dtbs_check warns about this node; that is expected.
  58. */
  59. panel@74 {
  60. compatible = "k4be,s1d13700-tca9539";
  61. reg = <0x74>;
  62. };
  63. /*
  64. * U2, TCA9539 at 0x76 (A1=H, A0=L): the keys. INT (open drain, active
  65. * low) is wired to PA6/PWM1 (pin 7 of the 26-pin header); the SoC's
  66. * pull-up is enabled in case there is none on the board.
  67. */
  68. radio_u2: gpio@76 {
  69. compatible = "ti,tca9539";
  70. reg = <0x76>;
  71. pinctrl-names = "default";
  72. pinctrl-0 = <&radio_u2_int_pin>;
  73. gpio-controller;
  74. #gpio-cells = <2>;
  75. interrupt-controller;
  76. #interrupt-cells = <2>;
  77. interrupt-parent = <&pio>;
  78. interrupts = <0 6 IRQ_TYPE_LEVEL_LOW>; /* PA6 */
  79. };
  80. };
  81. &pio {
  82. radio_u2_int_pin: radio-u2-int-pin {
  83. pins = "PA6";
  84. function = "irq";
  85. bias-pull-up;
  86. };
  87. };
  88. / {
  89. /*
  90. * Keys are active high, read directly: one pin each to the supply,
  91. * with an external pull-down. Pins 0-7 are P0.0-7, 8-15 are P1.0-7;
  92. * P0.0-P0.2 are unused. Same table as radio-keyboard-tca's
  93. * dts/radio-keys.dts and radio-ui's radio/keypad.py; build-kernel.sh compares
  94. * the compiled tables and stops if they differ. The input device is
  95. * named "radio-keys", which radio-ui looks for.
  96. */
  97. radio-keys {
  98. compatible = "gpio-keys";
  99. label = "radio-keys";
  100. autorepeat;
  101. key-next { label = "next"; gpios = <&radio_u2 3 GPIO_ACTIVE_HIGH>; linux,code = <KEY_NEXTSONG>; debounce-interval = <20>; };
  102. key-left { label = "left"; gpios = <&radio_u2 4 GPIO_ACTIVE_HIGH>; linux,code = <KEY_LEFT>; debounce-interval = <20>; };
  103. key-down { label = "down"; gpios = <&radio_u2 5 GPIO_ACTIVE_HIGH>; linux,code = <KEY_DOWN>; debounce-interval = <20>; };
  104. key-up { label = "up"; gpios = <&radio_u2 6 GPIO_ACTIVE_HIGH>; linux,code = <KEY_UP>; debounce-interval = <20>; };
  105. key-right { label = "right"; gpios = <&radio_u2 7 GPIO_ACTIVE_HIGH>; linux,code = <KEY_RIGHT>; debounce-interval = <20>; };
  106. key-esc { label = "esc"; gpios = <&radio_u2 8 GPIO_ACTIVE_HIGH>; linux,code = <KEY_ESC>; debounce-interval = <20>; };
  107. key-ok { label = "ok"; gpios = <&radio_u2 9 GPIO_ACTIVE_HIGH>; linux,code = <KEY_OK>; debounce-interval = <20>; };
  108. key-menu { label = "menu"; gpios = <&radio_u2 10 GPIO_ACTIVE_HIGH>; linux,code = <KEY_MENU>; debounce-interval = <20>; };
  109. key-list { label = "list"; gpios = <&radio_u2 11 GPIO_ACTIVE_HIGH>; linux,code = <KEY_LIST>; debounce-interval = <20>; };
  110. key-stop { label = "stop"; gpios = <&radio_u2 12 GPIO_ACTIVE_HIGH>; linux,code = <KEY_STOPCD>; debounce-interval = <20>; };
  111. key-pause { label = "pause"; gpios = <&radio_u2 13 GPIO_ACTIVE_HIGH>; linux,code = <KEY_PAUSECD>; debounce-interval = <20>; };
  112. key-play { label = "play"; gpios = <&radio_u2 14 GPIO_ACTIVE_HIGH>; linux,code = <KEY_PLAYCD>; debounce-interval = <20>; };
  113. key-prev { label = "prev"; gpios = <&radio_u2 15 GPIO_ACTIVE_HIGH>; linux,code = <KEY_PREVIOUSSONG>; debounce-interval = <20>; };
  114. };
  115. };
  116. /*
  117. * XR819 on mmc1: the xradio driver matches this compatible and needs the
  118. * host-wake interrupt on PG10. U-Boot fills in local-mac-address through
  119. * the ethernet1 alias of the mainline file (derived from the SoC SID).
  120. */
  121. &xr819 {
  122. compatible = "xradio,xr819";
  123. interrupt-parent = <&pio>;
  124. interrupts = <6 10 IRQ_TYPE_EDGE_RISING>; /* PG10 */
  125. interrupt-names = "host-wake";
  126. };