Input: mma8450 - add device tree probe support
authorShawn Guo <shawn.guo@linaro.org>
Mon, 1 Aug 2011 02:56:10 +0000 (19:56 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 1 Aug 2011 03:08:15 +0000 (20:08 -0700)
It adds device tree probe support for mma8450 driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Eric Miao <eric.miao@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Documentation/devicetree/bindings/input/fsl-mma8450.txt [new file with mode: 0644]
drivers/input/misc/mma8450.c

diff --git a/Documentation/devicetree/bindings/input/fsl-mma8450.txt b/Documentation/devicetree/bindings/input/fsl-mma8450.txt
new file mode 100644 (file)
index 0000000..a00c94c
--- /dev/null
@@ -0,0 +1,11 @@
+* Freescale MMA8450 3-Axis Accelerometer
+
+Required properties:
+- compatible : "fsl,mma8450".
+
+Example:
+
+accelerometer: mma8450@1c {
+       compatible = "fsl,mma8450";
+       reg = <0x1c>;
+};
index 20f8f9284f028e7f125224187d40db2ef7ed330d..6c76cf79299143ce16542af8e734e49e4a21bf12 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/input-polldev.h>
+#include <linux/of_device.h>
 
 #define MMA8450_DRV_NAME       "mma8450"
 
@@ -229,10 +230,17 @@ static const struct i2c_device_id mma8450_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, mma8450_id);
 
+static const struct of_device_id mma8450_dt_ids[] = {
+       { .compatible = "fsl,mma8450", },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(i2c, mma8450_dt_ids);
+
 static struct i2c_driver mma8450_driver = {
        .driver = {
                .name   = MMA8450_DRV_NAME,
                .owner  = THIS_MODULE,
+               .of_match_table = mma8450_dt_ids,
        },
        .probe          = mma8450_probe,
        .remove         = __devexit_p(mma8450_remove),