Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * PCM179X ASoC SPI driver
0004  *
0005  * Copyright (c) Amarula Solutions B.V. 2013
0006  *
0007  *     Michael Trimarchi <michael@amarulasolutions.com>
0008  */
0009 
0010 #include <linux/module.h>
0011 #include <linux/of.h>
0012 #include <linux/spi/spi.h>
0013 #include <linux/regmap.h>
0014 
0015 #include "pcm179x.h"
0016 
0017 static int pcm179x_spi_probe(struct spi_device *spi)
0018 {
0019     struct regmap *regmap;
0020     int ret;
0021 
0022     regmap = devm_regmap_init_spi(spi, &pcm179x_regmap_config);
0023     if (IS_ERR(regmap)) {
0024         ret = PTR_ERR(regmap);
0025         dev_err(&spi->dev, "Failed to allocate regmap: %d\n", ret);
0026         return ret;
0027     }
0028 
0029     return pcm179x_common_init(&spi->dev, regmap);
0030 }
0031 
0032 static const struct of_device_id pcm179x_of_match[] = {
0033     { .compatible = "ti,pcm1792a", },
0034     { }
0035 };
0036 MODULE_DEVICE_TABLE(of, pcm179x_of_match);
0037 
0038 static const struct spi_device_id pcm179x_spi_ids[] = {
0039     { "pcm1792a", 0 },
0040     { "pcm179x", 0 },
0041     { },
0042 };
0043 MODULE_DEVICE_TABLE(spi, pcm179x_spi_ids);
0044 
0045 static struct spi_driver pcm179x_spi_driver = {
0046     .driver = {
0047         .name = "pcm179x",
0048         .of_match_table = of_match_ptr(pcm179x_of_match),
0049     },
0050     .id_table = pcm179x_spi_ids,
0051     .probe = pcm179x_spi_probe,
0052 };
0053 
0054 module_spi_driver(pcm179x_spi_driver);
0055 
0056 MODULE_DESCRIPTION("ASoC PCM179X SPI driver");
0057 MODULE_AUTHOR("Michael Trimarchi <michael@amarulasolutions.com>");
0058 MODULE_LICENSE("GPL");