]> Git Repo - linux.git/blob - drivers/iio/accel/fxls8962af-i2c.c
Linux 6.14-rc3
[linux.git] / drivers / iio / accel / fxls8962af-i2c.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * NXP FXLS8962AF/FXLS8964AF Accelerometer I2C Driver
4  *
5  * Copyright 2021 Connected Cars A/S
6  */
7
8 #include <linux/dev_printk.h>
9 #include <linux/err.h>
10 #include <linux/i2c.h>
11 #include <linux/mod_devicetable.h>
12 #include <linux/module.h>
13 #include <linux/regmap.h>
14
15 #include "fxls8962af.h"
16
17 static int fxls8962af_probe(struct i2c_client *client)
18 {
19         struct regmap *regmap;
20
21         regmap = devm_regmap_init_i2c(client, &fxls8962af_i2c_regmap_conf);
22         if (IS_ERR(regmap)) {
23                 dev_err(&client->dev, "Failed to initialize i2c regmap\n");
24                 return PTR_ERR(regmap);
25         }
26
27         return fxls8962af_core_probe(&client->dev, regmap, client->irq);
28 }
29
30 static const struct i2c_device_id fxls8962af_id[] = {
31         { "fxls8962af", fxls8962af },
32         { "fxls8964af", fxls8964af },
33         { "fxls8967af", fxls8967af },
34         { "fxls8974cf", fxls8974cf },
35         {}
36 };
37 MODULE_DEVICE_TABLE(i2c, fxls8962af_id);
38
39 static const struct of_device_id fxls8962af_of_match[] = {
40         { .compatible = "nxp,fxls8962af" },
41         { .compatible = "nxp,fxls8964af" },
42         {}
43 };
44 MODULE_DEVICE_TABLE(of, fxls8962af_of_match);
45
46 static struct i2c_driver fxls8962af_driver = {
47         .driver = {
48                    .name = "fxls8962af_i2c",
49                    .of_match_table = fxls8962af_of_match,
50                    .pm = pm_ptr(&fxls8962af_pm_ops),
51                    },
52         .probe = fxls8962af_probe,
53         .id_table = fxls8962af_id,
54 };
55 module_i2c_driver(fxls8962af_driver);
56
57 MODULE_AUTHOR("Sean Nyekjaer <[email protected]>");
58 MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer i2c driver");
59 MODULE_LICENSE("GPL v2");
60 MODULE_IMPORT_NS("IIO_FXLS8962AF");
This page took 0.037779 seconds and 4 git commands to generate.