diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 13:39:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 13:39:20 -0400 |
commit | 18b34b9546dc192d978dda940673f40928d2e36e (patch) | |
tree | ca396840ed95fc46cd360c68bf2cefe5ab4cbda8 /include/linux | |
parent | ca1ee219c070eab755712d50638bbcd1f8630fc1 (diff) | |
parent | d6bb69cfa88b8ac9f952de4fada5b216d5ba8830 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: (32 commits)
regulator: twl4030 VAUX3 supports 3.0V
regulator: Support disabling of unused regulators by machines
regulator: Don't increment use_count for boot_on regulators
twl4030-regulator: expose VPLL2
regulator: refcount fixes
regulator: Don't warn if we failed to get a regulator
regulator: Allow boot_on regulators to be disabled by clients
regulator: Implement list_voltage for WM835x LDOs and DCDCs
twl4030-regulator: list more VAUX4 voltages
regulator: Don't warn on omitted voltage constraints
regulator: Implement list_voltage() for WM8400 DCDCs and LDOs
MMC: regulator utilities
regulator: twl4030 voltage enumeration (v2)
regulator: twl4030 regulators
regulator: get_status() grows kerneldoc
regulator: enumerate voltages (v2)
regulator: Fix get_mode() for WM835x DCDCs
regulator: Allow regulators to set the initial operating mode
regulator: Suggest use of datasheet supply or pin names for consumers
regulator: email - update email address and regulator webpage.
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/i2c/twl4030.h | 47 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 5 | ||||
-rw-r--r-- | include/linux/regulator/bq24022.h | 3 | ||||
-rw-r--r-- | include/linux/regulator/consumer.h | 6 | ||||
-rw-r--r-- | include/linux/regulator/driver.h | 81 | ||||
-rw-r--r-- | include/linux/regulator/fixed.h | 3 | ||||
-rw-r--r-- | include/linux/regulator/machine.h | 12 |
7 files changed, 144 insertions, 13 deletions
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index 8137f660a5cc..0dc80ef24975 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h | |||
@@ -218,6 +218,53 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | |||
218 | 218 | ||
219 | /*----------------------------------------------------------------------*/ | 219 | /*----------------------------------------------------------------------*/ |
220 | 220 | ||
221 | /* Power bus message definitions */ | ||
222 | |||
223 | #define DEV_GRP_NULL 0x0 | ||
224 | #define DEV_GRP_P1 0x1 | ||
225 | #define DEV_GRP_P2 0x2 | ||
226 | #define DEV_GRP_P3 0x4 | ||
227 | |||
228 | #define RES_GRP_RES 0x0 | ||
229 | #define RES_GRP_PP 0x1 | ||
230 | #define RES_GRP_RC 0x2 | ||
231 | #define RES_GRP_PP_RC 0x3 | ||
232 | #define RES_GRP_PR 0x4 | ||
233 | #define RES_GRP_PP_PR 0x5 | ||
234 | #define RES_GRP_RC_PR 0x6 | ||
235 | #define RES_GRP_ALL 0x7 | ||
236 | |||
237 | #define RES_TYPE2_R0 0x0 | ||
238 | |||
239 | #define RES_TYPE_ALL 0x7 | ||
240 | |||
241 | #define RES_STATE_WRST 0xF | ||
242 | #define RES_STATE_ACTIVE 0xE | ||
243 | #define RES_STATE_SLEEP 0x8 | ||
244 | #define RES_STATE_OFF 0x0 | ||
245 | |||
246 | /* | ||
247 | * Power Bus Message Format ... these can be sent individually by Linux, | ||
248 | * but are usually part of downloaded scripts that are run when various | ||
249 | * power events are triggered. | ||
250 | * | ||
251 | * Broadcast Message (16 Bits): | ||
252 | * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4] | ||
253 | * RES_STATE[3:0] | ||
254 | * | ||
255 | * Singular Message (16 Bits): | ||
256 | * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0] | ||
257 | */ | ||
258 | |||
259 | #define MSG_BROADCAST(devgrp, grp, type, type2, state) \ | ||
260 | ( (devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \ | ||
261 | | (type) << 4 | (state)) | ||
262 | |||
263 | #define MSG_SINGULAR(devgrp, id, state) \ | ||
264 | ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) | ||
265 | |||
266 | /*----------------------------------------------------------------------*/ | ||
267 | |||
221 | struct twl4030_bci_platform_data { | 268 | struct twl4030_bci_platform_data { |
222 | int *battery_tmp_tbl; | 269 | int *battery_tmp_tbl; |
223 | unsigned int tblsize; | 270 | unsigned int tblsize; |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4e457256bd33..3e7615e9087e 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -192,5 +192,10 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host) | |||
192 | wake_up_process(host->sdio_irq_thread); | 192 | wake_up_process(host->sdio_irq_thread); |
193 | } | 193 | } |
194 | 194 | ||
195 | struct regulator; | ||
196 | |||
197 | int mmc_regulator_get_ocrmask(struct regulator *supply); | ||
198 | int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); | ||
199 | |||
195 | #endif | 200 | #endif |
196 | 201 | ||
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h index e84b0a9feda5..a6d014005d49 100644 --- a/include/linux/regulator/bq24022.h +++ b/include/linux/regulator/bq24022.h | |||
@@ -10,6 +10,8 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | struct regulator_init_data; | ||
14 | |||
13 | /** | 15 | /** |
14 | * bq24022_mach_info - platform data for bq24022 | 16 | * bq24022_mach_info - platform data for bq24022 |
15 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | 17 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging |
@@ -18,4 +20,5 @@ | |||
18 | struct bq24022_mach_info { | 20 | struct bq24022_mach_info { |
19 | int gpio_nce; | 21 | int gpio_nce; |
20 | int gpio_iset2; | 22 | int gpio_iset2; |
23 | struct regulator_init_data *init_data; | ||
21 | }; | 24 | }; |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 801bf77ff4e2..277f4b964df5 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | 4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. |
5 | * | 5 | * |
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 6 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -88,6 +88,7 @@ | |||
88 | * FAIL Regulator output has failed. | 88 | * FAIL Regulator output has failed. |
89 | * OVER_TEMP Regulator over temp. | 89 | * OVER_TEMP Regulator over temp. |
90 | * FORCE_DISABLE Regulator shut down by software. | 90 | * FORCE_DISABLE Regulator shut down by software. |
91 | * VOLTAGE_CHANGE Regulator voltage changed. | ||
91 | * | 92 | * |
92 | * NOTE: These events can be OR'ed together when passed into handler. | 93 | * NOTE: These events can be OR'ed together when passed into handler. |
93 | */ | 94 | */ |
@@ -98,6 +99,7 @@ | |||
98 | #define REGULATOR_EVENT_FAIL 0x08 | 99 | #define REGULATOR_EVENT_FAIL 0x08 |
99 | #define REGULATOR_EVENT_OVER_TEMP 0x10 | 100 | #define REGULATOR_EVENT_OVER_TEMP 0x10 |
100 | #define REGULATOR_EVENT_FORCE_DISABLE 0x20 | 101 | #define REGULATOR_EVENT_FORCE_DISABLE 0x20 |
102 | #define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 | ||
101 | 103 | ||
102 | struct regulator; | 104 | struct regulator; |
103 | 105 | ||
@@ -140,6 +142,8 @@ int regulator_bulk_disable(int num_consumers, | |||
140 | void regulator_bulk_free(int num_consumers, | 142 | void regulator_bulk_free(int num_consumers, |
141 | struct regulator_bulk_data *consumers); | 143 | struct regulator_bulk_data *consumers); |
142 | 144 | ||
145 | int regulator_count_voltages(struct regulator *regulator); | ||
146 | int regulator_list_voltage(struct regulator *regulator, unsigned selector); | ||
143 | int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); | 147 | int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); |
144 | int regulator_get_voltage(struct regulator *regulator); | 148 | int regulator_get_voltage(struct regulator *regulator); |
145 | int regulator_set_current_limit(struct regulator *regulator, | 149 | int regulator_set_current_limit(struct regulator *regulator, |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 2dae05705f13..4848d8dacd90 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | 4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. |
5 | * | 5 | * |
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 6 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -21,25 +21,38 @@ | |||
21 | struct regulator_dev; | 21 | struct regulator_dev; |
22 | struct regulator_init_data; | 22 | struct regulator_init_data; |
23 | 23 | ||
24 | enum regulator_status { | ||
25 | REGULATOR_STATUS_OFF, | ||
26 | REGULATOR_STATUS_ON, | ||
27 | REGULATOR_STATUS_ERROR, | ||
28 | /* fast/normal/idle/standby are flavors of "on" */ | ||
29 | REGULATOR_STATUS_FAST, | ||
30 | REGULATOR_STATUS_NORMAL, | ||
31 | REGULATOR_STATUS_IDLE, | ||
32 | REGULATOR_STATUS_STANDBY, | ||
33 | }; | ||
34 | |||
24 | /** | 35 | /** |
25 | * struct regulator_ops - regulator operations. | 36 | * struct regulator_ops - regulator operations. |
26 | * | 37 | * |
27 | * This struct describes regulator operations which can be implemented by | 38 | * @enable: Configure the regulator as enabled. |
28 | * regulator chip drivers. | 39 | * @disable: Configure the regulator as disabled. |
29 | * | ||
30 | * @enable: Enable the regulator. | ||
31 | * @disable: Disable the regulator. | ||
32 | * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. | 40 | * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. |
33 | * | 41 | * |
34 | * @set_voltage: Set the voltage for the regulator within the range specified. | 42 | * @set_voltage: Set the voltage for the regulator within the range specified. |
35 | * The driver should select the voltage closest to min_uV. | 43 | * The driver should select the voltage closest to min_uV. |
36 | * @get_voltage: Return the currently configured voltage for the regulator. | 44 | * @get_voltage: Return the currently configured voltage for the regulator. |
45 | * @list_voltage: Return one of the supported voltages, in microvolts; zero | ||
46 | * if the selector indicates a voltage that is unusable on this system; | ||
47 | * or negative errno. Selectors range from zero to one less than | ||
48 | * regulator_desc.n_voltages. Voltages may be reported in any order. | ||
37 | * | 49 | * |
38 | * @set_current_limit: Configure a limit for a current-limited regulator. | 50 | * @set_current_limit: Configure a limit for a current-limited regulator. |
39 | * @get_current_limit: Get the limit for a current-limited regulator. | 51 | * @get_current_limit: Get the configured limit for a current-limited regulator. |
40 | * | 52 | * |
41 | * @set_mode: Set the operating mode for the regulator. | 53 | * @get_mode: Get the configured operating mode for the regulator. |
42 | * @get_mode: Get the current operating mode for the regulator. | 54 | * @get_status: Return actual (not as-configured) status of regulator, as a |
55 | * REGULATOR_STATUS value (or negative errno) | ||
43 | * @get_optimum_mode: Get the most efficient operating mode for the regulator | 56 | * @get_optimum_mode: Get the most efficient operating mode for the regulator |
44 | * when running with the specified parameters. | 57 | * when running with the specified parameters. |
45 | * | 58 | * |
@@ -51,9 +64,15 @@ struct regulator_init_data; | |||
51 | * suspended. | 64 | * suspended. |
52 | * @set_suspend_mode: Set the operating mode for the regulator when the | 65 | * @set_suspend_mode: Set the operating mode for the regulator when the |
53 | * system is suspended. | 66 | * system is suspended. |
67 | * | ||
68 | * This struct describes regulator operations which can be implemented by | ||
69 | * regulator chip drivers. | ||
54 | */ | 70 | */ |
55 | struct regulator_ops { | 71 | struct regulator_ops { |
56 | 72 | ||
73 | /* enumerate supported voltages */ | ||
74 | int (*list_voltage) (struct regulator_dev *, unsigned selector); | ||
75 | |||
57 | /* get/set regulator voltage */ | 76 | /* get/set regulator voltage */ |
58 | int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV); | 77 | int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV); |
59 | int (*get_voltage) (struct regulator_dev *); | 78 | int (*get_voltage) (struct regulator_dev *); |
@@ -72,6 +91,13 @@ struct regulator_ops { | |||
72 | int (*set_mode) (struct regulator_dev *, unsigned int mode); | 91 | int (*set_mode) (struct regulator_dev *, unsigned int mode); |
73 | unsigned int (*get_mode) (struct regulator_dev *); | 92 | unsigned int (*get_mode) (struct regulator_dev *); |
74 | 93 | ||
94 | /* report regulator status ... most other accessors report | ||
95 | * control inputs, this reports results of combining inputs | ||
96 | * from Linux (and other sources) with the actual load. | ||
97 | * returns REGULATOR_STATUS_* or negative errno. | ||
98 | */ | ||
99 | int (*get_status)(struct regulator_dev *); | ||
100 | |||
75 | /* get most efficient regulator operating mode for load */ | 101 | /* get most efficient regulator operating mode for load */ |
76 | unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, | 102 | unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, |
77 | int output_uV, int load_uA); | 103 | int output_uV, int load_uA); |
@@ -106,6 +132,7 @@ enum regulator_type { | |||
106 | * | 132 | * |
107 | * @name: Identifying name for the regulator. | 133 | * @name: Identifying name for the regulator. |
108 | * @id: Numerical identifier for the regulator. | 134 | * @id: Numerical identifier for the regulator. |
135 | * @n_voltages: Number of selectors available for ops.list_voltage(). | ||
109 | * @ops: Regulator operations table. | 136 | * @ops: Regulator operations table. |
110 | * @irq: Interrupt number for the regulator. | 137 | * @irq: Interrupt number for the regulator. |
111 | * @type: Indicates if the regulator is a voltage or current regulator. | 138 | * @type: Indicates if the regulator is a voltage or current regulator. |
@@ -114,14 +141,48 @@ enum regulator_type { | |||
114 | struct regulator_desc { | 141 | struct regulator_desc { |
115 | const char *name; | 142 | const char *name; |
116 | int id; | 143 | int id; |
144 | unsigned n_voltages; | ||
117 | struct regulator_ops *ops; | 145 | struct regulator_ops *ops; |
118 | int irq; | 146 | int irq; |
119 | enum regulator_type type; | 147 | enum regulator_type type; |
120 | struct module *owner; | 148 | struct module *owner; |
121 | }; | 149 | }; |
122 | 150 | ||
151 | /* | ||
152 | * struct regulator_dev | ||
153 | * | ||
154 | * Voltage / Current regulator class device. One for each | ||
155 | * regulator. | ||
156 | * | ||
157 | * This should *not* be used directly by anything except the regulator | ||
158 | * core and notification injection (which should take the mutex and do | ||
159 | * no other direct access). | ||
160 | */ | ||
161 | struct regulator_dev { | ||
162 | struct regulator_desc *desc; | ||
163 | int use_count; | ||
164 | |||
165 | /* lists we belong to */ | ||
166 | struct list_head list; /* list of all regulators */ | ||
167 | struct list_head slist; /* list of supplied regulators */ | ||
168 | |||
169 | /* lists we own */ | ||
170 | struct list_head consumer_list; /* consumers we supply */ | ||
171 | struct list_head supply_list; /* regulators we supply */ | ||
172 | |||
173 | struct blocking_notifier_head notifier; | ||
174 | struct mutex mutex; /* consumer lock */ | ||
175 | struct module *owner; | ||
176 | struct device dev; | ||
177 | struct regulation_constraints *constraints; | ||
178 | struct regulator_dev *supply; /* for tree */ | ||
179 | |||
180 | void *reg_data; /* regulator_dev data */ | ||
181 | }; | ||
182 | |||
123 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 183 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
124 | struct device *dev, void *driver_data); | 184 | struct device *dev, struct regulator_init_data *init_data, |
185 | void *driver_data); | ||
125 | void regulator_unregister(struct regulator_dev *rdev); | 186 | void regulator_unregister(struct regulator_dev *rdev); |
126 | 187 | ||
127 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | 188 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index 1387a5d2190e..91b4da31f1b5 100644 --- a/include/linux/regulator/fixed.h +++ b/include/linux/regulator/fixed.h | |||
@@ -14,9 +14,12 @@ | |||
14 | #ifndef __REGULATOR_FIXED_H | 14 | #ifndef __REGULATOR_FIXED_H |
15 | #define __REGULATOR_FIXED_H | 15 | #define __REGULATOR_FIXED_H |
16 | 16 | ||
17 | struct regulator_init_data; | ||
18 | |||
17 | struct fixed_voltage_config { | 19 | struct fixed_voltage_config { |
18 | const char *supply_name; | 20 | const char *supply_name; |
19 | int microvolts; | 21 | int microvolts; |
22 | struct regulator_init_data *init_data; | ||
20 | }; | 23 | }; |
21 | 24 | ||
22 | #endif | 25 | #endif |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 3794773b23d2..bac64fa390f2 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. | 4 | * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. |
5 | * | 5 | * |
6 | * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 6 | * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -73,7 +73,9 @@ struct regulator_state { | |||
73 | * | 73 | * |
74 | * @always_on: Set if the regulator should never be disabled. | 74 | * @always_on: Set if the regulator should never be disabled. |
75 | * @boot_on: Set if the regulator is enabled when the system is initially | 75 | * @boot_on: Set if the regulator is enabled when the system is initially |
76 | * started. | 76 | * started. If the regulator is not enabled by the hardware or |
77 | * bootloader then it will be enabled when the constraints are | ||
78 | * applied. | ||
77 | * @apply_uV: Apply the voltage constraint when initialising. | 79 | * @apply_uV: Apply the voltage constraint when initialising. |
78 | * | 80 | * |
79 | * @input_uV: Input voltage for regulator when supplied by another regulator. | 81 | * @input_uV: Input voltage for regulator when supplied by another regulator. |
@@ -83,6 +85,7 @@ struct regulator_state { | |||
83 | * @state_standby: State for regulator when system is suspended in standby | 85 | * @state_standby: State for regulator when system is suspended in standby |
84 | * mode. | 86 | * mode. |
85 | * @initial_state: Suspend state to set by default. | 87 | * @initial_state: Suspend state to set by default. |
88 | * @initial_mode: Mode to set at startup. | ||
86 | */ | 89 | */ |
87 | struct regulation_constraints { | 90 | struct regulation_constraints { |
88 | 91 | ||
@@ -111,6 +114,9 @@ struct regulation_constraints { | |||
111 | struct regulator_state state_standby; | 114 | struct regulator_state state_standby; |
112 | suspend_state_t initial_state; /* suspend state to set at init */ | 115 | suspend_state_t initial_state; /* suspend state to set at init */ |
113 | 116 | ||
117 | /* mode to set on startup */ | ||
118 | unsigned int initial_mode; | ||
119 | |||
114 | /* constriant flags */ | 120 | /* constriant flags */ |
115 | unsigned always_on:1; /* regulator never off when system is on */ | 121 | unsigned always_on:1; /* regulator never off when system is on */ |
116 | unsigned boot_on:1; /* bootloader/firmware enabled regulator */ | 122 | unsigned boot_on:1; /* bootloader/firmware enabled regulator */ |
@@ -160,4 +166,6 @@ struct regulator_init_data { | |||
160 | 166 | ||
161 | int regulator_suspend_prepare(suspend_state_t state); | 167 | int regulator_suspend_prepare(suspend_state_t state); |
162 | 168 | ||
169 | void regulator_has_full_constraints(void); | ||
170 | |||
163 | #endif | 171 | #endif |