Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6997a24 authored by Frank Rowand's avatar Frank Rowand Committed by Greg Kroah-Hartman
Browse files

of: unittest: add overlay gpio test to catch gpio hog problem

[ Upstream commit f4056e705b2ef7f123a188f6aee23ade70e7d793 ]

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: default avatarFrank Rowand <frank.rowand@sony.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Stable-dep-of: 607aad1e4356 ("of: unittest: Fix compile in the non-dynamic case")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 89485251
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -21,7 +21,13 @@ obj-$(CONFIG_OF_OVERLAY) += overlay.dtb.o \
			    overlay_bad_add_dup_prop.dtb.o \
			    overlay_bad_phandle.dtb.o \
			    overlay_bad_symbol.dtb.o \
			    overlay_base.dtb.o
			    overlay_base.dtb.o \
			    overlay_gpio_01.dtb.o \
			    overlay_gpio_02a.dtb.o \
			    overlay_gpio_02b.dtb.o \
			    overlay_gpio_03.dtb.o \
			    overlay_gpio_04a.dtb.o \
			    overlay_gpio_04b.dtb.o

# enable creation of __symbols__ node
DTC_FLAGS_overlay += -@
+23 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;

&unittest_test_bus {
	#address-cells = <1>;
	#size-cells = <0>;
	gpio@0 {
		compatible = "unittest-gpio";
		reg = <0>;
		gpio-controller;
		#gpio-cells = <2>;
		ngpios = <2>;
		gpio-line-names = "line-A", "line-B";

		line-b {
			gpio-hog;
			gpios = <2 0>;
			input;
			line-name = "line-B-input";
		};
	};
};
+16 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;

&unittest_test_bus {
	#address-cells = <1>;
	#size-cells = <0>;
	gpio@2 {
		compatible = "unittest-gpio";
		reg = <2>;
		gpio-controller;
		#gpio-cells = <2>;
		ngpios = <2>;
		gpio-line-names = "line-A", "line-B";
	};
};
+16 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;

&unittest_test_bus {
	#address-cells = <1>;
	#size-cells = <0>;
	gpio@2 {
		line-a {
			gpio-hog;
			gpios = <1 0>;
			input;
			line-name = "line-A-input";
		};
	};
};
+23 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;

&unittest_test_bus {
	#address-cells = <1>;
	#size-cells = <0>;
	gpio@3 {
		compatible = "unittest-gpio";
		reg = <3>;
		gpio-controller;
		#gpio-cells = <2>;
		ngpios = <2>;
		gpio-line-names = "line-A", "line-B", "line-C", "line-D";

		line-d {
			gpio-hog;
			gpios = <4 0>;
			input;
			line-name = "line-D-input";
		};
	};
};
Loading