diff options
author | Marcin Niestroj <m.niestroj@grinn-global.com> | 2016-12-08 15:22:54 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-12-30 10:32:39 +0000 |
commit | 968bdbf8f3e4f4e60420fb4643fed06c9d78418c (patch) | |
tree | 53024d4b1ed991d7887ed90ac549d4518ddfdd65 /drivers/iio/imu/bmi160/bmi160_i2c.c | |
parent | f8611c00d9abcf964a288a3f8f13dd18ff4f6512 (diff) |
iio: bmi160: Add of device table for i2c
From now on we can add bmi160 device to device-tree by specifying
compatible string.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu/bmi160/bmi160_i2c.c')
-rw-r--r-- | drivers/iio/imu/bmi160/bmi160_i2c.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/iio/imu/bmi160/bmi160_i2c.c b/drivers/iio/imu/bmi160/bmi160_i2c.c index 07a179d8fb48..155a31f72445 100644 --- a/drivers/iio/imu/bmi160/bmi160_i2c.c +++ b/drivers/iio/imu/bmi160/bmi160_i2c.c @@ -11,10 +11,11 @@ * - 0x68 if SDO is pulled to GND * - 0x69 if SDO is pulled to VDDIO */ -#include <linux/module.h> +#include <linux/acpi.h> #include <linux/i2c.h> +#include <linux/module.h> +#include <linux/of.h> #include <linux/regmap.h> -#include <linux/acpi.h> #include "bmi160.h" @@ -56,10 +57,19 @@ static const struct acpi_device_id bmi160_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match); +#ifdef CONFIG_OF +static const struct of_device_id bmi160_of_match[] = { + { .compatible = "bosch,bmi160" }, + { }, +}; +MODULE_DEVICE_TABLE(of, bmi160_of_match); +#endif + static struct i2c_driver bmi160_i2c_driver = { .driver = { .name = "bmi160_i2c", .acpi_match_table = ACPI_PTR(bmi160_acpi_match), + .of_match_table = of_match_ptr(bmi160_of_match), }, .probe = bmi160_i2c_probe, .remove = bmi160_i2c_remove, |