Skip to contentSkip to conversation

mfd: TPS65218: Add support for TPS65218 PMIC

PATCH Superseded Keerthy 5 participants 16 messages Dec 3, 2013 – Dec 4, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

cover mfd: TPS65218: Add support for TPS65218 PMIC

The TPS65218 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components:

- Regulators.
- Over Temperature warning and Shut down.

This patch adds support for TPS65218 mfd device. At this time only the regulator functionality is made available.

The patch series is dependent on:

http://www.spinics.net/lists/arm-kernel/msg289361.html

The series is boot tested on am43x-epos-evm board.

Keerthy (4):
mfd: DT bindings for TPS65218 PMIC
MFD: TPS65218: Add driver for the TPS65218 PMIC
Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC
ARM: dts: AM437x: Add TPS65218 device tree nodes

 Documentation/devicetree/bindings/mfd/tps65218.txt |   27 ++
 .../devicetree/bindings/regulator/tps65218.txt     |   22 ++
 arch/arm/boot/dts/am43x-epos-evm.dts               |   41 ++
 drivers/mfd/Kconfig                                |   14 +
 drivers/mfd/Makefile                               |    1 +
 drivers/mfd/tps65218.c                             |  281 ++++++++++++++
 drivers/regulator/Kconfig                          |    9 +
 drivers/regulator/Makefile                         |    1 +
 drivers/regulator/tps65218-regulator.c             |  393 ++++++++++++++++++++
 include/linux/mfd/tps65218.h                       |  288 ++++++++++++++
 10 files changed, 1077 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65218.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/tps65218.txt
 create mode 100644 drivers/mfd/tps65218.c
 create mode 100644 drivers/regulator/tps65218-regulator.c
 create mode 100644 include/linux/mfd/tps65218.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/4 mfd: DT bindings for TPS65218 PMIC

Add DT bindings for TPS65218 PMIC.

---
 Documentation/devicetree/bindings/mfd/tps65218.txt |   27 ++++++++++++++++++++
 .../devicetree/bindings/regulator/tps65218.txt     |   22 ++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65218.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/tps65218.txt
Documentation/devicetree/bindings/mfd/tps65218.txt new file +27 -0
new file mode 100644
index 0000000..87cb7a8
@@ -0,0 +1,27 @@
+The TPS65218 Integrated Power Management Chips.
+These chips are connected to an i2c bus.
+
+Required properties:
+- compatible : Must be "ti,tps65218";
+- interrupts : This i2c device has an IRQ line connected to the main SoC
+- interrupt-controller : Since the tps65218 support several interrupts
+  internally, it is considered as an interrupt controller cascaded to the SoC.
+- #interrupt-cells = <2>;
+- interrupt-parent : The parent interrupt controller.
+
+Optional node:
+- Child nodes contain in the tps65218.
+  It supports a number of features.
+  The children nodes will thus depend of the capability of the variant.
+
+Example:
+/*
+ * Integrated Power Management Chip
+ */
+tps@24 {
+    compatible = "ti,tps65218";
+    reg = <0x24>;
+    interrupt-controller;
+    #interrupt-cells = <2>;
+    interrupt-parent = <&gic>;
+};
Documentation/devicetree/bindings/regulator/tps65218.txt new file +22 -0
new file mode 100644
index 0000000..1ccf170
@@ -0,0 +1,22 @@
+TPS65218 family of regulators
+
+Required properties:
+For tps65218 regulators/LDOs
+- compatible:
+  - "ti,tps65218-dcdc1" for DCDC1
+  - "ti,tps65218-dcdc2" for DCDC2
+  - "ti,tps65218-dcdc3" for DCDC3
+  - "ti,tps65218-dcdc4" for DCDC4
+  - "ti,tps65218-dcdc5" for DCDC5
+  - "ti,tps65218-dcdc6" for DCDC6
+  - "ti,tps65218-ldo1" for LDO1 LDO
+
+Optional properties:
+- Any optional property defined in bindings/regulator/regulator.txt
+
+Example:
+	xyz: regulator@0 {
+		compatible = "ti,tps65218-dcdc1";
+		regulator-min-microvolt  = <1000000>;
+		regulator-max-microvolt  = <3000000>;
+	};
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/4] mfd: DT bindings for TPS65218 PMIC

Quoted 16 lines

Add DT bindings for TPS65218 PMIC.

---
 Documentation/devicetree/bindings/mfd/tps65218.txt |   27 ++++++++++++++++++++
 .../devicetree/bindings/regulator/tps65218.txt     |   22 ++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/tps65218.txt
 create mode 100644 Documentation/devicetree/bindings/regulator/tps65218.txt
Documentation/devicetree/bindings/mfd/tps65218.txt new file +0 -0
new file mode 100644
index 0000000..87cb7a8

Documentation/devicetree/bindings/mfd/tps65218.txt line 2

Quoted 2 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +2 -0
@@ -0,0 +1,27 @@
+The TPS65218 Integrated Power Management Chips.
+These chips are connected to an i2c bus.
                                   I2C

Documentation/devicetree/bindings/mfd/tps65218.txt line 6

Quoted 3 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +3 -0
+Required properties:
+- compatible : Must be "ti,tps65218";
+- interrupts : This i2c device has an IRQ line connected to the main SoC
                       I2C

Documentation/devicetree/bindings/mfd/tps65218.txt line 7

Quoted 1 line
Documentation/devicetree/bindings/mfd/tps65218.txt new file +1 -0
+- interrupt-controller : Since the tps65218 support several interrupts
                                               support(s) (hosts?)

Documentation/devicetree/bindings/mfd/tps65218.txt line 10

Quoted 3 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +3 -0
+  internally, it is considered as an interrupt controller cascaded to the SoC.
+- #interrupt-cells = <2>;
+- interrupt-parent : The parent interrupt controller.

Phandle to ...

Documentation/devicetree/bindings/mfd/tps65218.txt line 12

Quoted 1 line
Documentation/devicetree/bindings/mfd/tps65218.txt new file +1 -0
+Optional node:
            node(s):

Documentation/devicetree/bindings/mfd/tps65218.txt line 14

Quoted 2 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +2 -0
+- Child nodes contain in the tps65218.
+  It supports a number of features.

Please re-phase the above two sentences to something decipherable.

Documentation/devicetree/bindings/mfd/tps65218.txt line 15

Quoted 1 line
Documentation/devicetree/bindings/mfd/tps65218.txt new file +1 -0
+  The children nodes will thus depend of the capability of the variant.

Please, go on ...

Documentation/devicetree/bindings/mfd/tps65218.txt line 27

Quoted 11 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +11 -0
+Example:
+/*
+ * Integrated Power Management Chip
+ */
+tps@24 {
+    compatible = "ti,tps65218";
+    reg = <0x24>;
+    interrupt-controller;
+    #interrupt-cells = <2>;
+    interrupt-parent = <&gic>;
+};

Perhaps it would be better to centralise the documentation inclusive of the regulator contingent. Or at least provide a _full_ example in each document.

Quoted 8 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +2 -0
new file mode 100644
index 0000000..1ccf170
@@ -0,0 +1,22 @@
+TPS65218 family of regulators
+

Documentation/devicetree/bindings/regulator/tps65218.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +10 -0
+Required properties:
+For tps65218 regulators/LDOs
+- compatible:
+  - "ti,tps65218-dcdc1" for DCDC1
+  - "ti,tps65218-dcdc2" for DCDC2
+  - "ti,tps65218-dcdc3" for DCDC3
+  - "ti,tps65218-dcdc4" for DCDC4
+  - "ti,tps65218-dcdc5" for DCDC5
+  - "ti,tps65218-dcdc6" for DCDC6
+  - "ti,tps65218-ldo1" for LDO1 LDO

Why aren't you using 'regulator-compatible'?

Documentation/devicetree/bindings/regulator/tps65218.txt line 18

Quoted 5 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +5 -0
+Optional properties:
+- Any optional property defined in bindings/regulator/regulator.txt
+
+Example:
+	xyz: regulator@0 {

Genuine question: Is the @0 meaningful?

Quoted 4 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +4 -0
+		compatible = "ti,tps65218-dcdc1";
+		regulator-min-microvolt  = <1000000>;
+		regulator-max-microvolt  = <3000000>;
+	};
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

Re: [PATCH 1/4] mfd: DT bindings for TPS65218 PMIC

Quoted 10 lines · Lee Jones
Quoted 10 lines

Add DT bindings for TPS65218 PMIC.

---
  Documentation/devicetree/bindings/mfd/tps65218.txt |   27 ++++++++++++++++++++
  .../devicetree/bindings/regulator/tps65218.txt     |   22 ++++++++++++++++
  2 files changed, 49 insertions(+)

create mode 100644 Documentation/devicetree/bindings/mfd/tps65218.txt create mode 100644 Documentation/devicetree/bindings/regulator/tps65218.txt

Quoted 9 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 2

Quoted 8 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +2 -0
new file mode 100644
index 0000000..87cb7a8
@@ -0,0 +1,27 @@
+The TPS65218 Integrated Power Management Chips.
+These chips are connected to an i2c bus.
                                    I2C

Ok.

Quoted 4 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 6

Quoted 3 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +3 -0
+Required properties:
+- compatible : Must be "ti,tps65218";
+- interrupts : This i2c device has an IRQ line connected to the main SoC
                        I2C

Ok.

Quoted 2 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 7

Quoted 1 line
Documentation/devicetree/bindings/mfd/tps65218.txt new file +1 -0
+- interrupt-controller : Since the tps65218 support several interrupts
                                                support(s) (hosts?)

Yes Supports multiple interrupts from the sub-modules.

Quoted 7 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 10

Quoted 3 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +3 -0
+  internally, it is considered as an interrupt controller cascaded to the SoC.
+- #interrupt-cells = <2>;
+- interrupt-parent : The parent interrupt controller.

Phandle to ...

Documentation/devicetree/bindings/mfd/tps65218.txt line 12

Quoted 1 line
Documentation/devicetree/bindings/mfd/tps65218.txt new file +1 -0
+Optional node:
             node(s):

Ok.

Quoted 4 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 14

Quoted 3 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +2 -0
+- Child nodes contain in the tps65218.
+  It supports a number of features.

Please re-phase the above two sentences to something decipherable.

Ok.

Quoted 2 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 15

Quoted 1 line
Documentation/devicetree/bindings/mfd/tps65218.txt new file +1 -0
+  The children nodes will thus depend of the capability of the variant.

Please, go on ...

Ok.

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +6 -0
+Example:
+/*
+ * Integrated Power Management Chip
+ */
+tps@24 {
+    compatible = "ti,tps65218";
Quoted 8 lines

Documentation/devicetree/bindings/mfd/tps65218.txt line 27

Quoted 5 lines
Documentation/devicetree/bindings/mfd/tps65218.txt new file +5 -0
+    reg = <0x24>;
+    interrupt-controller;
+    #interrupt-cells = <2>;
+    interrupt-parent = <&gic>;
+};

Perhaps it would be better to centralise the documentation inclusive of the regulator contingent. Or at least provide a _full_ example in each document.

Ok.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +5 -0
new file mode 100644
index 0000000..1ccf170
@@ -0,0 +1,22 @@
+TPS65218 family of regulators
+
+Required properties:
+For tps65218 regulators/LDOs
+- compatible:
Quoted 8 lines

Documentation/devicetree/bindings/regulator/tps65218.txt line 12

Quoted 7 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +7 -0
+  - "ti,tps65218-dcdc1" for DCDC1
+  - "ti,tps65218-dcdc2" for DCDC2
+  - "ti,tps65218-dcdc3" for DCDC3
+  - "ti,tps65218-dcdc4" for DCDC4
+  - "ti,tps65218-dcdc5" for DCDC5
+  - "ti,tps65218-dcdc6" for DCDC6
+  - "ti,tps65218-ldo1" for LDO1 LDO

Why aren't you using 'regulator-compatible'?

I referred tps65217.txt the predecessors and used the compatible. I also referred twl-regulator.txt.

Quoted 7 lines

Documentation/devicetree/bindings/regulator/tps65218.txt line 18

Quoted 6 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +5 -0
+Optional properties:
+- Any optional property defined in bindings/regulator/regulator.txt
+
+Example:
+	xyz: regulator@0 {

Genuine question: Is the @0 meaningful?

@0 is not the best example. @24 is what i use on the am43x. I will change it to @24.

Quoted 4 lines

Documentation/devicetree/bindings/regulator/tps65218.txt line 22

Quoted 4 lines
Documentation/devicetree/bindings/regulator/tps65218.txt new file +4 -0
+		compatible = "ti,tps65218-dcdc1";
+		regulator-min-microvolt  = <1000000>;
+		regulator-max-microvolt  = <3000000>;
+	};

Thanks for reviewing.

Kind Regards,
Keerthy

#4 lore raw

Re: [PATCH 1/4] mfd: DT bindings for TPS65218 PMIC

Quoted 4 lines
Quoted 2 lines
Quoted 1 line

+- interrupt-controller : Since the tps65218 support several interrupts

                                               support(s) (hosts?)

Yes Supports multiple interrupts from the sub-modules.

I think 'support' should be the plural 'supports'.

<snip>

Quoted 4 lines
Quoted 1 line

Why aren't you using 'regulator-compatible'?

I referred tps65217.txt the predecessors and used the compatible. I also referred twl-regulator.txt.

That doesn't mean that they are correct/better. ;)

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#5 lore raw

PATCH 2/4 MFD: TPS65218: Add driver for the TPS65218 PMIC

In reply to Keerthy

The TPS65218 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components:

- Regulators.
- Over Temperature warning and Shut down.

This patch adds support for tps65218 mfd device. At this time only the regulator functionality is made available.

---
 drivers/mfd/Kconfig          |   14 ++
 drivers/mfd/Makefile         |    1 +
 drivers/mfd/tps65218.c       |  281 +++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/tps65218.h |  288 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 584 insertions(+)
 create mode 100644 drivers/mfd/tps65218.c
 create mode 100644 include/linux/mfd/tps65218.h
drivers/mfd/Kconfig +14 -0
index 62a60ca..b8f8b30 100644
@@ -833,6 +833,20 @@ config MFD_TPS65217
 	  This driver can also be built as a module.  If so, the module
 	  will be called tps65217.
 
+config MFD_TPS65218
+	tristate "TI TPS65218 Power Management chips"
+	depends on I2C
+	select MFD_CORE
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for the TPS65218 series of
+	  Power Management chips.
+	  These include voltage regulators, gpio and other features
+	  that are often used in portable devices.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called tps65218.
+
 config MFD_TPS6586X
 	bool "TI TPS6586x Power Management chips"
 	depends on I2C=y
drivers/mfd/Makefile +1 -0
index 8a28dc9..76668da 100644
@@ -62,6 +62,7 @@ obj-$(CONFIG_TPS6105X)		+= tps6105x.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 obj-$(CONFIG_TPS6507X)		+= tps6507x.o
 obj-$(CONFIG_MFD_TPS65217)	+= tps65217.o
+obj-$(CONFIG_MFD_TPS65218)	+= tps65218.o
 obj-$(CONFIG_MFD_TPS65910)	+= tps65910.o
 tps65912-objs                   := tps65912-core.o tps65912-irq.o
 obj-$(CONFIG_MFD_TPS65912)	+= tps65912.o
drivers/mfd/tps65218.c new file +281 -0

281 lines not on this page · raw message

include/linux/mfd/tps65218.h new file +288 -0

288 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH 2/4] MFD: TPS65218: Add driver for the TPS65218 PMIC

Quoted 15 lines

The TPS65218 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components:

- Regulators.
- Over Temperature warning and Shut down.

This patch adds support for tps65218 mfd device. At this time only the regulator functionality is made available.

---
 drivers/mfd/Kconfig          |   14 ++
 drivers/mfd/Makefile         |    1 +
 drivers/mfd/tps65218.c       |  281 +++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/tps65218.h |  288 ++++++++++++++++++++++++++++++++++++++++++

<snip>

drivers/mfd/Kconfig config MFD_TPS65217 · line 845

Quoted 10 lines
drivers/mfd/Kconfig +10 -0
+config MFD_TPS65218
+	tristate "TI TPS65218 Power Management chips"
+	depends on I2C
+	select MFD_CORE
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for the TPS65218 series of
+	  Power Management chips.
+	  These include voltage regulators, gpio and other features
+	  that are often used in portable devices.

Perhaps you should add a note that only the regulator component is currently supported.

<snip>

drivers/mfd/tps65218.c line 2

Quoted 7 lines

new file mode 100644
index 0000000..8c61640

drivers/mfd/tps65218.c new file +2 -0
@@ -0,0 +1,281 @@
+/*
+ * TPS65218 chip family multi-function driver

Instead of calling it an MFD driver (is there such a thing?) I think you should mention its true purpose, as per the datasheet.

<snip>

drivers/mfd/tps65218.c line 199

Quoted 3 lines
drivers/mfd/tps65218.c new file +3 -0
+static const struct of_device_id of_tps65218_match_table[] = {
+	{ .compatible = "ti,tps65218", },
+	{ /* end */ }

I think the end comment is superfluous.

However, if you _really_ want to put something in there, I dislike "/* Sentinel */" the least.

Quoted 3 lines
drivers/mfd/tps65218.c new file +3 -0
+static int tps65218_probe(struct i2c_client *client,
+				const struct i2c_device_id *ids)
+{

<snip>

drivers/mfd/tps65218.c line 240

Quoted 2 lines
drivers/mfd/tps65218.c new file +2 -0
+	ret = of_platform_populate(client->dev.of_node, NULL, NULL,
+				   &client->dev);

What are you trying to do here?

Register each regulator as a platform device?

<snip>

drivers/mfd/tps65218.c line 263

Quoted 3 lines
drivers/mfd/tps65218.c new file +3 -0
+static const struct i2c_device_id tps65218_id_table[] = {
+	{"tps65218", TPS65218},
+};

This has a different structure to of_tps65218_match_table, please ensure they're the same. I prefer spaces after '{' and before '}'.

<snip>

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" 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 2/4] MFD: TPS65218: Add driver for the TPS65218 PMIC

Quoted 17 lines · Lee Jones
Quoted 15 lines

The TPS65218 chip is a power management IC for Portable Navigation Systems and Tablet Computing devices. It contains the following components:

- Regulators.
- Over Temperature warning and Shut down.

This patch adds support for tps65218 mfd device. At this time only the regulator functionality is made available.

---
  drivers/mfd/Kconfig          |   14 ++
  drivers/mfd/Makefile         |    1 +
  drivers/mfd/tps65218.c       |  281 +++++++++++++++++++++++++++++++++++++++++
  include/linux/mfd/tps65218.h |  288 ++++++++++++++++++++++++++++++++++++++++++

<snip>

Quoted 12 lines

drivers/mfd/Kconfig config MFD_TPS65217 · line 845

Quoted 10 lines
drivers/mfd/Kconfig +10 -0
+config MFD_TPS65218
+	tristate "TI TPS65218 Power Management chips"
+	depends on I2C
+	select MFD_CORE
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for the TPS65218 series of
+	  Power Management chips.
+	  These include voltage regulators, gpio and other features
+	  that are often used in portable devices.

Perhaps you should add a note that only the regulator component is currently supported.

Ok. I will add it.

Quoted 11 lines

<snip>

drivers/mfd/tps65218.c line 2

Quoted 7 lines

new file mode 100644
index 0000000..8c61640

drivers/mfd/tps65218.c new file +2 -0
@@ -0,0 +1,281 @@
+/*
+ * TPS65218 chip family multi-function driver

Instead of calling it an MFD driver (is there such a thing?) I think you should mention its true purpose, as per the datasheet.

Ok.

Quoted 10 lines

<snip>

drivers/mfd/tps65218.c line 199

Quoted 3 lines
drivers/mfd/tps65218.c new file +3 -0
+static const struct of_device_id of_tps65218_match_table[] = {
+	{ .compatible = "ti,tps65218", },
+	{ /* end */ }

I think the end comment is superfluous.

However, if you _really_ want to put something in there, I dislike "/* Sentinel */" the least.

I will remove it.

Quoted 11 lines
Quoted 4 lines
drivers/mfd/tps65218.c new file +3 -0
+static int tps65218_probe(struct i2c_client *client,
+				const struct i2c_device_id *ids)
+{

<snip>

drivers/mfd/tps65218.c line 240

Quoted 2 lines
drivers/mfd/tps65218.c new file +2 -0
+	ret = of_platform_populate(client->dev.of_node, NULL, NULL,
+				   &client->dev);

What are you trying to do here?

Register each regulator as a platform device?

Yeah. The probe will be called for every regulator separately.

Quoted 7 lines

<snip>

drivers/mfd/tps65218.c line 263

Quoted 3 lines
drivers/mfd/tps65218.c new file +3 -0
+static const struct i2c_device_id tps65218_id_table[] = {
+	{"tps65218", TPS65218},
+};

This has a different structure to of_tps65218_match_table, please ensure they're the same. I prefer spaces after '{' and before '}'.

Ok. I will add a space after '{' and before '}'. Sorry I did not follow tps65218_id_table being different than of_tps65218_match_table.

One is of the type of_device_id and the other i2c_device_id.

Quoted 3 lines

<snip>

#8 lore raw

Re: [PATCH 2/4] MFD: TPS65218: Add driver for the TPS65218 PMIC

Quoted 7 lines
Quoted 5 lines

drivers/mfd/tps65218.c line 240

Quoted 2 lines
drivers/mfd/tps65218.c new file +2 -0
+	ret = of_platform_populate(client->dev.of_node, NULL, NULL,
+				   &client->dev);

What are you trying to do here?

Register each regulator as a platform device?

Yeah. The probe will be called for every regulator separately.

So there are two schools of thought on this. One is that if you want to do it that way you should use the MFD framework to do this for you. There is no need to recreate functionality that already exists. The other is that you shouldn't be doing this at all with regulators. Mark likes the idea of having a single regulator controller node which contains all of these individual regulator sub-nodes and you initiate a single call to for_each_child_of_node() within the driver in order to register them all.

<snip>

Quoted 7 lines
Quoted 2 lines

This has a different structure to of_tps65218_match_table, please ensure they're the same. I prefer spaces after '{' and before '}'.

Ok. I will add a space after '{' and before '}'. Sorry I did not follow tps65218_id_table being different than of_tps65218_match_table.

One is of the type of_device_id and the other i2c_device_id.

Shouldn't matter, it's just a formatting thing.

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#9 lore raw

Re: [PATCH 2/4] MFD: TPS65218: Add driver for the TPS65218 PMIC

Quoted 5 lines · Lee Jones

other is that you shouldn't be doing this at all with regulators. Mark likes the idea of having a single regulator controller node which contains all of these individual regulator sub-nodes and you initiate a single call to for_each_child_of_node() within the driver in order to register them all.

That's not really the case, it depends on how the hardware is structured. If the regulators are not laid out in a regular fashion or otherwise reusable then the above big bag of regulators makes sense. If the hardware is reusable then things are different.

maintainer
#10 lore raw

Re: [PATCH 2/4] MFD: TPS65218: Add driver for the TPS65218 PMIC

In reply to Keerthy

drivers/mfd/tps65218.c line 131

Quoted 4 lines · Keerthy
drivers/mfd/tps65218.c new file +4 -0
+static struct regmap_config tps65218_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+};

You should consider using a register cache for at least the interrupt mask registers, it'll improve performance.

author
#11 lore raw

PATCH 3/4 Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC

In reply to Keerthy

This patch adds support for TPS65218 PMIC regulators.

The regulators set consists of 6 DCDCs and 1 LDO. The output voltages are configurable and are meant to supply power to the main processor and other components.

---
 drivers/regulator/Kconfig              |    9 +
 drivers/regulator/Makefile             |    1 +
 drivers/regulator/tps65218-regulator.c |  393 ++++++++++++++++++++++++++++++++
 3 files changed, 403 insertions(+)
 create mode 100644 drivers/regulator/tps65218-regulator.c
drivers/regulator/Kconfig +9 -0
index ce785f4..42f94eb 100644
@@ -498,6 +498,15 @@ config REGULATOR_TPS65217
 	  voltage regulators. It supports software based voltage control
 	  for different voltage domains
 
+config REGULATOR_TPS65218
+	tristate "TI TPS65218 Power regulators"
+	depends on MFD_TPS65218
+	help
+	  This driver supports TPS65218 voltage regulator chips. TPS65218
+	  provides six step-down converters and one general-purpose LDO
+	  voltage regulators. It supports software based voltage control
+	  for different voltage domains
+
 config REGULATOR_TPS6524X
 	tristate "TI TPS6524X Power regulators"
 	depends on SPI
drivers/regulator/Makefile +1 -0
index 01c597e..dfbfdf9 100644
@@ -65,6 +65,7 @@ obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o
+obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
drivers/regulator/tps65218-regulator.c new file +393 -0

393 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#12 lore raw

Re: [PATCH 3/4] Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC

drivers/regulator/tps65218-regulator.c line 67

Quoted 11 lines · Keerthy
drivers/regulator/tps65218-regulator.c new file +11 -0
+static int tps65218_ldo1_dcdc3_vsel_to_uv(unsigned int vsel)
+{
+	int uV = 0;
+
+	if (vsel <= 26)
+		uV = vsel * 25000 + 900000;
+	else
+		uV = (vsel - 26) * 50000 + 1550000;
+
+	return uV;
+}

Use regulator_map_voltage_linear_range() (and similarly for most of the other functions).

drivers/regulator/tps65218-regulator.c line 155

Quoted 10 lines
drivers/regulator/tps65218-regulator.c new file +10 -0
+static const struct of_device_id tps65218_of_match[] = {
+	TPS65218_OF_MATCH("ti,tps65218-dcdc1", tps65218_pmic_regs[0]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc2", tps65218_pmic_regs[1]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc3", tps65218_pmic_regs[2]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc4", tps65218_pmic_regs[3]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc5", tps65218_pmic_regs[4]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc6", tps65218_pmic_regs[5]),
+	TPS65218_OF_MATCH("ti,tps65218-ldo1", tps65218_pmic_regs[6]),
+};
+MODULE_DEVICE_TABLE(of, tps65218_of_match);

Indexing into another array by magic number like this is both error prone and hard to read. Either use defined constants or individual variables for the things being referenced.

#13 lore raw

Re: [PATCH 3/4] Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC

Thanks for the review Mark.

Quoted 15 lines · Mark Brown

drivers/regulator/tps65218-regulator.c line 67

Quoted 11 lines · Keerthy
drivers/regulator/tps65218-regulator.c new file +11 -0
+static int tps65218_ldo1_dcdc3_vsel_to_uv(unsigned int vsel)
+{
+	int uV = 0;
+
+	if (vsel <= 26)
+		uV = vsel * 25000 + 900000;
+	else
+		uV = (vsel - 26) * 50000 + 1550000;
+
+	return uV;
+}

Use regulator_map_voltage_linear_range() (and similarly for most of the other functions).

Ok.

Quoted 5 lines
Quoted 5 lines
drivers/regulator/tps65218-regulator.c new file +5 -0
+static const struct of_device_id tps65218_of_match[] = {
+	TPS65218_OF_MATCH("ti,tps65218-dcdc1", tps65218_pmic_regs[0]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc2", tps65218_pmic_regs[1]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc3", tps65218_pmic_regs[2]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc4", tps65218_pmic_regs[3]),
Quoted 8 lines

drivers/regulator/tps65218-regulator.c line 155

Quoted 5 lines
drivers/regulator/tps65218-regulator.c new file +5 -0
+	TPS65218_OF_MATCH("ti,tps65218-dcdc5", tps65218_pmic_regs[4]),
+	TPS65218_OF_MATCH("ti,tps65218-dcdc6", tps65218_pmic_regs[5]),
+	TPS65218_OF_MATCH("ti,tps65218-ldo1", tps65218_pmic_regs[6]),
+};
+MODULE_DEVICE_TABLE(of, tps65218_of_match);

Indexing into another array by magic number like this is both error prone and hard to read. Either use defined constants or individual variables for the things being referenced.

Okay.

Regards,
Keerthy
--
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

#14 lore raw

Re: [PATCH 3/4] Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC

In reply to Keerthy

Hi Keerthy,

Quoted 1 line

+ rdev = regulator_register(&regulators[id], &config);

Can you make use of "devm_regulator_register" instead?

drivers/regulator/tps65218-regulator.c line 362

Quoted 11 lines
drivers/regulator/tps65218-regulator.c new file +11 -0
+       if (IS_ERR(rdev)) {
+               dev_err(tps->dev, "failed to register %s regulator\n",
+                       pdev->name);
+               return PTR_ERR(rdev);
+       }
+
+       /* Save regulator */
+       tps->rdev[id] = rdev;
+
+       return 0;
+}

Best Regards
Manish Badarkhe

author
#15 lore raw

PATCH 4/4 ARM: dts: AM437x: Add TPS65218 device tree nodes

In reply to Keerthy

Add TPS65218 device tree nodes. This patch is tested on am43x-epos-evm board.

---
 arch/arm/boot/dts/am43x-epos-evm.dts |   41 ++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/am43x-epos-evm.dts +41 -0
index fbf9c4c..ad7000a 100644
@@ -156,6 +156,47 @@
 		reg = <0x50>;
 	};
 
+	tps65218: tps65218@24 {
+		reg = <0x24>;
+		compatible = "ti,tps65218";
+		interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* NMIn */
+		interrupt-parent = <&gic>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+
+		dcdc1: regulator-dcdc1 {
+			compatible = "ti,tps65218-dcdc1";
+			/* VDD_CORE voltage limits min of OPP50 and max of OPP100 */
+			regulator-name = "vdd_core";
+			regulator-min-microvolt = <912000>;
+			regulator-max-microvolt = <1144000>;
+			regulator-boot-on;
+			regulator-always-on;
+		};
+
+		dcdc2: regulator-dcdc2 {
+			compatible = "ti,tps65218-dcdc2";
+			/* VDD_MPU voltage limits min of OPP50 and max of OPP_NITRO */
+			regulator-name = "vdd_mpu";
+			regulator-min-microvolt = <912000>;
+			regulator-max-microvolt = <1378000>;
+			regulator-boot-on;
+			regulator-always-on;
+		};
+
+		dcdc3: regulator-dcdc3 {
+			compatible = "ti,tps65218-dcdc3";
+		};
+
+		ldo1: regulator-ldo1 {
+			compatible = "ti,tps65218-ldo1";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-boot-on;
+			regulator-always-on;
+		};
+	};
+
 	pixcir_ts@5c {
 		compatible = "pixcir,pixcir_ts";
 		reg = <0x5c>;
Signature · 1 line
1.7.9.5