diff options
author | Daniel Mack <zonque@gmail.com> | 2013-09-22 21:51:49 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-26 09:04:06 -0700 |
commit | f91f9258f61f024d34b7c001f989acf8ee39378a (patch) | |
tree | 2e3ea12e5b20e59c824a7ed74a16083261a1f322 | |
parent | beb900fc2428fa812e4a49251ef8396fa46b77fc (diff) | |
download | linux-f91f9258f61f024d34b7c001f989acf8ee39378a.tar.gz linux-f91f9258f61f024d34b7c001f989acf8ee39378a.tar.bz2 linux-f91f9258f61f024d34b7c001f989acf8ee39378a.zip |
drivers: misc: ti_dac7512: add support for DT matching
Only matching is done via DT, no other details can be passed.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/devicetree/bindings/misc/ti,dac7512.txt | 20 | ||||
-rw-r--r-- | drivers/misc/ti_dac7512.c | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/misc/ti,dac7512.txt b/Documentation/devicetree/bindings/misc/ti,dac7512.txt new file mode 100644 index 000000000000..1db45939dac9 --- /dev/null +++ b/Documentation/devicetree/bindings/misc/ti,dac7512.txt @@ -0,0 +1,20 @@ +TI DAC7512 DEVICETREE BINDINGS + +Required properties: + + - "compatible" Must be set to "ti,dac7512" + +Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt +apply. In particular, "reg" and "spi-max-frequency" properties must be given. + + +Example: + + spi_master { + dac7512: dac7512@0 { + compatible = "ti,dac7512"; + reg = <0>; /* CS0 */ + spi-max-frequency = <1000000>; + }; + }; + diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c index 6393a68122ae..83da711ce9f1 100644 --- a/drivers/misc/ti_dac7512.c +++ b/drivers/misc/ti_dac7512.c @@ -22,6 +22,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/spi/spi.h> +#include <linux/of.h> static ssize_t dac7512_store_val(struct device *dev, struct device_attribute *attr, @@ -78,10 +79,19 @@ static const struct spi_device_id dac7512_id_table[] = { }; MODULE_DEVICE_TABLE(spi, dac7512_id_table); +#ifdef CONFIG_OF +static const struct of_device_id dac7512_of_match[] = { + { .compatible = "ti,dac7512", }, + { } +}; +MODULE_DEVICE_TABLE(of, dac7512_of_match); +#endif + static struct spi_driver dac7512_driver = { .driver = { .name = "dac7512", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(dac7512_of_match), }, .probe = dac7512_probe, .remove = dac7512_remove, |