Skip to content

Commit f4056e7

Browse files
frowandrobherring
authored andcommitted
of: unittest: add overlay gpio test to catch gpio hog problem
Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an RFC patch to fix the problem [1]. Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's RFC patch and "0 failed" after applying Geert's RFC patch. [1] https://lore.kernel.org/linux-devicetree/20191230133852.5890-1-geert+renesas@glider.be/ Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
1 parent 2f7afc3 commit f4056e7

8 files changed

Lines changed: 370 additions & 1 deletion

File tree

‎drivers/of/unittest-data/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
2121
overlay_bad_add_dup_prop.dtb.o \
2222
overlay_bad_phandle.dtb.o \
2323
overlay_bad_symbol.dtb.o \
24-
overlay_base.dtb.o
24+
overlay_base.dtb.o \
25+
overlay_gpio_01.dtb.o \
26+
overlay_gpio_02a.dtb.o \
27+
overlay_gpio_02b.dtb.o \
28+
overlay_gpio_03.dtb.o \
29+
overlay_gpio_04a.dtb.o \
30+
overlay_gpio_04b.dtb.o
2531

2632
# enable creation of __symbols__ node
2733
DTC_FLAGS_overlay += -@
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/dts-v1/;
3+
/plugin/;
4+
5+
&unittest_test_bus {
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
gpio@0 {
9+
compatible = "unittest-gpio";
10+
reg = <0>;
11+
gpio-controller;
12+
#gpio-cells = <2>;
13+
ngpios = <2>;
14+
gpio-line-names = "line-A", "line-B";
15+
16+
line-b {
17+
gpio-hog;
18+
gpios = <2 0>;
19+
input;
20+
line-name = "line-B-input";
21+
};
22+
};
23+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/dts-v1/;
3+
/plugin/;
4+
5+
&unittest_test_bus {
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
gpio@2 {
9+
compatible = "unittest-gpio";
10+
reg = <2>;
11+
gpio-controller;
12+
#gpio-cells = <2>;
13+
ngpios = <2>;
14+
gpio-line-names = "line-A", "line-B";
15+
};
16+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/dts-v1/;
3+
/plugin/;
4+
5+
&unittest_test_bus {
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
gpio@2 {
9+
line-a {
10+
gpio-hog;
11+
gpios = <1 0>;
12+
input;
13+
line-name = "line-A-input";
14+
};
15+
};
16+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/dts-v1/;
3+
/plugin/;
4+
5+
&unittest_test_bus {
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
gpio@3 {
9+
compatible = "unittest-gpio";
10+
reg = <3>;
11+
gpio-controller;
12+
#gpio-cells = <2>;
13+
ngpios = <2>;
14+
gpio-line-names = "line-A", "line-B", "line-C", "line-D";
15+
16+
line-d {
17+
gpio-hog;
18+
gpios = <4 0>;
19+
input;
20+
line-name = "line-D-input";
21+
};
22+
};
23+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/dts-v1/;
3+
/plugin/;
4+
5+
&unittest_test_bus {
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
gpio@4 {
9+
compatible = "unittest-gpio";
10+
reg = <4>;
11+
gpio-controller;
12+
#gpio-cells = <2>;
13+
ngpios = <2>;
14+
gpio-line-names = "line-A", "line-B", "line-C", "line-D";
15+
};
16+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/dts-v1/;
3+
/plugin/;
4+
5+
&unittest_test_bus {
6+
#address-cells = <1>;
7+
#size-cells = <0>;
8+
gpio@4 {
9+
line-c {
10+
gpio-hog;
11+
gpios = <3 0>;
12+
input;
13+
line-name = "line-C-input";
14+
};
15+
};
16+
};

0 commit comments

Comments
 (0)