1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8731.c -- WM8731 ALSA SoC Audio driver
5 * Copyright 2005 Openedhand Ltd.
6 * Copyright 2006-12 Wolfson Microelectronics, plc
10 * Based on wm8753.c by Liam Girdwood
13 #include <linux/spi/spi.h>
14 #include <linux/module.h>
15 #include <linux/of_device.h>
19 static const struct of_device_id wm8731_of_match[] = {
20 { .compatible = "wlf,wm8731", },
23 MODULE_DEVICE_TABLE(of, wm8731_of_match);
25 static int wm8731_spi_probe(struct spi_device *spi)
27 struct wm8731_priv *wm8731;
30 wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL);
34 spi_set_drvdata(spi, wm8731);
36 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
37 if (IS_ERR(wm8731->regmap)) {
38 ret = PTR_ERR(wm8731->regmap);
39 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
44 return wm8731_init(&spi->dev, wm8731);
47 static struct spi_driver wm8731_spi_driver = {
50 .of_match_table = wm8731_of_match,
52 .probe = wm8731_spi_probe,
55 module_spi_driver(wm8731_spi_driver);
57 MODULE_DESCRIPTION("ASoC WM8731 driver - SPI");
58 MODULE_AUTHOR("Richard Purdie");
59 MODULE_LICENSE("GPL");