Skip to content

Commit 4b3d88e

Browse files
decsnydleach02
authored andcommitted
soc: nxp: MCXW71: Add LPADC node + clocking
Add DT entry and default clocking for ADC0 on MCXW71. Signed-off-by: Declan Snyder <[email protected]>
1 parent 66ae009 commit 4b3d88e

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

dts/arm/nxp/nxp_mcxw71.dtsi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,22 @@
318318
status = "disabled";
319319
};
320320

321+
adc0: adc@47000 {
322+
compatible = "nxp,lpc-lpadc";
323+
reg = <0x47000 0x1000>;
324+
interrupts = <71 0>;
325+
clocks = <&scg SCG_K4_FIRC_CLK 0x11c>;
326+
voltage-ref= <1>;
327+
calibration-average = <128>;
328+
/* pwrlvl 0 is slow speed low power, 1 is opposite */
329+
power-level = <0>;
330+
offset-value-a = <0>;
331+
offset-value-b = <0>;
332+
#io-channel-cells = <1>;
333+
nxp,references = <&vref 1800>;
334+
status = "disabled";
335+
};
336+
321337
vref: regulator@4a000 {
322338
compatible = "nxp,vref";
323339
regulator-name = "mcxw71-vref";

soc/nxp/mcx/mcxw/soc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ static ALWAYS_INLINE void clock_init(void)
121121
CLOCK_SetIpSrcDiv(kCLOCK_Lpi2c1, kSCG_SysClkDivBy16);
122122
CLOCK_SetIpSrc(kCLOCK_Lpspi0, kCLOCK_IpSrcFro192M);
123123
CLOCK_SetIpSrc(kCLOCK_Lpspi1, kCLOCK_IpSrcFro192M);
124+
CLOCK_SetIpSrc(kCLOCK_Lpadc0, kCLOCK_IpSrcFro192M);
125+
CLOCK_SetIpSrcDiv(kCLOCK_Lpadc0, kSCG_SysClkDivBy10);
124126

125127
/* Ungate clocks if the peripheral is enabled in devicetree */
126128
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart0), nxp_lpc_lpuart, okay)) {
@@ -162,6 +164,10 @@ static ALWAYS_INLINE void clock_init(void)
162164
if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(vref), nxp_vref, okay)) {
163165
CLOCK_EnableClock(kCLOCK_Vref0);
164166
}
167+
168+
if (DT_NODE_HAS_COMPAT_STATUS(adc0, nxp_lpadc, okay)) {
169+
CLOCK_EnableClock(kCLOCK_Lpadc0);
170+
}
165171
}
166172

167173
static void vbat_init(void)

0 commit comments

Comments
 (0)