[PATCH v2 5/7] of: unittest: Test fw_devlink with PWM nexus maps

From: Ernest Van Hoecke

Date: Thu Sep 10 2026 - 10:25:35 EST


From: Ernest Van Hoecke <ernest.vanhoecke@xxxxxxxxxxx>

Extend the fw_devlink OF unit tests with PWM references routed through a
nexus map. Verify that the mapped consumer has exactly one link to the
final PWM provider rather than to the nexus.

Also cover a direct PWM reference to ensure that it continues to resolve
to the original provider when no map is present.

Signed-off-by: Ernest Van Hoecke <ernest.vanhoecke@xxxxxxxxxxx>
---
drivers/of/unittest-data/tests-phandle.dtsi | 16 ++++++++++++++++
drivers/of/unittest.c | 2 ++
2 files changed, 18 insertions(+)

diff --git a/drivers/of/unittest-data/tests-phandle.dtsi b/drivers/of/unittest-data/tests-phandle.dtsi
index c3727ed15bde..eef966615b22 100644
--- a/drivers/of/unittest-data/tests-phandle.dtsi
+++ b/drivers/of/unittest-data/tests-phandle.dtsi
@@ -85,11 +85,19 @@ gpio_provider: gpio-controller {
#gpio-cells = <2>;
};

+ pwm_provider: pwm-controller {
+ #pwm-cells = <2>;
+ };
+
fwdevlink_nexus: nexus {
#gpio-cells = <2>;
+ #pwm-cells = <2>;
gpio-map = <0 0 &gpio_provider 1 0>;
gpio-map-mask = <0xffffffff 0>;
gpio-map-pass-thru = <0 0xffffffff>;
+ pwm-map = <0 0 &pwm_provider 1 0>;
+ pwm-map-mask = <0xffffffff 0>;
+ pwm-map-pass-thru = <0 0xffffffff>;
};

gpio-compat-consumer {
@@ -111,6 +119,14 @@ gpio-direct-consumer {
gpio-singular-consumer {
test-gpio = <&fwdevlink_nexus 0 0>;
};
+
+ pwm-consumer {
+ pwms = <&fwdevlink_nexus 0 0>;
+ };
+
+ pwm-direct-consumer {
+ pwms = <&pwm_provider 1 0>;
+ };
};
};
};
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index dfa3c885d142..b739a69997a9 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -770,6 +770,8 @@ static void __init of_unittest_fw_devlink(void)
{ "gpio-consumer", "gpio-controller" },
{ "gpio-direct-consumer", "gpio-controller" },
{ "gpio-singular-consumer", "gpio-controller" },
+ { "pwm-consumer", "pwm-controller" },
+ { "pwm-direct-consumer", "pwm-controller" },
};
struct device_node *tests;
int i;

--
2.43.0