xref: /openbmc/linux/sound/soc/codecs/pcm3168a-spi.c (revision 6391503b)
1 /*
2  * PCM3168A codec spi driver
3  *
4  * Copyright (C) 2015 Imagination Technologies Ltd.
5  *
6  * Author: Damien Horsley <Damien.Horsley@imgtec.com>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms and conditions of the GNU General Public License,
10  * version 2, as published by the Free Software Foundation.
11  */
12 
13 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/spi/spi.h>
16 
17 #include <sound/soc.h>
18 
19 #include "pcm3168a.h"
20 
21 static int pcm3168a_spi_probe(struct spi_device *spi)
22 {
23 	struct regmap *regmap;
24 
25 	regmap = devm_regmap_init_spi(spi, &pcm3168a_regmap);
26 	if (IS_ERR(regmap))
27 		return PTR_ERR(regmap);
28 
29 	return pcm3168a_probe(&spi->dev, regmap);
30 }
31 
32 static int pcm3168a_spi_remove(struct spi_device *spi)
33 {
34 	pcm3168a_remove(&spi->dev);
35 
36 	return 0;
37 }
38 
39 static const struct spi_device_id pcm3168a_spi_id[] = {
40 	{ "pcm3168a", },
41 	{ },
42 };
43 MODULE_DEVICE_TABLE(spi, pcm3168a_spi_id);
44 
45 static const struct of_device_id pcm3168a_of_match[] = {
46 	{ .compatible = "ti,pcm3168a", },
47 	{ }
48 };
49 MODULE_DEVICE_TABLE(of, pcm3168a_of_match);
50 
51 static struct spi_driver pcm3168a_spi_driver = {
52 	.probe		= pcm3168a_spi_probe,
53 	.remove		= pcm3168a_spi_remove,
54 	.id_table	= pcm3168a_spi_id,
55 	.driver = {
56 		.name	= "pcm3168a",
57 		.of_match_table = pcm3168a_of_match,
58 		.pm		= &pcm3168a_pm_ops,
59 	},
60 };
61 module_spi_driver(pcm3168a_spi_driver);
62 
63 MODULE_DESCRIPTION("PCM3168A SPI codec driver");
64 MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
65 MODULE_LICENSE("GPL v2");
66