1 // SPDX-License-Identifier: GPL-2.0+
3 * ADXL372 3-Axis Digital Accelerometer SPI driver
5 * Copyright 2018 Analog Devices Inc.
8 #include <linux/module.h>
9 #include <linux/regmap.h>
10 #include <linux/spi/spi.h>
14 static const struct regmap_config adxl372_spi_regmap_config
= {
18 .read_flag_mask
= BIT(0),
19 .readable_noinc_reg
= adxl372_readable_noinc_reg
,
22 static int adxl372_spi_probe(struct spi_device
*spi
)
24 const struct spi_device_id
*id
= spi_get_device_id(spi
);
25 struct regmap
*regmap
;
27 regmap
= devm_regmap_init_spi(spi
, &adxl372_spi_regmap_config
);
29 return PTR_ERR(regmap
);
31 return adxl372_probe(&spi
->dev
, regmap
, spi
->irq
, id
->name
);
34 static const struct spi_device_id adxl372_spi_id
[] = {
38 MODULE_DEVICE_TABLE(spi
, adxl372_spi_id
);
40 static struct spi_driver adxl372_spi_driver
= {
42 .name
= "adxl372_spi",
44 .probe
= adxl372_spi_probe
,
45 .id_table
= adxl372_spi_id
,
48 module_spi_driver(adxl372_spi_driver
);
50 MODULE_AUTHOR("Stefan Popa <stefan.popa@analog.com>");
51 MODULE_DESCRIPTION("Analog Devices ADXL372 3-axis accelerometer SPI driver");
52 MODULE_LICENSE("GPL");