drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / iio / accel / adxl372_spi.c
blob787699773f96f9ab1777ccba17e4be455cf388f8
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * ADXL372 3-Axis Digital Accelerometer SPI driver
5 * Copyright 2018 Analog Devices Inc.
6 */
8 #include <linux/module.h>
9 #include <linux/mod_devicetable.h>
10 #include <linux/regmap.h>
11 #include <linux/spi/spi.h>
13 #include "adxl372.h"
15 static const struct regmap_config adxl372_spi_regmap_config = {
16 .reg_bits = 7,
17 .pad_bits = 1,
18 .val_bits = 8,
19 .read_flag_mask = BIT(0),
20 .readable_noinc_reg = adxl372_readable_noinc_reg,
23 static int adxl372_spi_probe(struct spi_device *spi)
25 const struct spi_device_id *id = spi_get_device_id(spi);
26 struct regmap *regmap;
28 regmap = devm_regmap_init_spi(spi, &adxl372_spi_regmap_config);
29 if (IS_ERR(regmap))
30 return PTR_ERR(regmap);
32 return adxl372_probe(&spi->dev, regmap, spi->irq, id->name);
35 static const struct spi_device_id adxl372_spi_id[] = {
36 { "adxl372", 0 },
39 MODULE_DEVICE_TABLE(spi, adxl372_spi_id);
41 static const struct of_device_id adxl372_of_match[] = {
42 { .compatible = "adi,adxl372" },
43 { }
45 MODULE_DEVICE_TABLE(of, adxl372_of_match);
47 static struct spi_driver adxl372_spi_driver = {
48 .driver = {
49 .name = "adxl372_spi",
50 .of_match_table = adxl372_of_match,
52 .probe = adxl372_spi_probe,
53 .id_table = adxl372_spi_id,
56 module_spi_driver(adxl372_spi_driver);
58 MODULE_AUTHOR("Stefan Popa <stefan.popa@analog.com>");
59 MODULE_DESCRIPTION("Analog Devices ADXL372 3-axis accelerometer SPI driver");
60 MODULE_LICENSE("GPL");
61 MODULE_IMPORT_NS(IIO_ADXL372);