xref: /openbmc/linux/sound/soc/codecs/wm8804-spi.c (revision 255490f9)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * wm8804-spi.c  --  WM8804 S/PDIF transceiver driver - SPI
4  *
5  * Copyright 2015 Cirrus Logic Inc
6  *
7  * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
8  */
9 
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/spi/spi.h>
13 
14 #include "wm8804.h"
15 
16 static int wm8804_spi_probe(struct spi_device *spi)
17 {
18 	struct regmap *regmap;
19 
20 	regmap = devm_regmap_init_spi(spi, &wm8804_regmap_config);
21 	if (IS_ERR(regmap))
22 		return PTR_ERR(regmap);
23 
24 	return wm8804_probe(&spi->dev, regmap);
25 }
26 
27 static void wm8804_spi_remove(struct spi_device *spi)
28 {
29 	wm8804_remove(&spi->dev);
30 }
31 
32 static const struct of_device_id wm8804_of_match[] = {
33 	{ .compatible = "wlf,wm8804", },
34 	{ }
35 };
36 MODULE_DEVICE_TABLE(of, wm8804_of_match);
37 
38 static struct spi_driver wm8804_spi_driver = {
39 	.driver = {
40 		.name = "wm8804",
41 		.pm = &wm8804_pm,
42 		.of_match_table = wm8804_of_match,
43 	},
44 	.probe = wm8804_spi_probe,
45 	.remove = wm8804_spi_remove
46 };
47 
48 module_spi_driver(wm8804_spi_driver);
49 
50 MODULE_DESCRIPTION("ASoC WM8804 driver - SPI");
51 MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
52 MODULE_LICENSE("GPL");
53