Unable to get interrupts for rotary encoder

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to get interrupts for rotary encoder

1,685 Views
Bhargava
Contributor I

Hi,

We are working with a Rotary encoder from Grayhill (62A15-02-040C).

The SOM we are using is SMARC conga-SMX8-Mini based on iMX8M Mini.

The Rotary encoder is interfaced to GPIOs 9 and 10 for Channel A and Channel B respectively.

The device tree for the same goes as below which is in reference with the document Documentation/devicetree/bindings/input/rotary-encoder.txt

rotary@0 {
compatible = "rotary-encoder";
gpios = <&gpio1 9 1>, <&gpio1 10 0>;
linux,axis = <0>; /* REL_X */
rotary-encoder,encoding = "gray";
rotary-encoder,relative-axis;
rotary-encoder,steps-per-period = <2>;
status = "okay";
};

We are using the generic rotary encoder driver available in the kernel (drivers/input/misc/rotary_encoder.c).

The driver probes successfully with device registration and interrupts allocation.

root@imx8mm-cgt-sx8m: cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
gpio-1 ( |bkl pwm ) out hi
gpio-8 ( |enable ) out hi
gpio-9 ( |rotary@0 ) in lo IRQ ACTIVE LOW
gpio-10 ( |rotary@0 ) in lo IRQ
gpio-12 ( |regulator-usb ) out lo

 

And the interrupts being:

root@imx8mm-cgt-sx8m:~# cat /proc/interrupts

.

.

73: 0 gpio-mxc 9 Edge rotary-encoder
74: 0 gpio-mxc 10 Edge rotary-encoder

 

When tested with evtest tool no events are reported.

root@imx8mm-cgt-sx8m:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: 30370000.snvs:snvs-powerkey
/dev/input/event1: rotary@0
/dev/input/event2: gpio-keys
/dev/input/event3: bd718xx-pwrkey
/dev/input/event4: PixArt Dell MS116 USB Optical Mouse
Select the device event number [0-4]: 1
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "rotary@0"
Supported events:
Event type 0 (EV_SYN)
Event type 2 (EV_REL)
Event code 1 (REL_Y)
Properties:
Testing ... (interrupt to exit)

 

The issue is from the rotary_encoder.c driver none of the interrupt handlers like rotary_encoder_irq, rotary_encoder_half_period_irq.. are called.

Is there anything else to be done for the rotary encoder to work? On the hardware we checked for the pulses when encoder is rotated.

Please provide leads since the issue is hindering our further development.

 

SOC: iMX8M Mini

Yocto Zeus

 

Regards,

Bhargava

Labels (1)
0 Kudos
5 Replies

1,667 Views
igorpadykov
NXP Employee
NXP Employee

Hi Bhargava

 

for producing gpio interrupts one can try below example (for can), add "interrupt-parent"

https://variwiki.com/index.php?title=VAR-SOM-MX8M-MINI-CAN

 

Best regards
igor

0 Kudos

1,665 Views
Bhargava
Contributor I

Hi Igor,

Thanks for responding.

I tried with the interrupt-parent but no success.

 

Here rotary encoder is the input device, the device generates signals on GPIOs which have to be interpreted as interrupts. Is my understanding correct? Please through some light on this.

 

Regards,

Bhargava

0 Kudos

1,479 Views
zoob
Contributor I

Hi Bhargava, 

@Bhargava 

I have the same problem .

please could you tell me how did you fix it  ?

 

Thanks for your answer.

0 Kudos

1,456 Views
Bhargava
Contributor I

Hi Zoob,

In my case there was an issue in configuring GPIOs for rotary encoder.

GPIO configuration in device tree ("gpios" property in DTS) must be proper in order for rotary to work.

 

Regards,

Bhargava

0 Kudos

1,453 Views
zoob
Contributor I

Thanks. 

I fixed it yesterday. Everythng is working fine. 

0 Kudos