devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: gyro: itg3200: Add DT support.
@ 2014-01-11 21:17 Marek Belisko
  2014-01-18 11:55 ` Jonathan Cameron
       [not found] ` <1389475047-4353-1-git-send-email-marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Belisko @ 2014-01-11 21:17 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ,
	jic23-DgEjT+Ai2ygdnm+yROfE0A, grant.likely-QSEj5FYQhm4dnm+yROfE0A
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA, Marek Belisko, NeilBrown

Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Marek Belisko <marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
---
 .../devicetree/bindings/iio/gyro/itg3200.txt       | 22 ++++++++++++++++++++++
 drivers/iio/gyro/itg3200_core.c                    |  9 +++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/gyro/itg3200.txt

diff --git a/Documentation/devicetree/bindings/iio/gyro/itg3200.txt b/Documentation/devicetree/bindings/iio/gyro/itg3200.txt
new file mode 100644
index 0000000..b1b18dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/gyro/itg3200.txt
@@ -0,0 +1,22 @@
+* InvenSense ITG-3200 gyroscope
+
+http://www.invensense.com/mems/gyro/itg3200.html
+
+Required properties:
+
+  - compatible : should be "invensense,itg3200"
+  - reg : the I2C address of the sensor
+
+Optional properties:
+
+  - interrupt-parent : should be the phandle for the interrupt controller
+  - interrupts : interrupt mapping for GPIO IRQ
+
+Example:
+
+itg3200@68 {
+	compatible = "invensense,itg3200";
+	reg = <0x68>;
+	interrupt-parent = <&gpio2>;
+	interrupts = <29 IRQ_TYPE_EDGE_RISING>;
+};
diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c
index 4d3f3b9..adbf20d 100644
--- a/drivers/iio/gyro/itg3200_core.c
+++ b/drivers/iio/gyro/itg3200_core.c
@@ -374,10 +374,19 @@ static const struct i2c_device_id itg3200_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, itg3200_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id itg3200_of_match[] = {
+	{ .compatible = "invensense,itg3200", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, itg3200_of_match);
+#endif
+
 static struct i2c_driver itg3200_driver = {
 	.driver = {
 		.owner  = THIS_MODULE,
 		.name	= "itg3200",
+		.of_match_table = of_match_ptr(itg3200_of_match),
 	},
 	.id_table	= itg3200_id,
 	.probe		= itg3200_probe,
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: gyro: itg3200: Add DT support.
  2014-01-11 21:17 [PATCH] iio: gyro: itg3200: Add DT support Marek Belisko
@ 2014-01-18 11:55 ` Jonathan Cameron
       [not found] ` <1389475047-4353-1-git-send-email-marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2014-01-18 11:55 UTC (permalink / raw)
  To: Marek Belisko, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, rob, grant.likely
  Cc: devicetree, linux-doc, linux-kernel, linux-iio, NeilBrown



On 11/01/14 21:17, Marek Belisko wrote:
> Signed-off-by: NeilBrown <neilb@suse.de>
> Signed-off-by: Marek Belisko <marek@goldelico.com>
Unless it is very recent, I don't the the invensense vendor-prefix is in
vendor-prefixes.txt. Please add that to the patch.

Otherwise, there is nothing here that isn't covered by the trivial
i2c bindings - thus perhaps it should be an entry in bindings/i2c/trivial-devices.txt?

Personally I'm not that fond of the trivial file as a single location
for the relevant info makes more sense to me.  Still thought I'd bring
it up as a possibility.

Jonathan
> ---
>   .../devicetree/bindings/iio/gyro/itg3200.txt       | 22 ++++++++++++++++++++++
>   drivers/iio/gyro/itg3200_core.c                    |  9 +++++++++
>   2 files changed, 31 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/iio/gyro/itg3200.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/gyro/itg3200.txt b/Documentation/devicetree/bindings/iio/gyro/itg3200.txt
> new file mode 100644
> index 0000000..b1b18dc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/gyro/itg3200.txt
> @@ -0,0 +1,22 @@
> +* InvenSense ITG-3200 gyroscope
> +
> +http://www.invensense.com/mems/gyro/itg3200.html
> +
> +Required properties:
> +
> +  - compatible : should be "invensense,itg3200"
> +  - reg : the I2C address of the sensor
> +
> +Optional properties:
> +
> +  - interrupt-parent : should be the phandle for the interrupt controller
> +  - interrupts : interrupt mapping for GPIO IRQ
> +
> +Example:
> +
> +itg3200@68 {
> +	compatible = "invensense,itg3200";
> +	reg = <0x68>;
> +	interrupt-parent = <&gpio2>;
> +	interrupts = <29 IRQ_TYPE_EDGE_RISING>;
> +};
> diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c
> index 4d3f3b9..adbf20d 100644
> --- a/drivers/iio/gyro/itg3200_core.c
> +++ b/drivers/iio/gyro/itg3200_core.c
> @@ -374,10 +374,19 @@ static const struct i2c_device_id itg3200_id[] = {
>   };
>   MODULE_DEVICE_TABLE(i2c, itg3200_id);
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id itg3200_of_match[] = {
> +	{ .compatible = "invensense,itg3200", },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, itg3200_of_match);
> +#endif
> +
>   static struct i2c_driver itg3200_driver = {
>   	.driver = {
>   		.owner  = THIS_MODULE,
>   		.name	= "itg3200",
> +		.of_match_table = of_match_ptr(itg3200_of_match),
>   	},
>   	.id_table	= itg3200_id,
>   	.probe		= itg3200_probe,
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] iio: gyro: itg3200: Add DT support.
       [not found] ` <1389475047-4353-1-git-send-email-marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
@ 2014-01-18 21:57   ` Marek Belisko
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Belisko @ 2014-01-18 21:57 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ,
	jic23-DgEjT+Ai2ygdnm+yROfE0A, grant.likely-QSEj5FYQhm4dnm+yROfE0A
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA, hns-xXXSsgcRVICgSpxsJD1C4w,
	Marek Belisko, NeilBrown

Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Marek Belisko <marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
---

V2:
Added entries to i2c/trivial-devices and also add invensense to vendor-prefixes file.

 .../devicetree/bindings/i2c/trivial-devices.txt    |  1 +
 .../devicetree/bindings/iio/gyro/itg3200.txt       | 22 ++++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |  1 +
 drivers/iio/gyro/itg3200_core.c                    |  9 +++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/gyro/itg3200.txt

diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index 1a1ac2e..86078de 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -40,6 +40,7 @@ fsl,sgtl5000		SGTL5000: Ultra Low-Power Audio Codec
 gmt,g751		G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
 infineon,slb9635tt	Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
 infineon,slb9645tt	Infineon SLB9645 I2C TPM (new protocol, max 400khz)
+invensense,itg3200	InvenSense ITG-3200, Gyroscope
 isl,isl12057		Intersil ISL12057 I2C RTC Chip
 maxim,ds1050		5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237		Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
diff --git a/Documentation/devicetree/bindings/iio/gyro/itg3200.txt b/Documentation/devicetree/bindings/iio/gyro/itg3200.txt
new file mode 100644
index 0000000..b1b18dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/gyro/itg3200.txt
@@ -0,0 +1,22 @@
+* InvenSense ITG-3200 gyroscope
+
+http://www.invensense.com/mems/gyro/itg3200.html
+
+Required properties:
+
+  - compatible : should be "invensense,itg3200"
+  - reg : the I2C address of the sensor
+
+Optional properties:
+
+  - interrupt-parent : should be the phandle for the interrupt controller
+  - interrupts : interrupt mapping for GPIO IRQ
+
+Example:
+
+itg3200@68 {
+	compatible = "invensense,itg3200";
+	reg = <0x68>;
+	interrupt-parent = <&gpio2>;
+	interrupts = <29 IRQ_TYPE_EDGE_RISING>;
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index b2635c5..01bf752 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -44,6 +44,7 @@ ibm	International Business Machines (IBM)
 idt	Integrated Device Technologies, Inc.
 img	Imagination Technologies Ltd.
 intercontrol	Inter Control Group
+invensense InvenSense
 isl	Intersil
 karo	Ka-Ro electronics GmbH
 lg	LG Corporation
diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c
index 4d3f3b9..adbf20d 100644
--- a/drivers/iio/gyro/itg3200_core.c
+++ b/drivers/iio/gyro/itg3200_core.c
@@ -374,10 +374,19 @@ static const struct i2c_device_id itg3200_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, itg3200_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id itg3200_of_match[] = {
+	{ .compatible = "invensense,itg3200", },
+	{}
+};
+MODULE_DEVICE_TABLE(of, itg3200_of_match);
+#endif
+
 static struct i2c_driver itg3200_driver = {
 	.driver = {
 		.owner  = THIS_MODULE,
 		.name	= "itg3200",
+		.of_match_table = of_match_ptr(itg3200_of_match),
 	},
 	.id_table	= itg3200_id,
 	.probe		= itg3200_probe,
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-18 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 21:17 [PATCH] iio: gyro: itg3200: Add DT support Marek Belisko
2014-01-18 11:55 ` Jonathan Cameron
     [not found] ` <1389475047-4353-1-git-send-email-marek-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
2014-01-18 21:57   ` Marek Belisko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).