drivers: use new PM macros

Port some drivers to the recently introduced macros to showcase its
usage and be able to do some initial testing (nRF52840).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-10-13 12:25:06 +02:00 committed by Carles Cufí
commit 88a69674c0
38 changed files with 123 additions and 71 deletions

View file

@ -349,9 +349,11 @@ static struct entropy_cc13xx_cc26xx_data entropy_cc13xx_cc26xx_data = {
.sync = Z_SEM_INITIALIZER(entropy_cc13xx_cc26xx_data.sync, 0, 1),
};
PM_DEVICE_DT_INST_DEFINE(0, entropy_cc13xx_cc26xx_pm_action);
DEVICE_DT_INST_DEFINE(0,
entropy_cc13xx_cc26xx_init,
entropy_cc13xx_cc26xx_pm_action,
PM_DEVICE_DT_INST_REF(0),
&entropy_cc13xx_cc26xx_data, NULL,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_cc13xx_cc26xx_driver_api);

View file

@ -129,20 +129,16 @@ static const struct entropy_driver_api neorv32_trng_driver_api = {
.get_entropy_isr = neorv32_trng_get_entropy_isr,
};
#ifdef CONFIG_PM_DEVICE
#define NEORV32_TRNG_PM_ACTION_CB neorv32_trng_pm_action
#else /* CONFIG_PM_DEVICE */
#define NEORV32_TRNG_PM_ACTION_CB NULL
#endif /* ! CONFIG_PM_DEVICE */
#define NEORV32_TRNG_INIT(n) \
static const struct neorv32_trng_config neorv32_trng_##n##_config = { \
.syscon = DEVICE_DT_GET(DT_INST_PHANDLE(n, syscon)), \
.base = DT_INST_REG_ADDR(n), \
}; \
\
PM_DEVICE_DT_INST_DEFINE(n, neorv32_trng_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, &neorv32_trng_init, \
NEORV32_TRNG_PM_ACTION_CB, \
PM_DEVICE_DT_INST_REF(n), \
NULL, \
&neorv32_trng_##n##_config, \
PRE_KERNEL_1, \