Advertisement
silver2row

Relay for Real

Mar 18th, 2022
1,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.96 KB | None | 0 0
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3.  * Copyright (C) 2015 Robert Nelson
  4.  * Copyright (C) 2019 Amilcar Lucas
  5.  */
  6.  
  7. /dts-v1/;
  8. /plugin/;
  9.  
  10. #include <dt-bindings/gpio/gpio.h>
  11. #include <dt-bindings/pinctrl/am33xx.h>
  12.  
  13. /*
  14.  * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
  15.  */
  16. &{/chosen} {
  17.         overlays {
  18.                 BBORG_RELAY-00A2.kernel = __TIMESTAMP__;
  19.         };
  20. };
  21.  
  22. /*
  23.  * Free up the pins used by the cape from the pinmux helpers.
  24.  */
  25. &ocp {
  26.         P9_41_pinmux { status = "disabled"; };  /* P9_41: gpmc_a0.gpio0_20 */
  27.         P9_42_pinmux { status = "disabled"; };  /* P9_42: gpmc_a1.gpio0_07 */
  28.         P9_30_pinmux { status = "disabled"; };  /* P9_30: gpmc_be1n.gpio3_16 */
  29.         P9_27_pinmux { status = "disabled"; };  /* P9_27: mcasp0_fsr.gpio3_19 */
  30. };
  31.  
  32. &am33xx_pinmux {
  33.         bb_gpio_relay_pins: pinmux_bb_gpio_relay_pins {
  34.                 pinctrl-single,pins = <
  35.                         0x1B4 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_41: gpmc_a0.gpio0_20 */
  36.                         0x164 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_42: gpmc_a1.gpio0_07 */
  37.                         0x198 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_30: gpmc_be1n.gpio3_16 */
  38.                         0x1A4 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_27: mcasp0_fsr.gpio3_19 */
  39.                 >;
  40.         };
  41. };
  42.  
  43. &{/} {
  44.         leds {
  45.                 pinctrl-names = "default";
  46.                 pinctrl-0 = <&bb_gpio_relay_pins>;
  47.  
  48.                 compatible = "gpio-leds";
  49.  
  50.         jp@1 {
  51.             label = "relay-jp1";
  52.             gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
  53.             default-state = "keep";
  54.         };
  55.  
  56.         jp@2 {
  57.             label = "relay-jp2";
  58.             gpios = <&gpio0 07 GPIO_ACTIVE_HIGH>;
  59.             default-state = "keep";
  60.         };
  61.  
  62.         jp@3 {
  63.             label = "relay-jp3";
  64.             gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
  65.             default-state = "keep";
  66.         };
  67.  
  68.         jp@4 {
  69.             label = "relay-jp4";
  70.             gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
  71.             default-state = "keep";
  72.         };
  73.         };
  74. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement