sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / iio / accel / kxsd9-spi.c
blobb7d0078fd00edc50efa2e056a89e16b0472469bf
1 #include <linux/device.h>
2 #include <linux/kernel.h>
3 #include <linux/spi/spi.h>
4 #include <linux/module.h>
5 #include <linux/slab.h>
6 #include <linux/regmap.h>
8 #include "kxsd9.h"
10 static int kxsd9_spi_probe(struct spi_device *spi)
12 static const struct regmap_config config = {
13 .reg_bits = 8,
14 .val_bits = 8,
15 .max_register = 0x0e,
17 struct regmap *regmap;
19 spi->mode = SPI_MODE_0;
20 regmap = devm_regmap_init_spi(spi, &config);
21 if (IS_ERR(regmap)) {
22 dev_err(&spi->dev, "%s: regmap allocation failed: %ld\n",
23 __func__, PTR_ERR(regmap));
24 return PTR_ERR(regmap);
27 return kxsd9_common_probe(&spi->dev,
28 regmap,
29 spi_get_device_id(spi)->name);
32 static int kxsd9_spi_remove(struct spi_device *spi)
34 return kxsd9_common_remove(&spi->dev);
37 static const struct spi_device_id kxsd9_spi_id[] = {
38 {"kxsd9", 0},
39 { },
41 MODULE_DEVICE_TABLE(spi, kxsd9_spi_id);
43 static struct spi_driver kxsd9_spi_driver = {
44 .driver = {
45 .name = "kxsd9",
46 .pm = &kxsd9_dev_pm_ops,
48 .probe = kxsd9_spi_probe,
49 .remove = kxsd9_spi_remove,
50 .id_table = kxsd9_spi_id,
52 module_spi_driver(kxsd9_spi_driver);
54 MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
55 MODULE_DESCRIPTION("Kionix KXSD9 SPI driver");
56 MODULE_LICENSE("GPL v2");