Repository: zephyrproject-rtos/zephyr
Pull request #88242: soc: st: common: Rename STM32_PWR_WKUP_PIN_SRC_x
Author: login: jurenat
Labels: name: area: Power Management
name: platform: STM32
description: ST Micro STM32
Created: 2025-04-07T09:59:19Z | Merged: 2025-04-09T13:22:59Z

This renames the STM32_PWR_WKUP_PIN_SRC_x symbols to better match their meaning. It also adds a new symbol (STM32_PWR_WKUP_LINE_NOT_MUXED) for SoCs without wake-up mux support.


Diff:
diff --git a/dts/arm/st/c0/stm32c0.dtsi b/dts/arm/st/c0/stm32c0.dtsi
index 1e96391c6a81f..e5545e8b05f71 100644
--- a/dts/arm/st/c0/stm32c0.dtsi
+++ b/dts/arm/st/c0/stm32c0.dtsi
@@ -11,13 +11,13 @@
  *
  *   &pwr {
  *       wkup-pin@2 {
- *           wkup-gpios = <&gpioX YY STM32_PWR_WKUP_PIN_SRC_0>;
+ *           wkup-gpios = <&gpioX YY STM32_PWR_WKUP_PIN_NOT_MUXED>;
  *       };
  *       wkup-pin@5 {
- *           wkup-gpios = <&gpioX YY STM32_PWR_WKUP_PIN_SRC_0>;
+ *           wkup-gpios = <&gpioX YY STM32_PWR_WKUP_PIN_NOT_MUXED>;
  *       };
  *       wkup-pin@6 {
- *           wkup-gpios = <&gpioX YY STM32_PWR_WKUP_PIN_SRC_0>;
+ *           wkup-gpios = <&gpioX YY STM32_PWR_WKUP_PIN_NOT_MUXED>;
  *       };
  *   };
  *
@@ -229,7 +229,7 @@
 
 			wkup-pin@1 {
 				reg = <0x1>;
-				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 
 			wkup-pin@2 {
@@ -238,12 +238,12 @@
 
 			wkup-pin@3 {
 				reg = <0x3>;
-				wkup-gpios = <&gpiob 6 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpiob 6 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 
 			wkup-pin@4 {
 				reg = <0x4>;
-				wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 
 			wkup-pin@5 {
diff --git a/dts/arm/st/l4/stm32l4r5Xi.dtsi b/dts/arm/st/l4/stm32l4r5Xi.dtsi
index 5da6f035e7693..b5318d1e40d85 100644
--- a/dts/arm/st/l4/stm32l4r5Xi.dtsi
+++ b/dts/arm/st/l4/stm32l4r5Xi.dtsi
@@ -20,22 +20,22 @@
 
 &pwr {
 	wkup-pin@1 {
-		wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 
 	wkup-pin@2 {
-		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 
 	wkup-pin@3 {
-		wkup-gpios = <&gpioe 6 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioe 6 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 
 	wkup-pin@4 {
-		wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 
 	wkup-pin@5 {
-		wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 };
diff --git a/dts/arm/st/u5/stm32u5.dtsi b/dts/arm/st/u5/stm32u5.dtsi
index 1e64b5a259665..da2d4eceb64c8 100644
--- a/dts/arm/st/u5/stm32u5.dtsi
+++ b/dts/arm/st/u5/stm32u5.dtsi
@@ -876,58 +876,58 @@
 
 			wkup-pin@1 {
 				reg = <0x1>;
-				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpiob 2 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpioe 4 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpiob 2 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpioe 4 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@2 {
 				reg = <0x2>;
-				wkup-gpios = <&gpioa 4 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpioc 13 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpioe 5 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpioa 4 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpioc 13 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpioe 5 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@3 {
 				reg = <0x3>;
-				wkup-gpios = <&gpioe 6 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpioa 1 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpiob 6 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpioe 6 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpioa 1 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpiob 6 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@4 {
 				reg = <0x4>;
-				wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpiob 1 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpiob 7 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpiob 1 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpiob 7 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@5 {
 				reg = <0x5>;
-				wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpioa 3 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpiob 8 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpioa 3 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpiob 8 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@6 {
 				reg = <0x6>;
-				wkup-gpios = <&gpiob 5 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpioa 5 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpioe 7 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpiob 5 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpioa 5 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpioe 7 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@7 {
 				reg = <0x7>;
-				wkup-gpios = <&gpiob 15 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpioa 6 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpioe 8 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpiob 15 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpioa 6 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpioe 8 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 
 			wkup-pin@8 {
 				reg = <0x8>;
-				wkup-gpios = <&gpiof 2 STM32_PWR_WKUP_PIN_SRC_0>,
-					     <&gpioa 7 STM32_PWR_WKUP_PIN_SRC_1>,
-					     <&gpiob 10 STM32_PWR_WKUP_PIN_SRC_2>;
+				wkup-gpios = <&gpiof 2 STM32_PWR_WKUP_EVT_SRC_0>,
+					     <&gpioa 7 STM32_PWR_WKUP_EVT_SRC_1>,
+					     <&gpiob 10 STM32_PWR_WKUP_EVT_SRC_2>;
 			};
 		};
 
diff --git a/dts/arm/st/wb/stm32wb.dtsi b/dts/arm/st/wb/stm32wb.dtsi
index e46be118da513..a9652addf3f1c 100644
--- a/dts/arm/st/wb/stm32wb.dtsi
+++ b/dts/arm/st/wb/stm32wb.dtsi
@@ -535,12 +535,12 @@
 
 			wkup-pin@1 {
 				reg = <0x1>;
-				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 
 			wkup-pin@4 {
 				reg = <0x4>;
-				wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 2 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 		};
 	};
diff --git a/dts/arm/st/wb/stm32wb55Xg.dtsi b/dts/arm/st/wb/stm32wb55Xg.dtsi
index c3a7d391e7752..0e4a2220038cf 100644
--- a/dts/arm/st/wb/stm32wb55Xg.dtsi
+++ b/dts/arm/st/wb/stm32wb55Xg.dtsi
@@ -24,16 +24,16 @@
 &pwr {
 	wkup-pin@2 {
 		reg = <0x2>;
-		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 
 	wkup-pin@3 {
 		reg = <0x3>;
-		wkup-gpios = <&gpioc 12 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioc 12 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 
 	wkup-pin@5 {
 		reg = <0x5>;
-		wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioc 5 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 	};
 };
diff --git a/dts/arm/st/wl/stm32wl.dtsi b/dts/arm/st/wl/stm32wl.dtsi
index bfcff2670cef6..3c7c477c47254 100644
--- a/dts/arm/st/wl/stm32wl.dtsi
+++ b/dts/arm/st/wl/stm32wl.dtsi
@@ -523,17 +523,17 @@
 
 			wkup-pin@1 {
 				reg = <0x1>;
-				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 
 			wkup-pin@2 {
 				reg = <0x2>;
-				wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 
 			wkup-pin@3 {
 				reg = <0x3>;
-				wkup-gpios = <&gpiob 3 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpiob 3 STM32_PWR_WKUP_PIN_NOT_MUXED>;
 			};
 		};
 	};
diff --git a/dts/bindings/power/st,stm32-pwr.yaml b/dts/bindings/power/st,stm32-pwr.yaml
index 84b67104dac7d..0eaccb39c1bc8 100644
--- a/dts/bindings/power/st,stm32-pwr.yaml
+++ b/dts/bindings/power/st,stm32-pwr.yaml
@@ -62,6 +62,6 @@ child-binding:
       description: |
         Specifies the GPIOs, if any, that are associated with the wake-up pin.
 
-        For example, for GPIO B2 associated with wakeup source 1 on wake-up
-        pin 1 on STM32U5 SoCs:
-        wkup-gpios = <&gpiob 2 STM32_PWR_WKUP_PIN_SRC_1>, <...>;
+        For example, for GPIO PB2 associated with wakeup source 1 on wake-up
+        event 1 on STM32U5 SoCs:
+        wkup-gpios = <&gpiob 2 STM32_PWR_WKUP_EVT_SRC_1>, <...>;
diff --git a/include/zephyr/dt-bindings/power/stm32_pwr.h b/include/zephyr/dt-bindings/power/stm32_pwr.h
index 8c7962f14ada8..b7eee0005591c 100644
--- a/include/zephyr/dt-bindings/power/stm32_pwr.h
+++ b/include/zephyr/dt-bindings/power/stm32_pwr.h
@@ -7,6 +7,8 @@
 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_POWER_STM32_PWR_H_
 #define ZEPHYR_INCLUDE_DT_BINDINGS_POWER_STM32_PWR_H_
 
+#include <zephyr/dt-bindings/dt-util.h>
+
 /**
  * @brief STM32 power controller
  * @{
@@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this flag on series where wake-up event source is fixed/not configurable */
+#define STM32_PWR_WKUP_PIN_NOT_MUXED	STM32_PWR_WKUP_EVT_SRC_0
+#define STM32_PWR_WKUP_EVT_SRC_0	BIT(0)
+#define STM32_PWR_WKUP_EVT_SRC_1	BIT(1)
+#define STM32_PWR_WKUP_EVT_SRC_2	BIT(2)
 
 /** @} */
 
diff --git a/soc/st/stm32/common/stm32_wkup_pins.c b/soc/st/stm32/common/stm32_wkup_pins.c
index 751ff1741c1d1..0ca40b9b2a946 100644
--- a/soc/st/stm32/common/stm32_wkup_pins.c
+++ b/soc/st/stm32/common/stm32_wkup_pins.c
@@ -225,11 +225,11 @@ static void wkup_pin_setup(const struct wkup_pin_cfg_t *wakeup_pin_cfg)
 
 #if defined(CONFIG_SOC_SERIES_STM32U5X) || defined(CONFIG_SOC_SERIES_STM32WBAX)
 	/* Select the proper wake-up signal source */
-	if (wakeup_pin_cfg->src_selection & STM32_PWR_WKUP_PIN_SRC_0) {
+	if (wakeup_pin_cfg->src_selection & STM32_PWR_WKUP_EVT_SRC_0) {
 		LL_PWR_SetWakeUpPinSignal0Selection(table_wakeup_pins[wkup_pin_index]);
-	} else if (wakeup_pin_cfg->src_selection & STM32_PWR_WKUP_PIN_SRC_1) {
+	} else if (wakeup_pin_cfg->src_selection & STM32_PWR_WKUP_EVT_SRC_1) {
 		LL_PWR_SetWakeUpPinSignal1Selection(table_wakeup_pins[wkup_pin_index]);
-	} else if (wakeup_pin_cfg->src_selection & STM32_PWR_WKUP_PIN_SRC_2) {
+	} else if (wakeup_pin_cfg->src_selection & STM32_PWR_WKUP_EVT_SRC_2) {
 		LL_PWR_SetWakeUpPinSignal2Selection(table_wakeup_pins[wkup_pin_index]);
 	} else {
 		LL_PWR_SetWakeUpPinSignal3Selection(table_wakeup_pins[wkup_pin_index]);
@@ -286,9 +286,9 @@ int stm32_pwr_wkup_pin_cfg_gpio(const struct gpio_dt_spec *gpio)
 /* Each wake-up pin on STM32U5 is associated with 4 wkup srcs, 3 of them correspond to GPIOs. */
 #if defined(CONFIG_SOC_SERIES_STM32U5X) || defined(CONFIG_SOC_SERIES_STM32WBAX)
 	wakeup_pin_cfg.src_selection = wkup_pin_gpio_cfg->dt_flags &
-					(STM32_PWR_WKUP_PIN_SRC_0 |
-					STM32_PWR_WKUP_PIN_SRC_1 |
-					STM32_PWR_WKUP_PIN_SRC_2);
+					(STM32_PWR_WKUP_EVT_SRC_0 |
+					STM32_PWR_WKUP_EVT_SRC_1 |
+					STM32_PWR_WKUP_EVT_SRC_2);
 #else
 	wakeup_pin_cfg.src_selection = 0;
 #endif /* CONFIG_SOC_SERIES_STM32U5X or CONFIG_SOC_SERIES_STM32WBAX */


Reviews:
user: login: mathieuchopstm
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T11:18:46Z
user: login: jurenat
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T11:41:47Z
user: login: mathieuchopstm
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T15:42:03Z
user: login: mathieuchopstm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T15:44:49Z
user: login: mathieuchopstm
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T09:29:07Z
user: login: mathieuchopstm
body: Thanks for thinking about C0 :slightly_smiling_face:

Could you also update the comment at the top of the file?
https://github.com/zephyrproject-rtos/zephyr/blob/b53937239f18f708ab20dd927458d80a8b4ce39a/dts/arm/st/c0/stm32c0.dtsi#L12-L22
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T11:19:06Z
user: login: JarmouniA
body: I see a benefit in having a separate flag for non-muxed wake-up pins.
About the renaming, I don't see why it's necessary or how the new name is clearer. BTW in the ref man they are called Wake-up Sources.
![IMG](https://github.com/user-attachments/assets/c38159b4-341b-41f3-a608-c19a79050989)


state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T14:59:00Z
user: login: JarmouniA
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T07:58:23Z
user: login: jurenat
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T08:15:15Z
user: login: JarmouniA
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T08:42:59Z
user: login: JarmouniA
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:22:50Z
user: login: mathieuchopstm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:38:16Z
user: login: mathieuchopstm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:41:03Z
user: login: JarmouniA
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T09:43:14Z
user: login: JarmouniA
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T11:18:04Z
user: login: martinjaeger
body: Looks good and thanks for fixing this.
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-09T11:46:31Z
user: login: bjarki-andreasen
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T12:48:05Z
user: login: mathieuchopstm
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T12:51:08Z

Review comments:
diff_hunk: @@ -17,9 +17,10 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+#define STM32_PWR_WKUP_LINE_0         0
+#define STM32_PWR_WKUP_LINE_1         1
+#define STM32_PWR_WKUP_LINE_2         (1 << 2)
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: Unrelated to the change you're proposing, but I see that this code has been broken all along - we're treating these as bitmasks, but `LINE_0` has no bit set!

Could you add the following as a separate commit?
```suggestion
#define STM32_PWR_WKUP_LINE_0         BIT(0)
#define STM32_PWR_WKUP_LINE_1         BIT(1)
#define STM32_PWR_WKUP_LINE_2         BIT(2)
#define STM32_PWR_WKUP_LINE_NOT_MUXED 0
```

(The `BIT` macro may require `#include <zephyr/dt-bindings/dt-util.h>`)
created_at: 2025-04-07T11:03:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -20,22 +20,22 @@
 
 &pwr {
 	wkup-pin@1 {
-		wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_LINE_0>;
path: dts/arm/st/l4/stm32l4r5Xi.dtsi
user: login: mathieuchopstm
body: STM32L4+ doesn't appear to have muxed WKUP lines.
```suggestion
		wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_LINE_NOT_MUXED>;
```
Ditto for all entries.
created_at: 2025-04-07T11:06:56Z
author_association: CONTRIBUTOR
diff_hunk: @@ -535,12 +535,12 @@
 
 			wkup-pin@1 {
 				reg = <0x1>;
-				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_LINE_0>;
path: dts/arm/st/wb/stm32wb.dtsi
user: login: mathieuchopstm
body: STM32WB series doesn't appear to have muxed WKUP lines.
```suggestion
				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_LINE_NOT_MUXED>;
```
Ditto for all entries.
created_at: 2025-04-07T11:08:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -24,16 +24,16 @@
 &pwr {
 	wkup-pin@2 {
 		reg = <0x2>;
-		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_PIN_SRC_0>;
+		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_LINE_0>;
path: dts/arm/st/wb/stm32wb55Xg.dtsi
user: login: mathieuchopstm
body: Same remark.
```suggestion
		wkup-gpios = <&gpioc 13 STM32_PWR_WKUP_LINE_NOT_MUXED>;
```
Ditto for all entries.
created_at: 2025-04-07T11:10:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -523,17 +523,17 @@
 
 			wkup-pin@1 {
 				reg = <0x1>;
-				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_PIN_SRC_0>;
+				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_LINE_0>;
path: dts/arm/st/wl/stm32wl.dtsi
user: login: mathieuchopstm
body: STM32WL series doesn't appear to have muxed WKUP lines.
```suggestion
				wkup-gpios = <&gpioa 0 STM32_PWR_WKUP_LINE_NOT_MUXED>;
```
Ditto for all entries.
created_at: 2025-04-07T11:10:59Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +17,10 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+#define STM32_PWR_WKUP_LINE_0         0
+#define STM32_PWR_WKUP_LINE_1         1
+#define STM32_PWR_WKUP_LINE_2         (1 << 2)
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: The `STM32_PWR_WKUP_LINE_NOT_MUXED` define should be moved at the top, and an explanatory comment should be added, e.g.:
```suggestion
/* Use this value on series where wake-up line source is fixed/not configurable */
#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
```
created_at: 2025-04-07T11:14:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -64,4 +64,4 @@ child-binding:
 
         For example, for GPIO B2 associated with wakeup source 1 on wake-up
         pin 1 on STM32U5 SoCs:
path: dts/bindings/power/st,stm32-pwr.yaml
user: login: mathieuchopstm
body: ```suggestion
        For example, for GPIO PB2 associated with wakeup source 1 on wake-up
        line 1 on STM32U5 SoCs:
```

Also, adding an example for mux-less series would be appreciated.
created_at: 2025-04-07T11:18:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +17,10 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+#define STM32_PWR_WKUP_LINE_0         0
+#define STM32_PWR_WKUP_LINE_1         1
+#define STM32_PWR_WKUP_LINE_2         (1 << 2)
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: jurenat
body: It looked strange to me, but I did not check with RM. Fixed.
created_at: 2025-04-07T11:41:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
+#define STM32_PWR_WKUP_LINE_0         BIT(0)
+#define STM32_PWR_WKUP_LINE_1         BIT(0)
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: ```suggestion
#define STM32_PWR_WKUP_LINE_1         BIT(1)
```
created_at: 2025-04-07T15:41:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +17,10 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+#define STM32_PWR_WKUP_LINE_0         0
+#define STM32_PWR_WKUP_LINE_1         1
+#define STM32_PWR_WKUP_LINE_2         (1 << 2)
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: These values don't match anything in RM, they are for usage by the driver only - see: https://github.com/zephyrproject-rtos/zephyr/blob/8f2f97ce320ae184e3b2f572436a3758580205fe/soc/st/stm32/common/stm32_wkup_pins.c#L226-L237
created_at: 2025-04-07T15:44:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: JarmouniA
body: In Ref Mans of series with non-muxed wakeup pins (RM0351 Rev 10 page 186 for exp), `wakeup lines` are internal, and `wakeup pins` are external (which we are using here).
```suggestion
#define STM32_PWR_WKUP_PIN_NOT_MUXED STM32_PWR_WKUP_LINE_0
```
created_at: 2025-04-09T07:58:12Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: jurenat
body: So there should be two types of symbols? Isn't it confusing?

```
#define STM32_PWR_WKUP_PIN_NOT_MUXED WKUP_EVT_SRC_0
#define WKUP_EVT_SRC_0         0
#define WKUP_EVT_SRC_1         1
#define WKUP_EVT_SRC_2         (1 << 2)
```
created_at: 2025-04-09T08:15:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: JarmouniA
body: > So there should be two types of symbols? Isn't it confusing?

I don't think so.

> #define WKUP_EVT_SRC_0         0
> #define WKUP_EVT_SRC_1         1
> #define WKUP_EVT_SRC_2         (1 << 2)

STM32_PWR_WKUP_EVT_SRC_x


created_at: 2025-04-09T08:42:58Z
author_association: CONTRIBUTOR
diff_hunk: @@ -62,6 +62,6 @@ child-binding:
       description: |
         Specifies the GPIOs, if any, that are associated with the wake-up pin.
 
-        For example, for GPIO B2 associated with wakeup source 1 on wake-up
-        pin 1 on STM32U5 SoCs:
-        wkup-gpios = <&gpiob 2 STM32_PWR_WKUP_PIN_SRC_1>, <...>;
+        For example, for GPIO PB2 associated with wakeup source 1 on wake-up
+        line 1 on STM32U5 SoCs:
path: dts/bindings/power/st,stm32-pwr.yaml
user: login: JarmouniA
body: ```suggestion
        event 1 on STM32U5 SoCs:
```
created_at: 2025-04-09T09:20:13Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: JarmouniA
body: ```suggestion
/* Use this flag on series where wake-up pin source is fixed/not configurable */
```
created_at: 2025-04-09T09:20:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: What about `STM32_PWR_WKUP_EVT_NOT_MUXED`?

IMO we should refer to `WKUPx` as `wake-up event` everywhere since it's a more generic name.
Older hardware used `wake-up pin` because it didn't support anything else, but I don't see an issue of naming `WKUPx` "events" on these series as well.
created_at: 2025-04-09T09:38:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: IMO `value` is fine as only one of these defines should be used at a time (i.e., `(EVT_SRC_0 | EVT_SRC_1)` is an invalid usage).

(Using bitwise logic isn't really necessary for this reason, but w/e...)

```suggestion
/* Use this value on series where wake-up event source is fixed/not configurable */
```
created_at: 2025-04-09T09:41:03Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: JarmouniA
body: > What about `STM32_PWR_WKUP_EVT_NOT_MUXED`?
> 
> IMO we should refer to `WKUPx` as `wake-up event` everywhere since it's a more generic name. Older hardware used `wake-up pin` because it didn't support anything else, but I don't see an issue of naming `WKUPx` "events" on these series as well.

Wake-up Event is a different thing than wake-up pin, ex: an interrupt is a wake-up event.
created_at: 2025-04-09T09:43:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -17,9 +19,11 @@
  * @{
  */
 
-#define STM32_PWR_WKUP_PIN_SRC_0	0
-#define STM32_PWR_WKUP_PIN_SRC_1	1
-#define STM32_PWR_WKUP_PIN_SRC_2	(1 << 2)
+/* Use this value on series where wake-up line source is fixed/not configurable */
+#define STM32_PWR_WKUP_LINE_NOT_MUXED STM32_PWR_WKUP_LINE_0
path: include/zephyr/dt-bindings/power/stm32_pwr.h
user: login: mathieuchopstm
body: `Wake-up event` is the name used by RM0456 though
![Screenshot from 2025-04-09 14-48-29](https://github.com/user-attachments/assets/e645158b-e942-4efc-912d-c6d7aed7a34c)
(which doesn't mean other things can't be wake-up events)
created_at: 2025-04-09T12:51:08Z
author_association: CONTRIBUTOR

PR comments:
user: login: jurenat
created_at: 2025-04-08T11:25:39Z
body: > Thanks for thinking about C0 🙂
> 
> Could you also update the comment at the top of the file?
> 
> https://github.com/zephyrproject-rtos/zephyr/blob/b53937239f18f708ab20dd927458d80a8b4ce39a/dts/arm/st/c0/stm32c0.dtsi#L12-L22

Did I miss something? The comment at the beginning of the stm32c0.dtsi file is updated in [7e1e7ec](https://github.com/zephyrproject-rtos/zephyr/pull/88242/commits/7e1e7ec7729cd37cbfceb8116d56c6aebff5a80b)
author_association: CONTRIBUTOR
user: login: mathieuchopstm
created_at: 2025-04-08T16:43:17Z
body: > > Thanks for thinking about C0 🙂
> > Could you also update the comment at the top of the file?
>
> Did I miss something? The comment at the beginning of the stm32c0.dtsi file is updated in [7e1e7ec](https://github.com/zephyrproject-rtos/zephyr/pull/88242/commits/7e1e7ec7729cd37cbfceb8116d56c6aebff5a80b)

Indeed :facepalm: 

Sorry for the unnecessary comment, I didn't see it.
author_association: CONTRIBUTOR
user: login: mathieuchopstm
created_at: 2025-04-08T16:48:46Z
body: > I see a benefit in having a separate flag for non-muxed wake-up pins. About the renaming, I don't see why it's necessary or how the new name is clearer. BTW in the ref man they are called Wake-up Sources.

Indeed; I had originally suggested `STM32_PWR_WKUP_LINE_SRC_x` but it flew over my mind when reviewing. We definitely want the `SRC` part, otherwise it is very confusing.

We could also name the defines `WKUP_EVENT_SRC_x`/`WKUP_EVT_SRC_x` instead of `WKUP_LINE` to stick to U5 RefMan more closely (IMO, all three options are fine).

What do you think @JarmouniA ?
author_association: CONTRIBUTOR
user: login: JarmouniA
created_at: 2025-04-08T16:52:46Z
body: > Indeed; I had originally suggested `STM32_PWR_WKUP_LINE_SRC_x` but it flew over my mind when reviewing. We definitely want the `SRC` part, otherwise it is very confusing.
> 
> We could also name the defines `WKUP_EVENT_SRC_x`/`WKUP_EVT_SRC_x` instead of `WKUP_LINE` to stick to U5 RefMan more closely (IMO, all three options are fine).
> 
> What do you think @JarmouniA ?

I think WKUP_EVT_SRC_x would be better.
author_association: CONTRIBUTOR
user: login: jurenat
created_at: 2025-04-08T17:07:50Z
body: > > I see a benefit in having a separate flag for non-muxed wake-up pins. About the renaming, I don't see why it's necessary or how the new name is clearer. BTW in the ref man they are called Wake-up Sources.
> 
> Indeed; I had originally suggested `STM32_PWR_WKUP_LINE_SRC_x` but it flew over my mind when reviewing. We definitely want the `SRC` part, otherwise it is very confusing.
> 
> We could also name the defines `WKUP_EVENT_SRC_x`/`WKUP_EVT_SRC_x` instead of `WKUP_LINE` to stick to U5 RefMan more closely (IMO, all three options are fine).
> 
> What do you think @JarmouniA ?

Oh, this was my mistake. I misread the name in the PR you suggested this.

If you both agree, I will change the names to `WKUP_EVT_SRC_x`.
author_association: CONTRIBUTOR
user: login: mathieuchopstm
created_at: 2025-04-09T07:44:54Z
body: > If you both agree, I will change the names to `WKUP_EVT_SRC_x`.

@JarmouniA said OK and I agree as well, so you can go for it :slightly_smiling_face: 
author_association: CONTRIBUTOR