xref: /linux-6.15/include/linux/regulator/fixed.h (revision efdfeb07)
1 /*
2  * fixed.h
3  *
4  * Copyright 2008 Wolfson Microelectronics PLC.
5  *
6  * Author: Mark Brown <[email protected]>
7  *
8  * Copyright (c) 2009 Nokia Corporation
9  * Roger Quadros <[email protected]>
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of the
14  * License, or (at your option) any later version.
15  */
16 
17 #ifndef __REGULATOR_FIXED_H
18 #define __REGULATOR_FIXED_H
19 
20 struct regulator_init_data;
21 
22 /**
23  * struct fixed_voltage_config - fixed_voltage_config structure
24  * @supply_name:	Name of the regulator supply
25  * @input_supply:	Name of the input regulator supply
26  * @microvolts:		Output voltage of regulator
27  * @startup_delay:	Start-up time in microseconds
28  * @gpio_is_open_drain: Gpio pin is open drain or normal type.
29  *			If it is open drain type then HIGH will be set
30  *			through PULL-UP with setting gpio as input
31  *			and low will be set as gpio-output with driven
32  *			to low. For non-open-drain case, the gpio will
33  *			will be in output and drive to low/high accordingly.
34  * @enable_high:	Polarity of enable GPIO
35  *			1 = Active high, 0 = Active low
36  * @enabled_at_boot:	Whether regulator has been enabled at
37  * 			boot or not. 1 = Yes, 0 = No
38  * 			This is used to keep the regulator at
39  * 			the default state
40  * @init_data:		regulator_init_data
41  *
42  * This structure contains fixed voltage regulator configuration
43  * information that must be passed by platform code to the fixed
44  * voltage regulator driver.
45  */
46 struct fixed_voltage_config {
47 	const char *supply_name;
48 	const char *input_supply;
49 	int microvolts;
50 	unsigned startup_delay;
51 	unsigned gpio_is_open_drain:1;
52 	unsigned enable_high:1;
53 	unsigned enabled_at_boot:1;
54 	struct regulator_init_data *init_data;
55 };
56 
57 struct regulator_consumer_supply;
58 
59 #if IS_ENABLED(CONFIG_REGULATOR)
60 struct platform_device *regulator_register_always_on(int id, const char *name,
61 		struct regulator_consumer_supply *supplies, int num_supplies, int uv);
62 #else
63 static inline struct platform_device *regulator_register_always_on(int id, const char *name,
64 		struct regulator_consumer_supply *supplies, int num_supplies, int uv)
65 {
66 	return NULL;
67 }
68 #endif
69 
70 #define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \
71 						"fixed-dummy", s, ns, 0)
72 
73 #endif
74