blob: aba8e4149838e34f3a8ced074c11e6566a213ad0 [file] [log] [blame]
Mark Brown0cdfcc02013-09-11 13:15:40 +01001/*
2 * internal.h -- Voltage/Current Regulator framework internal code
3 *
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
5 * Copyright 2008 SlimLogic Ltd.
6 *
7 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __REGULATOR_INTERNAL_H
17#define __REGULATOR_INTERNAL_H
18
Chunyan Zhangc360a6d2018-01-26 21:08:44 +080019#include <linux/suspend.h>
20
21#define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1)
22
23struct regulator_voltage {
24 int min_uV;
25 int max_uV;
26};
27
Mark Brown0cdfcc02013-09-11 13:15:40 +010028/*
29 * struct regulator
30 *
31 * One for each consumer device.
Chunyan Zhangc360a6d2018-01-26 21:08:44 +080032 * @voltage - a voltage array for each state of runtime, i.e.:
33 * PM_SUSPEND_ON
34 * PM_SUSPEND_TO_IDLE
35 * PM_SUSPEND_STANDBY
36 * PM_SUSPEND_MEM
37 * PM_SUSPEND_MAX
Mark Brown0cdfcc02013-09-11 13:15:40 +010038 */
39struct regulator {
40 struct device *dev;
41 struct list_head list;
42 unsigned int always_on:1;
43 unsigned int bypass:1;
44 int uA_load;
Chunyan Zhangc360a6d2018-01-26 21:08:44 +080045 struct regulator_voltage voltage[REGULATOR_STATES_NUM];
Stephen Boyd0630b612017-03-16 18:07:14 -070046 const char *supply_name;
Mark Brown0cdfcc02013-09-11 13:15:40 +010047 struct device_attribute dev_attr;
48 struct regulator_dev *rdev;
49 struct dentry *debugfs;
50};
51
Mark Brownef126a42014-09-10 15:17:01 +010052#ifdef CONFIG_OF
Mark Browna0c7b162014-09-09 23:13:57 +010053struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
54 const struct regulator_desc *desc,
Krzysztof Kozlowskibfa21a02015-01-05 12:48:42 +010055 struct regulator_config *config,
Mark Browna0c7b162014-09-09 23:13:57 +010056 struct device_node **node);
Mark Brownef126a42014-09-10 15:17:01 +010057#else
58static inline struct regulator_init_data *
59regulator_of_get_init_data(struct device *dev,
60 const struct regulator_desc *desc,
Krzysztof Kozlowskibfa21a02015-01-05 12:48:42 +010061 struct regulator_config *config,
Mark Brownef126a42014-09-10 15:17:01 +010062 struct device_node **node)
63{
64 return NULL;
65}
66#endif
Mark Browna0c7b162014-09-09 23:13:57 +010067
Dmitry Torokhova8bd42a2017-02-03 13:56:02 -080068enum regulator_get_type {
69 NORMAL_GET,
70 EXCLUSIVE_GET,
71 OPTIONAL_GET,
72 MAX_GET_TYPE
73};
74
75struct regulator *_regulator_get(struct device *dev, const char *id,
76 enum regulator_get_type get_type);
77
Mark Brown0cdfcc02013-09-11 13:15:40 +010078#endif