Skip to content

Commit 4fa58d3

Browse files
ZhaoxiangJinaescolar
authored andcommitted
drivers: clock_control: add support for LPADC clock obtain
The lpadc driver needs to obtain its functional clock to configure the acquisition time. This patch add support for I.MX RT three digit parts, I.MX RT11xx parts, and LPC parts. Signed-off-by: Zhaoxiang Jin <[email protected]>
1 parent fc68d26 commit 4fa58d3

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

drivers/clock_control/clock_control_mcux_ccm_rev2.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev,
146146
clock_root = kCLOCK_Root_Bus + instance;
147147
break;
148148
#endif
149+
150+
#ifdef CONFIG_ADC_MCUX_LPADC
151+
case IMX_CCM_LPADC1_CLK:
152+
clock_root = kCLOCK_Root_Adc1 + instance;
153+
break;
154+
#endif
149155
default:
150156
return -EINVAL;
151157
}

drivers/clock_control/clock_control_mcux_syscon.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,21 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(
297297
*rate = CLOCK_GetLcdClkFreq();
298298
break;
299299
#endif
300+
301+
#if defined(CONFIG_ADC_MCUX_LPADC)
302+
case MCUX_LPADC1_CLK:
303+
#if (FSL_FEATURE_SOC_LPADC_COUNT == 1)
304+
*rate = CLOCK_GetAdcClkFreq();
305+
#else
306+
*rate = CLOCK_GetAdcClkFreq(0);
307+
#endif
308+
break;
309+
#if (FSL_FEATURE_SOC_LPADC_COUNT == 2)
310+
case MCUX_LPADC2_CLK:
311+
*rate = CLOCK_GetAdcClkFreq(1);
312+
break;
313+
#endif
314+
#endif /* CONFIG_ADC_MCUX_LPADC */
300315
}
301316

302317
return 0;

include/zephyr/dt-bindings/clock/imx_ccm_rev2.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,8 @@
9999
#define IMX_CCM_PIT_CLK 0x5000UL
100100
#define IMX_CCM_PIT1_CLK 0x5001UL
101101

102+
/* ADC */
103+
#define IMX_CCM_LPADC1_CLK 0x6000UL
104+
#define IMX_CCM_LPADC2_CLK 0x6001UL
105+
102106
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_IMX_CCM_REV2_H_ */

include/zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,7 @@
7878

7979
#define MCUX_LCDIC_CLK MCUX_LPC_CLK_ID(0x0E, 0x00)
8080

81+
#define MCUX_LPADC1_CLK MCUX_LPC_CLK_ID(0x0F, 0x00)
82+
#define MCUX_LPADC2_CLK MCUX_LPC_CLK_ID(0x0F, 0x01)
83+
8184
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_MCUX_LPC_SYSCON_H_ */

0 commit comments

Comments
 (0)