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

@ -573,7 +573,10 @@ static const struct display_driver_api st7735r_api = {
.x_offset = DT_INST_PROP(inst, x_offset), \ .x_offset = DT_INST_PROP(inst, x_offset), \
.y_offset = DT_INST_PROP(inst, y_offset), \ .y_offset = DT_INST_PROP(inst, y_offset), \
}; \ }; \
DEVICE_DT_INST_DEFINE(inst, st7735r_init, st7735r_pm_action, \ \
PM_DEVICE_DT_INST_DEFINE(inst, st7735r_pm_action); \
\
DEVICE_DT_INST_DEFINE(inst, st7735r_init, PM_DEVICE_DT_INST_REF(inst), \
&st7735r_data_ ## inst, &st7735r_config_ ## inst, \ &st7735r_data_ ## inst, &st7735r_config_ ## inst, \
POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \
&st7735r_api); &st7735r_api);

View file

@ -438,6 +438,8 @@ static struct st7789v_data st7789v_data = {
.y_offset = DT_INST_PROP(0, y_offset), .y_offset = DT_INST_PROP(0, y_offset),
}; };
PM_DEVICE_DT_INST_DEFINE(0, st7789v_pm_action);
DEVICE_DT_INST_DEFINE(0, &st7789v_init, DEVICE_DT_INST_DEFINE(0, &st7789v_init,
st7789v_pm_action, &st7789v_data, NULL, POST_KERNEL, PM_DEVICE_DT_INST_REF(0), &st7789v_data, NULL, POST_KERNEL,
CONFIG_DISPLAY_INIT_PRIORITY, &st7789v_api); CONFIG_DISPLAY_INIT_PRIORITY, &st7789v_api);

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), .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, DEVICE_DT_INST_DEFINE(0,
entropy_cc13xx_cc26xx_init, entropy_cc13xx_cc26xx_init,
entropy_cc13xx_cc26xx_pm_action, PM_DEVICE_DT_INST_REF(0),
&entropy_cc13xx_cc26xx_data, NULL, &entropy_cc13xx_cc26xx_data, NULL,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_cc13xx_cc26xx_driver_api); &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, .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) \ #define NEORV32_TRNG_INIT(n) \
static const struct neorv32_trng_config neorv32_trng_##n##_config = { \ static const struct neorv32_trng_config neorv32_trng_##n##_config = { \
.syscon = DEVICE_DT_GET(DT_INST_PHANDLE(n, syscon)), \ .syscon = DEVICE_DT_GET(DT_INST_PHANDLE(n, syscon)), \
.base = DT_INST_REG_ADDR(n), \ .base = DT_INST_REG_ADDR(n), \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(n, neorv32_trng_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, &neorv32_trng_init, \ DEVICE_DT_INST_DEFINE(n, &neorv32_trng_init, \
NEORV32_TRNG_PM_ACTION_CB, \ PM_DEVICE_DT_INST_REF(n), \
NULL, \ NULL, \
&neorv32_trng_##n##_config, \ &neorv32_trng_##n##_config, \
PRE_KERNEL_1, \ PRE_KERNEL_1, \

View file

@ -230,11 +230,6 @@ out:
return ret; return ret;
} }
#define ETH_MCUX_PM_ACTION_CB eth_mcux_device_pm_action
#else
#define ETH_MCUX_PM_ACTION_CB NULL
#endif /* CONFIG_NET_POWER_MANAGEMENT */ #endif /* CONFIG_NET_POWER_MANAGEMENT */
#if ETH_MCUX_FIXED_LINK #if ETH_MCUX_FIXED_LINK
@ -1393,9 +1388,11 @@ static void eth_mcux_err_isr(const struct device *dev)
ETH_MCUX_PTP_FRAMEINFO(n) \ ETH_MCUX_PTP_FRAMEINFO(n) \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(n, eth_mcux_device_pm_action); \
\
ETH_NET_DEVICE_DT_INST_DEFINE(n, \ ETH_NET_DEVICE_DT_INST_DEFINE(n, \
eth_init, \ eth_init, \
ETH_MCUX_PM_ACTION_CB, \ PM_DEVICE_DT_INST_REF(n), \
&eth##n##_context, \ &eth##n##_context, \
&eth##n##_buffer_config, \ &eth##n##_buffer_config, \
CONFIG_ETH_INIT_PRIORITY, \ CONFIG_ETH_INIT_PRIORITY, \

View file

@ -1139,8 +1139,6 @@ static int qspi_nor_pm_action(const struct device *dev,
return 0; return 0;
} }
#else
#define qspi_nor_pm_action NULL
#endif /* CONFIG_PM_DEVICE */ #endif /* CONFIG_PM_DEVICE */
static struct qspi_nor_data qspi_nor_dev_data = { static struct qspi_nor_data qspi_nor_dev_data = {
@ -1196,7 +1194,9 @@ static const struct qspi_nor_config qspi_nor_dev_config = {
.id = DT_INST_PROP(0, jedec_id), .id = DT_INST_PROP(0, jedec_id),
}; };
DEVICE_DT_INST_DEFINE(0, qspi_nor_init, qspi_nor_pm_action, PM_DEVICE_DT_INST_DEFINE(0, qspi_nor_pm_action);
DEVICE_DT_INST_DEFINE(0, qspi_nor_init, PM_DEVICE_DT_INST_REF(0),
&qspi_nor_dev_data, &qspi_nor_dev_config, &qspi_nor_dev_data, &qspi_nor_dev_config,
POST_KERNEL, CONFIG_NORDIC_QSPI_NOR_INIT_PRIORITY, POST_KERNEL, CONFIG_NORDIC_QSPI_NOR_INIT_PRIORITY,
&qspi_nor_api); &qspi_nor_api);

View file

@ -699,8 +699,11 @@ static const struct flash_driver_api spi_flash_at45_api = {
"Page size specified for instance " #idx " of " \ "Page size specified for instance " #idx " of " \
"atmel,at45 is not compatible with its " \ "atmel,at45 is not compatible with its " \
"total size");)) \ "total size");)) \
\
PM_DEVICE_DT_INST_DEFINE(idx, spi_flash_at45_pm_action); \
\
DEVICE_DT_INST_DEFINE(idx, \ DEVICE_DT_INST_DEFINE(idx, \
spi_flash_at45_init, spi_flash_at45_pm_action, \ spi_flash_at45_init, PM_DEVICE_DT_INST_REF(idx), \
&inst_##idx##_data, &inst_##idx##_config, \ &inst_##idx##_data, &inst_##idx##_config, \
POST_KERNEL, CONFIG_SPI_FLASH_AT45_INIT_PRIORITY, \ POST_KERNEL, CONFIG_SPI_FLASH_AT45_INIT_PRIORITY, \
&spi_flash_at45_api); &spi_flash_at45_api);

View file

@ -534,8 +534,10 @@ static struct gpio_dw_runtime gpio_0_runtime = {
.base_addr = DT_INST_REG_ADDR(0), .base_addr = DT_INST_REG_ADDR(0),
}; };
PM_DEVICE_DT_INST_DEFINE(0, gpio_dw_device_pm_action);
DEVICE_DT_INST_DEFINE(0, DEVICE_DT_INST_DEFINE(0,
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_0_runtime, gpio_dw_initialize, PM_DEVICE_DT_INST_REF(0), &gpio_0_runtime,
&gpio_config_0, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, &gpio_config_0, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
&api_funcs); &api_funcs);
@ -596,8 +598,10 @@ static struct gpio_dw_runtime gpio_1_runtime = {
.base_addr = DT_INST_REG_ADDR(1), .base_addr = DT_INST_REG_ADDR(1),
}; };
PM_DEVICE_DT_INST_DEFINE(1, gpio_dw_device_pm_action);
DEVICE_DT_INST_DEFINE(1, DEVICE_DT_INST_DEFINE(1,
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_1_runtime, gpio_dw_initialize, PM_DEVICE_DT_INST_REF(1), &gpio_1_runtime,
&gpio_dw_config_1, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, &gpio_dw_config_1, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
&api_funcs); &api_funcs);
@ -657,8 +661,10 @@ static struct gpio_dw_runtime gpio_2_runtime = {
.base_addr = DT_INST_REG_ADDR(2), .base_addr = DT_INST_REG_ADDR(2),
}; };
PM_DEVICE_DT_INST_DEFINE(2, gpio_dw_device_pm_action);
DEVICE_DT_INST_DEFINE(2, DEVICE_DT_INST_DEFINE(2,
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_2_runtime, gpio_dw_initialize, PM_DEVICE_DT_INST_REF(2), &gpio_2_runtime,
&gpio_dw_config_2, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, &gpio_dw_config_2, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
&api_funcs); &api_funcs);
@ -718,8 +724,10 @@ static struct gpio_dw_runtime gpio_3_runtime = {
.base_addr = DT_INST_REG_ADDR(3), .base_addr = DT_INST_REG_ADDR(3),
}; };
PM_DEVICE_DT_INST_DEFINE(3, gpio_dw_device_pm_action);
DEVICE_DT_INST_DEFINE(3, DEVICE_DT_INST_DEFINE(3,
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_3_runtime, gpio_dw_initialize, PM_DEVICE_DT_INST_REF(3), &gpio_3_runtime,
&gpio_dw_config_3, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, &gpio_dw_config_3, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
&api_funcs); &api_funcs);

View file

@ -672,8 +672,6 @@ static int gpio_emul_pm_device_pm_action(const struct device *dev,
return 0; return 0;
} }
#else
#define gpio_emul_pm_device_pm_action NULL
#endif #endif
/* /*
@ -709,8 +707,10 @@ static int gpio_emul_pm_device_pm_action(const struct device *dev,
.flags = gpio_emul_flags_##_num, \ .flags = gpio_emul_flags_##_num, \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(_num, gpio_emul_pm_device_pm_action); \
\
DEVICE_DT_INST_DEFINE(_num, gpio_emul_init, \ DEVICE_DT_INST_DEFINE(_num, gpio_emul_init, \
gpio_emul_pm_device_pm_action, \ PM_DEVICE_DT_INST_REF(_num), \
&gpio_emul_data_##_num, \ &gpio_emul_data_##_num, \
&gpio_emul_config_##_num, POST_KERNEL, \ &gpio_emul_config_##_num, POST_KERNEL, \
CONFIG_GPIO_INIT_PRIORITY, \ CONFIG_GPIO_INIT_PRIORITY, \

View file

@ -630,9 +630,10 @@ static int gpio_stm32_init(const struct device *dev)
.pclken = { .bus = __bus, .enr = __cenr } \ .pclken = { .bus = __bus, .enr = __cenr } \
}; \ }; \
static struct gpio_stm32_data gpio_stm32_data_## __suffix; \ static struct gpio_stm32_data gpio_stm32_data_## __suffix; \
PM_DEVICE_DT_DEFINE(__node, gpio_stm32_pm_action); \
DEVICE_DT_DEFINE(__node, \ DEVICE_DT_DEFINE(__node, \
gpio_stm32_init, \ gpio_stm32_init, \
gpio_stm32_pm_action, \ PM_DEVICE_DT_REF(__node), \
&gpio_stm32_data_## __suffix, \ &gpio_stm32_data_## __suffix, \
&gpio_stm32_cfg_## __suffix, \ &gpio_stm32_cfg_## __suffix, \
PRE_KERNEL_1, \ PRE_KERNEL_1, \

View file

@ -435,9 +435,11 @@ static struct i2c_cc13xx_cc26xx_data i2c_cc13xx_cc26xx_data = {
.error = I2C_MASTER_ERR_NONE .error = I2C_MASTER_ERR_NONE
}; };
PM_DEVICE_DT_INST_DEFINE(0, i2c_cc13xx_cc26xx_pm_action);
DEVICE_DT_INST_DEFINE(0, DEVICE_DT_INST_DEFINE(0,
i2c_cc13xx_cc26xx_init, i2c_cc13xx_cc26xx_init,
i2c_cc13xx_cc26xx_pm_action, PM_DEVICE_DT_INST_REF(0),
&i2c_cc13xx_cc26xx_data, &i2c_cc13xx_cc26xx_config, &i2c_cc13xx_cc26xx_data, &i2c_cc13xx_cc26xx_config,
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY,
&i2c_cc13xx_cc26xx_driver_api); &i2c_cc13xx_cc26xx_driver_api);

View file

@ -285,9 +285,10 @@ static int twi_nrfx_pm_action(const struct device *dev,
.frequency = I2C_FREQUENCY(idx), \ .frequency = I2C_FREQUENCY(idx), \
} \ } \
}; \ }; \
PM_DEVICE_DT_DEFINE(I2C(idx), twi_nrfx_pm_action); \
DEVICE_DT_DEFINE(I2C(idx), \ DEVICE_DT_DEFINE(I2C(idx), \
twi_##idx##_init, \ twi_##idx##_init, \
twi_nrfx_pm_action, \ PM_DEVICE_DT_REF(I2C(idx)), \
&twi_##idx##_data, \ &twi_##idx##_data, \
&twi_##idx##z_config, \ &twi_##idx##z_config, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -370,9 +370,10 @@ static int twim_nrfx_pm_action(const struct device *dev,
.concat_buf_size = CONCAT_BUF_SIZE(idx), \ .concat_buf_size = CONCAT_BUF_SIZE(idx), \
.flash_buf_max_size = FLASH_BUF_MAX_SIZE(idx), \ .flash_buf_max_size = FLASH_BUF_MAX_SIZE(idx), \
}; \ }; \
PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action); \
DEVICE_DT_DEFINE(I2C(idx), \ DEVICE_DT_DEFINE(I2C(idx), \
twim_##idx##_init, \ twim_##idx##_init, \
twim_nrfx_pm_action, \ PM_DEVICE_DT_REF(I2C(idx)), \
&twim_##idx##_data, \ &twim_##idx##_data, \
&twim_##idx##z_config, \ &twim_##idx##z_config, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -495,5 +495,7 @@ static void IoApicRedUpdateLo(unsigned int irq,
ioApicRedSetLo(irq, (ioApicRedGetLo(irq) & ~mask) | (value & mask)); ioApicRedSetLo(irq, (ioApicRedGetLo(irq) & ~mask) | (value & mask));
} }
DEVICE_DEFINE(ioapic, "ioapic", ioapic_init, ioapic_pm_action, NULL, NULL, PM_DEVICE_DEFINE(ioapic, ioapic_pm_action);
DEVICE_DEFINE(ioapic, "ioapic", ioapic_init, PM_DEVICE_REF(ioapic), NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);

View file

@ -428,7 +428,9 @@ static int loapic_pm_action(const struct device *dev,
} }
#endif /* CONFIG_PM_DEVICE */ #endif /* CONFIG_PM_DEVICE */
DEVICE_DEFINE(loapic, "loapic", loapic_init, loapic_pm_action, NULL, NULL, PM_DEVICE_DEFINE(loapic, loapic_pm_action);
DEVICE_DEFINE(loapic, "loapic", loapic_init, PM_DEVICE_REF(loapic), NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);
#if CONFIG_LOAPIC_SPURIOUS_VECTOR #if CONFIG_LOAPIC_SPURIOUS_VECTOR

View file

@ -176,8 +176,11 @@ static const struct led_pwm_config led_pwm_config_##id = { \
.led = led_pwm_##id, \ .led = led_pwm_##id, \
}; \ }; \
\ \
DEVICE_DT_INST_DEFINE(id, &led_pwm_init, led_pwm_pm_action, \ PM_DEVICE_DT_INST_DEFINE(id, led_pwm_pm_action); \
NULL, &led_pwm_config_##id, POST_KERNEL, \ \
DEVICE_DT_INST_DEFINE(id, &led_pwm_init, \
PM_DEVICE_DT_INST_REF(id), NULL, \
&led_pwm_config_##id, POST_KERNEL, \
CONFIG_LED_INIT_PRIORITY, &led_pwm_api); CONFIG_LED_INIT_PRIORITY, &led_pwm_api);
DT_INST_FOREACH_STATUS_OKAY(LED_PWM_DEVICE) DT_INST_FOREACH_STATUS_OKAY(LED_PWM_DEVICE)

View file

@ -368,8 +368,9 @@ static int pwm_nrfx_pm_action(const struct device *dev,
.seq.values.p_raw = pwm_nrfx_##idx##_data.current, \ .seq.values.p_raw = pwm_nrfx_##idx##_data.current, \
.seq.length = NRF_PWM_CHANNEL_COUNT \ .seq.length = NRF_PWM_CHANNEL_COUNT \
}; \ }; \
PM_DEVICE_DT_DEFINE(PWM(idx), pwm_nrfx_pm_action); \
DEVICE_DT_DEFINE(PWM(idx), \ DEVICE_DT_DEFINE(PWM(idx), \
pwm_nrfx_init, pwm_nrfx_pm_action, \ pwm_nrfx_init, PM_DEVICE_DT_REF(PWM(idx)), \
&pwm_nrfx_##idx##_data, \ &pwm_nrfx_##idx##_data, \
&pwm_nrfx_##idx##config, \ &pwm_nrfx_##idx##config, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \

View file

@ -534,6 +534,8 @@ static const struct apds9960_config apds9960_config = {
static struct apds9960_data apds9960_data; static struct apds9960_data apds9960_data;
PM_DEVICE_DT_INST_DEFINE(0, apds9960_pm_action);
DEVICE_DT_INST_DEFINE(0, apds9960_init, DEVICE_DT_INST_DEFINE(0, apds9960_init,
apds9960_pm_action, &apds9960_data, &apds9960_config, PM_DEVICE_DT_INST_REF(0), &apds9960_data, &apds9960_config,
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &apds9960_driver_api); POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &apds9960_driver_api);

View file

@ -447,9 +447,12 @@ static int bme280_pm_action(const struct device *dev,
COND_CODE_1(DT_INST_ON_BUS(inst, spi), \ COND_CODE_1(DT_INST_ON_BUS(inst, spi), \
(BME280_CONFIG_SPI(inst)), \ (BME280_CONFIG_SPI(inst)), \
(BME280_CONFIG_I2C(inst))); \ (BME280_CONFIG_I2C(inst))); \
\
PM_DEVICE_DT_INST_DEFINE(inst, bme280_pm_action); \
\
DEVICE_DT_INST_DEFINE(inst, \ DEVICE_DT_INST_DEFINE(inst, \
bme280_chip_init, \ bme280_chip_init, \
bme280_pm_action, \ PM_DEVICE_DT_INST_REF(inst), \
&bme280_data_##inst, \ &bme280_data_##inst, \
&bme280_config_##inst, \ &bme280_config_##inst, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -720,10 +720,11 @@ static int bmp388_init(const struct device *dev)
BMP388_INT_CFG(inst) \ BMP388_INT_CFG(inst) \
.iir_filter = DT_INST_ENUM_IDX(inst, iir_filter), \ .iir_filter = DT_INST_ENUM_IDX(inst, iir_filter), \
}; \ }; \
PM_DEVICE_DT_INST_DEFINE(inst, bmp388_pm_action); \
DEVICE_DT_INST_DEFINE( \ DEVICE_DT_INST_DEFINE( \
inst, \ inst, \
bmp388_init, \ bmp388_init, \
bmp388_pm_action, \ PM_DEVICE_DT_INST_REF(inst), \
&bmp388_data_##inst, \ &bmp388_data_##inst, \
&bmp388_config_##inst, \ &bmp388_config_##inst, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -773,7 +773,10 @@ static const struct sensor_driver_api bq274xx_battery_driver_api = {
.terminate_voltage = DT_INST_PROP(index, terminate_voltage), \ .terminate_voltage = DT_INST_PROP(index, terminate_voltage), \
}; \ }; \
\ \
DEVICE_DT_INST_DEFINE(index, &bq274xx_gauge_init, bq274xx_pm_action, \ PM_DEVICE_DT_INST_DEFINE(index, bq274xx_pm_action); \
\
DEVICE_DT_INST_DEFINE(index, &bq274xx_gauge_init, \
PM_DEVICE_DT_INST_REF(index), \
&bq274xx_driver_##index, \ &bq274xx_driver_##index, \
&bq274xx_config_##index, POST_KERNEL, \ &bq274xx_config_##index, POST_KERNEL, \
CONFIG_SENSOR_INIT_PRIORITY, \ CONFIG_SENSOR_INIT_PRIORITY, \

View file

@ -1025,9 +1025,11 @@ static int fdc2x1x_init(const struct device *dev)
FDC2X1X_INTB(n) \ FDC2X1X_INTB(n) \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(n, fdc2x1x_device_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, \ DEVICE_DT_INST_DEFINE(n, \
fdc2x1x_init, \ fdc2x1x_init, \
fdc2x1x_device_pm_action, \ PM_DEVICE_DT_INST_REF(n), \
&fdc2x1x_data_##n, \ &fdc2x1x_data_##n, \
&fdc2x1x_config_##n, \ &fdc2x1x_config_##n, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -302,9 +302,11 @@ static const struct sensor_driver_api ina219_api = {
.mode = INA219_MODE_NORMAL \ .mode = INA219_MODE_NORMAL \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(n, ina219_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, \ DEVICE_DT_INST_DEFINE(n, \
ina219_init, \ ina219_init, \
ina219_pm_action, \ PM_DEVICE_DT_INST_REF(n), \
&ina219_data_##n, \ &ina219_data_##n, \
&ina219_config_##n, \ &ina219_config_##n, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -488,9 +488,11 @@ static int lis2mdl_pm_action(const struct device *dev,
*/ */
#define LIS2MDL_DEVICE_INIT(inst) \ #define LIS2MDL_DEVICE_INIT(inst) \
PM_DEVICE_DT_INST_DEFINE(inst, lis2mdl_pm_action); \
\
DEVICE_DT_INST_DEFINE(inst, \ DEVICE_DT_INST_DEFINE(inst, \
lis2mdl_init, \ lis2mdl_init, \
lis2mdl_pm_action, \ PM_DEVICE_DT_INST_REF(inst), \
&lis2mdl_data_##inst, \ &lis2mdl_data_##inst, \
&lis2mdl_config_##inst, \ &lis2mdl_config_##inst, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -395,12 +395,6 @@ static int lm77_pm_action(const struct device *dev,
#define LM77_INT_GPIO_INIT(n) #define LM77_INT_GPIO_INIT(n)
#endif /* ! LM77_TRIGGER_SUPPORT */ #endif /* ! LM77_TRIGGER_SUPPORT */
#ifdef CONFIG_PM_DEVICE
#define LM77_PM_ACTION_CB lm77_pm_action
#else /* CONFIG_PM_DEVICE */
#define LM77_PM_ACTION_CB NULL
#endif /* ! CONFIG_PM_DEVICE */
#define LM77_INIT(n) \ #define LM77_INIT(n) \
static struct lm77_data lm77_data_##n; \ static struct lm77_data lm77_data_##n; \
\ \
@ -417,8 +411,10 @@ static int lm77_pm_action(const struct device *dev,
LM77_INT_GPIO_INIT(n) \ LM77_INT_GPIO_INIT(n) \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(n, lm77_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, lm77_init, \ DEVICE_DT_INST_DEFINE(n, lm77_init, \
LM77_PM_ACTION_CB, \ PM_DEVICE_DT_INST_REF(n), \
&lm77_data_##n, \ &lm77_data_##n, \
&lm77_config_##n, POST_KERNEL, \ &lm77_config_##n, POST_KERNEL, \
CONFIG_SENSOR_INIT_PRIORITY, \ CONFIG_SENSOR_INIT_PRIORITY, \

View file

@ -241,6 +241,8 @@ static const struct sensor_driver_api qdec_nrfx_driver_api = {
.trigger_set = qdec_nrfx_trigger_set, .trigger_set = qdec_nrfx_trigger_set,
}; };
PM_DEVICE_DT_INST_DEFINE(0, qdec_nrfx_pm_action);
DEVICE_DT_INST_DEFINE(0, qdec_nrfx_init, DEVICE_DT_INST_DEFINE(0, qdec_nrfx_init,
qdec_nrfx_pm_action, NULL, NULL, POST_KERNEL, PM_DEVICE_DT_INST_REF(0), NULL, NULL, POST_KERNEL,
CONFIG_SENSOR_INIT_PRIORITY, &qdec_nrfx_driver_api); CONFIG_SENSOR_INIT_PRIORITY, &qdec_nrfx_driver_api);

View file

@ -255,9 +255,11 @@ static const struct sensor_driver_api sgp40_api = {
.selftest = DT_INST_PROP(n, enable_selftest), \ .selftest = DT_INST_PROP(n, enable_selftest), \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(n, sgp40_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, \ DEVICE_DT_INST_DEFINE(n, \
sgp40_init, \ sgp40_init, \
sgp40_pm_action, \ PM_DEVICE_DT_INST_REF(n), \
&sgp40_data_##n, \ &sgp40_data_##n, \
&sgp40_config_##n, \ &sgp40_config_##n, \
POST_KERNEL, \ POST_KERNEL, \

View file

@ -537,7 +537,8 @@ static int si7210_init(const struct device *dev)
static const struct si7210_config si7210_config_##inst = { \ static const struct si7210_config si7210_config_##inst = { \
.bus = I2C_DT_SPEC_INST_GET(inst), \ .bus = I2C_DT_SPEC_INST_GET(inst), \
}; \ }; \
DEVICE_DT_INST_DEFINE(inst, si7210_init, si7210_pm_action, \ PM_DEVICE_DT_INST_DEFINE(inst, si7210_pm_action); \
DEVICE_DT_INST_DEFINE(inst, si7210_init, PM_DEVICE_DT_INST_REF(inst), \
&si7210_data_##inst, &si7210_config_##inst, POST_KERNEL, \ &si7210_data_##inst, &si7210_config_##inst, POST_KERNEL, \
CONFIG_SENSOR_INIT_PRIORITY, &si7210_api_funcs); CONFIG_SENSOR_INIT_PRIORITY, &si7210_api_funcs);

View file

@ -363,6 +363,8 @@ static const struct vcnl4040_config vcnl4040_config = {
static struct vcnl4040_data vcnl4040_data; static struct vcnl4040_data vcnl4040_data;
PM_DEVICE_DT_INST_DEFINE(0, vcnl4040_pm_action);
DEVICE_DT_INST_DEFINE(0, vcnl4040_init, DEVICE_DT_INST_DEFINE(0, vcnl4040_init,
vcnl4040_pm_action, &vcnl4040_data, &vcnl4040_config, PM_DEVICE_DT_INST_REF(0), &vcnl4040_data, &vcnl4040_config,
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &vcnl4040_driver_api); POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &vcnl4040_driver_api);

View file

@ -535,9 +535,11 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = {
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */ #endif /* CONFIG_UART_INTERRUPT_DRIVEN */
#define UART_CC13XX_CC26XX_DEVICE_DEFINE(n) \ #define UART_CC13XX_CC26XX_DEVICE_DEFINE(n) \
PM_DEVICE_DT_INST_DEFINE(n, uart_cc13xx_cc26xx_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, \ DEVICE_DT_INST_DEFINE(n, \
uart_cc13xx_cc26xx_init_##n, \ uart_cc13xx_cc26xx_init_##n, \
uart_cc13xx_cc26xx_pm_action, \ PM_DEVICE_DT_INST_REF(n), \
&uart_cc13xx_cc26xx_data_##n, &uart_cc13xx_cc26xx_config_##n,\ &uart_cc13xx_cc26xx_data_##n, &uart_cc13xx_cc26xx_config_##n,\
PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \
&uart_cc13xx_cc26xx_driver_api) &uart_cc13xx_cc26xx_driver_api)

View file

@ -129,8 +129,9 @@ static int uart_it8xxx2_init(const struct device *dev)
.port = DT_INST_PROP(inst, port_num), \ .port = DT_INST_PROP(inst, port_num), \
.gpio_wui = GPIO_DT_SPEC_INST_GET(inst, gpios), \ .gpio_wui = GPIO_DT_SPEC_INST_GET(inst, gpios), \
}; \ }; \
PM_DEVICE_DT_INST_DEFINE(inst, uart_it8xxx2_pm_action); \
DEVICE_DT_INST_DEFINE(inst, &uart_it8xxx2_init, \ DEVICE_DT_INST_DEFINE(inst, &uart_it8xxx2_init, \
uart_it8xxx2_pm_action, \ PM_DEVICE_DT_INST_REF(inst), \
NULL, &uart_it8xxx2_cfg_##inst, \ NULL, &uart_it8xxx2_cfg_##inst, \
PRE_KERNEL_1, \ PRE_KERNEL_1, \
CONFIG_SERIAL_INIT_PRIORITY, \ CONFIG_SERIAL_INIT_PRIORITY, \

View file

@ -484,12 +484,6 @@ static const struct uart_driver_api neorv32_uart_driver_api = {
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */ #endif /* CONFIG_UART_INTERRUPT_DRIVEN */
}; };
#ifdef CONFIG_PM_DEVICE
#define NEORV32_UART_PM_ACTION_CB neorv32_uart_pm_action
#else /* CONFIG_PM_DEVICE */
#define NEORV32_UART_PM_ACTION_CB NULL
#endif /* ! CONFIG_PM_DEVICE */
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
#define NEORV32_UART_CONFIG_FUNC(node_id, n) \ #define NEORV32_UART_CONFIG_FUNC(node_id, n) \
static void neorv32_uart_config_func_##n(const struct device *dev) \ static void neorv32_uart_config_func_##n(const struct device *dev) \
@ -536,8 +530,10 @@ static const struct uart_driver_api neorv32_uart_driver_api = {
NEORV32_UART_CONFIG_INIT(node_id, n) \ NEORV32_UART_CONFIG_INIT(node_id, n) \
}; \ }; \
\ \
PM_DEVICE_DT_DEFINE(node_id, neorv32_uart_pm_action); \
\
DEVICE_DT_DEFINE(node_id, &neorv32_uart_init, \ DEVICE_DT_DEFINE(node_id, &neorv32_uart_init, \
NEORV32_UART_PM_ACTION_CB, \ PM_DEVICE_DT_REF(node_id), \
&neorv32_uart_##n##_data, \ &neorv32_uart_##n##_data, \
&neorv32_uart_##n##_config, \ &neorv32_uart_##n##_config, \
PRE_KERNEL_1, \ PRE_KERNEL_1, \

View file

@ -502,9 +502,11 @@ static int uart_npcx_pm_action(const struct device *dev,
.baud_rate = DT_INST_PROP(inst, current_speed) \ .baud_rate = DT_INST_PROP(inst, current_speed) \
}; \ }; \
\ \
PM_DEVICE_DT_INST_DEFINE(inst, uart_npcx_pm_action); \
\
DEVICE_DT_INST_DEFINE(inst, \ DEVICE_DT_INST_DEFINE(inst, \
&uart_npcx_init, \ &uart_npcx_init, \
uart_npcx_pm_action, \ PM_DEVICE_DT_INST_REF(inst), \
&uart_npcx_data_##inst, &uart_npcx_cfg_##inst, \ &uart_npcx_data_##inst, &uart_npcx_cfg_##inst, \
PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \
&uart_npcx_driver_api); \ &uart_npcx_driver_api); \

View file

@ -1182,9 +1182,11 @@ static struct uart_nrfx_data uart_nrfx_uart0_data = {
} }
}; };
PM_DEVICE_DT_INST_DEFINE(0, uart_nrfx_pm_action);
DEVICE_DT_INST_DEFINE(0, DEVICE_DT_INST_DEFINE(0,
uart_nrfx_init, uart_nrfx_init,
uart_nrfx_pm_action, PM_DEVICE_DT_INST_REF(0),
&uart_nrfx_uart0_data, &uart_nrfx_uart0_data,
NULL, NULL,
/* Initialize UART device before UART console. */ /* Initialize UART device before UART console. */

View file

@ -1997,9 +1997,12 @@ static int uarte_nrfx_pm_action(const struct device *dev,
dev, \ dev, \
IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN)); \ IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN)); \
} \ } \
\
PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action); \
\
DEVICE_DT_DEFINE(UARTE(idx), \ DEVICE_DT_DEFINE(UARTE(idx), \
uarte_##idx##_init, \ uarte_##idx##_init, \
uarte_nrfx_pm_action, \ PM_DEVICE_DT_REF(UARTE(idx)), \
&uarte_##idx##_data, \ &uarte_##idx##_data, \
&uarte_##idx##z_config, \ &uarte_##idx##z_config, \
PRE_KERNEL_1, \ PRE_KERNEL_1, \

View file

@ -288,9 +288,11 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = {
#endif #endif
#define SPI_CC13XX_CC26XX_DEVICE_INIT(n) \ #define SPI_CC13XX_CC26XX_DEVICE_INIT(n) \
PM_DEVICE_DT_INST_DEFINE(n, spi_cc13xx_cc26xx_pm_action); \
\
DEVICE_DT_INST_DEFINE(n, \ DEVICE_DT_INST_DEFINE(n, \
spi_cc13xx_cc26xx_init_##n, \ spi_cc13xx_cc26xx_init_##n, \
spi_cc13xx_cc26xx_pm_action, \ PM_DEVICE_DT_INST_REF(n), \
&spi_cc13xx_cc26xx_data_##n, &spi_cc13xx_cc26xx_config_##n, \ &spi_cc13xx_cc26xx_data_##n, &spi_cc13xx_cc26xx_config_##n, \
POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \
&spi_cc13xx_cc26xx_driver_api) &spi_cc13xx_cc26xx_driver_api)

View file

@ -354,9 +354,10 @@ static int spi_nrfx_pm_action(const struct device *dev,
.miso_pull = SPI_NRFX_MISO_PULL(idx), \ .miso_pull = SPI_NRFX_MISO_PULL(idx), \
} \ } \
}; \ }; \
PM_DEVICE_DT_DEFINE(SPI(idx), spi_nrfx_pm_action); \
DEVICE_DT_DEFINE(SPI(idx), \ DEVICE_DT_DEFINE(SPI(idx), \
spi_##idx##_init, \ spi_##idx##_init, \
spi_nrfx_pm_action, \ PM_DEVICE_DT_REF(SPI(idx)), \
&spi_##idx##_data, \ &spi_##idx##_data, \
&spi_##idx##z_config, \ &spi_##idx##z_config, \
POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \

View file

@ -531,9 +531,10 @@ static int spim_nrfx_pm_action(const struct device *dev,
SPIM_PROP(idx, anomaly_58_workaround),), \ SPIM_PROP(idx, anomaly_58_workaround),), \
()) \ ()) \
}; \ }; \
PM_DEVICE_DT_DEFINE(SPIM(idx), spim_nrfx_pm_action); \
DEVICE_DT_DEFINE(SPIM(idx), \ DEVICE_DT_DEFINE(SPIM(idx), \
spi_##idx##_init, \ spi_##idx##_init, \
spim_nrfx_pm_action, \ PM_DEVICE_DT_REF(SPIM(idx)), \
&spi_##idx##_data, \ &spi_##idx##_data, \
&spi_##idx##z_config, \ &spi_##idx##z_config, \
POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \