* BMA250: 7-bit I2C slave address 0x18 or 0x19
*/
+#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
static int bma180_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ struct device *dev = &client->dev;
+ const struct acpi_device_id *acpi_id;
struct bma180_data *data;
struct iio_dev *indio_dev;
enum chip_ids chip;
data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
data->client = client;
- if (client->dev.of_node)
+ if (dev->of_node) {
chip = (enum chip_ids)of_device_get_match_data(&client->dev);
- else
+ } else if (id) {
chip = id->driver_data;
+ } else {
+ acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
+ if (!acpi_id)
+ return -ENODEV;
+
+ chip = acpi_id->driver_data;
+ }
data->part_info = &bma180_part_info[chip];
ret = data->part_info->chip_config(data);
#define BMA180_PM_OPS NULL
#endif
+static const struct acpi_device_id bma180_acpi_match[] = {
+ { "BMA250E", BMA250E },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, bma180_acpi_match);
+
static struct i2c_device_id bma180_ids[] = {
{ "bma180", BMA180 },
{ "bma250", BMA250 },
static struct i2c_driver bma180_driver = {
.driver = {
.name = "bma180",
+ .acpi_match_table = ACPI_PTR(bma180_acpi_match),
.pm = BMA180_PM_OPS,
.of_match_table = bma180_of_match,
},