iio:light:tsl2563: Add DT support
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / iio / light / tsl2563.c
index 5e5d9de..0c6e459 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;