File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed
arch/arm/boot/dts/overlays Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
76
76
pwm-2chan.dtbo \
77
77
qca7000.dtbo \
78
78
raspidac3.dtbo \
79
+ rotary-encoder.dtbo \
79
80
rpi-backlight.dtbo \
80
81
rpi-cirrus-wm5102.dtbo \
81
82
rpi-dac.dtbo \
Original file line number Diff line number Diff line change @@ -1122,6 +1122,15 @@ Load: dtoverlay=raspidac3
1122
1122
Params: <None>
1123
1123
1124
1124
1125
+ Name: rotary-encoder
1126
+ Info: Overlay for GPIO connected rotary encoder.
1127
+ Load: dtoverlay=rotary-encoder,<param>=<val>
1128
+ Params: rotary0_pin_a GPIO connected to rotary encoder channel A
1129
+ (default 4).
1130
+ rotary0_pin_b GPIO connected to rotary encoder channel B
1131
+ (default 17).
1132
+
1133
+
1125
1134
Name: rpi-backlight
1126
1135
Info: Raspberry Pi official display backlight driver
1127
1136
Load: dtoverlay=rpi-backlight
Original file line number Diff line number Diff line change
1
+ // Device tree overlay for GPIO connected rotary encoder.
2
+ /dts-v1/;
3
+ /plugin/;
4
+
5
+ / {
6
+ compatible = "brcm,bcm2708";
7
+
8
+ fragment@0 {
9
+ target = <&gpio>;
10
+ __overlay__ {
11
+ rotary0_pins: rotary0_pins {
12
+ brcm,pins = <4 17>; /* gpio 4 17 */
13
+ brcm,function = <0 0>; /* input */
14
+ brcm,pull = <2 2>; /* pull-up */
15
+ };
16
+
17
+ };
18
+ };
19
+
20
+ fragment@1 {
21
+ target-path = "/";
22
+ __overlay__ {
23
+ rotary0: rotary@0 {
24
+ compatible = "rotary-encoder";
25
+ status = "okay";
26
+ pinctrl-names = "default";
27
+ pinctrl-0 = <&rotary0_pins>;
28
+ gpios = <&gpio 4 0>, <&gpio 17 0>;
29
+ linux,axis = <0>; /* REL_X */
30
+ rotary-encoder,encoding = "gray";
31
+ rotary-encoder,relative-axis;
32
+ };
33
+ };
34
+
35
+ };
36
+
37
+ __overrides__ {
38
+ rotary0_pin_a = <&rotary0>,"gpios:4",
39
+ <&rotary0_pins>,"brcm,pins:0";
40
+ rotary0_pin_b = <&rotary0>,"gpios:16",
41
+ <&rotary0_pins>,"brcm,pins:4";
42
+ };
43
+ };
You can’t perform that action at this time.
0 commit comments