mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
101 lines
4.1 KiB
Diff
101 lines
4.1 KiB
Diff
|
From d61d506099a7e3dc2823927c89ac56478ef9f3a5 Mon Sep 17 00:00:00 2001
|
||
|
From: Ismael Asensio <isma.af@gmail.com>
|
||
|
Date: Sun, 18 Feb 2018 18:53:58 +0100
|
||
|
Subject: [PATCH 218/454] Generic Rotary Encoder overlay for multiple instances
|
||
|
(#2388)
|
||
|
|
||
|
Modify the rotary-encoder overlay to support multiple instances.
|
||
|
---
|
||
|
arch/arm/boot/dts/overlays/README | 4 +-
|
||
|
.../dts/overlays/rotary-encoder-overlay.dts | 54 +++++++++++--------
|
||
|
2 files changed, 33 insertions(+), 25 deletions(-)
|
||
|
|
||
|
--- a/arch/arm/boot/dts/overlays/README
|
||
|
+++ b/arch/arm/boot/dts/overlays/README
|
||
|
@@ -1345,9 +1345,9 @@ Params: <None>
|
||
|
Name: rotary-encoder
|
||
|
Info: Overlay for GPIO connected rotary encoder.
|
||
|
Load: dtoverlay=rotary-encoder,<param>=<val>
|
||
|
-Params: rotary0_pin_a GPIO connected to rotary encoder channel A
|
||
|
+Params: pin_a GPIO connected to rotary encoder channel A
|
||
|
(default 4).
|
||
|
- rotary0_pin_b GPIO connected to rotary encoder channel B
|
||
|
+ pin_b GPIO connected to rotary encoder channel B
|
||
|
(default 17).
|
||
|
relative_axis register a relative axis rather than an
|
||
|
absolute one. Relative axis will only
|
||
|
--- a/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts
|
||
|
+++ b/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts
|
||
|
@@ -8,7 +8,7 @@
|
||
|
fragment@0 {
|
||
|
target = <&gpio>;
|
||
|
__overlay__ {
|
||
|
- rotary0_pins: rotary0_pins {
|
||
|
+ rotary_pins: rotary_pins@4 {
|
||
|
brcm,pins = <4 17>; /* gpio 4 17 */
|
||
|
brcm,function = <0 0>; /* input */
|
||
|
brcm,pull = <2 2>; /* pull-up */
|
||
|
@@ -20,32 +20,40 @@
|
||
|
fragment@1 {
|
||
|
target-path = "/";
|
||
|
__overlay__ {
|
||
|
- rotary0: rotary@0 {
|
||
|
- compatible = "rotary-encoder";
|
||
|
- status = "okay";
|
||
|
- pinctrl-names = "default";
|
||
|
- pinctrl-0 = <&rotary0_pins>;
|
||
|
- gpios = <&gpio 4 0>, <&gpio 17 0>;
|
||
|
- linux,axis = <0>; /* REL_X */
|
||
|
- rotary-encoder,encoding = "gray";
|
||
|
- rotary-encoder,steps = <24>; /* 24 default */
|
||
|
- rotary-encoder,steps-per-period = <1>; /* corresponds to full period mode. See README */
|
||
|
+ rotary: rotary@4 {
|
||
|
+ compatible = "rotary-encoder";
|
||
|
+ status = "okay";
|
||
|
+ pinctrl-names = "default";
|
||
|
+ pinctrl-0 = <&rotary_pins>;
|
||
|
+ gpios = <&gpio 4 0>, <&gpio 17 0>;
|
||
|
+ linux,axis = <0>; /* REL_X */
|
||
|
+ rotary-encoder,encoding = "gray";
|
||
|
+ rotary-encoder,steps = <24>; /* 24 default */
|
||
|
+ rotary-encoder,steps-per-period = <1>; /* corresponds to full period mode. See README */
|
||
|
};
|
||
|
};
|
||
|
|
||
|
};
|
||
|
|
||
|
__overrides__ {
|
||
|
- rotary0_pin_a = <&rotary0>,"gpios:4",
|
||
|
- <&rotary0_pins>,"brcm,pins:0";
|
||
|
- rotary0_pin_b = <&rotary0>,"gpios:16",
|
||
|
- <&rotary0_pins>,"brcm,pins:4";
|
||
|
- relative_axis = <&rotary0>,"rotary-encoder,relative-axis?";
|
||
|
- linux_axis = <&rotary0>,"linux,axis:0";
|
||
|
- rollover = <&rotary0>,"rotary-encoder,rollover?";
|
||
|
- steps-per-period = <&rotary0>,"rotary-encoder,steps-per-period:0";
|
||
|
- steps = <&rotary0>,"rotary-encoder,steps:0";
|
||
|
- wakeup = <&rotary0>,"wakeup-source?";
|
||
|
- encoding = <&rotary0>,"rotary-encoder,encoding";
|
||
|
- };
|
||
|
+ pin_a = <&rotary>,"gpios:4",
|
||
|
+ <&rotary_pins>,"brcm,pins:0",
|
||
|
+ /* modify reg values to allow multiple instantiation */
|
||
|
+ <&rotary>,"reg:0",
|
||
|
+ <&rotary_pins>,"reg:0";
|
||
|
+ pin_b = <&rotary>,"gpios:16",
|
||
|
+ <&rotary_pins>,"brcm,pins:4";
|
||
|
+ relative_axis = <&rotary>,"rotary-encoder,relative-axis?";
|
||
|
+ linux_axis = <&rotary>,"linux,axis:0";
|
||
|
+ rollover = <&rotary>,"rotary-encoder,rollover?";
|
||
|
+ steps-per-period = <&rotary>,"rotary-encoder,steps-per-period:0";
|
||
|
+ steps = <&rotary>,"rotary-encoder,steps:0";
|
||
|
+ wakeup = <&rotary>,"wakeup-source?";
|
||
|
+ encoding = <&rotary>,"rotary-encoder,encoding";
|
||
|
+ /* legacy parameters*/
|
||
|
+ rotary0_pin_a = <&rotary>,"gpios:4",
|
||
|
+ <&rotary_pins>,"brcm,pins:0";
|
||
|
+ rotary0_pin_b = <&rotary>,"gpios:16",
|
||
|
+ <&rotary_pins>,"brcm,pins:4";
|
||
|
+ };
|
||
|
};
|