Revert "power_domain: gpio: init with `pm_device_driver_init`"

This reverts commit 39b2ec57a0.
This commit is contained in:
Jordan Yates 2023-07-25 17:42:20 +10:00 committed by Carles Cufí
parent b74efbe59e
commit 226f1c5e4b
1 changed files with 11 additions and 2 deletions

View File

@ -113,6 +113,7 @@ static int pd_gpio_init(const struct device *dev)
{
const struct pd_gpio_config *cfg = dev->config;
struct pd_gpio_data *data = dev->data;
int rc;
if (!device_is_ready(cfg->enable.port)) {
LOG_ERR("GPIO port %s is not ready", cfg->enable.port->name);
@ -121,8 +122,16 @@ static int pd_gpio_init(const struct device *dev)
/* We can't know how long the domain has been off for before boot */
data->next_boot = K_TIMEOUT_ABS_US(cfg->off_on_delay_us);
/* Boot according to state */
return pm_device_driver_init(dev, pd_gpio_pm_action);
if (pm_device_on_power_domain(dev)) {
/* Device is unpowered */
pm_device_init_off(dev);
rc = gpio_pin_configure_dt(&cfg->enable, GPIO_DISCONNECTED);
} else {
pm_device_init_suspended(dev);
rc = gpio_pin_configure_dt(&cfg->enable, GPIO_OUTPUT_INACTIVE);
}
return rc;
}
#define POWER_DOMAIN_DEVICE(id) \