1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/device.h>
3 #include <linux/kernel.h>
4 #include <linux/module.h>
5 #include <linux/mod_devicetable.h>
6 #include <linux/slab.h>
8 #include <linux/delay.h>
9 #include <linux/regmap.h>
13 static int kxsd9_i2c_probe(struct i2c_client
*i2c
)
15 static const struct regmap_config config
= {
20 struct regmap
*regmap
;
22 regmap
= devm_regmap_init_i2c(i2c
, &config
);
24 dev_err(&i2c
->dev
, "Failed to register i2c regmap: %pe\n",
26 return PTR_ERR(regmap
);
29 return kxsd9_common_probe(&i2c
->dev
,
34 static void kxsd9_i2c_remove(struct i2c_client
*client
)
36 kxsd9_common_remove(&client
->dev
);
39 static const struct of_device_id kxsd9_of_match
[] = {
40 { .compatible
= "kionix,kxsd9", },
43 MODULE_DEVICE_TABLE(of
, kxsd9_of_match
);
45 static const struct i2c_device_id kxsd9_i2c_id
[] = {
49 MODULE_DEVICE_TABLE(i2c
, kxsd9_i2c_id
);
51 static struct i2c_driver kxsd9_i2c_driver
= {
54 .of_match_table
= kxsd9_of_match
,
55 .pm
= pm_ptr(&kxsd9_dev_pm_ops
),
57 .probe
= kxsd9_i2c_probe
,
58 .remove
= kxsd9_i2c_remove
,
59 .id_table
= kxsd9_i2c_id
,
61 module_i2c_driver(kxsd9_i2c_driver
);
63 MODULE_LICENSE("GPL v2");
64 MODULE_DESCRIPTION("KXSD9 accelerometer I2C interface");
65 MODULE_IMPORT_NS(IIO_KXSD9
);