2 * BMI160 - Bosch IMU, SPI bits
4 * Copyright (c) 2016, Intel Corporation.
6 * This file is subject to the terms and conditions of version 2 of
7 * the GNU General Public License. See the file COPYING in the main
8 * directory of this archive for more details.
10 #include <linux/acpi.h>
11 #include <linux/module.h>
13 #include <linux/regmap.h>
14 #include <linux/spi/spi.h>
18 static int bmi160_spi_probe(struct spi_device
*spi
)
20 struct regmap
*regmap
;
21 const struct spi_device_id
*id
= spi_get_device_id(spi
);
23 regmap
= devm_regmap_init_spi(spi
, &bmi160_regmap_config
);
25 dev_err(&spi
->dev
, "Failed to register spi regmap %d\n",
26 (int)PTR_ERR(regmap
));
27 return PTR_ERR(regmap
);
29 return bmi160_core_probe(&spi
->dev
, regmap
, id
->name
, true);
32 static int bmi160_spi_remove(struct spi_device
*spi
)
34 bmi160_core_remove(&spi
->dev
);
39 static const struct spi_device_id bmi160_spi_id
[] = {
43 MODULE_DEVICE_TABLE(spi
, bmi160_spi_id
);
45 static const struct acpi_device_id bmi160_acpi_match
[] = {
49 MODULE_DEVICE_TABLE(acpi
, bmi160_acpi_match
);
52 static const struct of_device_id bmi160_of_match
[] = {
53 { .compatible
= "bosch,bmi160" },
56 MODULE_DEVICE_TABLE(of
, bmi160_of_match
);
59 static struct spi_driver bmi160_spi_driver
= {
60 .probe
= bmi160_spi_probe
,
61 .remove
= bmi160_spi_remove
,
62 .id_table
= bmi160_spi_id
,
64 .acpi_match_table
= ACPI_PTR(bmi160_acpi_match
),
65 .of_match_table
= of_match_ptr(bmi160_of_match
),
69 module_spi_driver(bmi160_spi_driver
);
71 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
72 MODULE_DESCRIPTION("Bosch BMI160 SPI driver");
73 MODULE_LICENSE("GPL v2");