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