From 9da5538f9276de34fcf451b9d2e9668627dab794 Mon Sep 17 00:00:00 2001 From: Bartosz Bilas Date: Tue, 12 Jul 2022 16:48:31 +0200 Subject: [PATCH] drivers: dac: mcp4728: set explicitly init priority Since this DAC is connected via I2C bus the init priority value must be higher than the default 50 so it can be initialized later than the bus itself so add a dedicated init config symbol for that. Signed-off-by: Bartosz Bilas --- drivers/dac/Kconfig.mcp4728 | 10 ++++++++++ drivers/dac/dac_mcp4728.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/dac/Kconfig.mcp4728 b/drivers/dac/Kconfig.mcp4728 index e2dcd77b4ce..7a796617f18 100644 --- a/drivers/dac/Kconfig.mcp4728 +++ b/drivers/dac/Kconfig.mcp4728 @@ -7,3 +7,13 @@ config DAC_MCP4728 depends on I2C help Enable driver for the Microchip MCP4728. + +if DAC_MCP4728 + +config DAC_MCP4728_INIT_PRIORITY + int "Init priority" + default 80 + help + Microchip MCP4728 device driver initialization priority. + +endif # DAC_MCP4728 diff --git a/drivers/dac/dac_mcp4728.c b/drivers/dac/dac_mcp4728.c index c264720a21e..f6a27c519b6 100644 --- a/drivers/dac/dac_mcp4728.c +++ b/drivers/dac/dac_mcp4728.c @@ -104,7 +104,7 @@ static const struct dac_driver_api mcp4728_driver_api = { DEVICE_DT_INST_DEFINE(index, dac_mcp4728_init, NULL, NULL, \ &mcp4728_config_##index, \ POST_KERNEL, \ - CONFIG_DAC_INIT_PRIORITY, \ + CONFIG_DAC_MCP4728_INIT_PRIORITY, \ &mcp4728_driver_api); DT_INST_FOREACH_STATUS_OKAY(INST_DT_MCP4728);