Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * NXP FXLS8962AF/FXLS8964AF Accelerometer I2C Driver
0004  *
0005  * Copyright 2021 Connected Cars A/S
0006  */
0007 
0008 #include <linux/dev_printk.h>
0009 #include <linux/err.h>
0010 #include <linux/i2c.h>
0011 #include <linux/mod_devicetable.h>
0012 #include <linux/module.h>
0013 #include <linux/regmap.h>
0014 
0015 #include "fxls8962af.h"
0016 
0017 static int fxls8962af_probe(struct i2c_client *client)
0018 {
0019     struct regmap *regmap;
0020 
0021     regmap = devm_regmap_init_i2c(client, &fxls8962af_i2c_regmap_conf);
0022     if (IS_ERR(regmap)) {
0023         dev_err(&client->dev, "Failed to initialize i2c regmap\n");
0024         return PTR_ERR(regmap);
0025     }
0026 
0027     return fxls8962af_core_probe(&client->dev, regmap, client->irq);
0028 }
0029 
0030 static const struct i2c_device_id fxls8962af_id[] = {
0031     { "fxls8962af", fxls8962af },
0032     { "fxls8964af", fxls8964af },
0033     {}
0034 };
0035 MODULE_DEVICE_TABLE(i2c, fxls8962af_id);
0036 
0037 static const struct of_device_id fxls8962af_of_match[] = {
0038     { .compatible = "nxp,fxls8962af" },
0039     { .compatible = "nxp,fxls8964af" },
0040     {}
0041 };
0042 MODULE_DEVICE_TABLE(of, fxls8962af_of_match);
0043 
0044 static struct i2c_driver fxls8962af_driver = {
0045     .driver = {
0046            .name = "fxls8962af_i2c",
0047            .of_match_table = fxls8962af_of_match,
0048            .pm = &fxls8962af_pm_ops,
0049            },
0050     .probe_new = fxls8962af_probe,
0051     .id_table = fxls8962af_id,
0052 };
0053 module_i2c_driver(fxls8962af_driver);
0054 
0055 MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>");
0056 MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer i2c driver");
0057 MODULE_LICENSE("GPL v2");
0058 MODULE_IMPORT_NS(IIO_FXLS8962AF);