1 // SPDX-License-Identifier: GPL-2.0
3 * FXOS8700 - NXP IMU, SPI bits
5 #include <linux/acpi.h>
6 #include <linux/module.h>
7 #include <linux/mod_devicetable.h>
8 #include <linux/regmap.h>
9 #include <linux/spi/spi.h>
13 static int fxos8700_spi_probe(struct spi_device *spi)
15 struct regmap *regmap;
16 const struct spi_device_id *id = spi_get_device_id(spi);
18 regmap = devm_regmap_init_spi(spi, &fxos8700_regmap_config);
20 dev_err(&spi->dev, "Failed to register spi regmap %d\n",
21 (int)PTR_ERR(regmap));
22 return PTR_ERR(regmap);
25 return fxos8700_core_probe(&spi->dev, regmap, id->name, true);
28 static const struct spi_device_id fxos8700_spi_id[] = {
32 MODULE_DEVICE_TABLE(spi, fxos8700_spi_id);
34 static const struct acpi_device_id fxos8700_acpi_match[] = {
38 MODULE_DEVICE_TABLE(acpi, fxos8700_acpi_match);
40 static const struct of_device_id fxos8700_of_match[] = {
41 { .compatible = "nxp,fxos8700" },
44 MODULE_DEVICE_TABLE(of, fxos8700_of_match);
46 static struct spi_driver fxos8700_spi_driver = {
47 .probe = fxos8700_spi_probe,
48 .id_table = fxos8700_spi_id,
50 .acpi_match_table = ACPI_PTR(fxos8700_acpi_match),
51 .of_match_table = fxos8700_of_match,
52 .name = "fxos8700_spi",
55 module_spi_driver(fxos8700_spi_driver);
58 MODULE_DESCRIPTION("FXOS8700 SPI driver");
59 MODULE_LICENSE("GPL v2");