Skip to contentSkip to conversation

i2c/gpio: add DT support

PATCH Superseded Jean-Christophe PLAGNIOL-VILLARD 2 participants 5 messages Mar 13, 2012 – Mar 15, 2012

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

PATCH v4 1/5 i2c/gpio: add DT support

update to use devm_kzalloc for private data

Cc Nicolas Ferre <[email protected]>
Cc linux-i2c at vger.kernel.org
Cc devicetree-discuss at lists.ozlabs.org

---
v4:

fix timeout
use gpio_is_valid

 .../devicetree/bindings/gpio/gpio_i2c.txt          |   32 +++++++
 drivers/i2c/busses/i2c-gpio.c                      |   94 +++++++++++++++----
 2 files changed, 106 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio_i2c.txt
Documentation/devicetree/bindings/gpio/gpio_i2c.txt new file +32 -0
new file mode 100644
index 0000000..4f8ec94
@@ -0,0 +1,32 @@
+Device-Tree bindings for i2c gpio driver
+
+Required properties:
+	- compatible = "i2c-gpio";
+	- gpios: sda and scl gpio
+
+
+Optional properties:
+	- i2c-gpio,sda-open-drain: sda as open drain
+	- i2c-gpio,scl-open-drain: scl as open drain
+	- i2c-gpio,scl-output-only: scl as output only
+	- i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform)
+	- i2c-gpio,timeout-ms: timeout to get data
+
+Example nodes:
+
+i2c at 0 {
+	compatible = "i2c-gpio";
+	gpios = <&pioA 23 0 /* sda */
+		 &pioA 24 0 /* scl */
+		>;
+	i2c-gpio,sda-open-drain;
+	i2c-gpio,scl-open-drain;
+	i2c-gpio,delay-us = <2>;	/* ~100 kHz */
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	rv3029c2 at 56 {
+		compatible = "rv3029c2";
+		reg = <0x56>;
+	};
+};
drivers/i2c/busses/i2c-gpio.c +74 -20

153 lines not on this page · raw message

Signature · 1 line
1.7.7
#1 lore raw

PATCH v4 1/5 i2c/gpio: add DT support

Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

update to use devm_kzalloc for private data

Hmm, you need really to work on the commit messages, not everybody is familiar with DT and its implications:

"To achieve DT support, we need to populate a custom platform_data in a private struct from DT information. To simplify code, the adapter and algorithm are also put into the private struct."

Something like this?

Quoted 4 lines

---
v4:

fix timeout

You need to work on the changelogs as well :)

Quoted 1 line

use gpio_is_valid

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120313/913aa960/attachment.sig>
#2 lore raw

PATCH v4 1/5 i2c/gpio: add DT support

Quoted 11 lines · Wolfram Sang
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

update to use devm_kzalloc for private data

Hmm, you need really to work on the commit messages, not everybody is familiar with DT and its implications:

"To achieve DT support, we need to populate a custom platform_data in a private struct from DT information. To simplify code, the adapter and algorithm are also put into the private struct."

ok I put this can I get the Ack ?

I need to send the pull asap

Best Regards,
J.

#3 lore raw

PATCH v4 1/5 i2c/gpio: add DT support

Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Wolfram Sang
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD

update to use devm_kzalloc for private data

Quoted 8 lines
Quoted 7 lines

Hmm, you need really to work on the commit messages, not everybody is familiar with DT and its implications:

"To achieve DT support, we need to populate a custom platform_data in a private struct from DT information. To simplify code, the adapter and algorithm are also put into the private struct."

ok I put this can I get the Ack ?

Yes.

Quoted 1 line

I need to send the pull asap

Please, no rush. Makes it too easy for bugs to slip in...

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120313/7cf3bc0a/attachment.sig>
#4 lore raw

PATCH v5 1/5 i2c/gpio: add DT support

In reply to Jean-Christophe PLAGNIOL-VILLARD

To achieve DT support, we need to populate a custom platform_data in a private struct from DT information. To simplify code, the adapter and algorithm are also put into the private struct.

---
 .../devicetree/bindings/gpio/gpio_i2c.txt          |   32 +++++++
 drivers/i2c/busses/i2c-gpio.c                      |   94 +++++++++++++++----
 2 files changed, 106 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio_i2c.txt
Documentation/devicetree/bindings/gpio/gpio_i2c.txt new file +32 -0
new file mode 100644
index 0000000..4f8ec94
@@ -0,0 +1,32 @@
+Device-Tree bindings for i2c gpio driver
+
+Required properties:
+	- compatible = "i2c-gpio";
+	- gpios: sda and scl gpio
+
+
+Optional properties:
+	- i2c-gpio,sda-open-drain: sda as open drain
+	- i2c-gpio,scl-open-drain: scl as open drain
+	- i2c-gpio,scl-output-only: scl as output only
+	- i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform)
+	- i2c-gpio,timeout-ms: timeout to get data
+
+Example nodes:
+
+i2c at 0 {
+	compatible = "i2c-gpio";
+	gpios = <&pioA 23 0 /* sda */
+		 &pioA 24 0 /* scl */
+		>;
+	i2c-gpio,sda-open-drain;
+	i2c-gpio,scl-open-drain;
+	i2c-gpio,delay-us = <2>;	/* ~100 kHz */
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	rv3029c2 at 56 {
+		compatible = "rv3029c2";
+		reg = <0x56>;
+	};
+};
drivers/i2c/busses/i2c-gpio.c +74 -20

153 lines not on this page · raw message

Signature · 1 line
1.7.7