root/drivers/iio/gyro/bmg160_spi.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. bmg160_spi_probe
  2. bmg160_spi_remove

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 #include <linux/spi/spi.h>
   3 #include <linux/regmap.h>
   4 #include <linux/iio/iio.h>
   5 #include <linux/module.h>
   6 
   7 #include "bmg160.h"
   8 
   9 static const struct regmap_config bmg160_regmap_spi_conf = {
  10         .reg_bits = 8,
  11         .val_bits = 8,
  12         .max_register = 0x3f,
  13 };
  14 
  15 static int bmg160_spi_probe(struct spi_device *spi)
  16 {
  17         struct regmap *regmap;
  18         const struct spi_device_id *id = spi_get_device_id(spi);
  19 
  20         regmap = devm_regmap_init_spi(spi, &bmg160_regmap_spi_conf);
  21         if (IS_ERR(regmap)) {
  22                 dev_err(&spi->dev, "Failed to register spi regmap %d\n",
  23                         (int)PTR_ERR(regmap));
  24                 return PTR_ERR(regmap);
  25         }
  26 
  27         return bmg160_core_probe(&spi->dev, regmap, spi->irq, id->name);
  28 }
  29 
  30 static int bmg160_spi_remove(struct spi_device *spi)
  31 {
  32         bmg160_core_remove(&spi->dev);
  33 
  34         return 0;
  35 }
  36 
  37 static const struct spi_device_id bmg160_spi_id[] = {
  38         {"bmg160", 0},
  39         {"bmi055_gyro", 0},
  40         {}
  41 };
  42 
  43 MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
  44 
  45 static struct spi_driver bmg160_spi_driver = {
  46         .driver = {
  47                 .name   = "bmg160_spi",
  48                 .pm     = &bmg160_pm_ops,
  49         },
  50         .probe          = bmg160_spi_probe,
  51         .remove         = bmg160_spi_remove,
  52         .id_table       = bmg160_spi_id,
  53 };
  54 module_spi_driver(bmg160_spi_driver);
  55 
  56 MODULE_AUTHOR("Markus Pargmann <mpa@pengutronix.de>");
  57 MODULE_LICENSE("GPL v2");
  58 MODULE_DESCRIPTION("BMG160 SPI Gyro driver");

/* [<][>][^][v][top][bottom][index][help] */