Skip to contentSkip to conversation

MFD/GPIO: Add twl6040 GPO driver

PATCH Superseded Peter Ujfalusi 3 participants 9 messages Aug 16, 2012 – Sep 19, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover MFD/GPIO: Add twl6040 GPO driver

Hello,

Changes since v1:
- Removed the ti,use-gpo property from DT bindings
- Register the GPO driver if we booted with DT blob or in legacy if the pdata for the GPO driver is present
- DT binding Documentation update

The Documentation update has reference to the twl6040.dtsi file which will be created to hold the common/static properties for the twl6040.
To avoid cross tree merge issues later I have only included the Documentation update to this series and I will send the actual .dtsi/.dts changes via linux-omap. If this is not a problem.

The dependencies for this series are in mainline and I think this series can go via GPIO if Samuel agrees with the changes.

Intro mail from v1:

The following series adds support for the GPO (General Purpose Output) on the twl6040/41 audio chip.
The series has been tested on SDP4430, compile tested for x86_64 and x86_32 bit to be sure it does not introduce build breakage.

Regards,
Peter
---
Peter Ujfalusi (3):
mfd: twl6040: Fix GPO mask
mfd: twl6040: Add twl6040-gpio child
gpio: Add basic support for TWL6040 GPOs

 Documentation/devicetree/bindings/mfd/twl6040.txt |    9 +-
 drivers/gpio/Kconfig                              |    7 +
 drivers/gpio/Makefile                             |    1 +
 drivers/gpio/gpio-twl6040.c                       |  137 +++++++++++++++++++++
 drivers/mfd/twl6040-core.c                        |   15 +++
 include/linux/mfd/twl6040.h                       |   11 ++-
 6 files changed, 175 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpio/gpio-twl6040.c
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH v2 1/3 mfd: twl6040: Fix GPO mask

---
 include/linux/mfd/twl6040.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/mfd/twl6040.h +1 -1
index eaad49f..269b706 100644
@@ -143,7 +143,7 @@
 
 #define TWL6040_GPO1			0x01
 #define TWL6040_GPO2			0x02
-#define TWL6040_GPO3			0x03
+#define TWL6040_GPO3			0x04
 
 /* ACCCTL (0x2D) fields */
 
Signature · 1 line
1.7.8.6
#2 lore raw

PATCH v2 2/3 mfd: twl6040: Add twl6040-gpio child

In reply to Peter Ujfalusi

Add needed platform data structure and code to be able to load the GPO child of twl6040.
Update the devicetree binding documentation at the same time.

---
 Documentation/devicetree/bindings/mfd/twl6040.txt |    9 ++++++---
 drivers/mfd/twl6040-core.c                        |   15 +++++++++++++++
 include/linux/mfd/twl6040.h                       |    9 ++++++++-
 3 files changed, 29 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/mfd/twl6040.txt +6 -3
index c855240..0f5dd70 100644
@@ -1,7 +1,7 @@
 Texas Instruments TWL6040 family
 
-The TWL6040s are 8-channel high quality low-power audio codecs providing audio
-and vibra functionality on OMAP4+ platforms.
+The TWL6040s are 8-channel high quality low-power audio codecs providing audio,
+vibra and GPO functionality on OMAP4+ platforms.
 They are connected ot the host processor via i2c for commands, McPDM for audio
 data and commands.
 
@@ -10,6 +10,8 @@ Required properties:
 - reg: must be 0x4b for i2c address
 - interrupts: twl6040 has one interrupt line connecteded to the main SoC
 - interrupt-parent: The parent interrupt controller
+- gpio-controller:
+- #gpio-cells = <1>: twl6040 provides GPO lines.
 - twl6040,audpwron-gpio: Power on GPIO line for the twl6040
 
 - vio-supply: Regulator for the twl6040 VIO supply
@@ -37,7 +39,6 @@ Example:
 &i2c1 {
 	twl6040: twl@4b {
 		compatible = "ti,twl6040";
-		reg = <0x4b>;
 
 		interrupts = <0 119 4>;
 		interrupt-parent = <&gic>;
@@ -60,3 +61,5 @@ Example:
 		};
 	};
 };
+
+/include/ "twl6040.dtsi"
drivers/mfd/twl6040-core.c +15 -0
index b0fad0f..413df8e 100644
@@ -631,6 +631,21 @@ static int __devinit twl6040_probe(struct i2c_client *client,
 		children++;
 	}
 
+	/*
+	 * Enable the GPO driver in the following cases:
+	 * DT booted kernel or legacy boot with valid gpo platform_data
+	 */
+	if (!pdata || (pdata && pdata->gpo)) {
+		cell = &twl6040->cells[children];
+		cell->name = "twl6040-gpo";
+
+		if (pdata) {
+			cell->platform_data = pdata->gpo;
+			cell->pdata_size = sizeof(*pdata->gpo);
+		}
+		children++;
+	}
+
 	ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children,
 			      NULL, 0);
 	if (ret)
include/linux/mfd/twl6040.h +8 -1
index 269b706..8991532 100644
@@ -158,7 +158,7 @@
 #define TWL6040_VIBROCDET		0x20
 #define TWL6040_TSHUTDET                0x40
 
-#define TWL6040_CELLS			2
+#define TWL6040_CELLS			3
 
 #define TWL6040_REV_ES1_0		0x00
 #define TWL6040_REV_ES1_1		0x01 /* Rev ES1.1 and ES1.2 */
@@ -176,6 +176,8 @@
 #define TWL6040_SYSCLK_SEL_LPPLL	0
 #define TWL6040_SYSCLK_SEL_HPPLL	1
 
+#define TWL6040_GPO_MAX	3
+
 struct twl6040_codec_data {
 	u16 hs_left_step;
 	u16 hs_right_step;
@@ -192,12 +194,17 @@ struct twl6040_vibra_data {
 	int vddvibr_uV;			/* VDDVIBR volt, set 0 for fixed reg */
 };
 
+struct twl6040_gpo_data {
+	int gpio_base;
+};
+
 struct twl6040_platform_data {
 	int audpwron_gpio;	/* audio power-on gpio */
 	unsigned int irq_base;
 
 	struct twl6040_codec_data *codec;
 	struct twl6040_vibra_data *vibra;
+	struct twl6040_gpo_data *gpo;
 };
 
 struct regmap;
Signature · 1 line
1.7.8.6
#3 lore raw

PATCH v2 3/3 gpio: Add basic support for TWL6040 GPOs

In reply to Peter Ujfalusi

TWL6040 provides GPO lines to be used for controlling external devices.The number of lines different between versions: twl6040 have 3 GPO while TWL6041 have 1.

---
 drivers/gpio/Kconfig        |    7 ++
 drivers/gpio/Makefile       |    1 +
 drivers/gpio/gpio-twl6040.c |  137 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 145 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/gpio-twl6040.c
drivers/gpio/Kconfig +7 -0
index b16c8a7..f74633e 100644
@@ -402,6 +402,13 @@ config GPIO_TWL4030
 	  Say yes here to access the GPIO signals of various multi-function
 	  power management chips from Texas Instruments.
 
+config GPIO_TWL6040
+	tristate "TWL6040 GPO"
+	depends on TWL6040_CORE
+	help
+	  Say yes here to access the GPO signals of twl6040
+	  audio chip from Texas Instruments.
+
 config GPIO_WM831X
 	tristate "WM831x GPIOs"
 	depends on MFD_WM831X
drivers/gpio/Makefile +1 -0
index 153cace..f857b46 100644
@@ -67,6 +67,7 @@ obj-$(CONFIG_GPIO_TPS6586X)	+= gpio-tps6586x.o
 obj-$(CONFIG_GPIO_TPS65910)	+= gpio-tps65910.o
 obj-$(CONFIG_GPIO_TPS65912)	+= gpio-tps65912.o
 obj-$(CONFIG_GPIO_TWL4030)	+= gpio-twl4030.o
+obj-$(CONFIG_GPIO_TWL6040)	+= gpio-twl6040.o
 obj-$(CONFIG_GPIO_UCB1400)	+= gpio-ucb1400.o
 obj-$(CONFIG_GPIO_VR41XX)	+= gpio-vr41xx.o
 obj-$(CONFIG_GPIO_VX855)	+= gpio-vx855.o
drivers/gpio/gpio-twl6040.c new file +137 -0

137 lines not on this page · raw message

Signature · 1 line
1.7.8.6
#4 lore raw

v2 cover MFD/GPIO: Add twl6040 GPO driver

In reply to Peter Ujfalusi

Hi Samuel, Linus,

Quoted 8 lines · Peter Ujfalusi

Hello,

Changes since v1:
- Removed the ti,use-gpo property from DT bindings
- Register the GPO driver if we booted with DT blob or in legacy if the pdata for the GPO driver is present
- DT binding Documentation update

Quoted 5 lines

The Documentation update has reference to the twl6040.dtsi file which will be created to hold the common/static properties for the twl6040.
To avoid cross tree merge issues later I have only included the Documentation update to this series and I will send the actual .dtsi/.dts changes via linux-omap. If this is not a problem.

Did you had time to look at this series? Do you want me to resend it?

Thank you,
Péter

Quoted 19 lines

The dependencies for this series are in mainline and I think this series can go via GPIO if Samuel agrees with the changes.

Intro mail from v1:

The following series adds support for the GPO (General Purpose Output) on the twl6040/41 audio chip.
The series has been tested on SDP4430, compile tested for x86_64 and x86_32 bit to be sure it does not introduce build breakage.

Regards,
Peter
---
Peter Ujfalusi (3):
mfd: twl6040: Fix GPO mask
mfd: twl6040: Add twl6040-gpio child
gpio: Add basic support for TWL6040 GPOs

Quoted 9 lines
 Documentation/devicetree/bindings/mfd/twl6040.txt |    9 +-
 drivers/gpio/Kconfig                              |    7 +
 drivers/gpio/Makefile                             |    1 +
 drivers/gpio/gpio-twl6040.c                       |  137 +++++++++++++++++++++
 drivers/mfd/twl6040-core.c                        |   15 +++
 include/linux/mfd/twl6040.h                       |   11 ++-
 6 files changed, 175 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpio/gpio-twl6040.c

--
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

#5 lore raw

v2 cover MFD/GPIO: Add twl6040 GPO driver

Quoted 1 line · Peter Ujfalusi

Hi Samuel, Linus,

(...)

Quoted 1 line

Did you had time to look at this series? Do you want me to resend it?

I have provided my ACK on the GPIO part assuming you're taking this series through the MFD tree. There is not more I can do...

Yours,
Linus Walleij

#6 lore raw

v2 cover MFD/GPIO: Add twl6040 GPO driver

Thanks Linus,

Quoted 8 lines · Linus Walleij
Quoted 1 line · Peter Ujfalusi

Hi Samuel, Linus,

(...)

Quoted 1 line

Did you had time to look at this series? Do you want me to resend it?

I have provided my ACK on the GPIO part assuming you're taking this series through the MFD tree. There is not more I can do...

Samuel: can you take a look at this series and if it is OK with you schedule it for 3.7?

Thank you,
Péter
--
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

v2 cover MFD/GPIO: Add twl6040 GPO driver

In reply to Peter Ujfalusi

Hi Peter,

Quoted 24 lines · Peter Ujfalusi

Hello,

Changes since v1:
- Removed the ti,use-gpo property from DT bindings
- Register the GPO driver if we booted with DT blob or in legacy if the pdata for the GPO driver is present
- DT binding Documentation update

The Documentation update has reference to the twl6040.dtsi file which will be created to hold the common/static properties for the twl6040.
To avoid cross tree merge issues later I have only included the Documentation update to this series and I will send the actual .dtsi/.dts changes via linux-omap. If this is not a problem.

The dependencies for this series are in mainline and I think this series can go via GPIO if Samuel agrees with the changes.

Intro mail from v1:

The following series adds support for the GPO (General Purpose Output) on the twl6040/41 audio chip.
The series has been tested on SDP4430, compile tested for x86_64 and x86_32 bit to be sure it does not introduce build breakage.

Quoted 7 lines

Regards,
Peter
---
Peter Ujfalusi (3):
mfd: twl6040: Fix GPO mask
mfd: twl6040: Add twl6040-gpio child
gpio: Add basic support for TWL6040 GPOs

All 3 patches applied, thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#8 lore raw

v2 cover MFD/GPIO: Add twl6040 GPO driver

In reply to Peter Ujfalusi

Hi Peter,

Quoted 24 lines · Peter Ujfalusi

Hello,

Changes since v1:
- Removed the ti,use-gpo property from DT bindings
- Register the GPO driver if we booted with DT blob or in legacy if the pdata for the GPO driver is present
- DT binding Documentation update

The Documentation update has reference to the twl6040.dtsi file which will be created to hold the common/static properties for the twl6040.
To avoid cross tree merge issues later I have only included the Documentation update to this series and I will send the actual .dtsi/.dts changes via linux-omap. If this is not a problem.

The dependencies for this series are in mainline and I think this series can go via GPIO if Samuel agrees with the changes.

Intro mail from v1:

The following series adds support for the GPO (General Purpose Output) on the twl6040/41 audio chip.
The series has been tested on SDP4430, compile tested for x86_64 and x86_32 bit to be sure it does not introduce build breakage.

Quoted 7 lines

Regards,
Peter
---
Peter Ujfalusi (3):
mfd: twl6040: Fix GPO mask
mfd: twl6040: Add twl6040-gpio child
gpio: Add basic support for TWL6040 GPOs

All 3 patches applied, thanks.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/