[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210824230620.1003828-3-djrscally@gmail.com>
Date: Wed, 25 Aug 2021 00:06:19 +0100
From: Daniel Scally <djrscally@...il.com>
To: linux-kernel@...r.kernel.org, platform-driver-x86@...r.kernel.org
Cc: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <mgross@...ux.intel.com>,
Maximilian Luz <luzmaximilian@...il.com>,
Kieran Bingham <kieran.bingham@...asonboard.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>
Subject: [RFC PATCH v2 2/3] Documentation: power: Document regulator_lookup_list
Add some explanatory documentation to machine.rst detailing when and
how to use the new regulator lookup functionality.
Signed-off-by: Daniel Scally <djrscally@...il.com>
---
Changes in v2:
- Patch introduced
Documentation/power/regulator/machine.rst | 31 +++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/Documentation/power/regulator/machine.rst b/Documentation/power/regulator/machine.rst
index 22fffefaa3ad..7ad64e59b649 100644
--- a/Documentation/power/regulator/machine.rst
+++ b/Documentation/power/regulator/machine.rst
@@ -95,3 +95,34 @@ Finally the regulator devices must be registered in the usual manner::
/* register regulator 2 device */
platform_device_register(®ulator_devices[1]);
+
+Alternatively, if the struct regulator_init_data is being created in a process
+distinct from the registration of the regulator devices themselves (for example
+if the regulator devices themselves are enumerated through devicetree or ACPI
+but the system lacks regulator_init_data in firmware), then it must be added to
+a lookup table that will be checked when the regulator devices are registered.
+
+ static struct regulator_lookup regulator1_lookup = {
+ .device_name = "regulator.1",
+ .regulator_name = "Regulator-1",
+ .init_data = {
+ .constraints = {
+ .name = "Regulator-1",
+ .min_uV = 3300000,
+ .max_uV = 3300000,
+ .valid_ops_mask = REGULATOR_MODE_NORMAL,
+ },
+ .num_consumer_supplies = ARRAY_SIZE(regulator1_consumers),
+ .consumer_supplies = regulator1_consumers,
+ },
+ };
+
+ regulator_add_lookup(®ulator1_lookup);
+
+The .device_name field should match that of the struct device that the
+regulator driver will bind to. The .regulator_name field should match the name
+field in the struct regulator_desc that is used to register the regulator that
+this regulator_init_data is intended to be mapped to. Neither field can be null
+since regulator_register() will not allow the name field of the regulator_desc
+to be null, and without at least the device name we cannot guarantee we're
+passing the init_data to the right regulator.
--
2.25.1
Powered by blists - more mailing lists