1 // SPDX-License-Identifier: GPL-2.0-only
3 * IIO accel SPI driver for Freescale MMA7455L 3-axis 10-bit accelerometer
4 * Copyright 2015 Joachim Eastwood <manabian@gmail.com>
7 #include <linux/module.h>
8 #include <linux/regmap.h>
9 #include <linux/spi/spi.h>
13 static int mma7455_spi_probe(struct spi_device
*spi
)
15 const struct spi_device_id
*id
= spi_get_device_id(spi
);
16 struct regmap
*regmap
;
18 regmap
= devm_regmap_init_spi(spi
, &mma7455_core_regmap
);
20 return PTR_ERR(regmap
);
22 return mma7455_core_probe(&spi
->dev
, regmap
, id
->name
);
25 static int mma7455_spi_remove(struct spi_device
*spi
)
27 return mma7455_core_remove(&spi
->dev
);
30 static const struct spi_device_id mma7455_spi_ids
[] = {
35 MODULE_DEVICE_TABLE(spi
, mma7455_spi_ids
);
37 static struct spi_driver mma7455_spi_driver
= {
38 .probe
= mma7455_spi_probe
,
39 .remove
= mma7455_spi_remove
,
40 .id_table
= mma7455_spi_ids
,
42 .name
= "mma7455-spi",
45 module_spi_driver(mma7455_spi_driver
);
47 MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
48 MODULE_DESCRIPTION("Freescale MMA7455L SPI accelerometer driver");
49 MODULE_LICENSE("GPL v2");