Skip to content

Commit 71ff069

Browse files
Shawn Guodtor
authored andcommitted
Input: mma8450 - add device tree probe support
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>
1 parent 1f4bb06 commit 71ff069

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* Freescale MMA8450 3-Axis Accelerometer
2+
3+
Required properties:
4+
- compatible : "fsl,mma8450".
5+
6+
Example:
7+
8+
accelerometer: mma8450@1c {
9+
compatible = "fsl,mma8450";
10+
reg = <0x1c>;
11+
};

‎drivers/input/misc/mma8450.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/delay.h>
2525
#include <linux/i2c.h>
2626
#include <linux/input-polldev.h>
27+
#include <linux/of_device.h>
2728

2829
#define MMA8450_DRV_NAME "mma8450"
2930

@@ -229,10 +230,17 @@ static const struct i2c_device_id mma8450_id[] = {
229230
};
230231
MODULE_DEVICE_TABLE(i2c, mma8450_id);
231232

233+
static const struct of_device_id mma8450_dt_ids[] = {
234+
{ .compatible = "fsl,mma8450", },
235+
{ /* sentinel */ }
236+
};
237+
MODULE_DEVICE_TABLE(i2c, mma8450_dt_ids);
238+
232239
static struct i2c_driver mma8450_driver = {
233240
.driver = {
234241
.name = MMA8450_DRV_NAME,
235242
.owner = THIS_MODULE,
243+
.of_match_table = mma8450_dt_ids,
236244
},
237245
.probe = mma8450_probe,
238246
.remove = __devexit_p(mma8450_remove),

0 commit comments

Comments
 (0)