1 #include <linux/spi/spi.h>
2 #include <linux/regmap.h>
3 #include <linux/iio/iio.h>
4 #include <linux/module.h>
8 static const struct regmap_config bmg160_regmap_spi_conf
= {
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
);
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
);
36 static const struct spi_device_id bmg160_spi_id
[] = {
42 MODULE_DEVICE_TABLE(spi
, bmg160_spi_id
);
44 static struct spi_driver bmg160_spi_driver
= {
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");