Skip to content

Generic Rotary Encoder overlay for multiple instances - #2388

Merged
pelwell merged 5 commits into
raspberrypi:rpi-4.9.yfrom
ismailof:rotary_generic
Feb 18, 2018
Merged

pelwell merged 5 commits into
raspberrypi:rpi-4.9.yfrom
ismailof:rotary_generic

Conversation

@ismailof

Copy link
Copy Markdown

A slightly modified rotary-encoder-overlay to allow multiple instances.
It make use of the <reg> property, similar to the gpio-keys-overlay, bounded to the pin_a parameter.

Then, it is possible to attach multiple rotary encoders to different pins, like the following example:

dtoverlay=rotary-encoder,pin_a=13,pin_b=19,relative_axis
dtoverlay=rotary-encoder,pin_a=22,pin_b=27,relative_axis,linux_axis=1

Parameters rotary0_pin_a and rotary0_pin_b are renamed to just pin_a and pin_b since they do not only refer to one rotary node only.

@pelwell

pelwell commented Feb 17, 2018

Copy link
Copy Markdown
Contributor

I think what you are doing is great, but I'm not so happy that it may stop working for existing users unless they rename their parameters to match. Can you keep rotary0_pin_a and _b as aliases, and make sure the README matches (I prefer the shorter pin_a and _b)?

@ismailof

Copy link
Copy Markdown
Author

Sure! I don't like to break compatibility for previous users either. I'm quite new to dts overlay format so I don't know the best way to achieve this.

My first simple attemp has been using the aliases section, but compiling fails sind pin_a and pin_b are not labels but parameters

        aliases {    /* for compatibilty with previous properties */
            rotary0_pin_a = &pin_a;
            rotary0_pin_b = &pin_b;
        };

I can think of duplicating the parameters inside the __overrides__ section, and even don't modify the reg property here to have same behaviour as previous code:

                /* legacy parameters*/
                rotary0_pin_a =   <&rotary>,"gpios:4",
                               <&rotary_pins>,"brcm,pins:0",
                rotary0_pin_b =   <&rotary>,"gpios:16",
                               <&rotary_pins>,"brcm,pins:4";

Is there a better alternative to this?

@pelwell

pelwell commented Feb 18, 2018

Copy link
Copy Markdown
Contributor

No, there is no clever way, just duplicate the parameter definition with a different name like your second example.

@ismailof

Copy link
Copy Markdown
Author

Ok. Commited this way

@pelwell
pelwell merged commit 7d9157c into raspberrypi:rpi-4.9.y Feb 18, 2018
pelwell pushed a commit that referenced this pull request Feb 18, 2018
Modify the rotary-encoder overlay to support multiple instances.
pelwell pushed a commit that referenced this pull request Feb 18, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Feb 19, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Feb 20, 2018
kernel: Add support for SuperAudioBoard sound card (#2386)
See: raspberrypi/linux#2386

kernel: Revert downstream wm8804 changes
See: raspberrypi/linux#2364

kernel: Generic Rotary Encoder overlay for multiple instances (#2388)
See: raspberrypi/linux#2388

kernel: dwc_otg: Fix a regression when dequeueing isochronous transfers
See: raspberrypi/linux#2380

kernel: dwc_otg: add smp_mb() to prevent driver state corruption on boot
See: raspberrypi/linux#2382

kernel: overlays: Allow multiple instances of gpio-ir[-tx]
kernel: overlay: Add missing pinctrl reference to gpio-ir

kernel: properly fix S24_LE mode with pcm512x codec
See: raspberrypi/linux#2365
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Feb 20, 2018
kernel: Add support for SuperAudioBoard sound card (#2386)
See: raspberrypi/linux#2386

kernel: Revert downstream wm8804 changes
See: raspberrypi/linux#2364

kernel: Generic Rotary Encoder overlay for multiple instances (#2388)
See: raspberrypi/linux#2388

kernel: dwc_otg: Fix a regression when dequeueing isochronous transfers
See: raspberrypi/linux#2380

kernel: dwc_otg: add smp_mb() to prevent driver state corruption on boot
See: raspberrypi/linux#2382

kernel: overlays: Allow multiple instances of gpio-ir[-tx]
kernel: overlay: Add missing pinctrl reference to gpio-ir

kernel: properly fix S24_LE mode with pcm512x codec
See: raspberrypi/linux#2365
@pelwell

pelwell commented Feb 20, 2018

Copy link
Copy Markdown
Contributor

The updated overlay is in the current rpi-update release.

pelwell pushed a commit that referenced this pull request Feb 20, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Feb 23, 2018
Modify the rotary-encoder overlay to support multiple instances.
@ismailof
ismailof deleted the rotary_generic branch February 24, 2018 00:33
popcornmix pushed a commit that referenced this pull request Feb 26, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Feb 26, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 5, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 8, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 13, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 14, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 16, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 22, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 22, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 26, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 26, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Mar 29, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 3, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 3, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 9, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 9, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 16, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 16, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Apr 26, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request May 5, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request May 5, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request May 17, 2018
Modify the rotary-encoder overlay to support multiple instances.
pelwell pushed a commit that referenced this pull request May 20, 2018
Modify the rotary-encoder overlay to support multiple instances.
pelwell pushed a commit that referenced this pull request May 20, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request May 21, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request May 25, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request May 29, 2018
Modify the rotary-encoder overlay to support multiple instances.
popcornmix pushed a commit that referenced this pull request Jun 5, 2018
Modify the rotary-encoder overlay to support multiple instances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants