Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / drivers / iio / accel / fxls8962af-spi.c
blob46fc6e002714f6893c5e22b11de315465a26a17f
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * NXP FXLS8962AF/FXLS8964AF Accelerometer SPI Driver
5 * Copyright 2021 Connected Cars A/S
6 */
8 #include <linux/dev_printk.h>
9 #include <linux/err.h>
10 #include <linux/module.h>
11 #include <linux/mod_devicetable.h>
12 #include <linux/spi/spi.h>
13 #include <linux/regmap.h>
15 #include "fxls8962af.h"
17 static int fxls8962af_probe(struct spi_device *spi)
19 struct regmap *regmap;
21 regmap = devm_regmap_init_spi(spi, &fxls8962af_spi_regmap_conf);
22 if (IS_ERR(regmap)) {
23 dev_err(&spi->dev, "Failed to initialize spi regmap\n");
24 return PTR_ERR(regmap);
27 return fxls8962af_core_probe(&spi->dev, regmap, spi->irq);
30 static const struct of_device_id fxls8962af_spi_of_match[] = {
31 { .compatible = "nxp,fxls8962af" },
32 { .compatible = "nxp,fxls8964af" },
35 MODULE_DEVICE_TABLE(of, fxls8962af_spi_of_match);
37 static const struct spi_device_id fxls8962af_spi_id_table[] = {
38 { "fxls8962af", fxls8962af },
39 { "fxls8964af", fxls8964af },
42 MODULE_DEVICE_TABLE(spi, fxls8962af_spi_id_table);
44 static struct spi_driver fxls8962af_driver = {
45 .driver = {
46 .name = "fxls8962af_spi",
47 .pm = pm_ptr(&fxls8962af_pm_ops),
48 .of_match_table = fxls8962af_spi_of_match,
50 .probe = fxls8962af_probe,
51 .id_table = fxls8962af_spi_id_table,
53 module_spi_driver(fxls8962af_driver);
55 MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>");
56 MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer spi driver");
57 MODULE_LICENSE("GPL v2");
58 MODULE_IMPORT_NS("IIO_FXLS8962AF");