Lines Matching +full:active +full:- +full:range +full:- +full:x +full:- +full:max

2  * Copyright (c) 2019-2020 Peter Bigot Consulting, LLC
7 * SPDX-License-Identifier: Apache-2.0
67 /** @brief Driver-specific API functions to support parent regulator control. */
100 /** @brief Driver-specific API functions to support regulator control. */
130 /** Regulator active discharge state mask */
132 /** Regulator active discharge state flag position*/
134 /** Disable regulator active discharge */
136 /** Enable regulator active discharge */
138 /** Leave regulator active discharge state as default */
140 /** Regulator active discharge set bits */
141 #define REGULATOR_ACTIVE_DISCHARGE_SET_BITS(x) \ argument
142 (((x) << REGULATOR_ACTIVE_DISCHARGE_POS) & REGULATOR_ACTIVE_DISCHARGE_MASK)
143 /** Regulator active discharge get bits */
144 #define REGULATOR_ACTIVE_DISCHARGE_GET_BITS(x) \ argument
145 (((x) & REGULATOR_ACTIVE_DISCHARGE_MASK) >> REGULATOR_ACTIVE_DISCHARGE_POS)
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()
519 * voltage. The voltage will be applied to the active or selected mode. Output
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()
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()
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()
614 * configured current limit. Current may be limited using `current-min-microamp`
615 * and/or `current-max-microamp` in Devicetree.
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.
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()
694 * @brief Set active discharge setting.
697 * @param active_discharge Active discharge enable or disable.
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()
717 * @brief Get active discharge setting.
720 * @param[out] active_discharge Where active discharge will be stored.
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()
740 * @brief Get active error flags.
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()