1 /* SPDX-License-Identifier: GPL-2.0-or-later */
9 * Copyright 2008 Wolfson Microelectronics PLC.
13 * Copyright (c) 2009 Nokia Corporation
17 #ifndef __REGULATOR_GPIO_H
18 #define __REGULATOR_GPIO_H
20 #include <linux/gpio/consumer.h>
22 struct regulator_init_data;
27 * struct gpio_regulator_state - state description
28 * @value: microvolts or microamps
29 * @gpios: bitfield of gpio target-states for the value
31 * This structure describes a supported setting of the regulator
32 * and the necessary gpio-state to achieve it.
34 * The n-th bit in the bitfield describes the state of the n-th GPIO
35 * from the gpios-array defined in gpio_regulator_config below.
37 struct gpio_regulator_state {
43 * struct gpio_regulator_config - config structure
44 * @supply_name: Name of the regulator supply
45 * @input_supply: Name of the input regulator supply
46 * @enabled_at_boot: Whether regulator has been enabled at
47 * boot or not. 1 = Yes, 0 = No
48 * This is used to keep the regulator at
50 * @startup_delay: Start-up time in microseconds
51 * @gflags: Array of GPIO configuration flags for initial
53 * @ngpios: Number of GPIOs and configurations available
54 * @states: Array of gpio_regulator_state entries describing
55 * the gpio state for specific voltages
56 * @nr_states: Number of states available
57 * @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
58 * @init_data: regulator_init_data
60 * This structure contains gpio-voltage regulator configuration
61 * information that must be passed by platform code to the
62 * gpio-voltage regulator driver.
64 struct gpio_regulator_config {
65 const char *supply_name;
66 const char *input_supply;
68 unsigned enabled_at_boot:1;
69 unsigned startup_delay;
71 enum gpiod_flags *gflags;
74 struct gpio_regulator_state *states;
77 enum regulator_type type;
78 struct regulator_init_data *init_data;