drm/client: Fix drm client endless Kconfig loop
[drm/drm-misc.git] / drivers / iio / accel / adxl380_i2c.c
blobb4f86f97236148b0df8666d48010054eef727071
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * ADXL380 3-Axis Digital Accelerometer I2C driver
5 * Copyright 2024 Analog Devices Inc.
6 */
8 #include <linux/i2c.h>
9 #include <linux/mod_devicetable.h>
10 #include <linux/module.h>
11 #include <linux/regmap.h>
13 #include "adxl380.h"
15 static const struct regmap_config adxl380_regmap_config = {
16 .reg_bits = 8,
17 .val_bits = 8,
18 .readable_noinc_reg = adxl380_readable_noinc_reg,
21 static int adxl380_i2c_probe(struct i2c_client *client)
23 struct regmap *regmap;
24 const struct adxl380_chip_info *chip_data;
26 chip_data = i2c_get_match_data(client);
28 regmap = devm_regmap_init_i2c(client, &adxl380_regmap_config);
29 if (IS_ERR(regmap))
30 return PTR_ERR(regmap);
32 return adxl380_probe(&client->dev, regmap, chip_data);
35 static const struct i2c_device_id adxl380_i2c_id[] = {
36 { "adxl380", (kernel_ulong_t)&adxl380_chip_info },
37 { "adxl382", (kernel_ulong_t)&adxl382_chip_info },
38 { }
40 MODULE_DEVICE_TABLE(i2c, adxl380_i2c_id);
42 static const struct of_device_id adxl380_of_match[] = {
43 { .compatible = "adi,adxl380", .data = &adxl380_chip_info },
44 { .compatible = "adi,adxl382", .data = &adxl382_chip_info },
45 { }
47 MODULE_DEVICE_TABLE(of, adxl380_of_match);
49 static struct i2c_driver adxl380_i2c_driver = {
50 .driver = {
51 .name = "adxl380_i2c",
52 .of_match_table = adxl380_of_match,
54 .probe = adxl380_i2c_probe,
55 .id_table = adxl380_i2c_id,
58 module_i2c_driver(adxl380_i2c_driver);
60 MODULE_AUTHOR("Ramona Gradinariu <ramona.gradinariu@analog.com>");
61 MODULE_AUTHOR("Antoniu Miclaus <antoniu.miclaus@analog.com>");
62 MODULE_DESCRIPTION("Analog Devices ADXL380 3-axis accelerometer I2C driver");
63 MODULE_LICENSE("GPL");
64 MODULE_IMPORT_NS("IIO_ADXL380");