diff options
Diffstat (limited to 'Documentation/power/regulator/consumer.txt')
-rw-r--r-- | Documentation/power/regulator/consumer.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt index 55c4175d8099..81c0e2b49cd8 100644 --- a/Documentation/power/regulator/consumer.txt +++ b/Documentation/power/regulator/consumer.txt | |||
@@ -180,3 +180,38 @@ int regulator_unregister_notifier(struct regulator *regulator, | |||
180 | 180 | ||
181 | Regulators use the kernel notifier framework to send event to their interested | 181 | Regulators use the kernel notifier framework to send event to their interested |
182 | consumers. | 182 | consumers. |
183 | |||
184 | 7. Regulator Direct Register Access | ||
185 | =================================== | ||
186 | Some kinds of power management hardware or firmware are designed such that | ||
187 | they need to do low-level hardware access to regulators, with no involvement | ||
188 | from the kernel. Examples of such devices are: | ||
189 | |||
190 | - clocksource with a voltage-controlled oscillator and control logic to change | ||
191 | the supply voltage over I2C to achieve a desired output clock rate | ||
192 | - thermal management firmware that can issue an arbitrary I2C transaction to | ||
193 | perform system poweroff during overtemperature conditions | ||
194 | |||
195 | To set up such a device/firmware, various parameters like I2C address of the | ||
196 | regulator, addresses of various regulator registers etc. need to be configured | ||
197 | to it. The regulator framework provides the following helpers for querying | ||
198 | these details. | ||
199 | |||
200 | Bus-specific details, like I2C addresses or transfer rates are handled by the | ||
201 | regmap framework. To get the regulator's regmap (if supported), use :- | ||
202 | |||
203 | struct regmap *regulator_get_regmap(struct regulator *regulator); | ||
204 | |||
205 | To obtain the hardware register offset and bitmask for the regulator's voltage | ||
206 | selector register, use :- | ||
207 | |||
208 | int regulator_get_hardware_vsel_register(struct regulator *regulator, | ||
209 | unsigned *vsel_reg, | ||
210 | unsigned *vsel_mask); | ||
211 | |||
212 | To convert a regulator framework voltage selector code (used by | ||
213 | regulator_list_voltage) to a hardware-specific voltage selector that can be | ||
214 | directly written to the voltage selector register, use :- | ||
215 | |||
216 | int regulator_list_hardware_vsel(struct regulator *regulator, | ||
217 | unsigned selector); | ||