~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/power/regulator/machine.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/power/regulator/machine.rst (Architecture sparc64) and /Documentation/power/regulator/machine.rst (Architecture alpha)


  1 ==================================                  1 ==================================
  2 Regulator Machine Driver Interface                  2 Regulator Machine Driver Interface
  3 ==================================                  3 ==================================
  4                                                     4 
  5 The regulator machine driver interface is inte      5 The regulator machine driver interface is intended for board/machine specific
  6 initialisation code to configure the regulator      6 initialisation code to configure the regulator subsystem.
  7                                                     7 
  8 Consider the following machine::                    8 Consider the following machine::
  9                                                     9 
 10   Regulator-1 -+-> Regulator-2 --> [Consumer A     10   Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
 11                |                                   11                |
 12                +-> [Consumer B @ 3.3V]             12                +-> [Consumer B @ 3.3V]
 13                                                    13 
 14 The drivers for consumers A & B must be mapped     14 The drivers for consumers A & B must be mapped to the correct regulator in
 15 order to control their power supplies. This ma     15 order to control their power supplies. This mapping can be achieved in machine
 16 initialisation code by creating a struct regul     16 initialisation code by creating a struct regulator_consumer_supply for
 17 each regulator::                                   17 each regulator::
 18                                                    18 
 19   struct regulator_consumer_supply {               19   struct regulator_consumer_supply {
 20         const char *dev_name;   /* consumer de     20         const char *dev_name;   /* consumer dev_name() */
 21         const char *supply;     /* consumer su     21         const char *supply;     /* consumer supply - e.g. "vcc" */
 22   };                                               22   };
 23                                                    23 
 24 e.g. for the machine above::                       24 e.g. for the machine above::
 25                                                    25 
 26   static struct regulator_consumer_supply regu     26   static struct regulator_consumer_supply regulator1_consumers[] = {
 27         REGULATOR_SUPPLY("Vcc", "consumer B"),     27         REGULATOR_SUPPLY("Vcc", "consumer B"),
 28   };                                               28   };
 29                                                    29 
 30   static struct regulator_consumer_supply regu     30   static struct regulator_consumer_supply regulator2_consumers[] = {
 31         REGULATOR_SUPPLY("Vcc", "consumer A"),     31         REGULATOR_SUPPLY("Vcc", "consumer A"),
 32   };                                               32   };
 33                                                    33 
 34 This maps Regulator-1 to the 'Vcc' supply for      34 This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
 35 to the 'Vcc' supply for Consumer A.                35 to the 'Vcc' supply for Consumer A.
 36                                                    36 
 37 Constraints can now be registered by defining      37 Constraints can now be registered by defining a struct regulator_init_data
 38 for each regulator power domain. This structur     38 for each regulator power domain. This structure also maps the consumers
 39 to their supply regulators::                       39 to their supply regulators::
 40                                                    40 
 41   static struct regulator_init_data regulator1     41   static struct regulator_init_data regulator1_data = {
 42         .constraints = {                           42         .constraints = {
 43                 .name = "Regulator-1",             43                 .name = "Regulator-1",
 44                 .min_uV = 3300000,                 44                 .min_uV = 3300000,
 45                 .max_uV = 3300000,                 45                 .max_uV = 3300000,
 46                 .valid_modes_mask = REGULATOR_     46                 .valid_modes_mask = REGULATOR_MODE_NORMAL,
 47         },                                         47         },
 48         .num_consumer_supplies = ARRAY_SIZE(re     48         .num_consumer_supplies = ARRAY_SIZE(regulator1_consumers),
 49         .consumer_supplies = regulator1_consum     49         .consumer_supplies = regulator1_consumers,
 50   };                                               50   };
 51                                                    51 
 52 The name field should be set to something that     52 The name field should be set to something that is usefully descriptive
 53 for the board for configuration of supplies fo     53 for the board for configuration of supplies for other regulators and
 54 for use in logging and other diagnostic output     54 for use in logging and other diagnostic output.  Normally the name
 55 used for the supply rail in the schematic is a     55 used for the supply rail in the schematic is a good choice.  If no
 56 name is provided then the subsystem will choos     56 name is provided then the subsystem will choose one.
 57                                                    57 
 58 Regulator-1 supplies power to Regulator-2. Thi     58 Regulator-1 supplies power to Regulator-2. This relationship must be registered
 59 with the core so that Regulator-1 is also enab     59 with the core so that Regulator-1 is also enabled when Consumer A enables its
 60 supply (Regulator-2). The supply regulator is      60 supply (Regulator-2). The supply regulator is set by the supply_regulator
 61 field below and co::                               61 field below and co::
 62                                                    62 
 63   static struct regulator_init_data regulator2     63   static struct regulator_init_data regulator2_data = {
 64         .supply_regulator = "Regulator-1",         64         .supply_regulator = "Regulator-1",
 65         .constraints = {                           65         .constraints = {
 66                 .min_uV = 1800000,                 66                 .min_uV = 1800000,
 67                 .max_uV = 2000000,                 67                 .max_uV = 2000000,
 68                 .valid_ops_mask = REGULATOR_CH     68                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
 69                 .valid_modes_mask = REGULATOR_     69                 .valid_modes_mask = REGULATOR_MODE_NORMAL,
 70         },                                         70         },
 71         .num_consumer_supplies = ARRAY_SIZE(re     71         .num_consumer_supplies = ARRAY_SIZE(regulator2_consumers),
 72         .consumer_supplies = regulator2_consum     72         .consumer_supplies = regulator2_consumers,
 73   };                                               73   };
 74                                                    74 
 75 Finally the regulator devices must be register     75 Finally the regulator devices must be registered in the usual manner::
 76                                                    76 
 77   static struct platform_device regulator_devi     77   static struct platform_device regulator_devices[] = {
 78         {                                          78         {
 79                 .name = "regulator",               79                 .name = "regulator",
 80                 .id = DCDC_1,                      80                 .id = DCDC_1,
 81                 .dev = {                           81                 .dev = {
 82                         .platform_data = &regu     82                         .platform_data = &regulator1_data,
 83                 },                                 83                 },
 84         },                                         84         },
 85         {                                          85         {
 86                 .name = "regulator",               86                 .name = "regulator",
 87                 .id = DCDC_2,                      87                 .id = DCDC_2,
 88                 .dev = {                           88                 .dev = {
 89                         .platform_data = &regu     89                         .platform_data = &regulator2_data,
 90                 },                                 90                 },
 91         },                                         91         },
 92   };                                               92   };
 93   /* register regulator 1 device */                93   /* register regulator 1 device */
 94   platform_device_register(&regulator_devices[     94   platform_device_register(&regulator_devices[0]);
 95                                                    95 
 96   /* register regulator 2 device */                96   /* register regulator 2 device */
 97   platform_device_register(&regulator_devices[     97   platform_device_register(&regulator_devices[1]);
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php