1 // SPDX-License-Identifier: GPL-2.0
3 * BMI160 - Bosch IMU, SPI bits
5 * Copyright (c) 2016, Intel Corporation.
8 #include <linux/acpi.h>
9 #include <linux/module.h>
11 #include <linux/regmap.h>
12 #include <linux/spi/spi.h>
16 static int bmi160_spi_probe(struct spi_device
*spi
)
18 struct regmap
*regmap
;
19 const struct spi_device_id
*id
= spi_get_device_id(spi
);
21 regmap
= devm_regmap_init_spi(spi
, &bmi160_regmap_config
);
23 dev_err(&spi
->dev
, "Failed to register spi regmap: %pe\n",
25 return PTR_ERR(regmap
);
27 return bmi160_core_probe(&spi
->dev
, regmap
, id
->name
, true);
30 static const struct spi_device_id bmi160_spi_id
[] = {
34 MODULE_DEVICE_TABLE(spi
, bmi160_spi_id
);
36 static const struct acpi_device_id bmi160_acpi_match
[] = {
40 MODULE_DEVICE_TABLE(acpi
, bmi160_acpi_match
);
43 static const struct of_device_id bmi160_of_match
[] = {
44 { .compatible
= "bosch,bmi160" },
47 MODULE_DEVICE_TABLE(of
, bmi160_of_match
);
50 static struct spi_driver bmi160_spi_driver
= {
51 .probe
= bmi160_spi_probe
,
52 .id_table
= bmi160_spi_id
,
54 .acpi_match_table
= ACPI_PTR(bmi160_acpi_match
),
55 .of_match_table
= of_match_ptr(bmi160_of_match
),
59 module_spi_driver(bmi160_spi_driver
);
61 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
62 MODULE_DESCRIPTION("Bosch BMI160 SPI driver");
63 MODULE_LICENSE("GPL v2");