summaryrefslogtreecommitdiff
path: root/patches.tizen/0196-iio-ak8975-Add-support-for-gpios-DT-property.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches.tizen/0196-iio-ak8975-Add-support-for-gpios-DT-property.patch')
-rw-r--r--patches.tizen/0196-iio-ak8975-Add-support-for-gpios-DT-property.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/patches.tizen/0196-iio-ak8975-Add-support-for-gpios-DT-property.patch b/patches.tizen/0196-iio-ak8975-Add-support-for-gpios-DT-property.patch
new file mode 100644
index 00000000000..e4f06c661a4
--- /dev/null
+++ b/patches.tizen/0196-iio-ak8975-Add-support-for-gpios-DT-property.patch
@@ -0,0 +1,76 @@
+From 784caada8f244c70a5988aa58033f3e8fdc522e4 Mon Sep 17 00:00:00 2001
+From: Jacek Anaszewski <j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
+Date: Tue, 7 May 2013 12:41:38 +0200
+Subject: [PATCH 0196/1302] 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>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+---
+ .../devicetree/bindings/iio/magnetometer/ak8975.txt | 18 ++++++++++++++++++
+ drivers/iio/magnetometer/ak8975.c | 12 +++++++++---
+ 2 files changed, 27 insertions(+), 3 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt
+
+diff --git a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt
+new file mode 100644
+index 0000000..011679f
+--- /dev/null
++++ b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt
+@@ -0,0 +1,18 @@
++* AsahiKASEI AK8975 magnetometer sensor
++
++Required properties:
++
++ - compatible : should be "asahi-kasei,ak8975"
++ - reg : the I2C address of the magnetometer
++
++Optional properties:
++
++ - gpios : should be device tree identifier of the magnetometer DRDY pin
++
++Example:
++
++ak8975@0c {
++ compatible = "asahi-kasei,ak8975";
++ reg = <0x0c>;
++ gpios = <&gpj0 7 0>;
++};
+diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
+index af6c320..d75cc23 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>
+@@ -384,10 +385,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 */
+--
+1.8.3.2
+