Lines Matching +full:resource +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * devres.c -- Voltage/Current Regulator framework devres implementation.
22 static struct regulator *_devm_regulator_get(struct device *dev, const char *id, in _devm_regulator_get() argument
29 return ERR_PTR(-ENOMEM); in _devm_regulator_get()
31 regulator = _regulator_get(dev, id, get_type); in _devm_regulator_get()
43 * devm_regulator_get - Resource managed regulator_get()
45 * @id: supply name or regulator ID.
51 struct regulator *devm_regulator_get(struct device *dev, const char *id) in devm_regulator_get() argument
53 return _devm_regulator_get(dev, id, NORMAL_GET); in devm_regulator_get()
58 * devm_regulator_get_exclusive - Resource managed regulator_get_exclusive()
60 * @id: supply name or regulator ID.
67 const char *id) in devm_regulator_get_exclusive() argument
69 return _devm_regulator_get(dev, id, EXCLUSIVE_GET); in devm_regulator_get_exclusive()
80 static int _devm_regulator_get_enable(struct device *dev, const char *id, in _devm_regulator_get_enable() argument
86 r = _devm_regulator_get(dev, id, get_type); in _devm_regulator_get_enable()
101 * devm_regulator_get_enable_optional - Resource managed regulator get and enable
103 * @id: supply name or regulator ID.
105 * Get and enable regulator for duration of the device life-time.
110 int devm_regulator_get_enable_optional(struct device *dev, const char *id) in devm_regulator_get_enable_optional() argument
112 return _devm_regulator_get_enable(dev, id, OPTIONAL_GET); in devm_regulator_get_enable_optional()
117 * devm_regulator_get_enable - Resource managed regulator get and enable
119 * @id: supply name or regulator ID.
121 * Get and enable regulator for duration of the device life-time.
126 int devm_regulator_get_enable(struct device *dev, const char *id) in devm_regulator_get_enable() argument
128 return _devm_regulator_get_enable(dev, id, NORMAL_GET); in devm_regulator_get_enable()
133 * devm_regulator_get_optional - Resource managed regulator_get_optional()
135 * @id: supply name or regulator ID.
142 const char *id) in devm_regulator_get_optional() argument
144 return _devm_regulator_get(dev, id, OPTIONAL_GET); in devm_regulator_get_optional()
149 * devm_regulator_get_enable_read_voltage - Resource managed regulator get and
152 * @id: supply name or regulator ID.
154 * Get and enable regulator for duration of the device life-time.
164 * -ENODEV error and handle it accordingly.
168 int devm_regulator_get_enable_read_voltage(struct device *dev, const char *id) in devm_regulator_get_enable_read_voltage() argument
176 * then letting regulator_get_voltage() fail with -EINVAL. This way, the in devm_regulator_get_enable_read_voltage()
177 * caller can handle the -ENODEV negative error number if needed instead in devm_regulator_get_enable_read_voltage()
178 * of the ambiguous -EINVAL. in devm_regulator_get_enable_read_voltage()
180 r = devm_regulator_get_optional(dev, id); in devm_regulator_get_enable_read_voltage()
218 * devm_regulator_put - Resource managed regulator_put()
222 * this function will not need to be called and the resource management
223 * code will ensure that the resource is freed.
229 rc = devres_release(regulator->dev, devm_regulator_release, in devm_regulator_put()
245 regulator_bulk_free(devres->num_consumers, devres->consumers); in devm_regulator_bulk_release()
258 return -ENOMEM; in _devm_regulator_bulk_get()
262 devres->consumers = consumers; in _devm_regulator_bulk_get()
263 devres->num_consumers = num_consumers; in _devm_regulator_bulk_get()
273 * devm_regulator_bulk_get - managed get multiple regulator consumers
295 * devm_regulator_bulk_get_exclusive - managed exclusive get of multiple
318 * devm_regulator_bulk_get_const - devm_regulator_bulk_get() w/ const data
339 return -ENOMEM; in devm_regulator_bulk_get_const()
357 return match->consumers == target; in devm_regulator_bulk_match()
361 * devm_regulator_bulk_put - Resource managed regulator_bulk_put()
365 * this function will not need to be called and the resource management
366 * code will ensure that the resource is freed.
373 rc = devres_release(regulator->dev, devm_regulator_bulk_release, in devm_regulator_bulk_put()
385 for (i = 0; i < devres->num_consumers; i++) in devm_regulator_bulk_disable()
386 regulator_disable(devres->consumers[i].consumer); in devm_regulator_bulk_disable()
390 * devm_regulator_bulk_get_enable - managed get'n enable multiple regulators
394 * @id: list of supply names or regulator IDs
405 const char * const *id) in devm_regulator_bulk_get_enable() argument
413 return -ENOMEM; in devm_regulator_bulk_get_enable()
415 devres->consumers = devm_kcalloc(dev, num_consumers, sizeof(*consumers), in devm_regulator_bulk_get_enable()
417 consumers = devres->consumers; in devm_regulator_bulk_get_enable()
419 return -ENOMEM; in devm_regulator_bulk_get_enable()
421 devres->num_consumers = num_consumers; in devm_regulator_bulk_get_enable()
424 consumers[i].supply = id[i]; in devm_regulator_bulk_get_enable()
441 while (--i >= 0) in devm_regulator_bulk_get_enable()
456 * devm_regulator_register - Resource managed regulator_register()
475 return ERR_PTR(-ENOMEM); in devm_regulator_register()
491 const char *id; member
500 return match->dev == target->dev && strcmp(match->id, target->id) == 0; in devm_regulator_match_supply_alias()
507 regulator_unregister_supply_alias(match->dev, match->id); in devm_regulator_destroy_supply_alias()
511 * devm_regulator_register_supply_alias - Resource managed
515 * @id: supply name or regulator ID
517 * @alias_id: supply name or regulator ID that should be used to lookup the
523 int devm_regulator_register_supply_alias(struct device *dev, const char *id, in devm_regulator_register_supply_alias() argument
534 return -ENOMEM; in devm_regulator_register_supply_alias()
536 match->dev = dev; in devm_regulator_register_supply_alias()
537 match->id = id; in devm_regulator_register_supply_alias()
539 ret = regulator_register_supply_alias(dev, id, alias_dev, alias_id); in devm_regulator_register_supply_alias()
552 const char *id) in devm_regulator_unregister_supply_alias() argument
558 match.id = id; in devm_regulator_unregister_supply_alias()
567 * devm_regulator_bulk_register_supply_alias - Managed register
571 * @id: list of supply names or regulator IDs
586 const char *const *id, in devm_regulator_bulk_register_supply_alias() argument
595 ret = devm_regulator_register_supply_alias(dev, id[i], in devm_regulator_bulk_register_supply_alias()
606 "Failed to create supply alias %s,%s -> %s,%s\n", in devm_regulator_bulk_register_supply_alias()
607 id[i], dev_name(dev), alias_id[i], dev_name(alias_dev)); in devm_regulator_bulk_register_supply_alias()
609 while (--i >= 0) in devm_regulator_bulk_register_supply_alias()
610 devm_regulator_unregister_supply_alias(dev, id[i]); in devm_regulator_bulk_register_supply_alias()
627 return match->regulator == target->regulator && match->nb == target->nb; in devm_regulator_match_notifier()
634 regulator_unregister_notifier(match->regulator, match->nb); in devm_regulator_destroy_notifier()
638 * devm_regulator_register_notifier - Resource managed
657 return -ENOMEM; in devm_regulator_register_notifier()
659 match->regulator = regulator; in devm_regulator_register_notifier()
660 match->nb = nb; in devm_regulator_register_notifier()
668 devres_add(regulator->dev, match); in devm_regulator_register_notifier()
675 * devm_regulator_unregister_notifier - Resource managed
682 * Normally this function will not need to be called and the resource
683 * management code will ensure that the resource is freed.
694 rc = devres_release(regulator->dev, devm_regulator_destroy_notifier, in devm_regulator_unregister_notifier()
707 * devm_regulator_irq_helper - resource managed registration of IRQ based
717 * When IRQ is re-enabled these errors will be cleared