Jump to content

Recommended Posts

Posted

Hi,

 

i need a gpio to trigger a key stroke.

 

I had an raspberry pi zero and this worked for setting up an gpio to trigger a key stroke.

For some reason I am not able to port this to my orangepi 3 lts H6 board.

 

I think there is some confusion because there are two pin-controller? Do I have to set the right one anywhere?

 

I thought the setting will be listed here like the raspberry did

root@orangepi3-lts:~# cat /sys/kernel/debug/gpio
gpiochip1: GPIOs 0-255, parent: platform/300b000.pinctrl, 300b000.pinctrl:
 gpio-79  (                    |usb0_id_det         ) in  hi
 gpio-102 (                    |gmac-3v3            ) out hi
 gpio-110 (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-166 (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-226 (                    |ddc-en              ) out hi
 gpio-231 (                    |vcc33-wifi          ) out hi

gpiochip0: GPIOs 352-415, parent: platform/7022000.pinctrl, 7022000.pinctrl:
 gpio-356 (                    |red-led             ) out lo
 gpio-359 (                    |green-led           ) out hi
 gpio-387 (                    |reset               ) out hi ACTIVE LOW

 

Here's my try using gpio "PD21" aka 117 for an active low input (bias-pull-up is not active ?!)

 

/dts-v1/;
/plugin/;

/ {

  compatible = "allwinner,sun50i-h6";

  fragment@0 {

    target = <&pio>;

    __overlay__ {
      gpio_keys: gpio_keys {
        pins = "PD21";
        function = "gpio_in";
        bias-pull-up;			
      };
    };

  };

  fragment@1 {

    target-path = "/";

    __overlay__ {
      pinctrl-names = "default";
      pinctrl-0 = <&gpio_keys>;

      keypad: photobox {
        compatible = "gpio-keys";
        #address-cells = <1>;
        #size-cells = <0>;
        autorepeat;

        button@117 {
          label = "KEY_R";
          linux,code = <19>;  // r
          gpios = <&pio 117 1>;
        };

      };

    };

  };

};

 

What does `pinctrl-0 = <&gpio_keys>;` mean? Is there an automatic mapping to the right pinctrl?

 

I have seen that the gpio pins eg. PD21 are represented as `gpios = <&pio 3 21 0>` here ... but it doesn't help either

                                                                                                                        ^   ^

                                                                                                                            - 21 as pin offset

                                                                                                                            - 3 multiplicator (A=0, B=1, C=2, D=3 ?)

 

Maybe I need to build with "CONFIG_INPUT_MATRIXKMAP" ?

 

CONFIG_INPUT=y
CONFIG_INPUT_LEDS=y
CONFIG_INPUT_FF_MEMLESS=m
# CONFIG_INPUT_SPARSEKMAP is not set
# CONFIG_INPUT_MATRIXKMAP is not set

 

<
This thread is quite old. Please consider starting a new thread rather than reviving this one.

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