r8152: fix tx packets accounting
[linux/fpc-iii.git] / drivers / iio / gyro / bmg160_spi.c
blob021ea5fe6a3771860e1a6b7d2cc34399f887a08f
1 #include <linux/spi/spi.h>
2 #include <linux/regmap.h>
3 #include <linux/iio/iio.h>
4 #include <linux/module.h>
6 #include "bmg160.h"
8 static const struct regmap_config bmg160_regmap_spi_conf = {
9 .reg_bits = 8,
10 .val_bits = 8,
11 .max_register = 0x3f,
14 static int bmg160_spi_probe(struct spi_device *spi)
16 struct regmap *regmap;
17 const struct spi_device_id *id = spi_get_device_id(spi);
19 regmap = devm_regmap_init_spi(spi, &bmg160_regmap_spi_conf);
20 if (IS_ERR(regmap)) {
21 dev_err(&spi->dev, "Failed to register spi regmap %d\n",
22 (int)PTR_ERR(regmap));
23 return PTR_ERR(regmap);
26 return bmg160_core_probe(&spi->dev, regmap, spi->irq, id->name);
29 static int bmg160_spi_remove(struct spi_device *spi)
31 bmg160_core_remove(&spi->dev);
33 return 0;
36 static const struct spi_device_id bmg160_spi_id[] = {
37 {"bmg160", 0},
38 {"bmi055_gyro", 0},
42 MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
44 static struct spi_driver bmg160_spi_driver = {
45 .driver = {
46 .name = "bmg160_spi",
47 .pm = &bmg160_pm_ops,
49 .probe = bmg160_spi_probe,
50 .remove = bmg160_spi_remove,
51 .id_table = bmg160_spi_id,
53 module_spi_driver(bmg160_spi_driver);
55 MODULE_AUTHOR("Markus Pargmann <mpa@pengutronix.de>");
56 MODULE_LICENSE("GPL v2");
57 MODULE_DESCRIPTION("BMG160 SPI Gyro driver");