Skip to contentSkip to conversation

tps65023: add device tree support

PATCH Superseded Thomas Elste 2 participants 6 messages Sep 15, 2015 – Sep 17, 2015 3 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

Hi all,

the following patch adds device tree support for TPS6502[0,1,3] regulators. It is largely based on the DT code of the other TPS regulator drivers and a previous patch I found here:

http://article.gmane.org/gmane.linux.drivers.devicetree/102864/

Tested on a custom board with AM3505 CPU.

Best regards
Thomas

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1442324035-16414-1-git-send-email-thomas.elste-cSCHQGRfioA@public.gmane.org

#2 lore raw

PATCH 1/1 regulator: tps65023: add device tree support

Add device tree based initialization support for tps65023 regulators. Add device tree binding document for tps65023 regulators.

---
 .../devicetree/bindings/regulator/tps65023.txt     | 58 +++++++++++++++
 drivers/regulator/tps65023-regulator.c             | 83 +++++++++++++++++++++-
 2 files changed, 139 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/tps65023.txt
Documentation/devicetree/bindings/regulator/tps65023.txt new file +58 -0
new file mode 100644
index 0000000..bdd0d96
@@ -0,0 +1,58 @@
+TPS65023 family of regulators
+
+Required properties:
+- compatible: Must be one of the following.
+	"ti,tps65020",
+	"ti,tps65021",
+	"ti,tps65023",
+- reg: I2C slave address
+- regulators: list of regulators provided by this controller, must be named
+  after their hardware counterparts: VDCDC[1-3] and LDO[1-2]
+- regulators: This is the list of child nodes that specify the regulator
+  initialization data for defined regulators. The definition for each of
+  these nodes is defined using the standard binding for regulators found at
+  Documentation/devicetree/bindings/regulator/regulator.txt.
+
+Example:
+
+	tps65023@48 {
+		compatible = "ti,tps65023";
+		reg = <0x48>;
+
+		regulators {
+			VDCDC1 {
+				regulator-name = "vdd_mpu";
+				regulator-always-on;
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+			};
+
+			VDCDC2 {
+				regulator-name = "vdd_core";
+				regulator-always-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			VDCDC3 {
+				regulator-name = "vdd_io";
+				regulator-always-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			LDO1 {
+				regulator-name = "vdd_usb18";
+				regulator-always-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
+			LDO2 {
+				regulator-name = "vdd_usb33";
+				regulator-always-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+			};
+		};
+	};
drivers/regulator/tps65023-regulator.c +81 -2

115 lines not on this page · raw message

Signature · 6 lines
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1442324035-16414-2-git-send-email-thomas.elste-cSCHQGRfioA@public.gmane.org

#4 lore raw

Re: [PATCH] regulator: tps65023: add device tree support

Quoted 4 lines · Thomas Elste
drivers/regulator/tps65023-regulator.c +4 -0
+static struct regulator_init_data*
+	of_get_tps65023_platform_data(struct device *dev)
+{
+	struct regulator_init_data *reg_data;

drivers/regulator/tps65023-regulator.c static const struct regmap_config tps65023_regmap_config = { · line 234

Quoted 10 lines
drivers/regulator/tps65023-regulator.c +10 -0
+	struct device_node *np = dev->of_node;
+	struct device_node *regulators;
+	struct of_regulator_match *matches;
+	int idx, count, ret;
+
+	regulators = of_get_child_by_name(np, "regulators");
+	if (!regulators) {
+		dev_err(dev, "Regulator node not found\n");
+		return NULL;
+	}

There's now core support for this so no need to open code in the driver
- set of_match and regulators_node in the regulator_desc instead.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH] regulator: tps65023: add device tree support

Quoted 10 lines
Quoted 10 lines
drivers/regulator/tps65023-regulator.c +10 -0
+static struct regulator_init_data*
+	of_get_tps65023_platform_data(struct device *dev)
+{
+	struct regulator_init_data *reg_data;
+	struct device_node *np = dev->of_node;
+	struct device_node *regulators;
+	struct of_regulator_match *matches;
+	int idx, count, ret;
+
+	regulators = of_get_child_by_name(np, "regulators");
Quoted 8 lines

drivers/regulator/tps65023-regulator.c static const struct regmap_config tps65023_regmap_config = { · line 234

Quoted 4 lines
drivers/regulator/tps65023-regulator.c +4 -0
+	if (!regulators) {
+		dev_err(dev, "Regulator node not found\n");
+		return NULL;
+	}

There's now core support for this so no need to open code in the driver
- set of_match and regulators_node in the regulator_desc instead.

Thanks for reviewing. I'll change the patch to matching regulator nodes via regulator core code.

And I will use a separate patch for the binding document (just found Documentation/devicetree/bindings/submitting-patches.txt).

Best regards
Thomas

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH] regulator: tps65023: add device tree support

Quoted 2 lines · Thomas Elste

And I will use a separate patch for the binding document (just found Documentation/devicetree/bindings/submitting-patches.txt).

It's actually fine to just have them in the same patch for a simple driver using established bindings like this - the DT maintainers are unlikely to have the bandwidth to look at it anyway. But splitting is also OK.

#8 lore raw
In reply to a message not in the archive
Quoted 5 lines · Thomas Elste

Hi all,

the following patch adds device tree support for TPS6502[0,1,3] regulators. It is largely based on the DT code of the other TPS regulator drivers and a previous patch I found here:

Please don't send cover letters for single patches, if there is anything useful either put it in the changelog or (if it's administrative stuff) put it after the ---.