Merge tag 'samsung-fixes-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk...
[deliverable/linux.git] / drivers / iio / accel / mma7455_spi.c
CommitLineData
a84ef0d1
JE
1/*
2 * IIO accel SPI driver for Freescale MMA7455L 3-axis 10-bit accelerometer
3 * Copyright 2015 Joachim Eastwood <manabian@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/module.h>
11#include <linux/regmap.h>
12#include <linux/spi/spi.h>
13
14#include "mma7455.h"
15
16static int mma7455_spi_probe(struct spi_device *spi)
17{
18 const struct spi_device_id *id = spi_get_device_id(spi);
19 struct regmap *regmap;
20
21 regmap = devm_regmap_init_spi(spi, &mma7455_core_regmap);
22 if (IS_ERR(regmap))
23 return PTR_ERR(regmap);
24
25 return mma7455_core_probe(&spi->dev, regmap, id->name);
26}
27
28static int mma7455_spi_remove(struct spi_device *spi)
29{
30 return mma7455_core_remove(&spi->dev);
31}
32
33static const struct spi_device_id mma7455_spi_ids[] = {
34 { "mma7455", 0 },
35 { "mma7456", 0 },
36 { }
37};
38MODULE_DEVICE_TABLE(spi, mma7455_spi_ids);
39
40static struct spi_driver mma7455_spi_driver = {
41 .probe = mma7455_spi_probe,
42 .remove = mma7455_spi_remove,
43 .id_table = mma7455_spi_ids,
44 .driver = {
45 .name = "mma7455-spi",
46 },
47};
48module_spi_driver(mma7455_spi_driver);
49
50MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
51MODULE_DESCRIPTION("Freescale MMA7455L SPI accelerometer driver");
52MODULE_LICENSE("GPL v2");
This page took 0.072098 seconds and 5 git commands to generate.