drivers: pwm: mcux_tpm: Add clock configuration support
Add clock_control_configure() call during initialization to properly configure the TPM clock. The driver now attempts to configure the clock and handles cases where configuration is not supported by the platform (-ENOTSUP/-ENOSYS) by continuing with default settings. Real configuration errors are logged and cause initialization to fail. Note: -ENOSYS is temporarily ignored as not all clock control drivers currently implement the configure API. This handling should be removed once all clock drivers support configure. Signed-off-by: Albort Xue <yao.xue@nxp.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2019 Henrik Brix Andersen <henrik@brixandersen.dk>
|
||||
* Copyright 2020, 2024-2025 NXP
|
||||
* Copyright 2020, 2024-2026 NXP
|
||||
*
|
||||
* Heavily based on pwm_mcux_ftm.c, which is:
|
||||
* Copyright (c) 2017, NXP
|
||||
@@ -515,6 +515,16 @@ static int mcux_tpm_init(const struct device *dev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
err = clock_control_configure(config->clock_dev, config->clock_subsys, NULL);
|
||||
if (err != 0) {
|
||||
/* Check if error is due to lack of support */
|
||||
if (err != -ENOSYS) {
|
||||
/* Real error occurred */
|
||||
LOG_ERR("Failed to configure clock: %d", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SOC_MIMX9596)
|
||||
/* IMX9596 AON and WAKEUP clocks aren't controllable */
|
||||
if (config->clock_subsys != (clock_control_subsys_t)IMX95_CLK_BUSWAKEUP &&
|
||||
|
||||
Reference in New Issue
Block a user