machine.txt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. Regulator Machine Driver Interface
  2. ===================================
  3. The regulator machine driver interface is intended for board/machine specific
  4. initialisation code to configure the regulator subsystem. Typical things that
  5. machine drivers would do are :-
  6. 1. Regulator -> Device mapping.
  7. 2. Regulator supply configuration.
  8. 3. Power Domain constraint setting.
  9. 1. Regulator -> device mapping
  10. ==============================
  11. Consider the following machine :-
  12. Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
  13. |
  14. +-> [Consumer B @ 3.3V]
  15. The drivers for consumers A & B must be mapped to the correct regulator in
  16. order to control their power supply. This mapping can be achieved in machine
  17. initialisation code by calling :-
  18. int regulator_set_device_supply(const char *regulator, struct device *dev,
  19. const char *supply);
  20. and is shown with the following code :-
  21. regulator_set_device_supply("Regulator-1", devB, "Vcc");
  22. regulator_set_device_supply("Regulator-2", devA, "Vcc");
  23. This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
  24. to the 'Vcc' supply for Consumer A.
  25. 2. Regulator supply configuration.
  26. ==================================
  27. Consider the following machine (again) :-
  28. Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
  29. |
  30. +-> [Consumer B @ 3.3V]
  31. Regulator-1 supplies power to Regulator-2. This relationship must be registered
  32. with the core so that Regulator-1 is also enabled when Consumer A enables it's
  33. supply (Regulator-2).
  34. This relationship can be register with the core via :-
  35. int regulator_set_supply(const char *regulator, const char *regulator_supply);
  36. In this example we would use the following code :-
  37. regulator_set_supply("Regulator-2", "Regulator-1");
  38. Relationships can be queried by calling :-
  39. const char *regulator_get_supply(const char *regulator);
  40. 3. Power Domain constraint setting.
  41. ===================================
  42. Each power domain within a system has physical constraints on voltage and
  43. current. This must be defined in software so that the power domain is always
  44. operated within specifications.
  45. Consider the following machine (again) :-
  46. Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
  47. |
  48. +-> [Consumer B @ 3.3V]
  49. This gives us two regulators and two power domains:
  50. Domain 1: Regulator-2, Consumer B.
  51. Domain 2: Consumer A.
  52. Constraints can be registered by calling :-
  53. int regulator_set_platform_constraints(const char *regulator,
  54. struct regulation_constraints *constraints);
  55. The example is defined as follows :-
  56. struct regulation_constraints domain_1 = {
  57. .min_uV = 3300000,
  58. .max_uV = 3300000,
  59. .valid_modes_mask = REGULATOR_MODE_NORMAL,
  60. };
  61. struct regulation_constraints domain_2 = {
  62. .min_uV = 1800000,
  63. .max_uV = 2000000,
  64. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  65. .valid_modes_mask = REGULATOR_MODE_NORMAL,
  66. };
  67. regulator_set_platform_constraints("Regulator-1", &domain_1);
  68. regulator_set_platform_constraints("Regulator-2", &domain_2);