diff options
author | Jacek Anaszewski <j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> | 2013-05-07 12:41:38 +0200 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:42:59 +0900 |
commit | ab5259057fbb68d4b1cf5366b561ebae0577f81a (patch) | |
tree | 7dafb826603b57a396a44947ccddc7b0b060444c /drivers/iio/magnetometer | |
parent | 28324a0b0bace3fd02d420c2ea30a3653500d945 (diff) | |
download | linux-3.10-ab5259057fbb68d4b1cf5366b561ebae0577f81a.tar.gz linux-3.10-ab5259057fbb68d4b1cf5366b561ebae0577f81a.tar.bz2 linux-3.10-ab5259057fbb68d4b1cf5366b561ebae0577f81a.zip |
iio:ak8975 Add support for gpios DT property
Add support for parsing 'gpios' property when initializing
from oftree.
This patch adds also the binding documentation file.
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/iio/magnetometer')
-rw-r--r-- | drivers/iio/magnetometer/ak8975.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 53f829004a0..b8826353601 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -29,6 +29,7 @@ #include <linux/delay.h> #include <linux/gpio.h> +#include <linux/of_gpio.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> @@ -377,10 +378,15 @@ static int ak8975_probe(struct i2c_client *client, int err; /* Grab and set up the supplied GPIO. */ - if (client->dev.platform_data == NULL) - eoc_gpio = -1; - else + if (client->dev.platform_data) eoc_gpio = *(int *)(client->dev.platform_data); + else if (client->dev.of_node) + eoc_gpio = of_get_gpio(client->dev.of_node, 0); + else + eoc_gpio = -1; + + if (eoc_gpio == -EPROBE_DEFER) + return -EPROBE_DEFER; /* We may not have a GPIO based IRQ to scan, that is fine, we will poll if so */ |