Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * gpio-regulator.h
0004  *
0005  * Copyright 2011 Heiko Stuebner <heiko@sntech.de>
0006  *
0007  * based on fixed.h
0008  *
0009  * Copyright 2008 Wolfson Microelectronics PLC.
0010  *
0011  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
0012  *
0013  * Copyright (c) 2009 Nokia Corporation
0014  * Roger Quadros <ext-roger.quadros@nokia.com>
0015  */
0016 
0017 #ifndef __REGULATOR_GPIO_H
0018 #define __REGULATOR_GPIO_H
0019 
0020 #include <linux/gpio/consumer.h>
0021 
0022 struct regulator_init_data;
0023 
0024 enum regulator_type;
0025 
0026 /**
0027  * struct gpio_regulator_state - state description
0028  * @value:      microvolts or microamps
0029  * @gpios:      bitfield of gpio target-states for the value
0030  *
0031  * This structure describes a supported setting of the regulator
0032  * and the necessary gpio-state to achieve it.
0033  *
0034  * The n-th bit in the bitfield describes the state of the n-th GPIO
0035  * from the gpios-array defined in gpio_regulator_config below.
0036  */
0037 struct gpio_regulator_state {
0038     int value;
0039     int gpios;
0040 };
0041 
0042 /**
0043  * struct gpio_regulator_config - config structure
0044  * @supply_name:    Name of the regulator supply
0045  * @enabled_at_boot:    Whether regulator has been enabled at
0046  *          boot or not. 1 = Yes, 0 = No
0047  *          This is used to keep the regulator at
0048  *          the default state
0049  * @startup_delay:  Start-up time in microseconds
0050  * @gflags:     Array of GPIO configuration flags for initial
0051  *          states
0052  * @ngpios:     Number of GPIOs and configurations available
0053  * @states:     Array of gpio_regulator_state entries describing
0054  *          the gpio state for specific voltages
0055  * @nr_states:      Number of states available
0056  * @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
0057  * @init_data:      regulator_init_data
0058  *
0059  * This structure contains gpio-voltage regulator configuration
0060  * information that must be passed by platform code to the
0061  * gpio-voltage regulator driver.
0062  */
0063 struct gpio_regulator_config {
0064     const char *supply_name;
0065 
0066     unsigned enabled_at_boot:1;
0067     unsigned startup_delay;
0068 
0069     enum gpiod_flags *gflags;
0070     int ngpios;
0071 
0072     struct gpio_regulator_state *states;
0073     int nr_states;
0074 
0075     enum regulator_type type;
0076     struct regulator_init_data *init_data;
0077 };
0078 
0079 #endif