aboutsummaryrefslogtreecommitdiff
path: root/include/linux/regulator/machine.h
blob: 4d4b8ac3cab8ec3e3cc68d9ff07538e6c96433e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * machine.h -- SoC Regulator support, machine/board driver API.
 *
 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
 *
 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Regulator Machine/Board Interface.
 */

#ifndef __LINUX_REGULATOR_MACHINE_H_
#define __LINUX_REGULATOR_MACHINE_H_

#include <linux/regulator/consumer.h>
#include <linux/suspend.h>

struct regulator;


#define REGULATOR_CHANGE_VOLTAGE	0x1
#define REGULATOR_CHANGE_CURRENT	0x2
#define REGULATOR_CHANGE_MODE		0x4
#define REGULATOR_CHANGE_STATUS		0x8
#define REGULATOR_CHANGE_DRMS		0x10

struct regulator_state {
	int uV;	
	unsigned int mode; 
	int enabled; 
	int disabled; 
};

struct regulation_constraints {

	const char *name;

	
	int min_uV;
	int max_uV;

	int uV_offset;

	
	int min_uA;
	int max_uA;

	
	unsigned int valid_modes_mask;

	
	unsigned int valid_ops_mask;

	
	int input_uV;

	
	struct regulator_state state_disk;
	struct regulator_state state_mem;
	struct regulator_state state_standby;
	suspend_state_t initial_state; 

	
	unsigned int initial_mode;

	
	unsigned always_on:1;	
	unsigned boot_on:1;	
	unsigned apply_uV:1;	
};

struct regulator_consumer_supply {
	const char *dev_name;   
	const char *supply;	
};

#define REGULATOR_SUPPLY(_name, _dev_name)			\
{								\
	.supply		= _name,				\
	.dev_name	= _dev_name,				\
}

struct regulator_init_data {
	const char *supply_regulator;        

	struct regulation_constraints constraints;

	int num_consumer_supplies;
	struct regulator_consumer_supply *consumer_supplies;

	
	int (*regulator_init)(void *driver_data);
	void *driver_data;	
};

int regulator_suspend_prepare(suspend_state_t state);
int regulator_suspend_finish(void);

#ifdef CONFIG_REGULATOR
void regulator_has_full_constraints(void);
void regulator_use_dummy_regulator(void);
void regulator_suppress_info_printing(void);
#else
static inline void regulator_has_full_constraints(void)
{
}

static inline void regulator_use_dummy_regulator(void)
{
}

static inline void regulator_suppress_info_printing(void)
{
}
#endif

#endif