Kernel driver, is pinctrl-0 property always needed with GPIO overlay?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0














I'm creating a kernel driver for SPI controlled display, which is meant to be working with Raspberry PI. I'm not sure about a one thing that I see sometimes in device tree overlays created by other people - pinctrl properties.



The display is controlled through SPI - as mentioned above - but it also has 3 additional control lines: BUSY, RST and DC. In order to has a possibility of controlling these lines, besides the spi overlay my DTS has to include another one, which clearly is: gpio.



fragment@0 
target = <&spi0>;
__overlay__
#address-cells = <1>;
#size-cells = <0>;

status = "okay";

spidev@0
status = "disabled";
;

epd0: epd@0
compatible = "waveshare,epd";
reg = <0>;

pinctrl-names = "default";
pinctrl-0 = <&epd_pins>;

spi-max-frequency = <1000000>;

width = <128>;
height = <296>;

dc-gpios = <&gpio 16 0>;
reset-gpios = <&gpio 20 0>;
busy-gpios = <&gpio 21 0>;

status = "okay";
;
;
;

fragment@1
target = <&gpio>;
__overlay__
epd_pins: epd_pins
brcm,pins = <16 20 21>; /* DC RST BUSY */
brcm,function = <1 1 0>; /* out out in */
;
;
;


That DTS works perfectly fine and I didn't expect any troubles. But there is one thing I'm not sure about:



pinctrl-names = "default";
pinctrl-0 = <&epd_pins>;


I've seen lines like that in other's DTs with gpio overlays, but not always; sometimes they are, sometimes they're not. If I comment out these two lines, it seems like nothing changes, and my driver still works as it should.



I have two questions:



  1. What is the purpose of those pinctrl lines? I'm aware of pin controller subsystem, but I'm asking strictly in context of my DT.

  2. Why do I need to declare the gpio overlay? I can set IN or OUT function directly from my driver code and my gpio numbers are defined in spi overlay (dc-gpios, reset-gpios, busy-gpios).









share|improve this question




























    0














    I'm creating a kernel driver for SPI controlled display, which is meant to be working with Raspberry PI. I'm not sure about a one thing that I see sometimes in device tree overlays created by other people - pinctrl properties.



    The display is controlled through SPI - as mentioned above - but it also has 3 additional control lines: BUSY, RST and DC. In order to has a possibility of controlling these lines, besides the spi overlay my DTS has to include another one, which clearly is: gpio.



    fragment@0 
    target = <&spi0>;
    __overlay__
    #address-cells = <1>;
    #size-cells = <0>;

    status = "okay";

    spidev@0
    status = "disabled";
    ;

    epd0: epd@0
    compatible = "waveshare,epd";
    reg = <0>;

    pinctrl-names = "default";
    pinctrl-0 = <&epd_pins>;

    spi-max-frequency = <1000000>;

    width = <128>;
    height = <296>;

    dc-gpios = <&gpio 16 0>;
    reset-gpios = <&gpio 20 0>;
    busy-gpios = <&gpio 21 0>;

    status = "okay";
    ;
    ;
    ;

    fragment@1
    target = <&gpio>;
    __overlay__
    epd_pins: epd_pins
    brcm,pins = <16 20 21>; /* DC RST BUSY */
    brcm,function = <1 1 0>; /* out out in */
    ;
    ;
    ;


    That DTS works perfectly fine and I didn't expect any troubles. But there is one thing I'm not sure about:



    pinctrl-names = "default";
    pinctrl-0 = <&epd_pins>;


    I've seen lines like that in other's DTs with gpio overlays, but not always; sometimes they are, sometimes they're not. If I comment out these two lines, it seems like nothing changes, and my driver still works as it should.



    I have two questions:



    1. What is the purpose of those pinctrl lines? I'm aware of pin controller subsystem, but I'm asking strictly in context of my DT.

    2. Why do I need to declare the gpio overlay? I can set IN or OUT function directly from my driver code and my gpio numbers are defined in spi overlay (dc-gpios, reset-gpios, busy-gpios).









    share|improve this question


























      0












      0








      0







      I'm creating a kernel driver for SPI controlled display, which is meant to be working with Raspberry PI. I'm not sure about a one thing that I see sometimes in device tree overlays created by other people - pinctrl properties.



      The display is controlled through SPI - as mentioned above - but it also has 3 additional control lines: BUSY, RST and DC. In order to has a possibility of controlling these lines, besides the spi overlay my DTS has to include another one, which clearly is: gpio.



      fragment@0 
      target = <&spi0>;
      __overlay__
      #address-cells = <1>;
      #size-cells = <0>;

      status = "okay";

      spidev@0
      status = "disabled";
      ;

      epd0: epd@0
      compatible = "waveshare,epd";
      reg = <0>;

      pinctrl-names = "default";
      pinctrl-0 = <&epd_pins>;

      spi-max-frequency = <1000000>;

      width = <128>;
      height = <296>;

      dc-gpios = <&gpio 16 0>;
      reset-gpios = <&gpio 20 0>;
      busy-gpios = <&gpio 21 0>;

      status = "okay";
      ;
      ;
      ;

      fragment@1
      target = <&gpio>;
      __overlay__
      epd_pins: epd_pins
      brcm,pins = <16 20 21>; /* DC RST BUSY */
      brcm,function = <1 1 0>; /* out out in */
      ;
      ;
      ;


      That DTS works perfectly fine and I didn't expect any troubles. But there is one thing I'm not sure about:



      pinctrl-names = "default";
      pinctrl-0 = <&epd_pins>;


      I've seen lines like that in other's DTs with gpio overlays, but not always; sometimes they are, sometimes they're not. If I comment out these two lines, it seems like nothing changes, and my driver still works as it should.



      I have two questions:



      1. What is the purpose of those pinctrl lines? I'm aware of pin controller subsystem, but I'm asking strictly in context of my DT.

      2. Why do I need to declare the gpio overlay? I can set IN or OUT function directly from my driver code and my gpio numbers are defined in spi overlay (dc-gpios, reset-gpios, busy-gpios).









      share|improve this question















      I'm creating a kernel driver for SPI controlled display, which is meant to be working with Raspberry PI. I'm not sure about a one thing that I see sometimes in device tree overlays created by other people - pinctrl properties.



      The display is controlled through SPI - as mentioned above - but it also has 3 additional control lines: BUSY, RST and DC. In order to has a possibility of controlling these lines, besides the spi overlay my DTS has to include another one, which clearly is: gpio.



      fragment@0 
      target = <&spi0>;
      __overlay__
      #address-cells = <1>;
      #size-cells = <0>;

      status = "okay";

      spidev@0
      status = "disabled";
      ;

      epd0: epd@0
      compatible = "waveshare,epd";
      reg = <0>;

      pinctrl-names = "default";
      pinctrl-0 = <&epd_pins>;

      spi-max-frequency = <1000000>;

      width = <128>;
      height = <296>;

      dc-gpios = <&gpio 16 0>;
      reset-gpios = <&gpio 20 0>;
      busy-gpios = <&gpio 21 0>;

      status = "okay";
      ;
      ;
      ;

      fragment@1
      target = <&gpio>;
      __overlay__
      epd_pins: epd_pins
      brcm,pins = <16 20 21>; /* DC RST BUSY */
      brcm,function = <1 1 0>; /* out out in */
      ;
      ;
      ;


      That DTS works perfectly fine and I didn't expect any troubles. But there is one thing I'm not sure about:



      pinctrl-names = "default";
      pinctrl-0 = <&epd_pins>;


      I've seen lines like that in other's DTs with gpio overlays, but not always; sometimes they are, sometimes they're not. If I comment out these two lines, it seems like nothing changes, and my driver still works as it should.



      I have two questions:



      1. What is the purpose of those pinctrl lines? I'm aware of pin controller subsystem, but I'm asking strictly in context of my DT.

      2. Why do I need to declare the gpio overlay? I can set IN or OUT function directly from my driver code and my gpio numbers are defined in spi overlay (dc-gpios, reset-gpios, busy-gpios).






      drivers kernel-modules device-tree






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 19 '18 at 17:25

























      asked Dec 19 '18 at 17:20









      itachi

      1013




      1013

























          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489966%2fkernel-driver-is-pinctrl-0-property-always-needed-with-gpio-overlay%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489966%2fkernel-driver-is-pinctrl-0-property-always-needed-with-gpio-overlay%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay