Skip to content

Commit 11ef521

Browse files
yangbolu1991carlescufi
authored andcommitted
drivers: pwm_mcux_tpm: adapt to more platforms
The TPM max channel number was got from register array size. However some platforms TPM instance may begin from TPM1 rather than TPM0. This should be handled in driver. Signed-off-by: Yangbo Lu <[email protected]>
1 parent c2911af commit 11ef521

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/pwm/pwm_mcux_tpm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2019 Henrik Brix Andersen <[email protected]>
3-
* Copyright 2020 NXP
3+
* Copyright 2020, 2024 NXP
44
*
55
* Heavily based on pwm_mcux_ftm.c, which is:
66
* Copyright (c) 2017, NXP
@@ -22,7 +22,11 @@
2222

2323
LOG_MODULE_REGISTER(pwm_mcux_tpm, CONFIG_PWM_LOG_LEVEL);
2424

25+
#if defined(TPM0)
2526
#define MAX_CHANNELS ARRAY_SIZE(TPM0->CONTROLS)
27+
#else
28+
#define MAX_CHANNELS ARRAY_SIZE(TPM1->CONTROLS)
29+
#endif
2630

2731
struct mcux_tpm_config {
2832
TPM_Type *base;

0 commit comments

Comments
 (0)