b85d5450333b297ed9d98c178cdb56f87d2f66e3
[openwrt/staging/dangole.git] /
1 From d61d506099a7e3dc2823927c89ac56478ef9f3a5 Mon Sep 17 00:00:00 2001
2 From: Ismael Asensio <isma.af@gmail.com>
3 Date: Sun, 18 Feb 2018 18:53:58 +0100
4 Subject: [PATCH 218/454] Generic Rotary Encoder overlay for multiple instances
5 (#2388)
6
7 Modify the rotary-encoder overlay to support multiple instances.
8 ---
9 arch/arm/boot/dts/overlays/README | 4 +-
10 .../dts/overlays/rotary-encoder-overlay.dts | 54 +++++++++++--------
11 2 files changed, 33 insertions(+), 25 deletions(-)
12
13 --- a/arch/arm/boot/dts/overlays/README
14 +++ b/arch/arm/boot/dts/overlays/README
15 @@ -1345,9 +1345,9 @@ Params: <None>
16 Name: rotary-encoder
17 Info: Overlay for GPIO connected rotary encoder.
18 Load: dtoverlay=rotary-encoder,<param>=<val>
19 -Params: rotary0_pin_a GPIO connected to rotary encoder channel A
20 +Params: pin_a GPIO connected to rotary encoder channel A
21 (default 4).
22 - rotary0_pin_b GPIO connected to rotary encoder channel B
23 + pin_b GPIO connected to rotary encoder channel B
24 (default 17).
25 relative_axis register a relative axis rather than an
26 absolute one. Relative axis will only
27 --- a/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts
28 +++ b/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts
29 @@ -8,7 +8,7 @@
30 fragment@0 {
31 target = <&gpio>;
32 __overlay__ {
33 - rotary0_pins: rotary0_pins {
34 + rotary_pins: rotary_pins@4 {
35 brcm,pins = <4 17>; /* gpio 4 17 */
36 brcm,function = <0 0>; /* input */
37 brcm,pull = <2 2>; /* pull-up */
38 @@ -20,32 +20,40 @@
39 fragment@1 {
40 target-path = "/";
41 __overlay__ {
42 - rotary0: rotary@0 {
43 - compatible = "rotary-encoder";
44 - status = "okay";
45 - pinctrl-names = "default";
46 - pinctrl-0 = <&rotary0_pins>;
47 - gpios = <&gpio 4 0>, <&gpio 17 0>;
48 - linux,axis = <0>; /* REL_X */
49 - rotary-encoder,encoding = "gray";
50 - rotary-encoder,steps = <24>; /* 24 default */
51 - rotary-encoder,steps-per-period = <1>; /* corresponds to full period mode. See README */
52 + rotary: rotary@4 {
53 + compatible = "rotary-encoder";
54 + status = "okay";
55 + pinctrl-names = "default";
56 + pinctrl-0 = <&rotary_pins>;
57 + gpios = <&gpio 4 0>, <&gpio 17 0>;
58 + linux,axis = <0>; /* REL_X */
59 + rotary-encoder,encoding = "gray";
60 + rotary-encoder,steps = <24>; /* 24 default */
61 + rotary-encoder,steps-per-period = <1>; /* corresponds to full period mode. See README */
62 };
63 };
64
65 };
66
67 __overrides__ {
68 - rotary0_pin_a = <&rotary0>,"gpios:4",
69 - <&rotary0_pins>,"brcm,pins:0";
70 - rotary0_pin_b = <&rotary0>,"gpios:16",
71 - <&rotary0_pins>,"brcm,pins:4";
72 - relative_axis = <&rotary0>,"rotary-encoder,relative-axis?";
73 - linux_axis = <&rotary0>,"linux,axis:0";
74 - rollover = <&rotary0>,"rotary-encoder,rollover?";
75 - steps-per-period = <&rotary0>,"rotary-encoder,steps-per-period:0";
76 - steps = <&rotary0>,"rotary-encoder,steps:0";
77 - wakeup = <&rotary0>,"wakeup-source?";
78 - encoding = <&rotary0>,"rotary-encoder,encoding";
79 - };
80 + pin_a = <&rotary>,"gpios:4",
81 + <&rotary_pins>,"brcm,pins:0",
82 + /* modify reg values to allow multiple instantiation */
83 + <&rotary>,"reg:0",
84 + <&rotary_pins>,"reg:0";
85 + pin_b = <&rotary>,"gpios:16",
86 + <&rotary_pins>,"brcm,pins:4";
87 + relative_axis = <&rotary>,"rotary-encoder,relative-axis?";
88 + linux_axis = <&rotary>,"linux,axis:0";
89 + rollover = <&rotary>,"rotary-encoder,rollover?";
90 + steps-per-period = <&rotary>,"rotary-encoder,steps-per-period:0";
91 + steps = <&rotary>,"rotary-encoder,steps:0";
92 + wakeup = <&rotary>,"wakeup-source?";
93 + encoding = <&rotary>,"rotary-encoder,encoding";
94 + /* legacy parameters*/
95 + rotary0_pin_a = <&rotary>,"gpios:4",
96 + <&rotary_pins>,"brcm,pins:0";
97 + rotary0_pin_b = <&rotary>,"gpios:16",
98 + <&rotary_pins>,"brcm,pins:4";
99 + };
100 };