diff options
author | Daniel Mack <zonque@gmail.com> | 2012-09-26 16:58:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-26 17:17:42 -0400 |
commit | 4bcdea86f176e96d44531c1e54a1b5c92672424d (patch) | |
tree | b76220793d3a66f2979e910612bcc8ab2de46452 /drivers/misc | |
parent | cbac1a8b89452f378a17cc2c673aca0e53af684d (diff) |
drivers/misc/lis3lv02d/lis3lv02d_spi.c: add DT matching table passthru code
If probed from a device tree, this driver now passes the node information
to the generic part, so the runtime information can be derived.
Successfully tested on a PXA3xx board.
[akpm@linux-foundation.org: fix lis302dl_spi_dt_ids unused warning when CONFIG_OF=n]
Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Rob Herring <robherring2@gmail.com>
Cc: "AnilKumar, Chimata" <anilkumar@ti.com>
Reviewed-by: Éric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/lis3lv02d/lis3lv02d_spi.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c index 80880e984b4f..4b8ccf200194 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/workqueue.h> | 17 | #include <linux/workqueue.h> |
18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
19 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
20 | #include <linux/of.h> | ||
21 | #include <linux/of_platform.h> | ||
20 | 22 | ||
21 | #include "lis3lv02d.h" | 23 | #include "lis3lv02d.h" |
22 | 24 | ||
@@ -58,6 +60,14 @@ static int lis3_spi_init(struct lis3lv02d *lis3) | |||
58 | static union axis_conversion lis3lv02d_axis_normal = | 60 | static union axis_conversion lis3lv02d_axis_normal = |
59 | { .as_array = { 1, 2, 3 } }; | 61 | { .as_array = { 1, 2, 3 } }; |
60 | 62 | ||
63 | #ifdef CONFIG_OF | ||
64 | static struct of_device_id lis302dl_spi_dt_ids[] = { | ||
65 | { .compatible = "st,lis302dl-spi" }, | ||
66 | {} | ||
67 | }; | ||
68 | MODULE_DEVICE_TABLE(of, lis302dl_spi_dt_ids); | ||
69 | #endif | ||
70 | |||
61 | static int __devinit lis302dl_spi_probe(struct spi_device *spi) | 71 | static int __devinit lis302dl_spi_probe(struct spi_device *spi) |
62 | { | 72 | { |
63 | int ret; | 73 | int ret; |
@@ -75,6 +85,12 @@ static int __devinit lis302dl_spi_probe(struct spi_device *spi) | |||
75 | lis3_dev.irq = spi->irq; | 85 | lis3_dev.irq = spi->irq; |
76 | lis3_dev.ac = lis3lv02d_axis_normal; | 86 | lis3_dev.ac = lis3lv02d_axis_normal; |
77 | lis3_dev.pdata = spi->dev.platform_data; | 87 | lis3_dev.pdata = spi->dev.platform_data; |
88 | |||
89 | #ifdef CONFIG_OF | ||
90 | if (of_match_device(lis302dl_spi_dt_ids, &spi->dev)) | ||
91 | lis3_dev.of_node = spi->dev.of_node; | ||
92 | #endif | ||
93 | |||
78 | spi_set_drvdata(spi, &lis3_dev); | 94 | spi_set_drvdata(spi, &lis3_dev); |
79 | 95 | ||
80 | return lis3lv02d_init_device(&lis3_dev); | 96 | return lis3lv02d_init_device(&lis3_dev); |
@@ -121,6 +137,7 @@ static struct spi_driver lis302dl_spi_driver = { | |||
121 | .name = DRV_NAME, | 137 | .name = DRV_NAME, |
122 | .owner = THIS_MODULE, | 138 | .owner = THIS_MODULE, |
123 | .pm = &lis3lv02d_spi_pm, | 139 | .pm = &lis3lv02d_spi_pm, |
140 | .of_match_table = of_match_ptr(lis302dl_spi_dt_ids), | ||
124 | }, | 141 | }, |
125 | .probe = lis302dl_spi_probe, | 142 | .probe = lis302dl_spi_probe, |
126 | .remove = __devexit_p(lis302dl_spi_remove), | 143 | .remove = __devexit_p(lis302dl_spi_remove), |