···11+Regulator Machine Driver Interface22+===================================33+44+The regulator machine driver interface is intended for board/machine specific55+initialisation code to configure the regulator subsystem. Typical things that66+machine drivers would do are :-77+88+ 1. Regulator -> Device mapping.99+ 2. Regulator supply configuration.1010+ 3. Power Domain constraint setting.1111+1212+1313+1414+1. Regulator -> device mapping1515+==============================1616+Consider the following machine :-1717+1818+ Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]1919+ |2020+ +-> [Consumer B @ 3.3V]2121+2222+The drivers for consumers A & B must be mapped to the correct regulator in2323+order to control their power supply. This mapping can be achieved in machine2424+initialisation code by calling :-2525+2626+int regulator_set_device_supply(const char *regulator, struct device *dev,2727+ const char *supply);2828+2929+and is shown with the following code :-3030+3131+regulator_set_device_supply("Regulator-1", devB, "Vcc");3232+regulator_set_device_supply("Regulator-2", devA, "Vcc");3333+3434+This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-23535+to the 'Vcc' supply for Consumer A.3636+3737+3838+2. Regulator supply configuration.3939+==================================4040+Consider the following machine (again) :-4141+4242+ Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]4343+ |4444+ +-> [Consumer B @ 3.3V]4545+4646+Regulator-1 supplies power to Regulator-2. This relationship must be registered4747+with the core so that Regulator-1 is also enabled when Consumer A enables it's4848+supply (Regulator-2).4949+5050+This relationship can be register with the core via :-5151+5252+int regulator_set_supply(const char *regulator, const char *regulator_supply);5353+5454+In this example we would use the following code :-5555+5656+regulator_set_supply("Regulator-2", "Regulator-1");5757+5858+Relationships can be queried by calling :-5959+6060+const char *regulator_get_supply(const char *regulator);6161+6262+6363+3. Power Domain constraint setting.6464+===================================6565+Each power domain within a system has physical constraints on voltage and6666+current. This must be defined in software so that the power domain is always6767+operated within specifications.6868+6969+Consider the following machine (again) :-7070+7171+ Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]7272+ |7373+ +-> [Consumer B @ 3.3V]7474+7575+This gives us two regulators and two power domains:7676+7777+ Domain 1: Regulator-2, Consumer B.7878+ Domain 2: Consumer A.7979+8080+Constraints can be registered by calling :-8181+8282+int regulator_set_platform_constraints(const char *regulator,8383+ struct regulation_constraints *constraints);8484+8585+The example is defined as follows :-8686+8787+struct regulation_constraints domain_1 = {8888+ .min_uV = 3300000,8989+ .max_uV = 3300000,9090+ .valid_modes_mask = REGULATOR_MODE_NORMAL,9191+};9292+9393+struct regulation_constraints domain_2 = {9494+ .min_uV = 1800000,9595+ .max_uV = 2000000,9696+ .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,9797+ .valid_modes_mask = REGULATOR_MODE_NORMAL,9898+};9999+100100+regulator_set_platform_constraints("Regulator-1", &domain_1);101101+regulator_set_platform_constraints("Regulator-2", &domain_2);