Merge tag 'iwlwifi-for-kalle-2016-02-15' of https://git.kernel.org/pub/scm/linux...
[deliverable/linux.git] / drivers / iio / accel / mma7455_i2c.c
CommitLineData
a84ef0d1
JE
1/*
2 * IIO accel I2C 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/i2c.h>
11#include <linux/module.h>
12#include <linux/regmap.h>
13
14#include "mma7455.h"
15
16static int mma7455_i2c_probe(struct i2c_client *i2c,
17 const struct i2c_device_id *id)
18{
19 struct regmap *regmap;
20 const char *name = NULL;
21
22 regmap = devm_regmap_init_i2c(i2c, &mma7455_core_regmap);
23 if (IS_ERR(regmap))
24 return PTR_ERR(regmap);
25
26 if (id)
27 name = id->name;
28
29 return mma7455_core_probe(&i2c->dev, regmap, name);
30}
31
32static int mma7455_i2c_remove(struct i2c_client *i2c)
33{
34 return mma7455_core_remove(&i2c->dev);
35}
36
37static const struct i2c_device_id mma7455_i2c_ids[] = {
38 { "mma7455", 0 },
39 { "mma7456", 0 },
40 { }
41};
42MODULE_DEVICE_TABLE(i2c, mma7455_i2c_ids);
43
44static struct i2c_driver mma7455_i2c_driver = {
45 .probe = mma7455_i2c_probe,
46 .remove = mma7455_i2c_remove,
47 .id_table = mma7455_i2c_ids,
48 .driver = {
49 .name = "mma7455-i2c",
50 },
51};
52module_i2c_driver(mma7455_i2c_driver);
53
54MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
55MODULE_DESCRIPTION("Freescale MMA7455L I2C accelerometer driver");
56MODULE_LICENSE("GPL v2");
This page took 0.040687 seconds and 5 git commands to generate.