blob: eb82cdfa8abc514b8cc7dc3d3a86957ca95f0596 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Joachim Eastwooda84ef0d2015-10-31 13:49:16 +01002/*
3 * IIO accel SPI driver for Freescale MMA7455L 3-axis 10-bit accelerometer
4 * Copyright 2015 Joachim Eastwood <manabian@gmail.com>
Joachim Eastwooda84ef0d2015-10-31 13:49:16 +01005 */
6
7#include <linux/module.h>
8#include <linux/regmap.h>
9#include <linux/spi/spi.h>
10
11#include "mma7455.h"
12
13static int mma7455_spi_probe(struct spi_device *spi)
14{
15 const struct spi_device_id *id = spi_get_device_id(spi);
16 struct regmap *regmap;
17
18 regmap = devm_regmap_init_spi(spi, &mma7455_core_regmap);
19 if (IS_ERR(regmap))
20 return PTR_ERR(regmap);
21
22 return mma7455_core_probe(&spi->dev, regmap, id->name);
23}
24
25static int mma7455_spi_remove(struct spi_device *spi)
26{
27 return mma7455_core_remove(&spi->dev);
28}
29
30static const struct spi_device_id mma7455_spi_ids[] = {
31 { "mma7455", 0 },
32 { "mma7456", 0 },
33 { }
34};
35MODULE_DEVICE_TABLE(spi, mma7455_spi_ids);
36
37static struct spi_driver mma7455_spi_driver = {
38 .probe = mma7455_spi_probe,
39 .remove = mma7455_spi_remove,
40 .id_table = mma7455_spi_ids,
41 .driver = {
42 .name = "mma7455-spi",
43 },
44};
45module_spi_driver(mma7455_spi_driver);
46
47MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
48MODULE_DESCRIPTION("Freescale MMA7455L SPI accelerometer driver");
49MODULE_LICENSE("GPL v2");