1 // SPDX-License-Identifier: GPL-2.0-only
3 * SPI access driver for TI TPS65912x PMICs
5 * Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
8 * Based on the TPS65218 driver and the previous TPS65912 driver by
12 #include <linux/module.h>
13 #include <linux/regmap.h>
14 #include <linux/spi/spi.h>
16 #include <linux/mfd/tps65912.h>
18 static const struct of_device_id tps65912_spi_of_match_table[] = {
19 { .compatible = "ti,tps65912", },
22 MODULE_DEVICE_TABLE(of, tps65912_spi_of_match_table);
24 static int tps65912_spi_probe(struct spi_device *spi)
28 tps = devm_kzalloc(&spi->dev, sizeof(*tps), GFP_KERNEL);
32 spi_set_drvdata(spi, tps);
36 tps->regmap = devm_regmap_init_spi(spi, &tps65912_regmap_config);
37 if (IS_ERR(tps->regmap)) {
38 dev_err(tps->dev, "Failed to initialize register map\n");
39 return PTR_ERR(tps->regmap);
42 return tps65912_device_init(tps);
45 static const struct spi_device_id tps65912_spi_id_table[] = {
49 MODULE_DEVICE_TABLE(spi, tps65912_spi_id_table);
51 static struct spi_driver tps65912_spi_driver = {
54 .of_match_table = tps65912_spi_of_match_table,
56 .probe = tps65912_spi_probe,
57 .id_table = tps65912_spi_id_table,
59 module_spi_driver(tps65912_spi_driver);
62 MODULE_DESCRIPTION("TPS65912x SPI Interface Driver");
63 MODULE_LICENSE("GPL v2");