2 * 3-axis accelerometer driver supporting following I2C Bosch-Sensortec chips:
10 * Copyright (c) 2014, Intel Corporation.
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms and conditions of the GNU General Public License,
14 * version 2, as published by the Free Software Foundation.
16 * This program is distributed in the hope it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
22 #include <linux/device.h>
23 #include <linux/mod_devicetable.h>
24 #include <linux/i2c.h>
25 #include <linux/module.h>
26 #include <linux/acpi.h>
27 #include <linux/regmap.h>
29 #include "bmc150-accel.h"
31 static int bmc150_accel_probe(struct i2c_client
*client
,
32 const struct i2c_device_id
*id
)
34 struct regmap
*regmap
;
35 const char *name
= NULL
;
36 bool block_supported
=
37 i2c_check_functionality(client
->adapter
, I2C_FUNC_I2C
) ||
38 i2c_check_functionality(client
->adapter
,
39 I2C_FUNC_SMBUS_READ_I2C_BLOCK
);
41 regmap
= devm_regmap_init_i2c(client
, &bmc150_regmap_conf
);
43 dev_err(&client
->dev
, "Failed to initialize i2c regmap\n");
44 return PTR_ERR(regmap
);
50 return bmc150_accel_core_probe(&client
->dev
, regmap
, client
->irq
, name
,
54 static int bmc150_accel_remove(struct i2c_client
*client
)
56 return bmc150_accel_core_remove(&client
->dev
);
59 static const struct acpi_device_id bmc150_accel_acpi_match
[] = {
69 MODULE_DEVICE_TABLE(acpi
, bmc150_accel_acpi_match
);
71 static const struct i2c_device_id bmc150_accel_id
[] = {
72 {"bmc150_accel", bmc150
},
73 {"bmi055_accel", bmi055
},
81 MODULE_DEVICE_TABLE(i2c
, bmc150_accel_id
);
83 static struct i2c_driver bmc150_accel_driver
= {
85 .name
= "bmc150_accel_i2c",
86 .acpi_match_table
= ACPI_PTR(bmc150_accel_acpi_match
),
87 .pm
= &bmc150_accel_pm_ops
,
89 .probe
= bmc150_accel_probe
,
90 .remove
= bmc150_accel_remove
,
91 .id_table
= bmc150_accel_id
,
93 module_i2c_driver(bmc150_accel_driver
);
95 MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
96 MODULE_LICENSE("GPL v2");
97 MODULE_DESCRIPTION("BMC150 I2C accelerometer driver");