devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:light:tsl2563: Add DT support
@ 2013-10-23 21:51 Sebastian Reichel
       [not found] ` <1382565063-17083-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Sebastian Reichel @ 2013-10-23 21:51 UTC (permalink / raw)
  To: Sebastian Reichel, linux-iio
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
	Ian Campbell, Rob Landley, Jonathan Cameron, Sebastian Reichel,
	Peter Meerwald, Greg Kroah-Hartman, Bill Pemberton, Sachin Kamat,
	devicetree, linux-doc, linux-kernel

Add Device Tree support for the TSL2563 driver
and document the binding.

Signed-off-by: Sebastian Reichel <sre@debian.org>
---
 .../devicetree/bindings/iio/light/tsl2563.txt         | 19 +++++++++++++++++++
 drivers/iio/light/tsl2563.c                           |  4 ++++
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt

diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
new file mode 100644
index 0000000..b52cf4b
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
@@ -0,0 +1,19 @@
+* TAOS TSL2563 ambient light sensor
+
+Required properties:
+
+  - compatible : should be "taos,tsl2563"
+  - reg : the I2C address of the sensor
+
+Optional properties:
+
+  - cover-comp-gain : integer used as multiplier for gain
+                      compensation (default = 1)
+
+Example:
+
+tsl2563@29 {
+	compatible = "taos,tsl2563";
+	reg = <0x29>;
+	cover-comp-gain = <16>;
+};
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index ebb962c..bd30b1d 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -699,6 +699,7 @@ static int tsl2563_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 	struct tsl2563_chip *chip;
 	struct tsl2563_platform_data *pdata = client->dev.platform_data;
+	struct device_node *np = client->dev.of_node;
 	int err = 0;
 	u8 id = 0;
 
@@ -735,6 +736,9 @@ static int tsl2563_probe(struct i2c_client *client,
 
 	if (pdata)
 		chip->cover_comp_gain = pdata->cover_comp_gain;
+	else if (np)
+		of_property_read_u32_index(np, "cover-comp-gain", 0,
+							&chip->cover_comp_gain);
 	else
 		chip->cover_comp_gain = 1;
 
-- 
1.8.4.rc3


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

end of thread, other threads:[~2013-11-23 12:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 21:51 [PATCH] iio:light:tsl2563: Add DT support Sebastian Reichel
     [not found] ` <1382565063-17083-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2013-10-24  8:29   ` Jonathan Cameron
     [not found]     ` <5268DA76.6060503-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-10-24 13:43       ` Sebastian Reichel
2013-10-24 13:58         ` Jon Brenner
     [not found]           ` <3C879D35B299F147B1DEDFBEE12F2E06012E5631C1-w6KWF4XPi0fT3vPUD1ni5ZoqS/4htBe4AL8bYrjMMd8@public.gmane.org>
2013-10-24 15:13             ` Jonathan Cameron
2013-10-24 14:27   ` [PATCHv2] " Sebastian Reichel
     [not found]     ` <1382624835-10228-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2013-10-25  3:32       ` Kumar Gala
2013-10-25  8:23         ` Sebastian Reichel
2013-10-25  8:37           ` Kumar Gala
2013-10-25  9:10 ` [PATCHv3] " Sebastian Reichel
2013-11-23 11:52   ` Jonathan Cameron
2013-10-25 19:10 ` [PATCH] " Grant Likely
     [not found]   ` <20131025191028.8C140C40422-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-10-25 23:09     ` Sebastian Reichel
2013-11-23 11:50       ` Jonathan Cameron
     [not found]         ` <52909685.6040606-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-11-23 12:06           ` Sebastian Reichel

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