Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pca95xx: set init prio per instance #20

Open
wants to merge 2 commits into
base: cyril/i2c_define_init_priority_per_device
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion drivers/gpio/gpio_pca95xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,28 @@ static int gpio_pca95xx_init(const struct device *dev)
return 0;
}

/* allow redefinition of init priority, per instance,
* at least for the 4 first instances
*/
#ifndef CONFIG_PCA95XX_INIT_PRIO_INST_0
#define CONFIG_PCA95XX_INIT_PRIO_INST_0 CONFIG_GPIO_PCA95XX_INIT_PRIORITY
#endif
#ifndef CONFIG_PCA95XX_INIT_PRIO_INST_1
#define CONFIG_PCA95XX_INIT_PRIO_INST_1 CONFIG_GPIO_PCA95XX_INIT_PRIORITY
#endif
#ifndef CONFIG_PCA95XX_INIT_PRIO_INST_2
#define CONFIG_PCA95XX_INIT_PRIO_INST_2 CONFIG_GPIO_PCA95XX_INIT_PRIORITY
#endif
#ifndef CONFIG_PCA95XX_INIT_PRIO_INST_3
#define CONFIG_PCA95XX_INIT_PRIO_INST_3 CONFIG_GPIO_PCA95XX_INIT_PRIORITY
#endif
#ifndef CONFIG_PCA95XX_INIT_PRIO_INST_4
#define CONFIG_PCA95XX_INIT_PRIO_INST_4 CONFIG_GPIO_PCA95XX_INIT_PRIORITY
#endif
#ifndef CONFIG_PCA95XX_INIT_PRIO_INST_5
#define CONFIG_PCA95XX_INIT_PRIO_INST_5 CONFIG_GPIO_PCA95XX_INIT_PRIORITY
#endif

#define GPIO_PCA95XX_DEVICE_INSTANCE(inst) \
static const struct gpio_pca95xx_config gpio_pca95xx_##inst##_cfg = { \
.common = { \
Expand Down Expand Up @@ -880,7 +902,8 @@ DEVICE_DT_INST_DEFINE(inst, \
NULL, \
&gpio_pca95xx_##inst##_drvdata, \
&gpio_pca95xx_##inst##_cfg, \
POST_KERNEL, CONFIG_GPIO_PCA95XX_INIT_PRIORITY, \
POST_KERNEL, \
_CONCAT(CONFIG_PCA95XX_INIT_PRIO_INST_, inst), \
&gpio_pca95xx_drv_api_funcs);

DT_INST_FOREACH_STATUS_OKAY(GPIO_PCA95XX_DEVICE_INSTANCE)