2 * 3-axis magnetometer driver support following SPI Bosch-Sensortec chips:
7 * Copyright (c) 2016, Intel Corporation.
9 * This file is subject to the terms and conditions of version 2 of
10 * the GNU General Public License. See the file COPYING in the main
11 * directory of this archive for more details.
13 #include <linux/module.h>
14 #include <linux/mod_devicetable.h>
15 #include <linux/spi/spi.h>
16 #include <linux/acpi.h>
17 #include <linux/regmap.h>
19 #include "bmc150_magn.h"
21 static int bmc150_magn_spi_probe(struct spi_device
*spi
)
23 struct regmap
*regmap
;
24 const struct spi_device_id
*id
= spi_get_device_id(spi
);
26 regmap
= devm_regmap_init_spi(spi
, &bmc150_magn_regmap_config
);
28 dev_err(&spi
->dev
, "Failed to register spi regmap %d\n",
29 (int)PTR_ERR(regmap
));
30 return PTR_ERR(regmap
);
32 return bmc150_magn_probe(&spi
->dev
, regmap
, spi
->irq
, id
->name
);
35 static int bmc150_magn_spi_remove(struct spi_device
*spi
)
37 bmc150_magn_remove(&spi
->dev
);
42 static const struct spi_device_id bmc150_magn_spi_id
[] = {
48 MODULE_DEVICE_TABLE(spi
, bmc150_magn_spi_id
);
50 static const struct acpi_device_id bmc150_magn_acpi_match
[] = {
56 MODULE_DEVICE_TABLE(acpi
, bmc150_magn_acpi_match
);
58 static struct spi_driver bmc150_magn_spi_driver
= {
59 .probe
= bmc150_magn_spi_probe
,
60 .remove
= bmc150_magn_spi_remove
,
61 .id_table
= bmc150_magn_spi_id
,
63 .acpi_match_table
= ACPI_PTR(bmc150_magn_acpi_match
),
64 .name
= "bmc150_magn_spi",
67 module_spi_driver(bmc150_magn_spi_driver
);
69 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
70 MODULE_DESCRIPTION("BMC150 magnetometer SPI driver");
71 MODULE_LICENSE("GPL v2");