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>
10 static int kxsd9_spi_probe(struct spi_device
*spi
)
12 static const struct regmap_config config
= {
17 struct regmap
*regmap
;
19 spi
->mode
= SPI_MODE_0
;
20 regmap
= devm_regmap_init_spi(spi
, &config
);
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
,
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
[] = {
41 MODULE_DEVICE_TABLE(spi
, kxsd9_spi_id
);
43 static struct spi_driver kxsd9_spi_driver
= {
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");