Skip to content

Commit be216ba

Browse files
pdgendtfabiobaltieri
authored andcommitted
drivers: counter: mcux_snvs: Convert Kconfig symbol to dts property
The SNVS RTC can act as a wakeup source, re-use pm.yaml properties and remove the Kconfig symbol. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent f8473d1 commit be216ba

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

drivers/counter/Kconfig.mcux_snvs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,3 @@ config COUNTER_MCUX_SNVS_SRTC
1616
default y
1717
help
1818
Enable the low power SRTC in SNVS to synchronise.
19-
20-
config COUNTER_MCUX_SNVS_SRTC_WAKE
21-
bool "IMX SNVS wake-up on SRTC alarm"
22-
depends on COUNTER_MCUX_SNVS_SRTC
23-
default y
24-
help
25-
Assert Wake-Up Interrupt on SRTC alarm

drivers/counter/counter_mcux_snvs.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
LOG_MODULE_REGISTER(mcux_snvs, CONFIG_COUNTER_LOG_LEVEL);
1111

12-
#if CONFIG_COUNTER_MCUX_SNVS_SRTC
12+
#ifdef CONFIG_COUNTER_MCUX_SNVS_SRTC
1313
#define MCUX_SNVS_SRTC
1414
#define MCUX_SNVS_NUM_CHANNELS 2
1515
#else
@@ -29,6 +29,9 @@ struct mcux_snvs_config {
2929
struct counter_config_info info;
3030
SNVS_Type *base;
3131
void (*irq_config_func)(const struct device *dev);
32+
#ifdef MCUX_SNVS_SRTC
33+
bool wakeup_source;
34+
#endif
3235
};
3336

3437
struct mcux_snvs_data {
@@ -276,9 +279,9 @@ static int mcux_snvs_init(const struct device *dev)
276279
SNVS_LP_SRTC_GetDefaultConfig(&lp_srtc_config);
277280
SNVS_LP_SRTC_Init(config->base, &lp_srtc_config);
278281

279-
#if CONFIG_COUNTER_MCUX_SNVS_SRTC_WAKE
280-
config->base->LPCR |= SNVS_LPCR_LPWUI_EN_MASK;
281-
#endif
282+
if (config->wakeup_source) {
283+
config->base->LPCR |= SNVS_LPCR_LPWUI_EN_MASK;
284+
}
282285

283286
/* RTC should always run */
284287
SNVS_LP_SRTC_StartTimer(config->base);
@@ -325,6 +328,9 @@ static struct mcux_snvs_config mcux_snvs_config_0 = {
325328
},
326329
.base = (SNVS_Type *)DT_REG_ADDR(DT_INST_PARENT(0)),
327330
.irq_config_func = mcux_snvs_irq_config_0,
331+
#ifdef MCUX_SNVS_SRTC
332+
.wakeup_source = DT_INST_PROP(0, wakeup_source),
333+
#endif
328334
};
329335

330336
DEVICE_DT_INST_DEFINE(0, &mcux_snvs_init, NULL,

dts/arm/nxp/nxp_rt10xx.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@
319319
snvs_rtc: rtc {
320320
compatible = "nxp,imx-snvs-rtc";
321321
interrupts = <46 0>;
322+
wakeup-source;
322323
};
323324
};
324325

0 commit comments

Comments
 (0)