1 // SPDX-License-Identifier: GPL-2.0
3 * NXP FXLS8962AF/FXLS8964AF Accelerometer I2C Driver
5 * Copyright 2021 Connected Cars A/S
8 #include <linux/dev_printk.h>
10 #include <linux/i2c.h>
11 #include <linux/mod_devicetable.h>
12 #include <linux/module.h>
13 #include <linux/regmap.h>
15 #include "fxls8962af.h"
17 static int fxls8962af_probe(struct i2c_client
*client
)
19 struct regmap
*regmap
;
21 regmap
= devm_regmap_init_i2c(client
, &fxls8962af_i2c_regmap_conf
);
23 dev_err(&client
->dev
, "Failed to initialize i2c regmap\n");
24 return PTR_ERR(regmap
);
27 return fxls8962af_core_probe(&client
->dev
, regmap
, client
->irq
);
30 static const struct i2c_device_id fxls8962af_id
[] = {
31 { "fxls8962af", fxls8962af
},
32 { "fxls8964af", fxls8964af
},
35 MODULE_DEVICE_TABLE(i2c
, fxls8962af_id
);
37 static const struct of_device_id fxls8962af_of_match
[] = {
38 { .compatible
= "nxp,fxls8962af" },
39 { .compatible
= "nxp,fxls8964af" },
42 MODULE_DEVICE_TABLE(of
, fxls8962af_of_match
);
44 static struct i2c_driver fxls8962af_driver
= {
46 .name
= "fxls8962af_i2c",
47 .of_match_table
= fxls8962af_of_match
,
48 .pm
= pm_ptr(&fxls8962af_pm_ops
),
50 .probe
= fxls8962af_probe
,
51 .id_table
= fxls8962af_id
,
53 module_i2c_driver(fxls8962af_driver
);
55 MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>");
56 MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer i2c driver");
57 MODULE_LICENSE("GPL v2");
58 MODULE_IMPORT_NS("IIO_FXLS8962AF");