Lines Matching +full:current +full:- +full:limit

2  * Copyright (c) 2019-2020 Peter Bigot Consulting, LLC
7 * SPDX-License-Identifier: Apache-2.0
53 /** Current is too high. */
67 /** @brief Driver-specific API functions to support parent regulator control. */
100 /** @brief Driver-specific API functions to support regulator control. */
166 /** Minimum allowed current, in microamps. */
168 /** Maximum allowed current, in microamps. */
170 /** Initial current, in microamps. */
261 * - Automatically enable the regulator if it is set to `regulator-boot-on`
262 * or `regulator-always-on` and increase its usage count.
263 * - Automatically disable the regulator if it is set to `regulator-boot-off`.
264 * - Configure the regulator mode if `regulator-initial-mode` is set.
265 * - Ensure regulator voltage is set to a valid range.
275 * @retval -errno Negative errno in case of failure.
289 (const struct regulator_common_config *)dev->config; in regulator_common_is_init_enabled()
291 return (config->flags & REGULATOR_INIT_ENABLED) != 0U; in regulator_common_is_init_enabled()
301 * @retval -ENOENT If minimum voltage is not specified.
306 (const struct regulator_common_config *)dev->config; in regulator_common_get_min_voltage()
308 if (config->min_uv == INT32_MIN) { in regulator_common_get_min_voltage()
309 return -ENOENT; in regulator_common_get_min_voltage()
312 *min_uv = config->min_uv; in regulator_common_get_min_voltage()
323 * @retval -ENOENT If maximum voltage is not specified.
328 (const struct regulator_common_config *)dev->config; in regulator_common_get_max_voltage()
330 if (config->max_uv == INT32_MAX) { in regulator_common_get_max_voltage()
331 return -ENOENT; in regulator_common_get_max_voltage()
334 *max_uv = config->max_uv; in regulator_common_get_max_voltage()
352 * configure specific output pins when entering low-power modes so that PMIC
360 * @retval -ENOTSUP If given state is not supported.
361 * @retval -EPERM If state can't be changed by software.
362 * @retval -ENOSYS If function is not implemented.
363 * @retval -errno In case of any other error.
369 (const struct regulator_parent_driver_api *)dev->api; in regulator_parent_dvs_state_set()
371 if (api->dvs_state_set == NULL) { in regulator_parent_dvs_state_set()
372 return -ENOSYS; in regulator_parent_dvs_state_set()
375 return api->dvs_state_set(dev, state); in regulator_parent_dvs_state_set()
389 * @retval -ENOSYS If function is not implemented.
390 * @retval -errno In case of any other error.
395 (const struct regulator_parent_driver_api *)dev->api; in regulator_parent_ship_mode()
397 if (api->ship_mode == NULL) { in regulator_parent_ship_mode()
398 return -ENOSYS; in regulator_parent_ship_mode()
401 return api->ship_mode(dev); in regulator_parent_ship_mode()
409 * Reference-counted request that a regulator be turned on. A regulator is
411 * are always on, or configured in devicetree with `regulator-always-on` will
417 * @retval -errno Negative errno in case of failure.
418 * @retval -ENOTSUP If regulator enablement can not be controlled.
437 * `regulator-always-on` will always stay enabled, and so this function will
445 * @retval -errno Negative errno in case of failure.
446 * @retval -ENOTSUP If regulator disablement can not be controlled.
464 (const struct regulator_driver_api *)dev->api; in regulator_count_voltages()
466 if (api->count_voltages == NULL) { in regulator_count_voltages()
470 return api->count_voltages(dev); in regulator_count_voltages()
486 * @retval -EINVAL If @p index does not correspond to a supported voltage.
492 (const struct regulator_driver_api *)dev->api; in regulator_list_voltage()
494 if (api->list_voltage == NULL) { in regulator_list_voltage()
495 return -EINVAL; in regulator_list_voltage()
498 return api->list_voltage(dev, idx, volt_uv); in regulator_list_voltage()
520 * voltage may be limited using `regulator-min-microvolt` and/or
521 * `regulator-max-microvolt` in devicetree.
528 * @retval -EINVAL If the given voltage window is not valid.
529 * @retval -ENOSYS If function is not implemented.
530 * @retval -errno In case of any other error.
542 * @retval -ENOSYS If function is not implemented.
543 * @retval -errno In case of any other error.
549 (const struct regulator_driver_api *)dev->api; in regulator_get_voltage()
551 if (api->get_voltage == NULL) { in regulator_get_voltage()
552 return -ENOSYS; in regulator_get_voltage()
555 return api->get_voltage(dev, volt_uv); in regulator_get_voltage()
559 * @brief Obtain the number of supported current limit levels.
561 * Each current limit level supported by a regulator gets an index, starting from
562 * zero. The total number of supported current limit levels can be used together with
563 * regulator_list_current_limit() to list all supported current limit levels.
567 * @return Number of supported current limits.
572 (const struct regulator_driver_api *)dev->api; in regulator_count_current_limits()
574 if (api->count_current_limits == NULL) { in regulator_count_current_limits()
578 return api->count_current_limits(dev); in regulator_count_current_limits()
582 * @brief Obtain the value of a current limit given an index.
584 * Each current limit level supported by a regulator gets an index, starting from
586 * to iterate over all supported current limits.
589 * @param idx Current index.
590 * @param[out] current_ua Where current for the given @p index will be stored, in
593 * @retval 0 If @p index corresponds to a supported current limit.
594 * @retval -EINVAL If @p index does not correspond to a supported current limit.
600 (const struct regulator_driver_api *)dev->api; in regulator_list_current_limit()
602 if (api->list_current_limit == NULL) { in regulator_list_current_limit()
603 return -EINVAL; in regulator_list_current_limit()
606 return api->list_current_limit(dev, idx, current_ua); in regulator_list_current_limit()
610 * @brief Set output current limit.
612 * The output current limit will be configured to the closest supported output
613 * current limit. regulator_get_current_limit() can be used to obtain the actual
614 * configured current limit. Current may be limited using `current-min-microamp`
615 * and/or `current-max-microamp` in Devicetree.
618 * @param min_ua Minimum acceptable current limit in microamps.
619 * @param max_ua Maximum acceptable current limit in microamps.
622 * @retval -EINVAL If the given current limit window is not valid.
623 * @retval -ENOSYS If function is not implemented.
624 * @retval -errno In case of any other error.
630 * @brief Get output current limit.
633 * @param[out] curr_ua Where output current limit will be stored.
636 * @retval -ENOSYS If function is not implemented.
637 * @retval -errno In case of any other error.
643 (const struct regulator_driver_api *)dev->api; in regulator_get_current_limit()
645 if (api->get_current_limit == NULL) { in regulator_get_current_limit()
646 return -ENOSYS; in regulator_get_current_limit()
649 return api->get_current_limit(dev, curr_ua); in regulator_get_current_limit()
657 * the regulator. Allowed modes may be limited using `regulator-allowed-modes`
664 * @retval -ENOTSUP If mode is not supported.
665 * @retval -ENOSYS If function is not implemented.
666 * @retval -errno In case of any other error.
677 * @retval -ENOSYS If function is not implemented.
678 * @retval -errno In case of any other error.
684 (const struct regulator_driver_api *)dev->api; in regulator_get_mode()
686 if (api->get_mode == NULL) { in regulator_get_mode()
687 return -ENOSYS; in regulator_get_mode()
690 return api->get_mode(dev, mode); in regulator_get_mode()
700 * @retval -ENOSYS If function is not implemented.
701 * @retval -errno In case of any other error.
707 (const struct regulator_driver_api *)dev->api; in regulator_set_active_discharge()
709 if (api->set_active_discharge == NULL) { in regulator_set_active_discharge()
710 return -ENOSYS; in regulator_set_active_discharge()
713 return api->set_active_discharge(dev, active_discharge); in regulator_set_active_discharge()
723 * @retval -ENOSYS If function is not implemented.
724 * @retval -errno In case of any other error.
730 (const struct regulator_driver_api *)dev->api; in regulator_get_active_discharge()
732 if (api->get_active_discharge == NULL) { in regulator_get_active_discharge()
733 return -ENOSYS; in regulator_get_active_discharge()
736 return api->get_active_discharge(dev, active_discharge); in regulator_get_active_discharge()
746 * @retval -ENOSYS If function is not implemented.
747 * @retval -errno In case of any other error.
753 (const struct regulator_driver_api *)dev->api; in regulator_get_error_flags()
755 if (api->get_error_flags == NULL) { in regulator_get_error_flags()
756 return -ENOSYS; in regulator_get_error_flags()
759 return api->get_error_flags(dev, flags); in regulator_get_error_flags()