sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / iio / magnetometer / bmc150_magn_spi.c
blob7d4152d4d01e310605a0f283417248d8d3c52d84
1 /*
2 * 3-axis magnetometer driver support following SPI Bosch-Sensortec chips:
3 * - BMC150
4 * - BMC156
5 * - BMM150
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);
27 if (IS_ERR(regmap)) {
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);
39 return 0;
42 static const struct spi_device_id bmc150_magn_spi_id[] = {
43 {"bmc150_magn", 0},
44 {"bmc156_magn", 0},
45 {"bmm150_magn", 0},
48 MODULE_DEVICE_TABLE(spi, bmc150_magn_spi_id);
50 static const struct acpi_device_id bmc150_magn_acpi_match[] = {
51 {"BMC150B", 0},
52 {"BMC156B", 0},
53 {"BMM150B", 0},
54 {},
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,
62 .driver = {
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");