drivers: dac: Refactor drivers to use shared init priority

Refactors all of the DAC drivers to use a shared driver class
initialization priority configuration, CONFIG_DAC_INIT_PRIORITY, to
allow configuring DAC drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are dacx0508, dacx3608, and mcp4725 drivers which have
dependencies on SPI or I2C drivers and must therefore initialize later
than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
Maureen Helm 2021-10-25 19:13:48 -05:00 committed by Carles Cufí
commit 9eef764c65
17 changed files with 29 additions and 35 deletions

View file

@ -25,6 +25,9 @@ if DAC
config DAC_MCP4725
default y
config DAC_INIT_PRIORITY
default 80
config I2C
default y

View file

@ -16,6 +16,9 @@ if DAC
config DAC_MCP4725
default y
config DAC_INIT_PRIORITY
default 80
config I2C
default y

View file

@ -20,6 +20,9 @@ if DAC
config DAC_MCP4725
default y
config DAC_INIT_PRIORITY
default 80
config I2C
default y

View file

@ -16,6 +16,9 @@ if DAC
config DAC_MCP4725
default y
config DAC_INIT_PRIORITY
default 80
config I2C
default y

View file

@ -11,6 +11,9 @@ config SPI
config DAC_DACX0508
default y
config DAC_INIT_PRIORITY
default 80
endif # DAC
endif # SHIELD_DAC80508_EVM

View file

@ -24,6 +24,12 @@ config DAC_SHELL
help
Enable DAC related shell commands.
config DAC_INIT_PRIORITY
int "DAC init priority"
default KERNEL_INIT_PRIORITY_DEVICE
help
DAC driver device initialization priority.
source "drivers/dac/Kconfig.mcux"
source "drivers/dac/Kconfig.stm32"

View file

@ -9,13 +9,3 @@ config DAC_DACX0508
depends on SPI
help
Enable the driver for the TI DACx0508.
if DAC_DACX0508
config DAC_DACX0508_INIT_PRIORITY
int "Init priority"
default 80
help
DACx0508 DAC device driver initialization priority.
endif # DAC_DACX0508

View file

@ -9,10 +9,3 @@ config DAC_DACX3608
depends on I2C
help
Enable the driver for the TI DACX3608.
config DAC_DACX3608_INIT_PRIORITY
int "Init priority"
depends on DAC_DACX3608
default 80
help
DACX3608 DAC device driver initialization priority.

View file

@ -9,13 +9,3 @@ config DAC_MCP4725
depends on I2C
help
Enable the driver for the Microchip MCP4725.
if DAC_MCP4725
config DAC_MCP4725_INIT_PRIORITY
int "Init priority"
default 80
help
MCP4725 DAC device driver initialization priority.
endif # DAC_MCP4725

View file

@ -385,7 +385,7 @@ static const struct dac_driver_api dacx0508_driver_api = {
&dacx0508_init, NULL, \
&dac##t##_data_##n, \
&dac##t##_config_##n, POST_KERNEL, \
CONFIG_DAC_DACX0508_INIT_PRIORITY, \
CONFIG_DAC_INIT_PRIORITY, \
&dacx0508_driver_api)
/*

View file

@ -258,7 +258,7 @@ static const struct dac_driver_api dacx3608_driver_api = {
&dacx3608_init, NULL, \
&dac##t##_data_##n, \
&dac##t##_config_##n, POST_KERNEL, \
CONFIG_DAC_DACX3608_INIT_PRIORITY, \
CONFIG_DAC_INIT_PRIORITY, \
&dacx3608_driver_api)
/*

View file

@ -142,7 +142,7 @@ static const struct dac_driver_api mcp4725_driver_api = {
NULL, \
NULL, \
&mcp4725_config_##index, POST_KERNEL, \
CONFIG_DAC_MCP4725_INIT_PRIORITY, \
CONFIG_DAC_INIT_PRIORITY, \
&mcp4725_driver_api);
DT_INST_FOREACH_STATUS_OKAY(INST_DT_MCP4725);

View file

@ -108,7 +108,7 @@ static const struct dac_driver_api mcux_dac_driver_api = {
DEVICE_DT_INST_DEFINE(n, mcux_dac_init, NULL, \
&mcux_dac_data_##n, \
&mcux_dac_config_##n, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, \
&mcux_dac_driver_api);
DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC_INIT)

View file

@ -114,7 +114,7 @@ static const struct dac_driver_api mcux_dac32_driver_api = {
DEVICE_DT_INST_DEFINE(n, mcux_dac32_init, NULL, \
&mcux_dac32_data_##n, \
&mcux_dac32_config_##n, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, \
&mcux_dac32_driver_api);
DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC32_INIT)

View file

@ -173,5 +173,5 @@ static const struct dac_sam_dev_cfg dacc_sam_config = {
static struct dac_sam_dev_data dacc_sam_data;
DEVICE_DT_INST_DEFINE(0, dac_sam_init, NULL, &dacc_sam_data, &dacc_sam_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
POST_KERNEL, CONFIG_DAC_INIT_PRIORITY,
&dac_sam_driver_api);

View file

@ -108,7 +108,7 @@ static const struct dac_driver_api api_sam0_driver_api = {
\
DEVICE_DT_INST_DEFINE(n, &dac_sam0_init, NULL, NULL, \
&dac_sam0_cfg_##n, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
CONFIG_DAC_INIT_PRIORITY, \
&api_sam0_driver_api)
DT_INST_FOREACH_STATUS_OKAY(SAM0_DAC_INIT);

View file

@ -168,7 +168,7 @@ static struct dac_stm32_data dac_stm32_data_##index = { \
DEVICE_DT_INST_DEFINE(index, &dac_stm32_init, NULL, \
&dac_stm32_data_##index, \
&dac_stm32_cfg_##index, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
CONFIG_DAC_INIT_PRIORITY, \
&api_stm32_driver_api);
DT_INST_FOREACH_STATUS_OKAY(STM32_DAC_INIT)