mmc: rtsx_pci: Enable MMC_CAP_ERASE to allow erase/discard/trim requests
[linux/fpc-iii.git] / drivers / iio / magnetometer / bmc150_magn_i2c.c
blobeddc7f0d0096c114775be9e22dfd161baed25f1c
1 /*
2 * 3-axis magnetometer driver supporting following I2C Bosch-Sensortec chips:
3 * - BMC150
4 * - BMC156
6 * Copyright (c) 2016, Intel Corporation.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
17 #include <linux/device.h>
18 #include <linux/mod_devicetable.h>
19 #include <linux/i2c.h>
20 #include <linux/module.h>
21 #include <linux/acpi.h>
22 #include <linux/regmap.h>
24 #include "bmc150_magn.h"
26 static int bmc150_magn_i2c_probe(struct i2c_client *client,
27 const struct i2c_device_id *id)
29 struct regmap *regmap;
30 const char *name = NULL;
32 regmap = devm_regmap_init_i2c(client, &bmc150_magn_regmap_config);
33 if (IS_ERR(regmap)) {
34 dev_err(&client->dev, "Failed to initialize i2c regmap\n");
35 return PTR_ERR(regmap);
38 if (id)
39 name = id->name;
41 return bmc150_magn_probe(&client->dev, regmap, client->irq, name);
44 static int bmc150_magn_i2c_remove(struct i2c_client *client)
46 return bmc150_magn_remove(&client->dev);
49 static const struct acpi_device_id bmc150_magn_acpi_match[] = {
50 {"BMC150B", 0},
51 {"BMC156B", 0},
52 {},
54 MODULE_DEVICE_TABLE(acpi, bmc150_magn_acpi_match);
56 static const struct i2c_device_id bmc150_magn_i2c_id[] = {
57 {"bmc150_magn", 0},
58 {"bmc156_magn", 0},
61 MODULE_DEVICE_TABLE(i2c, bmc150_magn_i2c_id);
63 static struct i2c_driver bmc150_magn_driver = {
64 .driver = {
65 .name = "bmc150_magn_i2c",
66 .acpi_match_table = ACPI_PTR(bmc150_magn_acpi_match),
67 .pm = &bmc150_magn_pm_ops,
69 .probe = bmc150_magn_i2c_probe,
70 .remove = bmc150_magn_i2c_remove,
71 .id_table = bmc150_magn_i2c_id,
73 module_i2c_driver(bmc150_magn_driver);
75 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
76 MODULE_LICENSE("GPL v2");
77 MODULE_DESCRIPTION("BMC150 I2C magnetometer driver");