xref: /openbmc/linux/sound/soc/codecs/wm8804-spi.c (revision ca55b2fe)
1 /*
2  * wm8804-spi.c  --  WM8804 S/PDIF transceiver driver - SPI
3  *
4  * Copyright 2015 Cirrus Logic Inc
5  *
6  * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * 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 "wm8804.h"
18 
19 static int wm8804_spi_probe(struct spi_device *spi)
20 {
21 	struct regmap *regmap;
22 
23 	regmap = devm_regmap_init_spi(spi, &wm8804_regmap_config);
24 	if (IS_ERR(regmap))
25 		return PTR_ERR(regmap);
26 
27 	return wm8804_probe(&spi->dev, regmap);
28 }
29 
30 static int wm8804_spi_remove(struct spi_device *spi)
31 {
32 	wm8804_remove(&spi->dev);
33 	return 0;
34 }
35 
36 static const struct of_device_id wm8804_of_match[] = {
37 	{ .compatible = "wlf,wm8804", },
38 	{ }
39 };
40 MODULE_DEVICE_TABLE(of, wm8804_of_match);
41 
42 static struct spi_driver wm8804_spi_driver = {
43 	.driver = {
44 		.name = "wm8804",
45 		.owner = THIS_MODULE,
46 		.pm = &wm8804_pm,
47 		.of_match_table = wm8804_of_match,
48 	},
49 	.probe = wm8804_spi_probe,
50 	.remove = wm8804_spi_remove
51 };
52 
53 module_spi_driver(wm8804_spi_driver);
54 
55 MODULE_DESCRIPTION("ASoC WM8804 driver - SPI");
56 MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
57 MODULE_LICENSE("GPL");
58