iio:light:tsl2563: Add DT support
authorSebastian Reichel <sre@debian.org>
Fri, 25 Oct 2013 09:10:00 +0000 (10:10 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sun, 24 Nov 2013 21:07:14 +0000 (21:07 +0000)
Add Device Tree support for the TSL2563 driver,
document the binding and add AMS-TAOS Inc. to the
list of vendor prefixes.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Acked-by: Kumar Gala <galak@codeaurora.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/devicetree/bindings/iio/light/tsl2563.txt [new file with mode: 0644]
Documentation/devicetree/bindings/vendor-prefixes.txt
drivers/iio/light/tsl2563.c

diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
new file mode 100644 (file)
index 0000000..f91e809
--- /dev/null
@@ -0,0 +1,19 @@
+* AMS TAOS TSL2563 ambient light sensor
+
+Required properties:
+
+  - compatible : should be "amstaos,tsl2563"
+  - reg : the I2C address of the sensor
+
+Optional properties:
+
+  - amstaos,cover-comp-gain : integer used as multiplier for gain
+                              compensation (default = 1)
+
+Example:
+
+tsl2563@29 {
+       compatible = "amstaos,tsl2563";
+       reg = <0x29>;
+       amstaos,cover-comp-gain = <16>;
+};
index 04eab45dd14816280f3acbd63e2f69d08b12e277..b65a44041ec168dc46b9470a9a99bafc7055fe66 100644 (file)
@@ -9,6 +9,7 @@ aeroflexgaisler Aeroflex Gaisler AB
 ak     Asahi Kasei Corp.
 altr   Altera Corp.
 amcc   Applied Micro Circuits Corporation (APM, formally AMCC)
+amstaos        AMS-Taos Inc.
 apm    Applied Micro Circuits Corporation (APM)
 arm    ARM Ltd.
 atmel  Atmel Corporation
index 5e5d9dea22c598016c225848333c1e31595c811f..0c6e459c86b1de6450e8de0fa05b3a3f8df57a3b 100644 (file)
@@ -714,6 +714,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;
 
@@ -750,6 +751,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(np, "amstaos,cover-comp-gain",
+                                    &chip->cover_comp_gain);
        else
                chip->cover_comp_gain = 1;