Jump to content

Recommended Posts

Posted

Hi everyone,

 

I'm struggling to get gpio_keys working.

 

I'm trying to use the overlay, which I have attached below, but after reboot there is no event node listed in "/dev/input/". (There is only one node named mice.)

 

Inspecting dmesg, I found the following error messages:

[    1.529891] sun50i-h616-pinctrl 300b000.pinctrl: pin PC8 already requested by gpio-keys-user; cannot claim for 300b000.pinctrl:72
[    1.529917] gpio-keys gpio-keys-user: failed to get gpio: -22
[    1.529926] gpio-keys: probe of gpio-keys-user failed with error -22

 

Inspecting the dts file of my board (orange pi zero 2), I found that PC5,PC6 and PC8 are already listed as mmc2-pins, but mmc2 is disabled, so I don't think that this is the issue. However, I have no idea what else might be wrong.

 

Any help?

 

Attachements:

 

custom-keys.dts Overlay:

/dts-v1/;                                                                                                                                                                                                          
/plugin/;                                                                                                                                                                                                          
                                                                                                                                                                                                                   
/ {                                                                                                                                                                                                                
  compatible = "allwinner,sun50i-h616";                                                                                                                                                                            
                                                                                                                                                                                                                   
  fragment@0 {                                                                                                                                                                                                     
    target = <&pio>;                                                                                                                                                                                               
    __overlay__ {                                                                                                                                                                                                  
      custom-buttons: custom-buttons {                                                                                                                                                                           
        pins = "PC5","PC6","PC8";                                                                                                                                                                                  
        function = "gpio_in";                                                                                                                                                                                      
        bias-pull-up;                                                                                                                                                                                              
      };                                                                                                                                                                                                           
    };                                                                                                                                                                                                             
  };                                                                                                                                                                                                               
                                                                                                                                                                                                                   
  fragment@1 {                                                                                                                                                                                                     
    target-path = "/";                                                                                                                                                                                             
    __overlay__ {                                                                                                                                                                                                  
      gpio-keys-user {                                                                                                                                                                                             
        compatible = "gpio-keys";                                                                                                                                                                                  
        pinctrl-names = "default";                                                                                                                                                                                 
        pinctrl-0 = <&custom-buttons>;                                                                                                                                                                            
                                                                                                                                                                                                                   
        play_button {                                                                                                                                                                                              
          label = "GPIO Key 1";                                                                                                                                                                                 
          linux,code = <25>;                                                                                                                                                                                       
          gpios = <&pio 0 69 1>;                                                                                                                                                                                   
        };                                                                                                                                                                                                         
        vol_up_button {                                                                                                                                                                                            
          label = "GPIO Key 2";                                                                                                                                                                               
          linux,code = <22>;                                                                                                                                                                                       
          gpios = <&pio 0 70 1>;                                                                                                                                                                                   
        };                                                                                                                                                                                                         
        vol_down_button {                                                                                                                                                                                          
          label = "GPIO Key 3";                                                                                                                                                                             
          linux,code = <32>;                                                                                                                                                                                       
          gpios = <&pio 0 72 1>;                                                                                                                                                                                   
        };                                                                                                                                                                                                         
      };                                                                                                                                                                                                           
    };                                                                                                                                                                                                             
  };                                                                                                                                                                                                               
};                                                                                                                                                                                                                 

 

<

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines