drivers: pwm: pwm_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per instance Kconfig symbol usage. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
b33325078f
commit
9c229e9169
2 changed files with 17 additions and 58 deletions
|
@ -53,10 +53,6 @@ config I2C_4
|
||||||
|
|
||||||
endif # I2C_IMX
|
endif # I2C_IMX
|
||||||
|
|
||||||
config PWM_1
|
|
||||||
default y
|
|
||||||
depends on PWM_IMX
|
|
||||||
|
|
||||||
if !XIP
|
if !XIP
|
||||||
config FLASH_SIZE
|
config FLASH_SIZE
|
||||||
default 0
|
default 0
|
||||||
|
|
|
@ -158,58 +158,21 @@ static const struct pwm_driver_api imx_pwm_driver_api = {
|
||||||
.get_cycles_per_sec = imx_pwm_get_cycles_per_sec,
|
.get_cycles_per_sec = imx_pwm_get_cycles_per_sec,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PWM_1
|
#define PWM_IMX_INIT(n) \
|
||||||
static const struct imx_pwm_config imx_pwm_config_1 = {
|
static const struct imx_pwm_config imx_pwm_config_##n = { \
|
||||||
.base = (PWM_Type *)DT_ALIAS_PWM_1_BASE_ADDRESS,
|
.base = (PWM_Type *)DT_INST_REG_ADDR(n), \
|
||||||
.prescaler = DT_ALIAS_PWM_1_PRESCALER,
|
.prescaler = DT_INST_PROP(n, prescaler), \
|
||||||
};
|
}; \
|
||||||
|
\
|
||||||
|
static struct imx_pwm_data imx_pwm_data_##n; \
|
||||||
|
\
|
||||||
|
DEVICE_AND_API_INIT(imx_pwm_##n, DT_INST_LABEL(n), \
|
||||||
|
&imx_pwm_init, &imx_pwm_data_##n, \
|
||||||
|
&imx_pwm_config_##n, POST_KERNEL, \
|
||||||
|
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||||
|
&imx_pwm_driver_api)
|
||||||
|
|
||||||
static struct imx_pwm_data imx_pwm_data_1;
|
#if DT_HAS_COMPAT(fsl_imx7d_pwm)
|
||||||
|
#define DT_DRV_COMPAT fsl_imx7d_pwm
|
||||||
DEVICE_AND_API_INIT(imx_pwm_1, DT_ALIAS_PWM_1_LABEL, &imx_pwm_init,
|
DT_INST_FOREACH(PWM_IMX_INIT)
|
||||||
&imx_pwm_data_1, &imx_pwm_config_1,
|
#endif
|
||||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
|
||||||
&imx_pwm_driver_api);
|
|
||||||
#endif /* CONFIG_PWM_1 */
|
|
||||||
|
|
||||||
#ifdef CONFIG_PWM_2
|
|
||||||
static const struct imx_pwm_config imx_pwm_config_2 = {
|
|
||||||
.base = (PWM_Type *)DT_ALIAS_PWM_2_BASE_ADDRESS,
|
|
||||||
.prescaler = DT_ALIAS_PWM_2_PRESCALER,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct imx_pwm_data imx_pwm_data_2;
|
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(imx_pwm_2, DT_ALIAS_PWM_2_LABEL, &imx_pwm_init,
|
|
||||||
&imx_pwm_data_2, &imx_pwm_config_2,
|
|
||||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
|
||||||
&imx_pwm_driver_api);
|
|
||||||
#endif /* CONFIG_PWM_2 */
|
|
||||||
|
|
||||||
#ifdef CONFIG_PWM_3
|
|
||||||
static const struct imx_pwm_config imx_pwm_config_3 = {
|
|
||||||
.base = (PWM_Type *)DT_ALIAS_PWM_3_BASE_ADDRESS,
|
|
||||||
.prescaler = DT_ALIAS_PWM_3_PRESCALER,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct imx_pwm_data imx_pwm_data_3;
|
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(imx_pwm_3, DT_ALIAS_PWM_3_LABEL, &imx_pwm_init,
|
|
||||||
&imx_pwm_data_3, &imx_pwm_config_3,
|
|
||||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
|
||||||
&imx_pwm_driver_api);
|
|
||||||
#endif /* CONFIG_PWM_3 */
|
|
||||||
|
|
||||||
#ifdef CONFIG_PWM_4
|
|
||||||
static const struct imx_pwm_config imx_pwm_config_4 = {
|
|
||||||
.base = (PWM_Type *)DT_ALIAS_PWM_4_BASE_ADDRESS
|
|
||||||
.prescaler = DT_ALIAS_PWM_4_PRESCALER,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct imx_pwm_data imx_pwm_data_4;
|
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(imx_pwm_4, DT_ALIAS_PWM_4_LABEL, &imx_pwm_init,
|
|
||||||
&imx_pwm_data_4, &imx_pwm_config_4,
|
|
||||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
|
||||||
&imx_pwm_driver_api);
|
|
||||||
#endif /* CONFIG_PWM_4 */
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue