|
@@ -1937,7 +1937,10 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
|
|
struct gpio_desc *gpiod;
|
|
struct gpio_desc *gpiod;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- gpiod = gpio_to_desc(config->ena_gpio);
|
|
|
|
|
|
+ if (config->ena_gpiod)
|
|
|
|
+ gpiod = config->ena_gpiod;
|
|
|
|
+ else
|
|
|
|
+ gpiod = gpio_to_desc(config->ena_gpio);
|
|
|
|
|
|
list_for_each_entry(pin, ®ulator_ena_gpio_list, list) {
|
|
list_for_each_entry(pin, ®ulator_ena_gpio_list, list) {
|
|
if (pin->gpiod == gpiod) {
|
|
if (pin->gpiod == gpiod) {
|
|
@@ -1947,15 +1950,18 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- ret = gpio_request_one(config->ena_gpio,
|
|
|
|
- GPIOF_DIR_OUT | config->ena_gpio_flags,
|
|
|
|
- rdev_get_name(rdev));
|
|
|
|
- if (ret)
|
|
|
|
- return ret;
|
|
|
|
|
|
+ if (!config->ena_gpiod) {
|
|
|
|
+ ret = gpio_request_one(config->ena_gpio,
|
|
|
|
+ GPIOF_DIR_OUT | config->ena_gpio_flags,
|
|
|
|
+ rdev_get_name(rdev));
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
|
|
pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL);
|
|
pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL);
|
|
if (pin == NULL) {
|
|
if (pin == NULL) {
|
|
- gpio_free(config->ena_gpio);
|
|
|
|
|
|
+ if (!config->ena_gpiod)
|
|
|
|
+ gpio_free(config->ena_gpio);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4154,8 +4160,9 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
|
goto clean;
|
|
goto clean;
|
|
}
|
|
}
|
|
|
|
|
|
- if ((config->ena_gpio || config->ena_gpio_initialized) &&
|
|
|
|
- gpio_is_valid(config->ena_gpio)) {
|
|
|
|
|
|
+ if (config->ena_gpiod ||
|
|
|
|
+ ((config->ena_gpio || config->ena_gpio_initialized) &&
|
|
|
|
+ gpio_is_valid(config->ena_gpio))) {
|
|
mutex_lock(®ulator_list_mutex);
|
|
mutex_lock(®ulator_list_mutex);
|
|
ret = regulator_ena_gpio_request(rdev, config);
|
|
ret = regulator_ena_gpio_request(rdev, config);
|
|
mutex_unlock(®ulator_list_mutex);
|
|
mutex_unlock(®ulator_list_mutex);
|