0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/init.h>
0011 #include <linux/module.h>
0012 #include <linux/spi/spi.h>
0013
0014 #include "pcm186x.h"
0015
0016 static const struct of_device_id pcm186x_of_match[] = {
0017 { .compatible = "ti,pcm1862", .data = (void *)PCM1862 },
0018 { .compatible = "ti,pcm1863", .data = (void *)PCM1863 },
0019 { .compatible = "ti,pcm1864", .data = (void *)PCM1864 },
0020 { .compatible = "ti,pcm1865", .data = (void *)PCM1865 },
0021 { }
0022 };
0023 MODULE_DEVICE_TABLE(of, pcm186x_of_match);
0024
0025 static int pcm186x_spi_probe(struct spi_device *spi)
0026 {
0027 const enum pcm186x_type type =
0028 (enum pcm186x_type)spi_get_device_id(spi)->driver_data;
0029 int irq = spi->irq;
0030 struct regmap *regmap;
0031
0032 regmap = devm_regmap_init_spi(spi, &pcm186x_regmap);
0033 if (IS_ERR(regmap))
0034 return PTR_ERR(regmap);
0035
0036 return pcm186x_probe(&spi->dev, type, irq, regmap);
0037 }
0038
0039 static const struct spi_device_id pcm186x_spi_id[] = {
0040 { "pcm1862", PCM1862 },
0041 { "pcm1863", PCM1863 },
0042 { "pcm1864", PCM1864 },
0043 { "pcm1865", PCM1865 },
0044 { }
0045 };
0046 MODULE_DEVICE_TABLE(spi, pcm186x_spi_id);
0047
0048 static struct spi_driver pcm186x_spi_driver = {
0049 .probe = pcm186x_spi_probe,
0050 .id_table = pcm186x_spi_id,
0051 .driver = {
0052 .name = "pcm186x",
0053 .of_match_table = pcm186x_of_match,
0054 },
0055 };
0056 module_spi_driver(pcm186x_spi_driver);
0057
0058 MODULE_AUTHOR("Andreas Dannenberg <dannenberg@ti.com>");
0059 MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
0060 MODULE_DESCRIPTION("PCM186x Universal Audio ADC SPI Interface Driver");
0061 MODULE_LICENSE("GPL v2");