1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="regulator-api">
6 <bookinfo>
7  <title>Voltage and current regulator API</title>
8
9  <authorgroup>
10   <author>
11    <firstname>Liam</firstname>
12    <surname>Girdwood</surname>
13    <affiliation>
14     <address>
15      <email>lrg@slimlogic.co.uk</email>
16     </address>
17    </affiliation>
18   </author>
19   <author>
20    <firstname>Mark</firstname>
21    <surname>Brown</surname>
22    <affiliation>
23     <orgname>Wolfson Microelectronics</orgname>
24     <address>
25      <email>broonie@opensource.wolfsonmicro.com</email>
26     </address>
27    </affiliation>
28   </author>
29  </authorgroup>
30
31  <copyright>
32   <year>2007-2008</year>
33   <holder>Wolfson Microelectronics</holder>
34  </copyright>
35  <copyright>
36   <year>2008</year>
37   <holder>Liam Girdwood</holder>
38  </copyright>
39
40  <legalnotice>
41   <para>
42     This documentation is free software; you can redistribute
43     it and/or modify it under the terms of the GNU General Public
44     License version 2 as published by the Free Software Foundation.
45   </para>
46
47   <para>
48     This program is distributed in the hope that it will be
49     useful, but WITHOUT ANY WARRANTY; without even the implied
50     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
51     See the GNU General Public License for more details.
52   </para>
53
54   <para>
55     You should have received a copy of the GNU General Public
56     License along with this program; if not, write to the Free
57     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
58     MA 02111-1307 USA
59   </para>
60
61   <para>
62     For more details see the file COPYING in the source
63     distribution of Linux.
64   </para>
65  </legalnotice>
66 </bookinfo>
67
68<toc></toc>
69
70  <chapter id="intro">
71    <title>Introduction</title>
72    <para>
73	This framework is designed to provide a standard kernel
74	interface to control voltage and current regulators.
75    </para>
76    <para>
77	The intention is to allow systems to dynamically control
78	regulator power output in order to save power and prolong
79	battery life.  This applies to both voltage regulators (where
80	voltage output is controllable) and current sinks (where current
81	limit is controllable).
82    </para>
83    <para>
84	Note that additional (and currently more complete) documentation
85	is available in the Linux kernel source under
86	<filename>Documentation/power/regulator</filename>.
87    </para>
88
89    <sect1 id="glossary">
90       <title>Glossary</title>
91       <para>
92	The regulator API uses a number of terms which may not be
93	familiar:
94       </para>
95       <glossary>
96
97         <glossentry>
98	   <glossterm>Regulator</glossterm>
99	   <glossdef>
100	     <para>
101	Electronic device that supplies power to other devices.  Most
102	regulators can enable and disable their output and some can also
103	control their output voltage or current.
104	     </para>
105	   </glossdef>
106         </glossentry>
107
108	 <glossentry>
109	   <glossterm>Consumer</glossterm>
110	   <glossdef>
111	     <para>
112	Electronic device which consumes power provided by a regulator.
113	These may either be static, requiring only a fixed supply, or
114	dynamic, requiring active management of the regulator at
115	runtime.
116	     </para>
117	   </glossdef>
118	 </glossentry>
119
120	 <glossentry>
121	   <glossterm>Power Domain</glossterm>
122	   <glossdef>
123	     <para>
124	The electronic circuit supplied by a given regulator, including
125	the regulator and all consumer devices.  The configuration of
126	the regulator is shared between all the components in the
127	circuit.
128	     </para>
129	   </glossdef>
130	 </glossentry>
131
132	 <glossentry>
133	   <glossterm>Power Management Integrated Circuit</glossterm>
134	   <acronym>PMIC</acronym>
135	   <glossdef>
136	     <para>
137	An IC which contains numerous regulators and often also other
138	subsystems.  In an embedded system the primary PMIC is often
139	equivalent to a combination of the PSU and southbridge in a
140	desktop system.
141	     </para>
142	   </glossdef>
143	 </glossentry>
144	</glossary>
145     </sect1>
146  </chapter>
147
148  <chapter id="consumer">
149     <title>Consumer driver interface</title>
150     <para>
151       This offers a similar API to the kernel clock framework.
152       Consumer drivers use <link
153       linkend='API-regulator-get'>get</link> and <link
154       linkend='API-regulator-put'>put</link> operations to acquire and
155       release regulators.  Functions are
156       provided to <link linkend='API-regulator-enable'>enable</link>
157       and <link linkend='API-regulator-disable'>disable</link> the
158       regulator and to get and set the runtime parameters of the
159       regulator.
160     </para>
161     <para>
162       When requesting regulators consumers use symbolic names for their
163       supplies, such as "Vcc", which are mapped into actual regulator
164       devices by the machine interface.
165     </para>
166     <para>
167	A stub version of this API is provided when the regulator
168	framework is not in use in order to minimise the need to use
169	ifdefs.
170     </para>
171
172     <sect1 id="consumer-enable">
173       <title>Enabling and disabling</title>
174       <para>
175         The regulator API provides reference counted enabling and
176	 disabling of regulators. Consumer devices use the <function><link
177	 linkend='API-regulator-enable'>regulator_enable</link></function>
178	 and <function><link
179	 linkend='API-regulator-disable'>regulator_disable</link>
180	 </function> functions to enable and disable regulators.  Calls
181	 to the two functions must be balanced.
182       </para>
183       <para>
184         Note that since multiple consumers may be using a regulator and
185	 machine constraints may not allow the regulator to be disabled
186	 there is no guarantee that calling
187	 <function>regulator_disable</function> will actually cause the
188	 supply provided by the regulator to be disabled. Consumer
189	 drivers should assume that the regulator may be enabled at all
190	 times.
191       </para>
192     </sect1>
193
194     <sect1 id="consumer-config">
195       <title>Configuration</title>
196       <para>
197         Some consumer devices may need to be able to dynamically
198	 configure their supplies.  For example, MMC drivers may need to
199	 select the correct operating voltage for their cards.  This may
200	 be done while the regulator is enabled or disabled.
201       </para>
202       <para>
203	 The <function><link
204	 linkend='API-regulator-set-voltage'>regulator_set_voltage</link>
205	 </function> and <function><link
206	 linkend='API-regulator-set-current-limit'
207	 >regulator_set_current_limit</link>
208	 </function> functions provide the primary interface for this.
209	 Both take ranges of voltages and currents, supporting drivers
210	 that do not require a specific value (eg, CPU frequency scaling
211	 normally permits the CPU to use a wider range of supply
212	 voltages at lower frequencies but does not require that the
213	 supply voltage be lowered).  Where an exact value is required
214	 both minimum and maximum values should be identical.
215       </para>
216     </sect1>
217
218     <sect1 id="consumer-callback">
219       <title>Callbacks</title>
220       <para>
221	  Callbacks may also be <link
222	  linkend='API-regulator-register-notifier'>registered</link>
223	  for events such as regulation failures.
224       </para>
225     </sect1>
226   </chapter>
227
228   <chapter id="driver">
229     <title>Regulator driver interface</title>
230     <para>
231       Drivers for regulator chips <link
232       linkend='API-regulator-register'>register</link> the regulators
233       with the regulator core, providing operations structures to the
234       core.  A <link
235       linkend='API-regulator-notifier-call-chain'>notifier</link> interface
236       allows error conditions to be reported to the core.
237     </para>
238     <para>
239       Registration should be triggered by explicit setup done by the
240       platform, supplying a <link
241       linkend='API-struct-regulator-init-data'>struct
242       regulator_init_data</link> for the regulator containing
243       <link linkend='machine-constraint'>constraint</link> and
244       <link linkend='machine-supply'>supply</link> information.
245     </para>
246   </chapter>
247
248   <chapter id="machine">
249     <title>Machine interface</title>
250     <para>
251       This interface provides a way to define how regulators are
252       connected to consumers on a given system and what the valid
253       operating parameters are for the system.
254     </para>
255
256     <sect1 id="machine-supply">
257       <title>Supplies</title>
258       <para>
259         Regulator supplies are specified using <link
260	 linkend='API-struct-regulator-consumer-supply'>struct
261	 regulator_consumer_supply</link>.  This is done at
262	 <link linkend='driver'>driver registration
263	 time</link> as part of the machine constraints.
264       </para>
265     </sect1>
266
267     <sect1 id="machine-constraint">
268       <title>Constraints</title>
269       <para>
270	 As well as defining the connections the machine interface
271	 also provides constraints defining the operations that
272	 clients are allowed to perform and the parameters that may be
273	 set.  This is required since generally regulator devices will
274	 offer more flexibility than it is safe to use on a given
275	 system, for example supporting higher supply voltages than the
276	 consumers are rated for.
277       </para>
278       <para>
279	 This is done at <link linkend='driver'>driver
280	 registration time</link> by providing a <link
281	 linkend='API-struct-regulation-constraints'>struct
282	 regulation_constraints</link>.
283       </para>
284       <para>
285         The constraints may also specify an initial configuration for the
286         regulator in the constraints, which is particularly useful for
287         use with static consumers.
288       </para>
289     </sect1>
290  </chapter>
291
292  <chapter id="api">
293    <title>API reference</title>
294    <para>
295      Due to limitations of the kernel documentation framework and the
296      existing layout of the source code the entire regulator API is
297      documented here.
298    </para>
299<!-- include/linux/regulator/consumer.h -->
300<refentry id="API-struct-pre-voltage-change-data">
301<refentryinfo>
302 <title>LINUX</title>
303 <productname>Kernel Hackers Manual</productname>
304 <date>July 2017</date>
305</refentryinfo>
306<refmeta>
307 <refentrytitle><phrase>struct pre_voltage_change_data</phrase></refentrytitle>
308 <manvolnum>9</manvolnum>
309 <refmiscinfo class="version">4.1.27</refmiscinfo>
310</refmeta>
311<refnamediv>
312 <refname>struct pre_voltage_change_data</refname>
313 <refpurpose>
314  Data sent with PRE_VOLTAGE_CHANGE event
315 </refpurpose>
316</refnamediv>
317<refsynopsisdiv>
318 <title>Synopsis</title>
319  <programlisting>
320struct pre_voltage_change_data {
321  unsigned long old_uV;
322  unsigned long min_uV;
323  unsigned long max_uV;
324};  </programlisting>
325</refsynopsisdiv>
326 <refsect1>
327  <title>Members</title>
328  <variablelist>
329    <varlistentry>      <term>old_uV</term>
330      <listitem><para>
331Current voltage before change.
332      </para></listitem>
333    </varlistentry>
334    <varlistentry>      <term>min_uV</term>
335      <listitem><para>
336Min voltage we'll change to.
337      </para></listitem>
338    </varlistentry>
339    <varlistentry>      <term>max_uV</term>
340      <listitem><para>
341Max voltage we'll change to.
342      </para></listitem>
343    </varlistentry>
344  </variablelist>
345 </refsect1>
346</refentry>
347
348<refentry id="API-struct-regulator-bulk-data">
349<refentryinfo>
350 <title>LINUX</title>
351 <productname>Kernel Hackers Manual</productname>
352 <date>July 2017</date>
353</refentryinfo>
354<refmeta>
355 <refentrytitle><phrase>struct regulator_bulk_data</phrase></refentrytitle>
356 <manvolnum>9</manvolnum>
357 <refmiscinfo class="version">4.1.27</refmiscinfo>
358</refmeta>
359<refnamediv>
360 <refname>struct regulator_bulk_data</refname>
361 <refpurpose>
362     Data used for bulk regulator operations.
363 </refpurpose>
364</refnamediv>
365<refsynopsisdiv>
366 <title>Synopsis</title>
367  <programlisting>
368struct regulator_bulk_data {
369  const char * supply;
370  struct regulator * consumer;
371};  </programlisting>
372</refsynopsisdiv>
373 <refsect1>
374  <title>Members</title>
375  <variablelist>
376    <varlistentry>      <term>supply</term>
377      <listitem><para>
378   The name of the supply.  Initialised by the user before
379   using the bulk regulator APIs.
380      </para></listitem>
381    </varlistentry>
382    <varlistentry>      <term>consumer</term>
383      <listitem><para>
384   The regulator consumer for the supply.  This will be managed
385   by the bulk API.
386      </para></listitem>
387    </varlistentry>
388  </variablelist>
389 </refsect1>
390<refsect1>
391<title>Description</title>
392<para>
393   The regulator APIs provide a series of <function>regulator_bulk_</function> API calls as
394   a convenience to consumers which require multiple supplies.  This
395   structure is used to manage data for these calls.
396</para>
397</refsect1>
398</refentry>
399
400<!-- include/linux/regulator/machine.h -->
401<refentry id="API-struct-regulator-state">
402<refentryinfo>
403 <title>LINUX</title>
404 <productname>Kernel Hackers Manual</productname>
405 <date>July 2017</date>
406</refentryinfo>
407<refmeta>
408 <refentrytitle><phrase>struct regulator_state</phrase></refentrytitle>
409 <manvolnum>9</manvolnum>
410 <refmiscinfo class="version">4.1.27</refmiscinfo>
411</refmeta>
412<refnamediv>
413 <refname>struct regulator_state</refname>
414 <refpurpose>
415  regulator state during low power system states
416 </refpurpose>
417</refnamediv>
418<refsynopsisdiv>
419 <title>Synopsis</title>
420  <programlisting>
421struct regulator_state {
422  int uV;
423  unsigned int mode;
424  int enabled;
425  int disabled;
426};  </programlisting>
427</refsynopsisdiv>
428 <refsect1>
429  <title>Members</title>
430  <variablelist>
431    <varlistentry>      <term>uV</term>
432      <listitem><para>
433Operating voltage during suspend.
434      </para></listitem>
435    </varlistentry>
436    <varlistentry>      <term>mode</term>
437      <listitem><para>
438Operating mode during suspend.
439      </para></listitem>
440    </varlistentry>
441    <varlistentry>      <term>enabled</term>
442      <listitem><para>
443Enabled during suspend.
444      </para></listitem>
445    </varlistentry>
446    <varlistentry>      <term>disabled</term>
447      <listitem><para>
448Disabled during suspend.
449      </para></listitem>
450    </varlistentry>
451  </variablelist>
452 </refsect1>
453<refsect1>
454<title>Description</title>
455<para>
456   </para><para>
457
458   This describes a regulators state during a system wide low power
459   state.  One of enabled or disabled must be set for the
460   configuration to be applied.
461</para>
462</refsect1>
463</refentry>
464
465<refentry id="API-struct-regulation-constraints">
466<refentryinfo>
467 <title>LINUX</title>
468 <productname>Kernel Hackers Manual</productname>
469 <date>July 2017</date>
470</refentryinfo>
471<refmeta>
472 <refentrytitle><phrase>struct regulation_constraints</phrase></refentrytitle>
473 <manvolnum>9</manvolnum>
474 <refmiscinfo class="version">4.1.27</refmiscinfo>
475</refmeta>
476<refnamediv>
477 <refname>struct regulation_constraints</refname>
478 <refpurpose>
479     regulator operating constraints.
480 </refpurpose>
481</refnamediv>
482<refsynopsisdiv>
483 <title>Synopsis</title>
484  <programlisting>
485struct regulation_constraints {
486  const char * name;
487  int min_uV;
488  int max_uV;
489  int uV_offset;
490  int min_uA;
491  int max_uA;
492  unsigned int valid_modes_mask;
493  unsigned int valid_ops_mask;
494  int input_uV;
495  struct regulator_state state_disk;
496  struct regulator_state state_mem;
497  struct regulator_state state_standby;
498  suspend_state_t initial_state;
499  unsigned int initial_mode;
500  unsigned int ramp_delay;
501  unsigned int enable_time;
502  unsigned always_on:1;
503  unsigned boot_on:1;
504  unsigned apply_uV:1;
505  unsigned ramp_disable:1;
506};  </programlisting>
507</refsynopsisdiv>
508 <refsect1>
509  <title>Members</title>
510  <variablelist>
511    <varlistentry>      <term>name</term>
512      <listitem><para>
513   Descriptive name for the constraints, used for display purposes.
514      </para></listitem>
515    </varlistentry>
516    <varlistentry>      <term>min_uV</term>
517      <listitem><para>
518   Smallest voltage consumers may set.
519      </para></listitem>
520    </varlistentry>
521    <varlistentry>      <term>max_uV</term>
522      <listitem><para>
523   Largest voltage consumers may set.
524      </para></listitem>
525    </varlistentry>
526    <varlistentry>      <term>uV_offset</term>
527      <listitem><para>
528   Offset applied to voltages from consumer to compensate for
529   voltage drops.
530      </para></listitem>
531    </varlistentry>
532    <varlistentry>      <term>min_uA</term>
533      <listitem><para>
534   Smallest current consumers may set.
535      </para></listitem>
536    </varlistentry>
537    <varlistentry>      <term>max_uA</term>
538      <listitem><para>
539   Largest current consumers may set.
540      </para></listitem>
541    </varlistentry>
542    <varlistentry>      <term>valid_modes_mask</term>
543      <listitem><para>
544   Mask of modes which may be configured by consumers.
545      </para></listitem>
546    </varlistentry>
547    <varlistentry>      <term>valid_ops_mask</term>
548      <listitem><para>
549   Operations which may be performed by consumers.
550      </para></listitem>
551    </varlistentry>
552    <varlistentry>      <term>input_uV</term>
553      <listitem><para>
554   Input voltage for regulator when supplied by another regulator.
555      </para></listitem>
556    </varlistentry>
557    <varlistentry>      <term>state_disk</term>
558      <listitem><para>
559   State for regulator when system is suspended in disk mode.
560      </para></listitem>
561    </varlistentry>
562    <varlistentry>      <term>state_mem</term>
563      <listitem><para>
564   State for regulator when system is suspended in mem mode.
565      </para></listitem>
566    </varlistentry>
567    <varlistentry>      <term>state_standby</term>
568      <listitem><para>
569   State for regulator when system is suspended in standby
570   mode.
571      </para></listitem>
572    </varlistentry>
573    <varlistentry>      <term>initial_state</term>
574      <listitem><para>
575   Suspend state to set by default.
576      </para></listitem>
577    </varlistentry>
578    <varlistentry>      <term>initial_mode</term>
579      <listitem><para>
580   Mode to set at startup.
581      </para></listitem>
582    </varlistentry>
583    <varlistentry>      <term>ramp_delay</term>
584      <listitem><para>
585   Time to settle down after voltage change (unit: uV/us)
586      </para></listitem>
587    </varlistentry>
588    <varlistentry>      <term>enable_time</term>
589      <listitem><para>
590   Turn-on time of the rails (unit: microseconds)
591      </para></listitem>
592    </varlistentry>
593    <varlistentry>      <term>always_on</term>
594      <listitem><para>
595   Set if the regulator should never be disabled.
596      </para></listitem>
597    </varlistentry>
598    <varlistentry>      <term>boot_on</term>
599      <listitem><para>
600   Set if the regulator is enabled when the system is initially
601   started.  If the regulator is not enabled by the hardware or
602   bootloader then it will be enabled when the constraints are
603   applied.
604      </para></listitem>
605    </varlistentry>
606    <varlistentry>      <term>apply_uV</term>
607      <listitem><para>
608   Apply the voltage constraint when initialising.
609      </para></listitem>
610    </varlistentry>
611    <varlistentry>      <term>ramp_disable</term>
612      <listitem><para>
613   Disable ramp delay when initialising or when setting voltage.
614      </para></listitem>
615    </varlistentry>
616  </variablelist>
617 </refsect1>
618<refsect1>
619<title>Description</title>
620<para>
621   </para><para>
622
623   This struct describes regulator and board/machine specific constraints.
624</para>
625</refsect1>
626</refentry>
627
628<refentry id="API-struct-regulator-consumer-supply">
629<refentryinfo>
630 <title>LINUX</title>
631 <productname>Kernel Hackers Manual</productname>
632 <date>July 2017</date>
633</refentryinfo>
634<refmeta>
635 <refentrytitle><phrase>struct regulator_consumer_supply</phrase></refentrytitle>
636 <manvolnum>9</manvolnum>
637 <refmiscinfo class="version">4.1.27</refmiscinfo>
638</refmeta>
639<refnamediv>
640 <refname>struct regulator_consumer_supply</refname>
641 <refpurpose>
642     supply -&gt; device mapping
643 </refpurpose>
644</refnamediv>
645<refsynopsisdiv>
646 <title>Synopsis</title>
647  <programlisting>
648struct regulator_consumer_supply {
649  const char * dev_name;
650  const char * supply;
651};  </programlisting>
652</refsynopsisdiv>
653 <refsect1>
654  <title>Members</title>
655  <variablelist>
656    <varlistentry>      <term>dev_name</term>
657      <listitem><para>
658   Result of <function>dev_name</function> for the consumer.
659      </para></listitem>
660    </varlistentry>
661    <varlistentry>      <term>supply</term>
662      <listitem><para>
663   Name for the supply.
664      </para></listitem>
665    </varlistentry>
666  </variablelist>
667 </refsect1>
668<refsect1>
669<title>Description</title>
670<para>
671   </para><para>
672
673   This maps a supply name to a device. Use of dev_name allows support for
674   buses which make struct device available late such as I2C.
675</para>
676</refsect1>
677</refentry>
678
679<refentry id="API-struct-regulator-init-data">
680<refentryinfo>
681 <title>LINUX</title>
682 <productname>Kernel Hackers Manual</productname>
683 <date>July 2017</date>
684</refentryinfo>
685<refmeta>
686 <refentrytitle><phrase>struct regulator_init_data</phrase></refentrytitle>
687 <manvolnum>9</manvolnum>
688 <refmiscinfo class="version">4.1.27</refmiscinfo>
689</refmeta>
690<refnamediv>
691 <refname>struct regulator_init_data</refname>
692 <refpurpose>
693     regulator platform initialisation data.
694 </refpurpose>
695</refnamediv>
696<refsynopsisdiv>
697 <title>Synopsis</title>
698  <programlisting>
699struct regulator_init_data {
700  const char * supply_regulator;
701  struct regulation_constraints constraints;
702  int num_consumer_supplies;
703  struct regulator_consumer_supply * consumer_supplies;
704  int (* regulator_init) (void *driver_data);
705  void * driver_data;
706};  </programlisting>
707</refsynopsisdiv>
708 <refsect1>
709  <title>Members</title>
710  <variablelist>
711    <varlistentry>      <term>supply_regulator</term>
712      <listitem><para>
713   Parent regulator.  Specified using the regulator name
714   as it appears in the name field in sysfs, which can
715   be explicitly set using the constraints field 'name'.
716      </para></listitem>
717    </varlistentry>
718    <varlistentry>      <term>constraints</term>
719      <listitem><para>
720   Constraints.  These must be specified for the regulator to
721   be usable.
722      </para></listitem>
723    </varlistentry>
724    <varlistentry>      <term>num_consumer_supplies</term>
725      <listitem><para>
726   Number of consumer device supplies.
727      </para></listitem>
728    </varlistentry>
729    <varlistentry>      <term>consumer_supplies</term>
730      <listitem><para>
731   Consumer device supply configuration.
732      </para></listitem>
733    </varlistentry>
734    <varlistentry>      <term>regulator_init</term>
735      <listitem><para>
736   Callback invoked when the regulator has been registered.
737      </para></listitem>
738    </varlistentry>
739    <varlistentry>      <term>driver_data</term>
740      <listitem><para>
741   Data passed to regulator_init.
742      </para></listitem>
743    </varlistentry>
744  </variablelist>
745 </refsect1>
746<refsect1>
747<title>Description</title>
748<para>
749   </para><para>
750
751   Initialisation constraints, our supply and consumers supplies.
752</para>
753</refsect1>
754</refentry>
755
756<!-- include/linux/regulator/driver.h -->
757<refentry id="API-struct-regulator-linear-range">
758<refentryinfo>
759 <title>LINUX</title>
760 <productname>Kernel Hackers Manual</productname>
761 <date>July 2017</date>
762</refentryinfo>
763<refmeta>
764 <refentrytitle><phrase>struct regulator_linear_range</phrase></refentrytitle>
765 <manvolnum>9</manvolnum>
766 <refmiscinfo class="version">4.1.27</refmiscinfo>
767</refmeta>
768<refnamediv>
769 <refname>struct regulator_linear_range</refname>
770 <refpurpose>
771  specify linear voltage ranges
772 </refpurpose>
773</refnamediv>
774<refsynopsisdiv>
775 <title>Synopsis</title>
776  <programlisting>
777struct regulator_linear_range {
778  unsigned int min_uV;
779  unsigned int min_sel;
780  unsigned int max_sel;
781  unsigned int uV_step;
782};  </programlisting>
783</refsynopsisdiv>
784 <refsect1>
785  <title>Members</title>
786  <variablelist>
787    <varlistentry>      <term>min_uV</term>
788      <listitem><para>
789Lowest voltage in range
790      </para></listitem>
791    </varlistentry>
792    <varlistentry>      <term>min_sel</term>
793      <listitem><para>
794Lowest selector for range
795      </para></listitem>
796    </varlistentry>
797    <varlistentry>      <term>max_sel</term>
798      <listitem><para>
799Highest selector for range
800      </para></listitem>
801    </varlistentry>
802    <varlistentry>      <term>uV_step</term>
803      <listitem><para>
804Step size
805      </para></listitem>
806    </varlistentry>
807  </variablelist>
808 </refsect1>
809<refsect1>
810<title>Description</title>
811<para>
812   </para><para>
813
814   Specify a range of voltages for <function>regulator_map_linar_range</function> and
815   <function>regulator_list_linear_range</function>.
816</para>
817</refsect1>
818</refentry>
819
820<refentry id="API-struct-regulator-ops">
821<refentryinfo>
822 <title>LINUX</title>
823 <productname>Kernel Hackers Manual</productname>
824 <date>July 2017</date>
825</refentryinfo>
826<refmeta>
827 <refentrytitle><phrase>struct regulator_ops</phrase></refentrytitle>
828 <manvolnum>9</manvolnum>
829 <refmiscinfo class="version">4.1.27</refmiscinfo>
830</refmeta>
831<refnamediv>
832 <refname>struct regulator_ops</refname>
833 <refpurpose>
834     regulator operations.
835 </refpurpose>
836</refnamediv>
837<refsynopsisdiv>
838 <title>Synopsis</title>
839  <programlisting>
840struct regulator_ops {
841  int (* list_voltage) (struct regulator_dev *, unsigned selector);
842  int (* set_voltage) (struct regulator_dev *, int min_uV, int max_uV,unsigned *selector);
843  int (* map_voltage) (struct regulator_dev *, int min_uV, int max_uV);
844  int (* set_voltage_sel) (struct regulator_dev *, unsigned selector);
845  int (* get_voltage) (struct regulator_dev *);
846  int (* get_voltage_sel) (struct regulator_dev *);
847  int (* set_current_limit) (struct regulator_dev *,int min_uA, int max_uA);
848  int (* get_current_limit) (struct regulator_dev *);
849  int (* enable) (struct regulator_dev *);
850  int (* disable) (struct regulator_dev *);
851  int (* is_enabled) (struct regulator_dev *);
852  int (* set_mode) (struct regulator_dev *, unsigned int mode);
853  unsigned int (* get_mode) (struct regulator_dev *);
854  int (* enable_time) (struct regulator_dev *);
855  int (* set_ramp_delay) (struct regulator_dev *, int ramp_delay);
856  int (* set_voltage_time_sel) (struct regulator_dev *,unsigned int old_selector,unsigned int new_selector);
857  int (* get_status) (struct regulator_dev *);
858  unsigned int (* get_optimum_mode) (struct regulator_dev *, int input_uV,int output_uV, int load_uA);
859  int (* set_load) (struct regulator_dev *, int load_uA);
860  int (* set_bypass) (struct regulator_dev *dev, bool enable);
861  int (* get_bypass) (struct regulator_dev *dev, bool *enable);
862  int (* set_suspend_voltage) (struct regulator_dev *, int uV);
863  int (* set_suspend_enable) (struct regulator_dev *);
864  int (* set_suspend_disable) (struct regulator_dev *);
865  int (* set_suspend_mode) (struct regulator_dev *, unsigned int mode);
866};  </programlisting>
867</refsynopsisdiv>
868 <refsect1>
869  <title>Members</title>
870  <variablelist>
871    <varlistentry>      <term>list_voltage</term>
872      <listitem><para>
873   Return one of the supported voltages, in microvolts; zero
874   if the selector indicates a voltage that is unusable on this system;
875   or negative errno.  Selectors range from zero to one less than
876   regulator_desc.n_voltages.  Voltages may be reported in any order.
877      </para></listitem>
878    </varlistentry>
879    <varlistentry>      <term>set_voltage</term>
880      <listitem><para>
881   Set the voltage for the regulator within the range specified.
882   The driver should select the voltage closest to min_uV.
883      </para></listitem>
884    </varlistentry>
885    <varlistentry>      <term>map_voltage</term>
886      <listitem><para>
887   Convert a voltage into a selector
888      </para></listitem>
889    </varlistentry>
890    <varlistentry>      <term>set_voltage_sel</term>
891      <listitem><para>
892   Set the voltage for the regulator using the specified
893   selector.
894      </para></listitem>
895    </varlistentry>
896    <varlistentry>      <term>get_voltage</term>
897      <listitem><para>
898   Return the currently configured voltage for the regulator.
899      </para></listitem>
900    </varlistentry>
901    <varlistentry>      <term>get_voltage_sel</term>
902      <listitem><para>
903   Return the currently configured voltage selector for the
904   regulator.
905      </para></listitem>
906    </varlistentry>
907    <varlistentry>      <term>set_current_limit</term>
908      <listitem><para>
909   Configure a limit for a current-limited regulator.
910   The driver should select the current closest to max_uA.
911      </para></listitem>
912    </varlistentry>
913    <varlistentry>      <term>get_current_limit</term>
914      <listitem><para>
915   Get the configured limit for a current-limited regulator.
916      </para></listitem>
917    </varlistentry>
918    <varlistentry>      <term>enable</term>
919      <listitem><para>
920   Configure the regulator as enabled.
921      </para></listitem>
922    </varlistentry>
923    <varlistentry>      <term>disable</term>
924      <listitem><para>
925   Configure the regulator as disabled.
926      </para></listitem>
927    </varlistentry>
928    <varlistentry>      <term>is_enabled</term>
929      <listitem><para>
930   Return 1 if the regulator is enabled, 0 if not.
931   May also return negative errno.
932      </para></listitem>
933    </varlistentry>
934    <varlistentry>      <term>set_mode</term>
935      <listitem><para>
936   Set the configured operating mode for the regulator.
937      </para></listitem>
938    </varlistentry>
939    <varlistentry>      <term>get_mode</term>
940      <listitem><para>
941   Get the configured operating mode for the regulator.
942      </para></listitem>
943    </varlistentry>
944    <varlistentry>      <term>enable_time</term>
945      <listitem><para>
946   Time taken for the regulator voltage output voltage to
947   stabilise after being enabled, in microseconds.
948      </para></listitem>
949    </varlistentry>
950    <varlistentry>      <term>set_ramp_delay</term>
951      <listitem><para>
952   Set the ramp delay for the regulator. The driver should
953   select ramp delay equal to or less than(closest) ramp_delay.
954      </para></listitem>
955    </varlistentry>
956    <varlistentry>      <term>set_voltage_time_sel</term>
957      <listitem><para>
958   Time taken for the regulator voltage output voltage
959   to stabilise after being set to a new value, in microseconds.
960   The function provides the from and to voltage selector, the
961   function should return the worst case.
962      </para></listitem>
963    </varlistentry>
964    <varlistentry>      <term>get_status</term>
965      <listitem><para>
966   Return actual (not as-configured) status of regulator, as a
967   REGULATOR_STATUS value (or negative errno)
968      </para></listitem>
969    </varlistentry>
970    <varlistentry>      <term>get_optimum_mode</term>
971      <listitem><para>
972   Get the most efficient operating mode for the regulator
973   when running with the specified parameters.
974      </para></listitem>
975    </varlistentry>
976    <varlistentry>      <term>set_load</term>
977      <listitem><para>
978   Set the load for the regulator.
979      </para></listitem>
980    </varlistentry>
981    <varlistentry>      <term>set_bypass</term>
982      <listitem><para>
983   Set the regulator in bypass mode.
984      </para></listitem>
985    </varlistentry>
986    <varlistentry>      <term>get_bypass</term>
987      <listitem><para>
988   Get the regulator bypass mode state.
989      </para></listitem>
990    </varlistentry>
991    <varlistentry>      <term>set_suspend_voltage</term>
992      <listitem><para>
993   Set the voltage for the regulator when the system
994   is suspended.
995      </para></listitem>
996    </varlistentry>
997    <varlistentry>      <term>set_suspend_enable</term>
998      <listitem><para>
999   Mark the regulator as enabled when the system is
1000   suspended.
1001      </para></listitem>
1002    </varlistentry>
1003    <varlistentry>      <term>set_suspend_disable</term>
1004      <listitem><para>
1005   Mark the regulator as disabled when the system is
1006   suspended.
1007      </para></listitem>
1008    </varlistentry>
1009    <varlistentry>      <term>set_suspend_mode</term>
1010      <listitem><para>
1011   Set the operating mode for the regulator when the
1012   system is suspended.
1013      </para></listitem>
1014    </varlistentry>
1015  </variablelist>
1016 </refsect1>
1017<refsect1>
1018<title>Description</title>
1019<para>
1020   This struct describes regulator operations which can be implemented by
1021   regulator chip drivers.
1022</para>
1023</refsect1>
1024</refentry>
1025
1026<refentry id="API-struct-regulator-desc">
1027<refentryinfo>
1028 <title>LINUX</title>
1029 <productname>Kernel Hackers Manual</productname>
1030 <date>July 2017</date>
1031</refentryinfo>
1032<refmeta>
1033 <refentrytitle><phrase>struct regulator_desc</phrase></refentrytitle>
1034 <manvolnum>9</manvolnum>
1035 <refmiscinfo class="version">4.1.27</refmiscinfo>
1036</refmeta>
1037<refnamediv>
1038 <refname>struct regulator_desc</refname>
1039 <refpurpose>
1040     Static regulator descriptor
1041 </refpurpose>
1042</refnamediv>
1043<refsynopsisdiv>
1044 <title>Synopsis</title>
1045  <programlisting>
1046struct regulator_desc {
1047  const char * name;
1048  const char * supply_name;
1049  const char * of_match;
1050  const char * regulators_node;
1051  int (* of_parse_cb) (struct device_node *,const struct regulator_desc *,struct regulator_config *);
1052  int id;
1053  bool continuous_voltage_range;
1054  unsigned n_voltages;
1055  const struct regulator_ops * ops;
1056  int irq;
1057  enum regulator_type type;
1058  struct module * owner;
1059  unsigned int min_uV;
1060  unsigned int uV_step;
1061  unsigned int linear_min_sel;
1062  int fixed_uV;
1063  unsigned int ramp_delay;
1064  const struct regulator_linear_range * linear_ranges;
1065  int n_linear_ranges;
1066  const unsigned int * volt_table;
1067  unsigned int vsel_reg;
1068  unsigned int vsel_mask;
1069  unsigned int apply_reg;
1070  unsigned int apply_bit;
1071  unsigned int enable_reg;
1072  unsigned int enable_mask;
1073  unsigned int enable_val;
1074  unsigned int disable_val;
1075  bool enable_is_inverted;
1076  unsigned int bypass_reg;
1077  unsigned int bypass_mask;
1078  unsigned int bypass_val_on;
1079  unsigned int bypass_val_off;
1080  unsigned int enable_time;
1081  unsigned int off_on_delay;
1082  unsigned int (* of_map_mode) (unsigned int mode);
1083};  </programlisting>
1084</refsynopsisdiv>
1085 <refsect1>
1086  <title>Members</title>
1087  <variablelist>
1088    <varlistentry>      <term>name</term>
1089      <listitem><para>
1090   Identifying name for the regulator.
1091      </para></listitem>
1092    </varlistentry>
1093    <varlistentry>      <term>supply_name</term>
1094      <listitem><para>
1095   Identifying the regulator supply
1096      </para></listitem>
1097    </varlistentry>
1098    <varlistentry>      <term>of_match</term>
1099      <listitem><para>
1100   Name used to identify regulator in DT.
1101      </para></listitem>
1102    </varlistentry>
1103    <varlistentry>      <term>regulators_node</term>
1104      <listitem><para>
1105   Name of node containing regulator definitions in DT.
1106      </para></listitem>
1107    </varlistentry>
1108    <varlistentry>      <term>of_parse_cb</term>
1109      <listitem><para>
1110   Optional callback called only if of_match is present.
1111   Will be called for each regulator parsed from DT, during
1112   init_data parsing.
1113   The regulator_config passed as argument to the callback will
1114   be a copy of config passed to regulator_register, valid only
1115   for this particular call. Callback may freely change the
1116   config but it cannot store it for later usage.
1117   Callback should return 0 on success or negative ERRNO
1118   indicating failure.
1119      </para></listitem>
1120    </varlistentry>
1121    <varlistentry>      <term>id</term>
1122      <listitem><para>
1123   Numerical identifier for the regulator.
1124      </para></listitem>
1125    </varlistentry>
1126    <varlistentry>      <term>continuous_voltage_range</term>
1127      <listitem><para>
1128   Indicates if the regulator can set any
1129   voltage within constrains range.
1130      </para></listitem>
1131    </varlistentry>
1132    <varlistentry>      <term>n_voltages</term>
1133      <listitem><para>
1134   Number of selectors available for ops.<function>list_voltage</function>.
1135      </para></listitem>
1136    </varlistentry>
1137    <varlistentry>      <term>ops</term>
1138      <listitem><para>
1139   Regulator operations table.
1140      </para></listitem>
1141    </varlistentry>
1142    <varlistentry>      <term>irq</term>
1143      <listitem><para>
1144   Interrupt number for the regulator.
1145      </para></listitem>
1146    </varlistentry>
1147    <varlistentry>      <term>type</term>
1148      <listitem><para>
1149   Indicates if the regulator is a voltage or current regulator.
1150      </para></listitem>
1151    </varlistentry>
1152    <varlistentry>      <term>owner</term>
1153      <listitem><para>
1154   Module providing the regulator, used for refcounting.
1155      </para></listitem>
1156    </varlistentry>
1157    <varlistentry>      <term>min_uV</term>
1158      <listitem><para>
1159   Voltage given by the lowest selector (if linear mapping)
1160      </para></listitem>
1161    </varlistentry>
1162    <varlistentry>      <term>uV_step</term>
1163      <listitem><para>
1164   Voltage increase with each selector (if linear mapping)
1165      </para></listitem>
1166    </varlistentry>
1167    <varlistentry>      <term>linear_min_sel</term>
1168      <listitem><para>
1169   Minimal selector for starting linear mapping
1170      </para></listitem>
1171    </varlistentry>
1172    <varlistentry>      <term>fixed_uV</term>
1173      <listitem><para>
1174   Fixed voltage of rails.
1175      </para></listitem>
1176    </varlistentry>
1177    <varlistentry>      <term>ramp_delay</term>
1178      <listitem><para>
1179   Time to settle down after voltage change (unit: uV/us)
1180      </para></listitem>
1181    </varlistentry>
1182    <varlistentry>      <term>linear_ranges</term>
1183      <listitem><para>
1184   A constant table of possible voltage ranges.
1185      </para></listitem>
1186    </varlistentry>
1187    <varlistentry>      <term>n_linear_ranges</term>
1188      <listitem><para>
1189   Number of entries in the <parameter>linear_ranges</parameter> table.
1190      </para></listitem>
1191    </varlistentry>
1192    <varlistentry>      <term>volt_table</term>
1193      <listitem><para>
1194   Voltage mapping table (if table based mapping)
1195      </para></listitem>
1196    </varlistentry>
1197    <varlistentry>      <term>vsel_reg</term>
1198      <listitem><para>
1199   Register for selector when using regulator_regmap_X_voltage_
1200      </para></listitem>
1201    </varlistentry>
1202    <varlistentry>      <term>vsel_mask</term>
1203      <listitem><para>
1204   Mask for register bitfield used for selector
1205      </para></listitem>
1206    </varlistentry>
1207    <varlistentry>      <term>apply_reg</term>
1208      <listitem><para>
1209   Register for initiate voltage change on the output when
1210   using regulator_set_voltage_sel_regmap
1211      </para></listitem>
1212    </varlistentry>
1213    <varlistentry>      <term>apply_bit</term>
1214      <listitem><para>
1215   Register bitfield used for initiate voltage change on the
1216   output when using regulator_set_voltage_sel_regmap
1217      </para></listitem>
1218    </varlistentry>
1219    <varlistentry>      <term>enable_reg</term>
1220      <listitem><para>
1221   Register for control when using regmap enable/disable ops
1222      </para></listitem>
1223    </varlistentry>
1224    <varlistentry>      <term>enable_mask</term>
1225      <listitem><para>
1226   Mask for control when using regmap enable/disable ops
1227      </para></listitem>
1228    </varlistentry>
1229    <varlistentry>      <term>enable_val</term>
1230      <listitem><para>
1231   Enabling value for control when using regmap enable/disable ops
1232      </para></listitem>
1233    </varlistentry>
1234    <varlistentry>      <term>disable_val</term>
1235      <listitem><para>
1236   Disabling value for control when using regmap enable/disable ops
1237      </para></listitem>
1238    </varlistentry>
1239    <varlistentry>      <term>enable_is_inverted</term>
1240      <listitem><para>
1241   A flag to indicate set enable_mask bits to disable
1242   when using regulator_enable_regmap and friends APIs.
1243      </para></listitem>
1244    </varlistentry>
1245    <varlistentry>      <term>bypass_reg</term>
1246      <listitem><para>
1247   Register for control when using regmap set_bypass
1248      </para></listitem>
1249    </varlistentry>
1250    <varlistentry>      <term>bypass_mask</term>
1251      <listitem><para>
1252   Mask for control when using regmap set_bypass
1253      </para></listitem>
1254    </varlistentry>
1255    <varlistentry>      <term>bypass_val_on</term>
1256      <listitem><para>
1257   Enabling value for control when using regmap set_bypass
1258      </para></listitem>
1259    </varlistentry>
1260    <varlistentry>      <term>bypass_val_off</term>
1261      <listitem><para>
1262   Disabling value for control when using regmap set_bypass
1263      </para></listitem>
1264    </varlistentry>
1265    <varlistentry>      <term>enable_time</term>
1266      <listitem><para>
1267   Time taken for initial enable of regulator (in uS).
1268      </para></listitem>
1269    </varlistentry>
1270    <varlistentry>      <term>off_on_delay</term>
1271      <listitem><para>
1272   guard time (in uS), before re-enabling a regulator
1273      </para></listitem>
1274    </varlistentry>
1275    <varlistentry>      <term>of_map_mode</term>
1276      <listitem><para>
1277   Maps a hardware mode defined in a DeviceTree to a standard mode
1278      </para></listitem>
1279    </varlistentry>
1280  </variablelist>
1281 </refsect1>
1282<refsect1>
1283<title>Description</title>
1284<para>
1285   </para><para>
1286
1287   Each regulator registered with the core is described with a
1288   structure of this type and a struct regulator_config.  This
1289   structure contains the non-varying parts of the regulator
1290   description.
1291</para>
1292</refsect1>
1293</refentry>
1294
1295<refentry id="API-struct-regulator-config">
1296<refentryinfo>
1297 <title>LINUX</title>
1298 <productname>Kernel Hackers Manual</productname>
1299 <date>July 2017</date>
1300</refentryinfo>
1301<refmeta>
1302 <refentrytitle><phrase>struct regulator_config</phrase></refentrytitle>
1303 <manvolnum>9</manvolnum>
1304 <refmiscinfo class="version">4.1.27</refmiscinfo>
1305</refmeta>
1306<refnamediv>
1307 <refname>struct regulator_config</refname>
1308 <refpurpose>
1309     Dynamic regulator descriptor
1310 </refpurpose>
1311</refnamediv>
1312<refsynopsisdiv>
1313 <title>Synopsis</title>
1314  <programlisting>
1315struct regulator_config {
1316  struct device * dev;
1317  const struct regulator_init_data * init_data;
1318  void * driver_data;
1319  struct device_node * of_node;
1320  struct regmap * regmap;
1321  bool ena_gpio_initialized;
1322  int ena_gpio;
1323  unsigned int ena_gpio_invert:1;
1324  unsigned int ena_gpio_flags;
1325};  </programlisting>
1326</refsynopsisdiv>
1327 <refsect1>
1328  <title>Members</title>
1329  <variablelist>
1330    <varlistentry>      <term>dev</term>
1331      <listitem><para>
1332   struct device for the regulator
1333      </para></listitem>
1334    </varlistentry>
1335    <varlistentry>      <term>init_data</term>
1336      <listitem><para>
1337   platform provided init data, passed through by driver
1338      </para></listitem>
1339    </varlistentry>
1340    <varlistentry>      <term>driver_data</term>
1341      <listitem><para>
1342   private regulator data
1343      </para></listitem>
1344    </varlistentry>
1345    <varlistentry>      <term>of_node</term>
1346      <listitem><para>
1347   OpenFirmware node to parse for device tree bindings (may be
1348   NULL).
1349      </para></listitem>
1350    </varlistentry>
1351    <varlistentry>      <term>regmap</term>
1352      <listitem><para>
1353   regmap to use for core regmap helpers if <function>dev_get_regmap</function> is
1354   insufficient.
1355      </para></listitem>
1356    </varlistentry>
1357    <varlistentry>      <term>ena_gpio_initialized</term>
1358      <listitem><para>
1359   GPIO controlling regulator enable was properly
1360   initialized, meaning that &gt;= 0 is a valid gpio
1361   identifier and &lt; 0 is a non existent gpio.
1362      </para></listitem>
1363    </varlistentry>
1364    <varlistentry>      <term>ena_gpio</term>
1365      <listitem><para>
1366   GPIO controlling regulator enable.
1367      </para></listitem>
1368    </varlistentry>
1369    <varlistentry>      <term>ena_gpio_invert</term>
1370      <listitem><para>
1371   Sense for GPIO enable control.
1372      </para></listitem>
1373    </varlistentry>
1374    <varlistentry>      <term>ena_gpio_flags</term>
1375      <listitem><para>
1376   Flags to use when calling <function>gpio_request_one</function>
1377      </para></listitem>
1378    </varlistentry>
1379  </variablelist>
1380 </refsect1>
1381<refsect1>
1382<title>Description</title>
1383<para>
1384   </para><para>
1385
1386   Each regulator registered with the core is described with a
1387   structure of this type and a struct regulator_desc.  This structure
1388   contains the runtime variable parts of the regulator description.
1389</para>
1390</refsect1>
1391</refentry>
1392
1393<!-- drivers/regulator/core.c -->
1394<refentry id="API-regulator-get">
1395<refentryinfo>
1396 <title>LINUX</title>
1397 <productname>Kernel Hackers Manual</productname>
1398 <date>July 2017</date>
1399</refentryinfo>
1400<refmeta>
1401 <refentrytitle><phrase>regulator_get</phrase></refentrytitle>
1402 <manvolnum>9</manvolnum>
1403 <refmiscinfo class="version">4.1.27</refmiscinfo>
1404</refmeta>
1405<refnamediv>
1406 <refname>regulator_get</refname>
1407 <refpurpose>
1408  lookup and obtain a reference to a regulator.
1409 </refpurpose>
1410</refnamediv>
1411<refsynopsisdiv>
1412 <title>Synopsis</title>
1413  <funcsynopsis><funcprototype>
1414   <funcdef>struct regulator * <function>regulator_get </function></funcdef>
1415   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1416   <paramdef>const char * <parameter>id</parameter></paramdef>
1417  </funcprototype></funcsynopsis>
1418</refsynopsisdiv>
1419<refsect1>
1420 <title>Arguments</title>
1421 <variablelist>
1422  <varlistentry>
1423   <term><parameter>dev</parameter></term>
1424   <listitem>
1425    <para>
1426     device for regulator <quote>consumer</quote>
1427    </para>
1428   </listitem>
1429  </varlistentry>
1430  <varlistentry>
1431   <term><parameter>id</parameter></term>
1432   <listitem>
1433    <para>
1434     Supply name or regulator ID.
1435    </para>
1436   </listitem>
1437  </varlistentry>
1438 </variablelist>
1439</refsect1>
1440<refsect1>
1441<title>Description</title>
1442<para>
1443   Returns a struct regulator corresponding to the regulator producer,
1444   or <function>IS_ERR</function> condition containing errno.
1445   </para><para>
1446
1447   Use of supply names configured via <function>regulator_set_device_supply</function> is
1448   strongly encouraged.  It is recommended that the supply name used
1449   should match the name used for the supply and/or the relevant
1450   device pins in the datasheet.
1451</para>
1452</refsect1>
1453</refentry>
1454
1455<refentry id="API-regulator-get-exclusive">
1456<refentryinfo>
1457 <title>LINUX</title>
1458 <productname>Kernel Hackers Manual</productname>
1459 <date>July 2017</date>
1460</refentryinfo>
1461<refmeta>
1462 <refentrytitle><phrase>regulator_get_exclusive</phrase></refentrytitle>
1463 <manvolnum>9</manvolnum>
1464 <refmiscinfo class="version">4.1.27</refmiscinfo>
1465</refmeta>
1466<refnamediv>
1467 <refname>regulator_get_exclusive</refname>
1468 <refpurpose>
1469     obtain exclusive access to a regulator.
1470 </refpurpose>
1471</refnamediv>
1472<refsynopsisdiv>
1473 <title>Synopsis</title>
1474  <funcsynopsis><funcprototype>
1475   <funcdef>struct regulator * <function>regulator_get_exclusive </function></funcdef>
1476   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1477   <paramdef>const char * <parameter>id</parameter></paramdef>
1478  </funcprototype></funcsynopsis>
1479</refsynopsisdiv>
1480<refsect1>
1481 <title>Arguments</title>
1482 <variablelist>
1483  <varlistentry>
1484   <term><parameter>dev</parameter></term>
1485   <listitem>
1486    <para>
1487     device for regulator <quote>consumer</quote>
1488    </para>
1489   </listitem>
1490  </varlistentry>
1491  <varlistentry>
1492   <term><parameter>id</parameter></term>
1493   <listitem>
1494    <para>
1495     Supply name or regulator ID.
1496    </para>
1497   </listitem>
1498  </varlistentry>
1499 </variablelist>
1500</refsect1>
1501<refsect1>
1502<title>Description</title>
1503<para>
1504   Returns a struct regulator corresponding to the regulator producer,
1505   or <function>IS_ERR</function> condition containing errno.  Other consumers will be
1506   unable to obtain this regulator while this reference is held and the
1507   use count for the regulator will be initialised to reflect the current
1508   state of the regulator.
1509   </para><para>
1510
1511   This is intended for use by consumers which cannot tolerate shared
1512   use of the regulator such as those which need to force the
1513   regulator off for correct operation of the hardware they are
1514   controlling.
1515   </para><para>
1516
1517   Use of supply names configured via <function>regulator_set_device_supply</function> is
1518   strongly encouraged.  It is recommended that the supply name used
1519   should match the name used for the supply and/or the relevant
1520   device pins in the datasheet.
1521</para>
1522</refsect1>
1523</refentry>
1524
1525<refentry id="API-regulator-get-optional">
1526<refentryinfo>
1527 <title>LINUX</title>
1528 <productname>Kernel Hackers Manual</productname>
1529 <date>July 2017</date>
1530</refentryinfo>
1531<refmeta>
1532 <refentrytitle><phrase>regulator_get_optional</phrase></refentrytitle>
1533 <manvolnum>9</manvolnum>
1534 <refmiscinfo class="version">4.1.27</refmiscinfo>
1535</refmeta>
1536<refnamediv>
1537 <refname>regulator_get_optional</refname>
1538 <refpurpose>
1539     obtain optional access to a regulator.
1540 </refpurpose>
1541</refnamediv>
1542<refsynopsisdiv>
1543 <title>Synopsis</title>
1544  <funcsynopsis><funcprototype>
1545   <funcdef>struct regulator * <function>regulator_get_optional </function></funcdef>
1546   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1547   <paramdef>const char * <parameter>id</parameter></paramdef>
1548  </funcprototype></funcsynopsis>
1549</refsynopsisdiv>
1550<refsect1>
1551 <title>Arguments</title>
1552 <variablelist>
1553  <varlistentry>
1554   <term><parameter>dev</parameter></term>
1555   <listitem>
1556    <para>
1557     device for regulator <quote>consumer</quote>
1558    </para>
1559   </listitem>
1560  </varlistentry>
1561  <varlistentry>
1562   <term><parameter>id</parameter></term>
1563   <listitem>
1564    <para>
1565     Supply name or regulator ID.
1566    </para>
1567   </listitem>
1568  </varlistentry>
1569 </variablelist>
1570</refsect1>
1571<refsect1>
1572<title>Description</title>
1573<para>
1574   Returns a struct regulator corresponding to the regulator producer,
1575   or <function>IS_ERR</function> condition containing errno.
1576   </para><para>
1577
1578   This is intended for use by consumers for devices which can have
1579   some supplies unconnected in normal use, such as some MMC devices.
1580   It can allow the regulator core to provide stub supplies for other
1581   supplies requested using normal <function>regulator_get</function> calls without
1582   disrupting the operation of drivers that can handle absent
1583   supplies.
1584   </para><para>
1585
1586   Use of supply names configured via <function>regulator_set_device_supply</function> is
1587   strongly encouraged.  It is recommended that the supply name used
1588   should match the name used for the supply and/or the relevant
1589   device pins in the datasheet.
1590</para>
1591</refsect1>
1592</refentry>
1593
1594<refentry id="API-regulator-put">
1595<refentryinfo>
1596 <title>LINUX</title>
1597 <productname>Kernel Hackers Manual</productname>
1598 <date>July 2017</date>
1599</refentryinfo>
1600<refmeta>
1601 <refentrytitle><phrase>regulator_put</phrase></refentrytitle>
1602 <manvolnum>9</manvolnum>
1603 <refmiscinfo class="version">4.1.27</refmiscinfo>
1604</refmeta>
1605<refnamediv>
1606 <refname>regulator_put</refname>
1607 <refpurpose>
1608     "free" the regulator source
1609 </refpurpose>
1610</refnamediv>
1611<refsynopsisdiv>
1612 <title>Synopsis</title>
1613  <funcsynopsis><funcprototype>
1614   <funcdef>void <function>regulator_put </function></funcdef>
1615   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
1616  </funcprototype></funcsynopsis>
1617</refsynopsisdiv>
1618<refsect1>
1619 <title>Arguments</title>
1620 <variablelist>
1621  <varlistentry>
1622   <term><parameter>regulator</parameter></term>
1623   <listitem>
1624    <para>
1625     regulator source
1626    </para>
1627   </listitem>
1628  </varlistentry>
1629 </variablelist>
1630</refsect1>
1631<refsect1>
1632<title>Note</title>
1633<para>
1634   drivers must ensure that all regulator_enable calls made on this
1635   regulator source are balanced by regulator_disable calls prior to calling
1636   this function.
1637</para>
1638</refsect1>
1639</refentry>
1640
1641<refentry id="API-regulator-register-supply-alias">
1642<refentryinfo>
1643 <title>LINUX</title>
1644 <productname>Kernel Hackers Manual</productname>
1645 <date>July 2017</date>
1646</refentryinfo>
1647<refmeta>
1648 <refentrytitle><phrase>regulator_register_supply_alias</phrase></refentrytitle>
1649 <manvolnum>9</manvolnum>
1650 <refmiscinfo class="version">4.1.27</refmiscinfo>
1651</refmeta>
1652<refnamediv>
1653 <refname>regulator_register_supply_alias</refname>
1654 <refpurpose>
1655     Provide device alias for supply lookup
1656 </refpurpose>
1657</refnamediv>
1658<refsynopsisdiv>
1659 <title>Synopsis</title>
1660  <funcsynopsis><funcprototype>
1661   <funcdef>int <function>regulator_register_supply_alias </function></funcdef>
1662   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1663   <paramdef>const char * <parameter>id</parameter></paramdef>
1664   <paramdef>struct device * <parameter>alias_dev</parameter></paramdef>
1665   <paramdef>const char * <parameter>alias_id</parameter></paramdef>
1666  </funcprototype></funcsynopsis>
1667</refsynopsisdiv>
1668<refsect1>
1669 <title>Arguments</title>
1670 <variablelist>
1671  <varlistentry>
1672   <term><parameter>dev</parameter></term>
1673   <listitem>
1674    <para>
1675     device that will be given as the regulator <quote>consumer</quote>
1676    </para>
1677   </listitem>
1678  </varlistentry>
1679  <varlistentry>
1680   <term><parameter>id</parameter></term>
1681   <listitem>
1682    <para>
1683     Supply name or regulator ID
1684    </para>
1685   </listitem>
1686  </varlistentry>
1687  <varlistentry>
1688   <term><parameter>alias_dev</parameter></term>
1689   <listitem>
1690    <para>
1691     device that should be used to lookup the supply
1692    </para>
1693   </listitem>
1694  </varlistentry>
1695  <varlistentry>
1696   <term><parameter>alias_id</parameter></term>
1697   <listitem>
1698    <para>
1699     Supply name or regulator ID that should be used to lookup the
1700     supply
1701    </para>
1702   </listitem>
1703  </varlistentry>
1704 </variablelist>
1705</refsect1>
1706<refsect1>
1707<title>Description</title>
1708<para>
1709   All lookups for id on dev will instead be conducted for alias_id on
1710   alias_dev.
1711</para>
1712</refsect1>
1713</refentry>
1714
1715<refentry id="API-regulator-unregister-supply-alias">
1716<refentryinfo>
1717 <title>LINUX</title>
1718 <productname>Kernel Hackers Manual</productname>
1719 <date>July 2017</date>
1720</refentryinfo>
1721<refmeta>
1722 <refentrytitle><phrase>regulator_unregister_supply_alias</phrase></refentrytitle>
1723 <manvolnum>9</manvolnum>
1724 <refmiscinfo class="version">4.1.27</refmiscinfo>
1725</refmeta>
1726<refnamediv>
1727 <refname>regulator_unregister_supply_alias</refname>
1728 <refpurpose>
1729     Remove device alias
1730 </refpurpose>
1731</refnamediv>
1732<refsynopsisdiv>
1733 <title>Synopsis</title>
1734  <funcsynopsis><funcprototype>
1735   <funcdef>void <function>regulator_unregister_supply_alias </function></funcdef>
1736   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1737   <paramdef>const char * <parameter>id</parameter></paramdef>
1738  </funcprototype></funcsynopsis>
1739</refsynopsisdiv>
1740<refsect1>
1741 <title>Arguments</title>
1742 <variablelist>
1743  <varlistentry>
1744   <term><parameter>dev</parameter></term>
1745   <listitem>
1746    <para>
1747     device that will be given as the regulator <quote>consumer</quote>
1748    </para>
1749   </listitem>
1750  </varlistentry>
1751  <varlistentry>
1752   <term><parameter>id</parameter></term>
1753   <listitem>
1754    <para>
1755     Supply name or regulator ID
1756    </para>
1757   </listitem>
1758  </varlistentry>
1759 </variablelist>
1760</refsect1>
1761<refsect1>
1762<title>Description</title>
1763<para>
1764   Remove a lookup alias if one exists for id on dev.
1765</para>
1766</refsect1>
1767</refentry>
1768
1769<refentry id="API-regulator-bulk-register-supply-alias">
1770<refentryinfo>
1771 <title>LINUX</title>
1772 <productname>Kernel Hackers Manual</productname>
1773 <date>July 2017</date>
1774</refentryinfo>
1775<refmeta>
1776 <refentrytitle><phrase>regulator_bulk_register_supply_alias</phrase></refentrytitle>
1777 <manvolnum>9</manvolnum>
1778 <refmiscinfo class="version">4.1.27</refmiscinfo>
1779</refmeta>
1780<refnamediv>
1781 <refname>regulator_bulk_register_supply_alias</refname>
1782 <refpurpose>
1783     register multiple aliases
1784 </refpurpose>
1785</refnamediv>
1786<refsynopsisdiv>
1787 <title>Synopsis</title>
1788  <funcsynopsis><funcprototype>
1789   <funcdef>int <function>regulator_bulk_register_supply_alias </function></funcdef>
1790   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1791   <paramdef>const char *const * <parameter>id</parameter></paramdef>
1792   <paramdef>struct device * <parameter>alias_dev</parameter></paramdef>
1793   <paramdef>const char *const * <parameter>alias_id</parameter></paramdef>
1794   <paramdef>int <parameter>num_id</parameter></paramdef>
1795  </funcprototype></funcsynopsis>
1796</refsynopsisdiv>
1797<refsect1>
1798 <title>Arguments</title>
1799 <variablelist>
1800  <varlistentry>
1801   <term><parameter>dev</parameter></term>
1802   <listitem>
1803    <para>
1804     device that will be given as the regulator <quote>consumer</quote>
1805    </para>
1806   </listitem>
1807  </varlistentry>
1808  <varlistentry>
1809   <term><parameter>id</parameter></term>
1810   <listitem>
1811    <para>
1812     List of supply names or regulator IDs
1813    </para>
1814   </listitem>
1815  </varlistentry>
1816  <varlistentry>
1817   <term><parameter>alias_dev</parameter></term>
1818   <listitem>
1819    <para>
1820     device that should be used to lookup the supply
1821    </para>
1822   </listitem>
1823  </varlistentry>
1824  <varlistentry>
1825   <term><parameter>alias_id</parameter></term>
1826   <listitem>
1827    <para>
1828     List of supply names or regulator IDs that should be used to
1829     lookup the supply
1830    </para>
1831   </listitem>
1832  </varlistentry>
1833  <varlistentry>
1834   <term><parameter>num_id</parameter></term>
1835   <listitem>
1836    <para>
1837     Number of aliases to register
1838    </para>
1839   </listitem>
1840  </varlistentry>
1841 </variablelist>
1842</refsect1>
1843<refsect1>
1844<title>Description</title>
1845<para>
1846   <parameter>return</parameter> 0 on success, an errno on failure.
1847   </para><para>
1848
1849   This helper function allows drivers to register several supply
1850   aliases in one operation.  If any of the aliases cannot be
1851   registered any aliases that were registered will be removed
1852   before returning to the caller.
1853</para>
1854</refsect1>
1855</refentry>
1856
1857<refentry id="API-regulator-bulk-unregister-supply-alias">
1858<refentryinfo>
1859 <title>LINUX</title>
1860 <productname>Kernel Hackers Manual</productname>
1861 <date>July 2017</date>
1862</refentryinfo>
1863<refmeta>
1864 <refentrytitle><phrase>regulator_bulk_unregister_supply_alias</phrase></refentrytitle>
1865 <manvolnum>9</manvolnum>
1866 <refmiscinfo class="version">4.1.27</refmiscinfo>
1867</refmeta>
1868<refnamediv>
1869 <refname>regulator_bulk_unregister_supply_alias</refname>
1870 <refpurpose>
1871     unregister multiple aliases
1872 </refpurpose>
1873</refnamediv>
1874<refsynopsisdiv>
1875 <title>Synopsis</title>
1876  <funcsynopsis><funcprototype>
1877   <funcdef>void <function>regulator_bulk_unregister_supply_alias </function></funcdef>
1878   <paramdef>struct device * <parameter>dev</parameter></paramdef>
1879   <paramdef>const char *const * <parameter>id</parameter></paramdef>
1880   <paramdef>int <parameter>num_id</parameter></paramdef>
1881  </funcprototype></funcsynopsis>
1882</refsynopsisdiv>
1883<refsect1>
1884 <title>Arguments</title>
1885 <variablelist>
1886  <varlistentry>
1887   <term><parameter>dev</parameter></term>
1888   <listitem>
1889    <para>
1890     device that will be given as the regulator <quote>consumer</quote>
1891    </para>
1892   </listitem>
1893  </varlistentry>
1894  <varlistentry>
1895   <term><parameter>id</parameter></term>
1896   <listitem>
1897    <para>
1898     List of supply names or regulator IDs
1899    </para>
1900   </listitem>
1901  </varlistentry>
1902  <varlistentry>
1903   <term><parameter>num_id</parameter></term>
1904   <listitem>
1905    <para>
1906     Number of aliases to unregister
1907    </para>
1908   </listitem>
1909  </varlistentry>
1910 </variablelist>
1911</refsect1>
1912<refsect1>
1913<title>Description</title>
1914<para>
1915   This helper function allows drivers to unregister several supply
1916   aliases in one operation.
1917</para>
1918</refsect1>
1919</refentry>
1920
1921<refentry id="API-regulator-enable">
1922<refentryinfo>
1923 <title>LINUX</title>
1924 <productname>Kernel Hackers Manual</productname>
1925 <date>July 2017</date>
1926</refentryinfo>
1927<refmeta>
1928 <refentrytitle><phrase>regulator_enable</phrase></refentrytitle>
1929 <manvolnum>9</manvolnum>
1930 <refmiscinfo class="version">4.1.27</refmiscinfo>
1931</refmeta>
1932<refnamediv>
1933 <refname>regulator_enable</refname>
1934 <refpurpose>
1935     enable regulator output
1936 </refpurpose>
1937</refnamediv>
1938<refsynopsisdiv>
1939 <title>Synopsis</title>
1940  <funcsynopsis><funcprototype>
1941   <funcdef>int <function>regulator_enable </function></funcdef>
1942   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
1943  </funcprototype></funcsynopsis>
1944</refsynopsisdiv>
1945<refsect1>
1946 <title>Arguments</title>
1947 <variablelist>
1948  <varlistentry>
1949   <term><parameter>regulator</parameter></term>
1950   <listitem>
1951    <para>
1952     regulator source
1953    </para>
1954   </listitem>
1955  </varlistentry>
1956 </variablelist>
1957</refsect1>
1958<refsect1>
1959<title>Description</title>
1960<para>
1961   Request that the regulator be enabled with the regulator output at
1962   the predefined voltage or current value.  Calls to <function>regulator_enable</function>
1963   must be balanced with calls to <function>regulator_disable</function>.
1964</para>
1965</refsect1>
1966<refsect1>
1967<title>NOTE</title>
1968<para>
1969   the output value can be set by other drivers, boot loader or may be
1970   hardwired in the regulator.
1971</para>
1972</refsect1>
1973</refentry>
1974
1975<refentry id="API-regulator-disable">
1976<refentryinfo>
1977 <title>LINUX</title>
1978 <productname>Kernel Hackers Manual</productname>
1979 <date>July 2017</date>
1980</refentryinfo>
1981<refmeta>
1982 <refentrytitle><phrase>regulator_disable</phrase></refentrytitle>
1983 <manvolnum>9</manvolnum>
1984 <refmiscinfo class="version">4.1.27</refmiscinfo>
1985</refmeta>
1986<refnamediv>
1987 <refname>regulator_disable</refname>
1988 <refpurpose>
1989     disable regulator output
1990 </refpurpose>
1991</refnamediv>
1992<refsynopsisdiv>
1993 <title>Synopsis</title>
1994  <funcsynopsis><funcprototype>
1995   <funcdef>int <function>regulator_disable </function></funcdef>
1996   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
1997  </funcprototype></funcsynopsis>
1998</refsynopsisdiv>
1999<refsect1>
2000 <title>Arguments</title>
2001 <variablelist>
2002  <varlistentry>
2003   <term><parameter>regulator</parameter></term>
2004   <listitem>
2005    <para>
2006     regulator source
2007    </para>
2008   </listitem>
2009  </varlistentry>
2010 </variablelist>
2011</refsect1>
2012<refsect1>
2013<title>Description</title>
2014<para>
2015   Disable the regulator output voltage or current.  Calls to
2016   <function>regulator_enable</function> must be balanced with calls to
2017   <function>regulator_disable</function>.
2018</para>
2019</refsect1>
2020<refsect1>
2021<title>NOTE</title>
2022<para>
2023   this will only disable the regulator output if no other consumer
2024   devices have it enabled, the regulator device supports disabling and
2025   machine constraints permit this operation.
2026</para>
2027</refsect1>
2028</refentry>
2029
2030<refentry id="API-regulator-force-disable">
2031<refentryinfo>
2032 <title>LINUX</title>
2033 <productname>Kernel Hackers Manual</productname>
2034 <date>July 2017</date>
2035</refentryinfo>
2036<refmeta>
2037 <refentrytitle><phrase>regulator_force_disable</phrase></refentrytitle>
2038 <manvolnum>9</manvolnum>
2039 <refmiscinfo class="version">4.1.27</refmiscinfo>
2040</refmeta>
2041<refnamediv>
2042 <refname>regulator_force_disable</refname>
2043 <refpurpose>
2044     force disable regulator output
2045 </refpurpose>
2046</refnamediv>
2047<refsynopsisdiv>
2048 <title>Synopsis</title>
2049  <funcsynopsis><funcprototype>
2050   <funcdef>int <function>regulator_force_disable </function></funcdef>
2051   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2052  </funcprototype></funcsynopsis>
2053</refsynopsisdiv>
2054<refsect1>
2055 <title>Arguments</title>
2056 <variablelist>
2057  <varlistentry>
2058   <term><parameter>regulator</parameter></term>
2059   <listitem>
2060    <para>
2061     regulator source
2062    </para>
2063   </listitem>
2064  </varlistentry>
2065 </variablelist>
2066</refsect1>
2067<refsect1>
2068<title>Description</title>
2069<para>
2070   Forcibly disable the regulator output voltage or current.
2071</para>
2072</refsect1>
2073<refsect1>
2074<title>NOTE</title>
2075<para>
2076   this *will* disable the regulator output even if other consumer
2077   devices have it enabled. This should be used for situations when device
2078   damage will likely occur if the regulator is not disabled (e.g. over temp).
2079</para>
2080</refsect1>
2081</refentry>
2082
2083<refentry id="API-regulator-disable-deferred">
2084<refentryinfo>
2085 <title>LINUX</title>
2086 <productname>Kernel Hackers Manual</productname>
2087 <date>July 2017</date>
2088</refentryinfo>
2089<refmeta>
2090 <refentrytitle><phrase>regulator_disable_deferred</phrase></refentrytitle>
2091 <manvolnum>9</manvolnum>
2092 <refmiscinfo class="version">4.1.27</refmiscinfo>
2093</refmeta>
2094<refnamediv>
2095 <refname>regulator_disable_deferred</refname>
2096 <refpurpose>
2097     disable regulator output with delay
2098 </refpurpose>
2099</refnamediv>
2100<refsynopsisdiv>
2101 <title>Synopsis</title>
2102  <funcsynopsis><funcprototype>
2103   <funcdef>int <function>regulator_disable_deferred </function></funcdef>
2104   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2105   <paramdef>int <parameter>ms</parameter></paramdef>
2106  </funcprototype></funcsynopsis>
2107</refsynopsisdiv>
2108<refsect1>
2109 <title>Arguments</title>
2110 <variablelist>
2111  <varlistentry>
2112   <term><parameter>regulator</parameter></term>
2113   <listitem>
2114    <para>
2115     regulator source
2116    </para>
2117   </listitem>
2118  </varlistentry>
2119  <varlistentry>
2120   <term><parameter>ms</parameter></term>
2121   <listitem>
2122    <para>
2123     miliseconds until the regulator is disabled
2124    </para>
2125   </listitem>
2126  </varlistentry>
2127 </variablelist>
2128</refsect1>
2129<refsect1>
2130<title>Description</title>
2131<para>
2132   Execute <function>regulator_disable</function> on the regulator after a delay.  This
2133   is intended for use with devices that require some time to quiesce.
2134</para>
2135</refsect1>
2136<refsect1>
2137<title>NOTE</title>
2138<para>
2139   this will only disable the regulator output if no other consumer
2140   devices have it enabled, the regulator device supports disabling and
2141   machine constraints permit this operation.
2142</para>
2143</refsect1>
2144</refentry>
2145
2146<refentry id="API-regulator-is-enabled">
2147<refentryinfo>
2148 <title>LINUX</title>
2149 <productname>Kernel Hackers Manual</productname>
2150 <date>July 2017</date>
2151</refentryinfo>
2152<refmeta>
2153 <refentrytitle><phrase>regulator_is_enabled</phrase></refentrytitle>
2154 <manvolnum>9</manvolnum>
2155 <refmiscinfo class="version">4.1.27</refmiscinfo>
2156</refmeta>
2157<refnamediv>
2158 <refname>regulator_is_enabled</refname>
2159 <refpurpose>
2160     is the regulator output enabled
2161 </refpurpose>
2162</refnamediv>
2163<refsynopsisdiv>
2164 <title>Synopsis</title>
2165  <funcsynopsis><funcprototype>
2166   <funcdef>int <function>regulator_is_enabled </function></funcdef>
2167   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2168  </funcprototype></funcsynopsis>
2169</refsynopsisdiv>
2170<refsect1>
2171 <title>Arguments</title>
2172 <variablelist>
2173  <varlistentry>
2174   <term><parameter>regulator</parameter></term>
2175   <listitem>
2176    <para>
2177     regulator source
2178    </para>
2179   </listitem>
2180  </varlistentry>
2181 </variablelist>
2182</refsect1>
2183<refsect1>
2184<title>Description</title>
2185<para>
2186   Returns positive if the regulator driver backing the source/client
2187   has requested that the device be enabled, zero if it hasn't, else a
2188   negative errno code.
2189   </para><para>
2190
2191   Note that the device backing this regulator handle can have multiple
2192   users, so it might be enabled even if <function>regulator_enable</function> was never
2193   called for this particular source.
2194</para>
2195</refsect1>
2196</refentry>
2197
2198<refentry id="API-regulator-can-change-voltage">
2199<refentryinfo>
2200 <title>LINUX</title>
2201 <productname>Kernel Hackers Manual</productname>
2202 <date>July 2017</date>
2203</refentryinfo>
2204<refmeta>
2205 <refentrytitle><phrase>regulator_can_change_voltage</phrase></refentrytitle>
2206 <manvolnum>9</manvolnum>
2207 <refmiscinfo class="version">4.1.27</refmiscinfo>
2208</refmeta>
2209<refnamediv>
2210 <refname>regulator_can_change_voltage</refname>
2211 <refpurpose>
2212     check if regulator can change voltage
2213 </refpurpose>
2214</refnamediv>
2215<refsynopsisdiv>
2216 <title>Synopsis</title>
2217  <funcsynopsis><funcprototype>
2218   <funcdef>int <function>regulator_can_change_voltage </function></funcdef>
2219   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2220  </funcprototype></funcsynopsis>
2221</refsynopsisdiv>
2222<refsect1>
2223 <title>Arguments</title>
2224 <variablelist>
2225  <varlistentry>
2226   <term><parameter>regulator</parameter></term>
2227   <listitem>
2228    <para>
2229     regulator source
2230    </para>
2231   </listitem>
2232  </varlistentry>
2233 </variablelist>
2234</refsect1>
2235<refsect1>
2236<title>Description</title>
2237<para>
2238   Returns positive if the regulator driver backing the source/client
2239   can change its voltage, false otherwise. Useful for detecting fixed
2240   or dummy regulators and disabling voltage change logic in the client
2241   driver.
2242</para>
2243</refsect1>
2244</refentry>
2245
2246<refentry id="API-regulator-count-voltages">
2247<refentryinfo>
2248 <title>LINUX</title>
2249 <productname>Kernel Hackers Manual</productname>
2250 <date>July 2017</date>
2251</refentryinfo>
2252<refmeta>
2253 <refentrytitle><phrase>regulator_count_voltages</phrase></refentrytitle>
2254 <manvolnum>9</manvolnum>
2255 <refmiscinfo class="version">4.1.27</refmiscinfo>
2256</refmeta>
2257<refnamediv>
2258 <refname>regulator_count_voltages</refname>
2259 <refpurpose>
2260     count <function>regulator_list_voltage</function> selectors
2261 </refpurpose>
2262</refnamediv>
2263<refsynopsisdiv>
2264 <title>Synopsis</title>
2265  <funcsynopsis><funcprototype>
2266   <funcdef>int <function>regulator_count_voltages </function></funcdef>
2267   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2268  </funcprototype></funcsynopsis>
2269</refsynopsisdiv>
2270<refsect1>
2271 <title>Arguments</title>
2272 <variablelist>
2273  <varlistentry>
2274   <term><parameter>regulator</parameter></term>
2275   <listitem>
2276    <para>
2277     regulator source
2278    </para>
2279   </listitem>
2280  </varlistentry>
2281 </variablelist>
2282</refsect1>
2283<refsect1>
2284<title>Description</title>
2285<para>
2286   Returns number of selectors, or negative errno.  Selectors are
2287   numbered starting at zero, and typically correspond to bitfields
2288   in hardware registers.
2289</para>
2290</refsect1>
2291</refentry>
2292
2293<refentry id="API-regulator-list-voltage">
2294<refentryinfo>
2295 <title>LINUX</title>
2296 <productname>Kernel Hackers Manual</productname>
2297 <date>July 2017</date>
2298</refentryinfo>
2299<refmeta>
2300 <refentrytitle><phrase>regulator_list_voltage</phrase></refentrytitle>
2301 <manvolnum>9</manvolnum>
2302 <refmiscinfo class="version">4.1.27</refmiscinfo>
2303</refmeta>
2304<refnamediv>
2305 <refname>regulator_list_voltage</refname>
2306 <refpurpose>
2307     enumerate supported voltages
2308 </refpurpose>
2309</refnamediv>
2310<refsynopsisdiv>
2311 <title>Synopsis</title>
2312  <funcsynopsis><funcprototype>
2313   <funcdef>int <function>regulator_list_voltage </function></funcdef>
2314   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2315   <paramdef>unsigned <parameter>selector</parameter></paramdef>
2316  </funcprototype></funcsynopsis>
2317</refsynopsisdiv>
2318<refsect1>
2319 <title>Arguments</title>
2320 <variablelist>
2321  <varlistentry>
2322   <term><parameter>regulator</parameter></term>
2323   <listitem>
2324    <para>
2325     regulator source
2326    </para>
2327   </listitem>
2328  </varlistentry>
2329  <varlistentry>
2330   <term><parameter>selector</parameter></term>
2331   <listitem>
2332    <para>
2333     identify voltage to list
2334    </para>
2335   </listitem>
2336  </varlistentry>
2337 </variablelist>
2338</refsect1>
2339<refsect1>
2340<title>Context</title>
2341<para>
2342   can sleep
2343</para>
2344</refsect1>
2345<refsect1>
2346<title>Description</title>
2347<para>
2348   Returns a voltage that can be passed to <parameter>regulator_set_voltage</parameter>(),
2349   zero if this selector code can't be used on this system, or a
2350   negative errno.
2351</para>
2352</refsect1>
2353</refentry>
2354
2355<refentry id="API-regulator-get-hardware-vsel-register">
2356<refentryinfo>
2357 <title>LINUX</title>
2358 <productname>Kernel Hackers Manual</productname>
2359 <date>July 2017</date>
2360</refentryinfo>
2361<refmeta>
2362 <refentrytitle><phrase>regulator_get_hardware_vsel_register</phrase></refentrytitle>
2363 <manvolnum>9</manvolnum>
2364 <refmiscinfo class="version">4.1.27</refmiscinfo>
2365</refmeta>
2366<refnamediv>
2367 <refname>regulator_get_hardware_vsel_register</refname>
2368 <refpurpose>
2369     get the HW voltage selector register
2370 </refpurpose>
2371</refnamediv>
2372<refsynopsisdiv>
2373 <title>Synopsis</title>
2374  <funcsynopsis><funcprototype>
2375   <funcdef>int <function>regulator_get_hardware_vsel_register </function></funcdef>
2376   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2377   <paramdef>unsigned * <parameter>vsel_reg</parameter></paramdef>
2378   <paramdef>unsigned * <parameter>vsel_mask</parameter></paramdef>
2379  </funcprototype></funcsynopsis>
2380</refsynopsisdiv>
2381<refsect1>
2382 <title>Arguments</title>
2383 <variablelist>
2384  <varlistentry>
2385   <term><parameter>regulator</parameter></term>
2386   <listitem>
2387    <para>
2388     regulator source
2389    </para>
2390   </listitem>
2391  </varlistentry>
2392  <varlistentry>
2393   <term><parameter>vsel_reg</parameter></term>
2394   <listitem>
2395    <para>
2396     voltage selector register, output parameter
2397    </para>
2398   </listitem>
2399  </varlistentry>
2400  <varlistentry>
2401   <term><parameter>vsel_mask</parameter></term>
2402   <listitem>
2403    <para>
2404     mask for voltage selector bitfield, output parameter
2405    </para>
2406   </listitem>
2407  </varlistentry>
2408 </variablelist>
2409</refsect1>
2410<refsect1>
2411<title>Description</title>
2412<para>
2413   Returns the hardware register offset and bitmask used for setting the
2414   regulator voltage. This might be useful when configuring voltage-scaling
2415   hardware or firmware that can make I2C requests behind the kernel's back,
2416   for example.
2417   </para><para>
2418
2419   On success, the output parameters <parameter>vsel_reg</parameter> and <parameter>vsel_mask</parameter> are filled in
2420   and 0 is returned, otherwise a negative errno is returned.
2421</para>
2422</refsect1>
2423</refentry>
2424
2425<refentry id="API-regulator-list-hardware-vsel">
2426<refentryinfo>
2427 <title>LINUX</title>
2428 <productname>Kernel Hackers Manual</productname>
2429 <date>July 2017</date>
2430</refentryinfo>
2431<refmeta>
2432 <refentrytitle><phrase>regulator_list_hardware_vsel</phrase></refentrytitle>
2433 <manvolnum>9</manvolnum>
2434 <refmiscinfo class="version">4.1.27</refmiscinfo>
2435</refmeta>
2436<refnamediv>
2437 <refname>regulator_list_hardware_vsel</refname>
2438 <refpurpose>
2439     get the HW-specific register value for a selector
2440 </refpurpose>
2441</refnamediv>
2442<refsynopsisdiv>
2443 <title>Synopsis</title>
2444  <funcsynopsis><funcprototype>
2445   <funcdef>int <function>regulator_list_hardware_vsel </function></funcdef>
2446   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2447   <paramdef>unsigned <parameter>selector</parameter></paramdef>
2448  </funcprototype></funcsynopsis>
2449</refsynopsisdiv>
2450<refsect1>
2451 <title>Arguments</title>
2452 <variablelist>
2453  <varlistentry>
2454   <term><parameter>regulator</parameter></term>
2455   <listitem>
2456    <para>
2457     regulator source
2458    </para>
2459   </listitem>
2460  </varlistentry>
2461  <varlistentry>
2462   <term><parameter>selector</parameter></term>
2463   <listitem>
2464    <para>
2465     identify voltage to list
2466    </para>
2467   </listitem>
2468  </varlistentry>
2469 </variablelist>
2470</refsect1>
2471<refsect1>
2472<title>Description</title>
2473<para>
2474   Converts the selector to a hardware-specific voltage selector that can be
2475   directly written to the regulator registers. The address of the voltage
2476   register can be determined by calling <parameter>regulator_get_hardware_vsel_register</parameter>.
2477   </para><para>
2478
2479   On error a negative errno is returned.
2480</para>
2481</refsect1>
2482</refentry>
2483
2484<refentry id="API-regulator-get-linear-step">
2485<refentryinfo>
2486 <title>LINUX</title>
2487 <productname>Kernel Hackers Manual</productname>
2488 <date>July 2017</date>
2489</refentryinfo>
2490<refmeta>
2491 <refentrytitle><phrase>regulator_get_linear_step</phrase></refentrytitle>
2492 <manvolnum>9</manvolnum>
2493 <refmiscinfo class="version">4.1.27</refmiscinfo>
2494</refmeta>
2495<refnamediv>
2496 <refname>regulator_get_linear_step</refname>
2497 <refpurpose>
2498     return the voltage step size between VSEL values
2499 </refpurpose>
2500</refnamediv>
2501<refsynopsisdiv>
2502 <title>Synopsis</title>
2503  <funcsynopsis><funcprototype>
2504   <funcdef>unsigned int <function>regulator_get_linear_step </function></funcdef>
2505   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2506  </funcprototype></funcsynopsis>
2507</refsynopsisdiv>
2508<refsect1>
2509 <title>Arguments</title>
2510 <variablelist>
2511  <varlistentry>
2512   <term><parameter>regulator</parameter></term>
2513   <listitem>
2514    <para>
2515     regulator source
2516    </para>
2517   </listitem>
2518  </varlistentry>
2519 </variablelist>
2520</refsect1>
2521<refsect1>
2522<title>Description</title>
2523<para>
2524   Returns the voltage step size between VSEL values for linear
2525   regulators, or return 0 if the regulator isn't a linear regulator.
2526</para>
2527</refsect1>
2528</refentry>
2529
2530<refentry id="API-regulator-is-supported-voltage">
2531<refentryinfo>
2532 <title>LINUX</title>
2533 <productname>Kernel Hackers Manual</productname>
2534 <date>July 2017</date>
2535</refentryinfo>
2536<refmeta>
2537 <refentrytitle><phrase>regulator_is_supported_voltage</phrase></refentrytitle>
2538 <manvolnum>9</manvolnum>
2539 <refmiscinfo class="version">4.1.27</refmiscinfo>
2540</refmeta>
2541<refnamediv>
2542 <refname>regulator_is_supported_voltage</refname>
2543 <refpurpose>
2544     check if a voltage range can be supported
2545 </refpurpose>
2546</refnamediv>
2547<refsynopsisdiv>
2548 <title>Synopsis</title>
2549  <funcsynopsis><funcprototype>
2550   <funcdef>int <function>regulator_is_supported_voltage </function></funcdef>
2551   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2552   <paramdef>int <parameter>min_uV</parameter></paramdef>
2553   <paramdef>int <parameter>max_uV</parameter></paramdef>
2554  </funcprototype></funcsynopsis>
2555</refsynopsisdiv>
2556<refsect1>
2557 <title>Arguments</title>
2558 <variablelist>
2559  <varlistentry>
2560   <term><parameter>regulator</parameter></term>
2561   <listitem>
2562    <para>
2563     Regulator to check.
2564    </para>
2565   </listitem>
2566  </varlistentry>
2567  <varlistentry>
2568   <term><parameter>min_uV</parameter></term>
2569   <listitem>
2570    <para>
2571     Minimum required voltage in uV.
2572    </para>
2573   </listitem>
2574  </varlistentry>
2575  <varlistentry>
2576   <term><parameter>max_uV</parameter></term>
2577   <listitem>
2578    <para>
2579     Maximum required voltage in uV.
2580    </para>
2581   </listitem>
2582  </varlistentry>
2583 </variablelist>
2584</refsect1>
2585<refsect1>
2586<title>Description</title>
2587<para>
2588   Returns a boolean or a negative error code.
2589</para>
2590</refsect1>
2591</refentry>
2592
2593<refentry id="API-regulator-set-voltage">
2594<refentryinfo>
2595 <title>LINUX</title>
2596 <productname>Kernel Hackers Manual</productname>
2597 <date>July 2017</date>
2598</refentryinfo>
2599<refmeta>
2600 <refentrytitle><phrase>regulator_set_voltage</phrase></refentrytitle>
2601 <manvolnum>9</manvolnum>
2602 <refmiscinfo class="version">4.1.27</refmiscinfo>
2603</refmeta>
2604<refnamediv>
2605 <refname>regulator_set_voltage</refname>
2606 <refpurpose>
2607     set regulator output voltage
2608 </refpurpose>
2609</refnamediv>
2610<refsynopsisdiv>
2611 <title>Synopsis</title>
2612  <funcsynopsis><funcprototype>
2613   <funcdef>int <function>regulator_set_voltage </function></funcdef>
2614   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2615   <paramdef>int <parameter>min_uV</parameter></paramdef>
2616   <paramdef>int <parameter>max_uV</parameter></paramdef>
2617  </funcprototype></funcsynopsis>
2618</refsynopsisdiv>
2619<refsect1>
2620 <title>Arguments</title>
2621 <variablelist>
2622  <varlistentry>
2623   <term><parameter>regulator</parameter></term>
2624   <listitem>
2625    <para>
2626     regulator source
2627    </para>
2628   </listitem>
2629  </varlistentry>
2630  <varlistentry>
2631   <term><parameter>min_uV</parameter></term>
2632   <listitem>
2633    <para>
2634     Minimum required voltage in uV
2635    </para>
2636   </listitem>
2637  </varlistentry>
2638  <varlistentry>
2639   <term><parameter>max_uV</parameter></term>
2640   <listitem>
2641    <para>
2642     Maximum acceptable voltage in uV
2643    </para>
2644   </listitem>
2645  </varlistentry>
2646 </variablelist>
2647</refsect1>
2648<refsect1>
2649<title>Description</title>
2650<para>
2651   Sets a voltage regulator to the desired output voltage. This can be set
2652   during any regulator state. IOW, regulator can be disabled or enabled.
2653   </para><para>
2654
2655   If the regulator is enabled then the voltage will change to the new value
2656   immediately otherwise if the regulator is disabled the regulator will
2657   output at the new voltage when enabled.
2658</para>
2659</refsect1>
2660<refsect1>
2661<title>NOTE</title>
2662<para>
2663   If the regulator is shared between several devices then the lowest
2664   request voltage that meets the system constraints will be used.
2665   Regulator system constraints must be set for this regulator before
2666   calling this function otherwise this call will fail.
2667</para>
2668</refsect1>
2669</refentry>
2670
2671<refentry id="API-regulator-set-voltage-time">
2672<refentryinfo>
2673 <title>LINUX</title>
2674 <productname>Kernel Hackers Manual</productname>
2675 <date>July 2017</date>
2676</refentryinfo>
2677<refmeta>
2678 <refentrytitle><phrase>regulator_set_voltage_time</phrase></refentrytitle>
2679 <manvolnum>9</manvolnum>
2680 <refmiscinfo class="version">4.1.27</refmiscinfo>
2681</refmeta>
2682<refnamediv>
2683 <refname>regulator_set_voltage_time</refname>
2684 <refpurpose>
2685     get raise/fall time
2686 </refpurpose>
2687</refnamediv>
2688<refsynopsisdiv>
2689 <title>Synopsis</title>
2690  <funcsynopsis><funcprototype>
2691   <funcdef>int <function>regulator_set_voltage_time </function></funcdef>
2692   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2693   <paramdef>int <parameter>old_uV</parameter></paramdef>
2694   <paramdef>int <parameter>new_uV</parameter></paramdef>
2695  </funcprototype></funcsynopsis>
2696</refsynopsisdiv>
2697<refsect1>
2698 <title>Arguments</title>
2699 <variablelist>
2700  <varlistentry>
2701   <term><parameter>regulator</parameter></term>
2702   <listitem>
2703    <para>
2704     regulator source
2705    </para>
2706   </listitem>
2707  </varlistentry>
2708  <varlistentry>
2709   <term><parameter>old_uV</parameter></term>
2710   <listitem>
2711    <para>
2712     starting voltage in microvolts
2713    </para>
2714   </listitem>
2715  </varlistentry>
2716  <varlistentry>
2717   <term><parameter>new_uV</parameter></term>
2718   <listitem>
2719    <para>
2720     target voltage in microvolts
2721    </para>
2722   </listitem>
2723  </varlistentry>
2724 </variablelist>
2725</refsect1>
2726<refsect1>
2727<title>Description</title>
2728<para>
2729   Provided with the starting and ending voltage, this function attempts to
2730   calculate the time in microseconds required to rise or fall to this new
2731   voltage.
2732</para>
2733</refsect1>
2734</refentry>
2735
2736<refentry id="API-regulator-set-voltage-time-sel">
2737<refentryinfo>
2738 <title>LINUX</title>
2739 <productname>Kernel Hackers Manual</productname>
2740 <date>July 2017</date>
2741</refentryinfo>
2742<refmeta>
2743 <refentrytitle><phrase>regulator_set_voltage_time_sel</phrase></refentrytitle>
2744 <manvolnum>9</manvolnum>
2745 <refmiscinfo class="version">4.1.27</refmiscinfo>
2746</refmeta>
2747<refnamediv>
2748 <refname>regulator_set_voltage_time_sel</refname>
2749 <refpurpose>
2750     get raise/fall time
2751 </refpurpose>
2752</refnamediv>
2753<refsynopsisdiv>
2754 <title>Synopsis</title>
2755  <funcsynopsis><funcprototype>
2756   <funcdef>int <function>regulator_set_voltage_time_sel </function></funcdef>
2757   <paramdef>struct regulator_dev * <parameter>rdev</parameter></paramdef>
2758   <paramdef>unsigned int <parameter>old_selector</parameter></paramdef>
2759   <paramdef>unsigned int <parameter>new_selector</parameter></paramdef>
2760  </funcprototype></funcsynopsis>
2761</refsynopsisdiv>
2762<refsect1>
2763 <title>Arguments</title>
2764 <variablelist>
2765  <varlistentry>
2766   <term><parameter>rdev</parameter></term>
2767   <listitem>
2768    <para>
2769     regulator source device
2770    </para>
2771   </listitem>
2772  </varlistentry>
2773  <varlistentry>
2774   <term><parameter>old_selector</parameter></term>
2775   <listitem>
2776    <para>
2777     selector for starting voltage
2778    </para>
2779   </listitem>
2780  </varlistentry>
2781  <varlistentry>
2782   <term><parameter>new_selector</parameter></term>
2783   <listitem>
2784    <para>
2785     selector for target voltage
2786    </para>
2787   </listitem>
2788  </varlistentry>
2789 </variablelist>
2790</refsect1>
2791<refsect1>
2792<title>Description</title>
2793<para>
2794   Provided with the starting and target voltage selectors, this function
2795   returns time in microseconds required to rise or fall to this new voltage
2796   </para><para>
2797
2798   Drivers providing ramp_delay in regulation_constraints can use this as their
2799   <function>set_voltage_time_sel</function> operation.
2800</para>
2801</refsect1>
2802</refentry>
2803
2804<refentry id="API-regulator-sync-voltage">
2805<refentryinfo>
2806 <title>LINUX</title>
2807 <productname>Kernel Hackers Manual</productname>
2808 <date>July 2017</date>
2809</refentryinfo>
2810<refmeta>
2811 <refentrytitle><phrase>regulator_sync_voltage</phrase></refentrytitle>
2812 <manvolnum>9</manvolnum>
2813 <refmiscinfo class="version">4.1.27</refmiscinfo>
2814</refmeta>
2815<refnamediv>
2816 <refname>regulator_sync_voltage</refname>
2817 <refpurpose>
2818     re-apply last regulator output voltage
2819 </refpurpose>
2820</refnamediv>
2821<refsynopsisdiv>
2822 <title>Synopsis</title>
2823  <funcsynopsis><funcprototype>
2824   <funcdef>int <function>regulator_sync_voltage </function></funcdef>
2825   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2826  </funcprototype></funcsynopsis>
2827</refsynopsisdiv>
2828<refsect1>
2829 <title>Arguments</title>
2830 <variablelist>
2831  <varlistentry>
2832   <term><parameter>regulator</parameter></term>
2833   <listitem>
2834    <para>
2835     regulator source
2836    </para>
2837   </listitem>
2838  </varlistentry>
2839 </variablelist>
2840</refsect1>
2841<refsect1>
2842<title>Description</title>
2843<para>
2844   Re-apply the last configured voltage.  This is intended to be used
2845   where some external control source the consumer is cooperating with
2846   has caused the configured voltage to change.
2847</para>
2848</refsect1>
2849</refentry>
2850
2851<refentry id="API-regulator-get-voltage">
2852<refentryinfo>
2853 <title>LINUX</title>
2854 <productname>Kernel Hackers Manual</productname>
2855 <date>July 2017</date>
2856</refentryinfo>
2857<refmeta>
2858 <refentrytitle><phrase>regulator_get_voltage</phrase></refentrytitle>
2859 <manvolnum>9</manvolnum>
2860 <refmiscinfo class="version">4.1.27</refmiscinfo>
2861</refmeta>
2862<refnamediv>
2863 <refname>regulator_get_voltage</refname>
2864 <refpurpose>
2865     get regulator output voltage
2866 </refpurpose>
2867</refnamediv>
2868<refsynopsisdiv>
2869 <title>Synopsis</title>
2870  <funcsynopsis><funcprototype>
2871   <funcdef>int <function>regulator_get_voltage </function></funcdef>
2872   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2873  </funcprototype></funcsynopsis>
2874</refsynopsisdiv>
2875<refsect1>
2876 <title>Arguments</title>
2877 <variablelist>
2878  <varlistentry>
2879   <term><parameter>regulator</parameter></term>
2880   <listitem>
2881    <para>
2882     regulator source
2883    </para>
2884   </listitem>
2885  </varlistentry>
2886 </variablelist>
2887</refsect1>
2888<refsect1>
2889<title>Description</title>
2890<para>
2891   This returns the current regulator voltage in uV.
2892</para>
2893</refsect1>
2894<refsect1>
2895<title>NOTE</title>
2896<para>
2897   If the regulator is disabled it will return the voltage value. This
2898   function should not be used to determine regulator state.
2899</para>
2900</refsect1>
2901</refentry>
2902
2903<refentry id="API-regulator-set-current-limit">
2904<refentryinfo>
2905 <title>LINUX</title>
2906 <productname>Kernel Hackers Manual</productname>
2907 <date>July 2017</date>
2908</refentryinfo>
2909<refmeta>
2910 <refentrytitle><phrase>regulator_set_current_limit</phrase></refentrytitle>
2911 <manvolnum>9</manvolnum>
2912 <refmiscinfo class="version">4.1.27</refmiscinfo>
2913</refmeta>
2914<refnamediv>
2915 <refname>regulator_set_current_limit</refname>
2916 <refpurpose>
2917     set regulator output current limit
2918 </refpurpose>
2919</refnamediv>
2920<refsynopsisdiv>
2921 <title>Synopsis</title>
2922  <funcsynopsis><funcprototype>
2923   <funcdef>int <function>regulator_set_current_limit </function></funcdef>
2924   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
2925   <paramdef>int <parameter>min_uA</parameter></paramdef>
2926   <paramdef>int <parameter>max_uA</parameter></paramdef>
2927  </funcprototype></funcsynopsis>
2928</refsynopsisdiv>
2929<refsect1>
2930 <title>Arguments</title>
2931 <variablelist>
2932  <varlistentry>
2933   <term><parameter>regulator</parameter></term>
2934   <listitem>
2935    <para>
2936     regulator source
2937    </para>
2938   </listitem>
2939  </varlistentry>
2940  <varlistentry>
2941   <term><parameter>min_uA</parameter></term>
2942   <listitem>
2943    <para>
2944     Minimum supported current in uA
2945    </para>
2946   </listitem>
2947  </varlistentry>
2948  <varlistentry>
2949   <term><parameter>max_uA</parameter></term>
2950   <listitem>
2951    <para>
2952     Maximum supported current in uA
2953    </para>
2954   </listitem>
2955  </varlistentry>
2956 </variablelist>
2957</refsect1>
2958<refsect1>
2959<title>Description</title>
2960<para>
2961   Sets current sink to the desired output current. This can be set during
2962   any regulator state. IOW, regulator can be disabled or enabled.
2963   </para><para>
2964
2965   If the regulator is enabled then the current will change to the new value
2966   immediately otherwise if the regulator is disabled the regulator will
2967   output at the new current when enabled.
2968</para>
2969</refsect1>
2970<refsect1>
2971<title>NOTE</title>
2972<para>
2973   Regulator system constraints must be set for this regulator before
2974   calling this function otherwise this call will fail.
2975</para>
2976</refsect1>
2977</refentry>
2978
2979<refentry id="API-regulator-get-current-limit">
2980<refentryinfo>
2981 <title>LINUX</title>
2982 <productname>Kernel Hackers Manual</productname>
2983 <date>July 2017</date>
2984</refentryinfo>
2985<refmeta>
2986 <refentrytitle><phrase>regulator_get_current_limit</phrase></refentrytitle>
2987 <manvolnum>9</manvolnum>
2988 <refmiscinfo class="version">4.1.27</refmiscinfo>
2989</refmeta>
2990<refnamediv>
2991 <refname>regulator_get_current_limit</refname>
2992 <refpurpose>
2993     get regulator output current
2994 </refpurpose>
2995</refnamediv>
2996<refsynopsisdiv>
2997 <title>Synopsis</title>
2998  <funcsynopsis><funcprototype>
2999   <funcdef>int <function>regulator_get_current_limit </function></funcdef>
3000   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3001  </funcprototype></funcsynopsis>
3002</refsynopsisdiv>
3003<refsect1>
3004 <title>Arguments</title>
3005 <variablelist>
3006  <varlistentry>
3007   <term><parameter>regulator</parameter></term>
3008   <listitem>
3009    <para>
3010     regulator source
3011    </para>
3012   </listitem>
3013  </varlistentry>
3014 </variablelist>
3015</refsect1>
3016<refsect1>
3017<title>Description</title>
3018<para>
3019   This returns the current supplied by the specified current sink in uA.
3020</para>
3021</refsect1>
3022<refsect1>
3023<title>NOTE</title>
3024<para>
3025   If the regulator is disabled it will return the current value. This
3026   function should not be used to determine regulator state.
3027</para>
3028</refsect1>
3029</refentry>
3030
3031<refentry id="API-regulator-set-mode">
3032<refentryinfo>
3033 <title>LINUX</title>
3034 <productname>Kernel Hackers Manual</productname>
3035 <date>July 2017</date>
3036</refentryinfo>
3037<refmeta>
3038 <refentrytitle><phrase>regulator_set_mode</phrase></refentrytitle>
3039 <manvolnum>9</manvolnum>
3040 <refmiscinfo class="version">4.1.27</refmiscinfo>
3041</refmeta>
3042<refnamediv>
3043 <refname>regulator_set_mode</refname>
3044 <refpurpose>
3045     set regulator operating mode
3046 </refpurpose>
3047</refnamediv>
3048<refsynopsisdiv>
3049 <title>Synopsis</title>
3050  <funcsynopsis><funcprototype>
3051   <funcdef>int <function>regulator_set_mode </function></funcdef>
3052   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3053   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
3054  </funcprototype></funcsynopsis>
3055</refsynopsisdiv>
3056<refsect1>
3057 <title>Arguments</title>
3058 <variablelist>
3059  <varlistentry>
3060   <term><parameter>regulator</parameter></term>
3061   <listitem>
3062    <para>
3063     regulator source
3064    </para>
3065   </listitem>
3066  </varlistentry>
3067  <varlistentry>
3068   <term><parameter>mode</parameter></term>
3069   <listitem>
3070    <para>
3071     operating mode - one of the REGULATOR_MODE constants
3072    </para>
3073   </listitem>
3074  </varlistentry>
3075 </variablelist>
3076</refsect1>
3077<refsect1>
3078<title>Description</title>
3079<para>
3080   Set regulator operating mode to increase regulator efficiency or improve
3081   regulation performance.
3082</para>
3083</refsect1>
3084<refsect1>
3085<title>NOTE</title>
3086<para>
3087   Regulator system constraints must be set for this regulator before
3088   calling this function otherwise this call will fail.
3089</para>
3090</refsect1>
3091</refentry>
3092
3093<refentry id="API-regulator-get-mode">
3094<refentryinfo>
3095 <title>LINUX</title>
3096 <productname>Kernel Hackers Manual</productname>
3097 <date>July 2017</date>
3098</refentryinfo>
3099<refmeta>
3100 <refentrytitle><phrase>regulator_get_mode</phrase></refentrytitle>
3101 <manvolnum>9</manvolnum>
3102 <refmiscinfo class="version">4.1.27</refmiscinfo>
3103</refmeta>
3104<refnamediv>
3105 <refname>regulator_get_mode</refname>
3106 <refpurpose>
3107     get regulator operating mode
3108 </refpurpose>
3109</refnamediv>
3110<refsynopsisdiv>
3111 <title>Synopsis</title>
3112  <funcsynopsis><funcprototype>
3113   <funcdef>unsigned int <function>regulator_get_mode </function></funcdef>
3114   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3115  </funcprototype></funcsynopsis>
3116</refsynopsisdiv>
3117<refsect1>
3118 <title>Arguments</title>
3119 <variablelist>
3120  <varlistentry>
3121   <term><parameter>regulator</parameter></term>
3122   <listitem>
3123    <para>
3124     regulator source
3125    </para>
3126   </listitem>
3127  </varlistentry>
3128 </variablelist>
3129</refsect1>
3130<refsect1>
3131<title>Description</title>
3132<para>
3133   Get the current regulator operating mode.
3134</para>
3135</refsect1>
3136</refentry>
3137
3138<refentry id="API-regulator-set-load">
3139<refentryinfo>
3140 <title>LINUX</title>
3141 <productname>Kernel Hackers Manual</productname>
3142 <date>July 2017</date>
3143</refentryinfo>
3144<refmeta>
3145 <refentrytitle><phrase>regulator_set_load</phrase></refentrytitle>
3146 <manvolnum>9</manvolnum>
3147 <refmiscinfo class="version">4.1.27</refmiscinfo>
3148</refmeta>
3149<refnamediv>
3150 <refname>regulator_set_load</refname>
3151 <refpurpose>
3152     set regulator load
3153 </refpurpose>
3154</refnamediv>
3155<refsynopsisdiv>
3156 <title>Synopsis</title>
3157  <funcsynopsis><funcprototype>
3158   <funcdef>int <function>regulator_set_load </function></funcdef>
3159   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3160   <paramdef>int <parameter>uA_load</parameter></paramdef>
3161  </funcprototype></funcsynopsis>
3162</refsynopsisdiv>
3163<refsect1>
3164 <title>Arguments</title>
3165 <variablelist>
3166  <varlistentry>
3167   <term><parameter>regulator</parameter></term>
3168   <listitem>
3169    <para>
3170     regulator source
3171    </para>
3172   </listitem>
3173  </varlistentry>
3174  <varlistentry>
3175   <term><parameter>uA_load</parameter></term>
3176   <listitem>
3177    <para>
3178     load current
3179    </para>
3180   </listitem>
3181  </varlistentry>
3182 </variablelist>
3183</refsect1>
3184<refsect1>
3185<title>Description</title>
3186<para>
3187   Notifies the regulator core of a new device load. This is then used by
3188   DRMS (if enabled by constraints) to set the most efficient regulator
3189   operating mode for the new regulator loading.
3190   </para><para>
3191
3192   Consumer devices notify their supply regulator of the maximum power
3193   they will require (can be taken from device datasheet in the power
3194   consumption tables) when they change operational status and hence power
3195   state. Examples of operational state changes that can affect power
3196</para>
3197</refsect1>
3198<refsect1>
3199<title>consumption are </title>
3200<para>
3201   -
3202   </para><para>
3203
3204   o Device is opened / closed.
3205   o Device I/O is about to begin or has just finished.
3206   o Device is idling in between work.
3207   </para><para>
3208
3209   This information is also exported via sysfs to userspace.
3210   </para><para>
3211
3212   DRMS will sum the total requested load on the regulator and change
3213   to the most efficient operating mode if platform constraints allow.
3214   </para><para>
3215
3216   On error a negative errno is returned.
3217</para>
3218</refsect1>
3219</refentry>
3220
3221<refentry id="API-regulator-allow-bypass">
3222<refentryinfo>
3223 <title>LINUX</title>
3224 <productname>Kernel Hackers Manual</productname>
3225 <date>July 2017</date>
3226</refentryinfo>
3227<refmeta>
3228 <refentrytitle><phrase>regulator_allow_bypass</phrase></refentrytitle>
3229 <manvolnum>9</manvolnum>
3230 <refmiscinfo class="version">4.1.27</refmiscinfo>
3231</refmeta>
3232<refnamediv>
3233 <refname>regulator_allow_bypass</refname>
3234 <refpurpose>
3235     allow the regulator to go into bypass mode
3236 </refpurpose>
3237</refnamediv>
3238<refsynopsisdiv>
3239 <title>Synopsis</title>
3240  <funcsynopsis><funcprototype>
3241   <funcdef>int <function>regulator_allow_bypass </function></funcdef>
3242   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3243   <paramdef>bool <parameter>enable</parameter></paramdef>
3244  </funcprototype></funcsynopsis>
3245</refsynopsisdiv>
3246<refsect1>
3247 <title>Arguments</title>
3248 <variablelist>
3249  <varlistentry>
3250   <term><parameter>regulator</parameter></term>
3251   <listitem>
3252    <para>
3253     Regulator to configure
3254    </para>
3255   </listitem>
3256  </varlistentry>
3257  <varlistentry>
3258   <term><parameter>enable</parameter></term>
3259   <listitem>
3260    <para>
3261     enable or disable bypass mode
3262    </para>
3263   </listitem>
3264  </varlistentry>
3265 </variablelist>
3266</refsect1>
3267<refsect1>
3268<title>Description</title>
3269<para>
3270   Allow the regulator to go into bypass mode if all other consumers
3271   for the regulator also enable bypass mode and the machine
3272   constraints allow this.  Bypass mode means that the regulator is
3273   simply passing the input directly to the output with no regulation.
3274</para>
3275</refsect1>
3276</refentry>
3277
3278<refentry id="API-regulator-register-notifier">
3279<refentryinfo>
3280 <title>LINUX</title>
3281 <productname>Kernel Hackers Manual</productname>
3282 <date>July 2017</date>
3283</refentryinfo>
3284<refmeta>
3285 <refentrytitle><phrase>regulator_register_notifier</phrase></refentrytitle>
3286 <manvolnum>9</manvolnum>
3287 <refmiscinfo class="version">4.1.27</refmiscinfo>
3288</refmeta>
3289<refnamediv>
3290 <refname>regulator_register_notifier</refname>
3291 <refpurpose>
3292     register regulator event notifier
3293 </refpurpose>
3294</refnamediv>
3295<refsynopsisdiv>
3296 <title>Synopsis</title>
3297  <funcsynopsis><funcprototype>
3298   <funcdef>int <function>regulator_register_notifier </function></funcdef>
3299   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3300   <paramdef>struct notifier_block * <parameter>nb</parameter></paramdef>
3301  </funcprototype></funcsynopsis>
3302</refsynopsisdiv>
3303<refsect1>
3304 <title>Arguments</title>
3305 <variablelist>
3306  <varlistentry>
3307   <term><parameter>regulator</parameter></term>
3308   <listitem>
3309    <para>
3310     regulator source
3311    </para>
3312   </listitem>
3313  </varlistentry>
3314  <varlistentry>
3315   <term><parameter>nb</parameter></term>
3316   <listitem>
3317    <para>
3318     notifier block
3319    </para>
3320   </listitem>
3321  </varlistentry>
3322 </variablelist>
3323</refsect1>
3324<refsect1>
3325<title>Description</title>
3326<para>
3327   Register notifier block to receive regulator events.
3328</para>
3329</refsect1>
3330</refentry>
3331
3332<refentry id="API-regulator-unregister-notifier">
3333<refentryinfo>
3334 <title>LINUX</title>
3335 <productname>Kernel Hackers Manual</productname>
3336 <date>July 2017</date>
3337</refentryinfo>
3338<refmeta>
3339 <refentrytitle><phrase>regulator_unregister_notifier</phrase></refentrytitle>
3340 <manvolnum>9</manvolnum>
3341 <refmiscinfo class="version">4.1.27</refmiscinfo>
3342</refmeta>
3343<refnamediv>
3344 <refname>regulator_unregister_notifier</refname>
3345 <refpurpose>
3346     unregister regulator event notifier
3347 </refpurpose>
3348</refnamediv>
3349<refsynopsisdiv>
3350 <title>Synopsis</title>
3351  <funcsynopsis><funcprototype>
3352   <funcdef>int <function>regulator_unregister_notifier </function></funcdef>
3353   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
3354   <paramdef>struct notifier_block * <parameter>nb</parameter></paramdef>
3355  </funcprototype></funcsynopsis>
3356</refsynopsisdiv>
3357<refsect1>
3358 <title>Arguments</title>
3359 <variablelist>
3360  <varlistentry>
3361   <term><parameter>regulator</parameter></term>
3362   <listitem>
3363    <para>
3364     regulator source
3365    </para>
3366   </listitem>
3367  </varlistentry>
3368  <varlistentry>
3369   <term><parameter>nb</parameter></term>
3370   <listitem>
3371    <para>
3372     notifier block
3373    </para>
3374   </listitem>
3375  </varlistentry>
3376 </variablelist>
3377</refsect1>
3378<refsect1>
3379<title>Description</title>
3380<para>
3381   Unregister regulator event notifier block.
3382</para>
3383</refsect1>
3384</refentry>
3385
3386<refentry id="API-regulator-bulk-get">
3387<refentryinfo>
3388 <title>LINUX</title>
3389 <productname>Kernel Hackers Manual</productname>
3390 <date>July 2017</date>
3391</refentryinfo>
3392<refmeta>
3393 <refentrytitle><phrase>regulator_bulk_get</phrase></refentrytitle>
3394 <manvolnum>9</manvolnum>
3395 <refmiscinfo class="version">4.1.27</refmiscinfo>
3396</refmeta>
3397<refnamediv>
3398 <refname>regulator_bulk_get</refname>
3399 <refpurpose>
3400     get multiple regulator consumers
3401 </refpurpose>
3402</refnamediv>
3403<refsynopsisdiv>
3404 <title>Synopsis</title>
3405  <funcsynopsis><funcprototype>
3406   <funcdef>int <function>regulator_bulk_get </function></funcdef>
3407   <paramdef>struct device * <parameter>dev</parameter></paramdef>
3408   <paramdef>int <parameter>num_consumers</parameter></paramdef>
3409   <paramdef>struct regulator_bulk_data * <parameter>consumers</parameter></paramdef>
3410  </funcprototype></funcsynopsis>
3411</refsynopsisdiv>
3412<refsect1>
3413 <title>Arguments</title>
3414 <variablelist>
3415  <varlistentry>
3416   <term><parameter>dev</parameter></term>
3417   <listitem>
3418    <para>
3419     Device to supply
3420    </para>
3421   </listitem>
3422  </varlistentry>
3423  <varlistentry>
3424   <term><parameter>num_consumers</parameter></term>
3425   <listitem>
3426    <para>
3427     Number of consumers to register
3428    </para>
3429   </listitem>
3430  </varlistentry>
3431  <varlistentry>
3432   <term><parameter>consumers</parameter></term>
3433   <listitem>
3434    <para>
3435     Configuration of consumers; clients are stored here.
3436    </para>
3437   </listitem>
3438  </varlistentry>
3439 </variablelist>
3440</refsect1>
3441<refsect1>
3442<title>Description</title>
3443<para>
3444   <parameter>return</parameter> 0 on success, an errno on failure.
3445   </para><para>
3446
3447   This helper function allows drivers to get several regulator
3448   consumers in one operation.  If any of the regulators cannot be
3449   acquired then any regulators that were allocated will be freed
3450   before returning to the caller.
3451</para>
3452</refsect1>
3453</refentry>
3454
3455<refentry id="API-regulator-bulk-enable">
3456<refentryinfo>
3457 <title>LINUX</title>
3458 <productname>Kernel Hackers Manual</productname>
3459 <date>July 2017</date>
3460</refentryinfo>
3461<refmeta>
3462 <refentrytitle><phrase>regulator_bulk_enable</phrase></refentrytitle>
3463 <manvolnum>9</manvolnum>
3464 <refmiscinfo class="version">4.1.27</refmiscinfo>
3465</refmeta>
3466<refnamediv>
3467 <refname>regulator_bulk_enable</refname>
3468 <refpurpose>
3469     enable multiple regulator consumers
3470 </refpurpose>
3471</refnamediv>
3472<refsynopsisdiv>
3473 <title>Synopsis</title>
3474  <funcsynopsis><funcprototype>
3475   <funcdef>int <function>regulator_bulk_enable </function></funcdef>
3476   <paramdef>int <parameter>num_consumers</parameter></paramdef>
3477   <paramdef>struct regulator_bulk_data * <parameter>consumers</parameter></paramdef>
3478  </funcprototype></funcsynopsis>
3479</refsynopsisdiv>
3480<refsect1>
3481 <title>Arguments</title>
3482 <variablelist>
3483  <varlistentry>
3484   <term><parameter>num_consumers</parameter></term>
3485   <listitem>
3486    <para>
3487     Number of consumers
3488    </para>
3489   </listitem>
3490  </varlistentry>
3491  <varlistentry>
3492   <term><parameter>consumers</parameter></term>
3493   <listitem>
3494    <para>
3495     Consumer data; clients are stored here.
3496     <parameter>return</parameter>         0 on success, an errno on failure
3497    </para>
3498   </listitem>
3499  </varlistentry>
3500 </variablelist>
3501</refsect1>
3502<refsect1>
3503<title>Description</title>
3504<para>
3505   This convenience API allows consumers to enable multiple regulator
3506   clients in a single API call.  If any consumers cannot be enabled
3507   then any others that were enabled will be disabled again prior to
3508   return.
3509</para>
3510</refsect1>
3511</refentry>
3512
3513<refentry id="API-regulator-bulk-disable">
3514<refentryinfo>
3515 <title>LINUX</title>
3516 <productname>Kernel Hackers Manual</productname>
3517 <date>July 2017</date>
3518</refentryinfo>
3519<refmeta>
3520 <refentrytitle><phrase>regulator_bulk_disable</phrase></refentrytitle>
3521 <manvolnum>9</manvolnum>
3522 <refmiscinfo class="version">4.1.27</refmiscinfo>
3523</refmeta>
3524<refnamediv>
3525 <refname>regulator_bulk_disable</refname>
3526 <refpurpose>
3527     disable multiple regulator consumers
3528 </refpurpose>
3529</refnamediv>
3530<refsynopsisdiv>
3531 <title>Synopsis</title>
3532  <funcsynopsis><funcprototype>
3533   <funcdef>int <function>regulator_bulk_disable </function></funcdef>
3534   <paramdef>int <parameter>num_consumers</parameter></paramdef>
3535   <paramdef>struct regulator_bulk_data * <parameter>consumers</parameter></paramdef>
3536  </funcprototype></funcsynopsis>
3537</refsynopsisdiv>
3538<refsect1>
3539 <title>Arguments</title>
3540 <variablelist>
3541  <varlistentry>
3542   <term><parameter>num_consumers</parameter></term>
3543   <listitem>
3544    <para>
3545     Number of consumers
3546    </para>
3547   </listitem>
3548  </varlistentry>
3549  <varlistentry>
3550   <term><parameter>consumers</parameter></term>
3551   <listitem>
3552    <para>
3553     Consumer data; clients are stored here.
3554     <parameter>return</parameter>         0 on success, an errno on failure
3555    </para>
3556   </listitem>
3557  </varlistentry>
3558 </variablelist>
3559</refsect1>
3560<refsect1>
3561<title>Description</title>
3562<para>
3563   This convenience API allows consumers to disable multiple regulator
3564   clients in a single API call.  If any consumers cannot be disabled
3565   then any others that were disabled will be enabled again prior to
3566   return.
3567</para>
3568</refsect1>
3569</refentry>
3570
3571<refentry id="API-regulator-bulk-force-disable">
3572<refentryinfo>
3573 <title>LINUX</title>
3574 <productname>Kernel Hackers Manual</productname>
3575 <date>July 2017</date>
3576</refentryinfo>
3577<refmeta>
3578 <refentrytitle><phrase>regulator_bulk_force_disable</phrase></refentrytitle>
3579 <manvolnum>9</manvolnum>
3580 <refmiscinfo class="version">4.1.27</refmiscinfo>
3581</refmeta>
3582<refnamediv>
3583 <refname>regulator_bulk_force_disable</refname>
3584 <refpurpose>
3585     force disable multiple regulator consumers
3586 </refpurpose>
3587</refnamediv>
3588<refsynopsisdiv>
3589 <title>Synopsis</title>
3590  <funcsynopsis><funcprototype>
3591   <funcdef>int <function>regulator_bulk_force_disable </function></funcdef>
3592   <paramdef>int <parameter>num_consumers</parameter></paramdef>
3593   <paramdef>struct regulator_bulk_data * <parameter>consumers</parameter></paramdef>
3594  </funcprototype></funcsynopsis>
3595</refsynopsisdiv>
3596<refsect1>
3597 <title>Arguments</title>
3598 <variablelist>
3599  <varlistentry>
3600   <term><parameter>num_consumers</parameter></term>
3601   <listitem>
3602    <para>
3603     Number of consumers
3604    </para>
3605   </listitem>
3606  </varlistentry>
3607  <varlistentry>
3608   <term><parameter>consumers</parameter></term>
3609   <listitem>
3610    <para>
3611     Consumer data; clients are stored here.
3612     <parameter>return</parameter>         0 on success, an errno on failure
3613    </para>
3614   </listitem>
3615  </varlistentry>
3616 </variablelist>
3617</refsect1>
3618<refsect1>
3619<title>Description</title>
3620<para>
3621   This convenience API allows consumers to forcibly disable multiple regulator
3622   clients in a single API call.
3623</para>
3624</refsect1>
3625<refsect1>
3626<title>NOTE</title>
3627<para>
3628   This should be used for situations when device damage will
3629   likely occur if the regulators are not disabled (e.g. over temp).
3630   Although regulator_force_disable function call for some consumers can
3631   return error numbers, the function is called for all consumers.
3632</para>
3633</refsect1>
3634</refentry>
3635
3636<refentry id="API-regulator-bulk-free">
3637<refentryinfo>
3638 <title>LINUX</title>
3639 <productname>Kernel Hackers Manual</productname>
3640 <date>July 2017</date>
3641</refentryinfo>
3642<refmeta>
3643 <refentrytitle><phrase>regulator_bulk_free</phrase></refentrytitle>
3644 <manvolnum>9</manvolnum>
3645 <refmiscinfo class="version">4.1.27</refmiscinfo>
3646</refmeta>
3647<refnamediv>
3648 <refname>regulator_bulk_free</refname>
3649 <refpurpose>
3650     free multiple regulator consumers
3651 </refpurpose>
3652</refnamediv>
3653<refsynopsisdiv>
3654 <title>Synopsis</title>
3655  <funcsynopsis><funcprototype>
3656   <funcdef>void <function>regulator_bulk_free </function></funcdef>
3657   <paramdef>int <parameter>num_consumers</parameter></paramdef>
3658   <paramdef>struct regulator_bulk_data * <parameter>consumers</parameter></paramdef>
3659  </funcprototype></funcsynopsis>
3660</refsynopsisdiv>
3661<refsect1>
3662 <title>Arguments</title>
3663 <variablelist>
3664  <varlistentry>
3665   <term><parameter>num_consumers</parameter></term>
3666   <listitem>
3667    <para>
3668     Number of consumers
3669    </para>
3670   </listitem>
3671  </varlistentry>
3672  <varlistentry>
3673   <term><parameter>consumers</parameter></term>
3674   <listitem>
3675    <para>
3676     Consumer data; clients are stored here.
3677    </para>
3678   </listitem>
3679  </varlistentry>
3680 </variablelist>
3681</refsect1>
3682<refsect1>
3683<title>Description</title>
3684<para>
3685   This convenience API allows consumers to free multiple regulator
3686   clients in a single API call.
3687</para>
3688</refsect1>
3689</refentry>
3690
3691<refentry id="API-regulator-notifier-call-chain">
3692<refentryinfo>
3693 <title>LINUX</title>
3694 <productname>Kernel Hackers Manual</productname>
3695 <date>July 2017</date>
3696</refentryinfo>
3697<refmeta>
3698 <refentrytitle><phrase>regulator_notifier_call_chain</phrase></refentrytitle>
3699 <manvolnum>9</manvolnum>
3700 <refmiscinfo class="version">4.1.27</refmiscinfo>
3701</refmeta>
3702<refnamediv>
3703 <refname>regulator_notifier_call_chain</refname>
3704 <refpurpose>
3705     call regulator event notifier
3706 </refpurpose>
3707</refnamediv>
3708<refsynopsisdiv>
3709 <title>Synopsis</title>
3710  <funcsynopsis><funcprototype>
3711   <funcdef>int <function>regulator_notifier_call_chain </function></funcdef>
3712   <paramdef>struct regulator_dev * <parameter>rdev</parameter></paramdef>
3713   <paramdef>unsigned long <parameter>event</parameter></paramdef>
3714   <paramdef>void * <parameter>data</parameter></paramdef>
3715  </funcprototype></funcsynopsis>
3716</refsynopsisdiv>
3717<refsect1>
3718 <title>Arguments</title>
3719 <variablelist>
3720  <varlistentry>
3721   <term><parameter>rdev</parameter></term>
3722   <listitem>
3723    <para>
3724     regulator source
3725    </para>
3726   </listitem>
3727  </varlistentry>
3728  <varlistentry>
3729   <term><parameter>event</parameter></term>
3730   <listitem>
3731    <para>
3732     notifier block
3733    </para>
3734   </listitem>
3735  </varlistentry>
3736  <varlistentry>
3737   <term><parameter>data</parameter></term>
3738   <listitem>
3739    <para>
3740     callback-specific data.
3741    </para>
3742   </listitem>
3743  </varlistentry>
3744 </variablelist>
3745</refsect1>
3746<refsect1>
3747<title>Description</title>
3748<para>
3749   Called by regulator drivers to notify clients a regulator event has
3750   occurred. We also notify regulator clients downstream.
3751   Note lock must be held by caller.
3752</para>
3753</refsect1>
3754</refentry>
3755
3756<refentry id="API-regulator-mode-to-status">
3757<refentryinfo>
3758 <title>LINUX</title>
3759 <productname>Kernel Hackers Manual</productname>
3760 <date>July 2017</date>
3761</refentryinfo>
3762<refmeta>
3763 <refentrytitle><phrase>regulator_mode_to_status</phrase></refentrytitle>
3764 <manvolnum>9</manvolnum>
3765 <refmiscinfo class="version">4.1.27</refmiscinfo>
3766</refmeta>
3767<refnamediv>
3768 <refname>regulator_mode_to_status</refname>
3769 <refpurpose>
3770     convert a regulator mode into a status
3771 </refpurpose>
3772</refnamediv>
3773<refsynopsisdiv>
3774 <title>Synopsis</title>
3775  <funcsynopsis><funcprototype>
3776   <funcdef>int <function>regulator_mode_to_status </function></funcdef>
3777   <paramdef>unsigned int <parameter>mode</parameter></paramdef>
3778  </funcprototype></funcsynopsis>
3779</refsynopsisdiv>
3780<refsect1>
3781 <title>Arguments</title>
3782 <variablelist>
3783  <varlistentry>
3784   <term><parameter>mode</parameter></term>
3785   <listitem>
3786    <para>
3787     Mode to convert
3788    </para>
3789   </listitem>
3790  </varlistentry>
3791 </variablelist>
3792</refsect1>
3793<refsect1>
3794<title>Description</title>
3795<para>
3796   Convert a regulator mode into a status.
3797</para>
3798</refsect1>
3799</refentry>
3800
3801<refentry id="API-regulator-register">
3802<refentryinfo>
3803 <title>LINUX</title>
3804 <productname>Kernel Hackers Manual</productname>
3805 <date>July 2017</date>
3806</refentryinfo>
3807<refmeta>
3808 <refentrytitle><phrase>regulator_register</phrase></refentrytitle>
3809 <manvolnum>9</manvolnum>
3810 <refmiscinfo class="version">4.1.27</refmiscinfo>
3811</refmeta>
3812<refnamediv>
3813 <refname>regulator_register</refname>
3814 <refpurpose>
3815     register regulator
3816 </refpurpose>
3817</refnamediv>
3818<refsynopsisdiv>
3819 <title>Synopsis</title>
3820  <funcsynopsis><funcprototype>
3821   <funcdef>struct regulator_dev * <function>regulator_register </function></funcdef>
3822   <paramdef>const struct regulator_desc * <parameter>regulator_desc</parameter></paramdef>
3823   <paramdef>const struct regulator_config * <parameter>cfg</parameter></paramdef>
3824  </funcprototype></funcsynopsis>
3825</refsynopsisdiv>
3826<refsect1>
3827 <title>Arguments</title>
3828 <variablelist>
3829  <varlistentry>
3830   <term><parameter>regulator_desc</parameter></term>
3831   <listitem>
3832    <para>
3833     regulator to register
3834    </para>
3835   </listitem>
3836  </varlistentry>
3837  <varlistentry>
3838   <term><parameter>cfg</parameter></term>
3839   <listitem>
3840    <para>
3841     runtime configuration for regulator
3842    </para>
3843   </listitem>
3844  </varlistentry>
3845 </variablelist>
3846</refsect1>
3847<refsect1>
3848<title>Description</title>
3849<para>
3850   Called by regulator drivers to register a regulator.
3851   Returns a valid pointer to struct regulator_dev on success
3852   or an <function>ERR_PTR</function> on error.
3853</para>
3854</refsect1>
3855</refentry>
3856
3857<refentry id="API-regulator-unregister">
3858<refentryinfo>
3859 <title>LINUX</title>
3860 <productname>Kernel Hackers Manual</productname>
3861 <date>July 2017</date>
3862</refentryinfo>
3863<refmeta>
3864 <refentrytitle><phrase>regulator_unregister</phrase></refentrytitle>
3865 <manvolnum>9</manvolnum>
3866 <refmiscinfo class="version">4.1.27</refmiscinfo>
3867</refmeta>
3868<refnamediv>
3869 <refname>regulator_unregister</refname>
3870 <refpurpose>
3871     unregister regulator
3872 </refpurpose>
3873</refnamediv>
3874<refsynopsisdiv>
3875 <title>Synopsis</title>
3876  <funcsynopsis><funcprototype>
3877   <funcdef>void <function>regulator_unregister </function></funcdef>
3878   <paramdef>struct regulator_dev * <parameter>rdev</parameter></paramdef>
3879  </funcprototype></funcsynopsis>
3880</refsynopsisdiv>
3881<refsect1>
3882 <title>Arguments</title>
3883 <variablelist>
3884  <varlistentry>
3885   <term><parameter>rdev</parameter></term>
3886   <listitem>
3887    <para>
3888     regulator to unregister
3889    </para>
3890   </listitem>
3891  </varlistentry>
3892 </variablelist>
3893</refsect1>
3894<refsect1>
3895<title>Description</title>
3896<para>
3897   Called by regulator drivers to unregister a regulator.
3898</para>
3899</refsect1>
3900</refentry>
3901
3902<refentry id="API-regulator-suspend-prepare">
3903<refentryinfo>
3904 <title>LINUX</title>
3905 <productname>Kernel Hackers Manual</productname>
3906 <date>July 2017</date>
3907</refentryinfo>
3908<refmeta>
3909 <refentrytitle><phrase>regulator_suspend_prepare</phrase></refentrytitle>
3910 <manvolnum>9</manvolnum>
3911 <refmiscinfo class="version">4.1.27</refmiscinfo>
3912</refmeta>
3913<refnamediv>
3914 <refname>regulator_suspend_prepare</refname>
3915 <refpurpose>
3916     prepare regulators for system wide suspend
3917 </refpurpose>
3918</refnamediv>
3919<refsynopsisdiv>
3920 <title>Synopsis</title>
3921  <funcsynopsis><funcprototype>
3922   <funcdef>int <function>regulator_suspend_prepare </function></funcdef>
3923   <paramdef>suspend_state_t <parameter>state</parameter></paramdef>
3924  </funcprototype></funcsynopsis>
3925</refsynopsisdiv>
3926<refsect1>
3927 <title>Arguments</title>
3928 <variablelist>
3929  <varlistentry>
3930   <term><parameter>state</parameter></term>
3931   <listitem>
3932    <para>
3933     system suspend state
3934    </para>
3935   </listitem>
3936  </varlistentry>
3937 </variablelist>
3938</refsect1>
3939<refsect1>
3940<title>Description</title>
3941<para>
3942   Configure each regulator with it's suspend operating parameters for state.
3943   This will usually be called by machine suspend code prior to supending.
3944</para>
3945</refsect1>
3946</refentry>
3947
3948<refentry id="API-regulator-suspend-finish">
3949<refentryinfo>
3950 <title>LINUX</title>
3951 <productname>Kernel Hackers Manual</productname>
3952 <date>July 2017</date>
3953</refentryinfo>
3954<refmeta>
3955 <refentrytitle><phrase>regulator_suspend_finish</phrase></refentrytitle>
3956 <manvolnum>9</manvolnum>
3957 <refmiscinfo class="version">4.1.27</refmiscinfo>
3958</refmeta>
3959<refnamediv>
3960 <refname>regulator_suspend_finish</refname>
3961 <refpurpose>
3962     resume regulators from system wide suspend
3963 </refpurpose>
3964</refnamediv>
3965<refsynopsisdiv>
3966 <title>Synopsis</title>
3967  <funcsynopsis><funcprototype>
3968   <funcdef>int <function>regulator_suspend_finish </function></funcdef>
3969   <paramdef> <parameter>void</parameter></paramdef>
3970  </funcprototype></funcsynopsis>
3971</refsynopsisdiv>
3972<refsect1>
3973 <title>Arguments</title>
3974 <variablelist>
3975  <varlistentry>
3976   <term><parameter>void</parameter></term>
3977   <listitem>
3978    <para>
3979     no arguments
3980    </para>
3981   </listitem>
3982  </varlistentry>
3983 </variablelist>
3984</refsect1>
3985<refsect1>
3986<title>Description</title>
3987<para>
3988   </para><para>
3989
3990   Turn on regulators that might be turned off by regulator_suspend_prepare
3991   and that should be turned on according to the regulators properties.
3992</para>
3993</refsect1>
3994</refentry>
3995
3996<refentry id="API-regulator-has-full-constraints">
3997<refentryinfo>
3998 <title>LINUX</title>
3999 <productname>Kernel Hackers Manual</productname>
4000 <date>July 2017</date>
4001</refentryinfo>
4002<refmeta>
4003 <refentrytitle><phrase>regulator_has_full_constraints</phrase></refentrytitle>
4004 <manvolnum>9</manvolnum>
4005 <refmiscinfo class="version">4.1.27</refmiscinfo>
4006</refmeta>
4007<refnamediv>
4008 <refname>regulator_has_full_constraints</refname>
4009 <refpurpose>
4010     the system has fully specified constraints
4011 </refpurpose>
4012</refnamediv>
4013<refsynopsisdiv>
4014 <title>Synopsis</title>
4015  <funcsynopsis><funcprototype>
4016   <funcdef>void <function>regulator_has_full_constraints </function></funcdef>
4017   <paramdef> <parameter>void</parameter></paramdef>
4018  </funcprototype></funcsynopsis>
4019</refsynopsisdiv>
4020<refsect1>
4021 <title>Arguments</title>
4022 <variablelist>
4023  <varlistentry>
4024   <term><parameter>void</parameter></term>
4025   <listitem>
4026    <para>
4027     no arguments
4028    </para>
4029   </listitem>
4030  </varlistentry>
4031 </variablelist>
4032</refsect1>
4033<refsect1>
4034<title>Description</title>
4035<para>
4036   </para><para>
4037
4038   Calling this function will cause the regulator API to disable all
4039   regulators which have a zero use count and don't have an always_on
4040   constraint in a late_initcall.
4041   </para><para>
4042
4043   The intention is that this will become the default behaviour in a
4044   future kernel release so users are encouraged to use this facility
4045   now.
4046</para>
4047</refsect1>
4048</refentry>
4049
4050<refentry id="API-rdev-get-drvdata">
4051<refentryinfo>
4052 <title>LINUX</title>
4053 <productname>Kernel Hackers Manual</productname>
4054 <date>July 2017</date>
4055</refentryinfo>
4056<refmeta>
4057 <refentrytitle><phrase>rdev_get_drvdata</phrase></refentrytitle>
4058 <manvolnum>9</manvolnum>
4059 <refmiscinfo class="version">4.1.27</refmiscinfo>
4060</refmeta>
4061<refnamediv>
4062 <refname>rdev_get_drvdata</refname>
4063 <refpurpose>
4064     get rdev regulator driver data
4065 </refpurpose>
4066</refnamediv>
4067<refsynopsisdiv>
4068 <title>Synopsis</title>
4069  <funcsynopsis><funcprototype>
4070   <funcdef>void * <function>rdev_get_drvdata </function></funcdef>
4071   <paramdef>struct regulator_dev * <parameter>rdev</parameter></paramdef>
4072  </funcprototype></funcsynopsis>
4073</refsynopsisdiv>
4074<refsect1>
4075 <title>Arguments</title>
4076 <variablelist>
4077  <varlistentry>
4078   <term><parameter>rdev</parameter></term>
4079   <listitem>
4080    <para>
4081     regulator
4082    </para>
4083   </listitem>
4084  </varlistentry>
4085 </variablelist>
4086</refsect1>
4087<refsect1>
4088<title>Description</title>
4089<para>
4090   Get rdev regulator driver private data. This call can be used in the
4091   regulator driver context.
4092</para>
4093</refsect1>
4094</refentry>
4095
4096<refentry id="API-regulator-get-drvdata">
4097<refentryinfo>
4098 <title>LINUX</title>
4099 <productname>Kernel Hackers Manual</productname>
4100 <date>July 2017</date>
4101</refentryinfo>
4102<refmeta>
4103 <refentrytitle><phrase>regulator_get_drvdata</phrase></refentrytitle>
4104 <manvolnum>9</manvolnum>
4105 <refmiscinfo class="version">4.1.27</refmiscinfo>
4106</refmeta>
4107<refnamediv>
4108 <refname>regulator_get_drvdata</refname>
4109 <refpurpose>
4110     get regulator driver data
4111 </refpurpose>
4112</refnamediv>
4113<refsynopsisdiv>
4114 <title>Synopsis</title>
4115  <funcsynopsis><funcprototype>
4116   <funcdef>void * <function>regulator_get_drvdata </function></funcdef>
4117   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
4118  </funcprototype></funcsynopsis>
4119</refsynopsisdiv>
4120<refsect1>
4121 <title>Arguments</title>
4122 <variablelist>
4123  <varlistentry>
4124   <term><parameter>regulator</parameter></term>
4125   <listitem>
4126    <para>
4127     regulator
4128    </para>
4129   </listitem>
4130  </varlistentry>
4131 </variablelist>
4132</refsect1>
4133<refsect1>
4134<title>Description</title>
4135<para>
4136   Get regulator driver private data. This call can be used in the consumer
4137   driver context when non API regulator specific functions need to be called.
4138</para>
4139</refsect1>
4140</refentry>
4141
4142<refentry id="API-regulator-set-drvdata">
4143<refentryinfo>
4144 <title>LINUX</title>
4145 <productname>Kernel Hackers Manual</productname>
4146 <date>July 2017</date>
4147</refentryinfo>
4148<refmeta>
4149 <refentrytitle><phrase>regulator_set_drvdata</phrase></refentrytitle>
4150 <manvolnum>9</manvolnum>
4151 <refmiscinfo class="version">4.1.27</refmiscinfo>
4152</refmeta>
4153<refnamediv>
4154 <refname>regulator_set_drvdata</refname>
4155 <refpurpose>
4156     set regulator driver data
4157 </refpurpose>
4158</refnamediv>
4159<refsynopsisdiv>
4160 <title>Synopsis</title>
4161  <funcsynopsis><funcprototype>
4162   <funcdef>void <function>regulator_set_drvdata </function></funcdef>
4163   <paramdef>struct regulator * <parameter>regulator</parameter></paramdef>
4164   <paramdef>void * <parameter>data</parameter></paramdef>
4165  </funcprototype></funcsynopsis>
4166</refsynopsisdiv>
4167<refsect1>
4168 <title>Arguments</title>
4169 <variablelist>
4170  <varlistentry>
4171   <term><parameter>regulator</parameter></term>
4172   <listitem>
4173    <para>
4174     regulator
4175    </para>
4176   </listitem>
4177  </varlistentry>
4178  <varlistentry>
4179   <term><parameter>data</parameter></term>
4180   <listitem>
4181    <para>
4182     data
4183    </para>
4184   </listitem>
4185  </varlistentry>
4186 </variablelist>
4187</refsect1>
4188</refentry>
4189
4190<refentry id="API-rdev-get-id">
4191<refentryinfo>
4192 <title>LINUX</title>
4193 <productname>Kernel Hackers Manual</productname>
4194 <date>July 2017</date>
4195</refentryinfo>
4196<refmeta>
4197 <refentrytitle><phrase>rdev_get_id</phrase></refentrytitle>
4198 <manvolnum>9</manvolnum>
4199 <refmiscinfo class="version">4.1.27</refmiscinfo>
4200</refmeta>
4201<refnamediv>
4202 <refname>rdev_get_id</refname>
4203 <refpurpose>
4204     get regulator ID
4205 </refpurpose>
4206</refnamediv>
4207<refsynopsisdiv>
4208 <title>Synopsis</title>
4209  <funcsynopsis><funcprototype>
4210   <funcdef>int <function>rdev_get_id </function></funcdef>
4211   <paramdef>struct regulator_dev * <parameter>rdev</parameter></paramdef>
4212  </funcprototype></funcsynopsis>
4213</refsynopsisdiv>
4214<refsect1>
4215 <title>Arguments</title>
4216 <variablelist>
4217  <varlistentry>
4218   <term><parameter>rdev</parameter></term>
4219   <listitem>
4220    <para>
4221     regulator
4222    </para>
4223   </listitem>
4224  </varlistentry>
4225 </variablelist>
4226</refsect1>
4227</refentry>
4228
4229  </chapter>
4230</book>
4231