1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * 3-axis accelerometer driver supporting SPI Bosch-Sensortec accelerometer chip
4 * Copyright © 2015 Pengutronix, Markus Pargmann <mpa@pengutronix.de>
7 #include <linux/device.h>
8 #include <linux/mod_devicetable.h>
9 #include <linux/module.h>
10 #include <linux/acpi.h>
11 #include <linux/regmap.h>
12 #include <linux/spi/spi.h>
14 #include "bmc150-accel.h"
16 static int bmc150_accel_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
, &bmc150_regmap_conf
);
23 dev_err(&spi
->dev
, "Failed to initialize spi regmap\n");
24 return PTR_ERR(regmap
);
27 return bmc150_accel_core_probe(&spi
->dev
, regmap
, spi
->irq
, id
->name
,
31 static int bmc150_accel_remove(struct spi_device
*spi
)
33 return bmc150_accel_core_remove(&spi
->dev
);
36 static const struct acpi_device_id bmc150_accel_acpi_match
[] = {
46 MODULE_DEVICE_TABLE(acpi
, bmc150_accel_acpi_match
);
48 static const struct spi_device_id bmc150_accel_id
[] = {
49 {"bmc150_accel", bmc150
},
50 {"bmi055_accel", bmi055
},
57 MODULE_DEVICE_TABLE(spi
, bmc150_accel_id
);
59 static struct spi_driver bmc150_accel_driver
= {
61 .name
= "bmc150_accel_spi",
62 .acpi_match_table
= ACPI_PTR(bmc150_accel_acpi_match
),
63 .pm
= &bmc150_accel_pm_ops
,
65 .probe
= bmc150_accel_probe
,
66 .remove
= bmc150_accel_remove
,
67 .id_table
= bmc150_accel_id
,
69 module_spi_driver(bmc150_accel_driver
);
71 MODULE_AUTHOR("Markus Pargmann <mpa@pengutronix.de>");
72 MODULE_LICENSE("GPL v2");
73 MODULE_DESCRIPTION("BMC150 SPI accelerometer driver");