Advertisement
Guest User

Untitled

a guest
May 19th, 2023
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. #include "bone/black.h"
  2. #include "gpio.h"
  3.  
  4. // disable conflicting cape-universal nodes
  5. USES_PIN( P9_31 );
  6. USES_PIN( P9_29 );
  7.  
  8. // Since we're creating a virtual device, there's not really a better place to
  9. // put it than root of the device tree.
  10. / {
  11. // Node name "magnet-gpios" is arbitrary but should not conflict with other
  12. // nodes or properties in the root of the device tree.
  13. // To list all of these on a running system: ls /proc/device-tree/
  14. shutter-gpios {
  15. // configure the driver for this device node, which must be "gpio-of-helper"
  16. compatible = "gpio-of-helper";
  17.  
  18. // Attach pinmux node to this device node. In rare cases devices may have
  19. // multiple pinmux states, but usually you only have a "default" state.
  20. pinctrl-names = "default";
  21. pinctrl-0 = <&shutter_gpio_pins>; //<--- references the "magnet_gpio_pins:" label below
  22.  
  23. // The node name "magnet_dir" becomes the gpio label and may be arbitrary but
  24. // must be unique for each gpio (globally, not merely those exported by this
  25. // gpio-of-helper device).
  26. CW-dir {
  27. gpio = <
  28. &gpio3
  29. 15
  30. ACTIVE_HIGH
  31. >;
  32. output; // initial direction: input or output (optional for outputs)
  33. init-low; // if output, whether it's initially low or initially high
  34. };
  35.  
  36. CCW-dir {
  37. gpio = <
  38. &gpio3
  39. 14
  40. ACTIVE_HIGH
  41. >;
  42. output; // initial direction: input or output (optional for outputs)
  43. init-low; // if output, whether it's initially low or initially high
  44. };
  45.  
  46. };
  47. };
  48.  
  49. // Pinmux nodes must be created inside the pinmux controller, which is &am33xx_pinmux
  50. &am33xx_pinmux {
  51. // Label "magnet_gpio_pins" is arbitrary but must be _globally_ unique among all labels
  52. // in the device tree (base + overlays), hence it's a good idea to make a bit more
  53. // verbose than the node name needs to be. Also, unlike the node name, the label
  54. // needs to be a valid C identifier (so only alphanumeric and underscores).
  55. //
  56. // Node name "magnet-gpios" only needs to be unique inside &am33xx_pinmux, so usually
  57. // it's fine to just use the same name as the device it's for.
  58. //
  59. gpio_pins: shutter-gpios {
  60. pinctrl-single,pins = <
  61. PIN_PULLDN( P9_29, 7 )
  62. PIN_PULLDN( P9_31, 7 )
  63. >;
  64. };
  65. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement