1 // SPDX-License-Identifier: GPL-2.0-only 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 2 /* 3 * wm8731.c -- WM8731 ALSA SoC Audio driver 3 * wm8731.c -- WM8731 ALSA SoC Audio driver 4 * 4 * 5 * Copyright 2005 Openedhand Ltd. 5 * Copyright 2005 Openedhand Ltd. 6 * Copyright 2006-12 Wolfson Microelectronics, 6 * Copyright 2006-12 Wolfson Microelectronics, plc 7 * 7 * 8 * Author: Richard Purdie <richard@openedhand. 8 * Author: Richard Purdie <richard@openedhand.com> 9 * 9 * 10 * Based on wm8753.c by Liam Girdwood 10 * Based on wm8753.c by Liam Girdwood 11 */ 11 */ 12 12 13 #include <linux/spi/spi.h> 13 #include <linux/spi/spi.h> 14 #include <linux/mod_devicetable.h> << 15 #include <linux/module.h> 14 #include <linux/module.h> >> 15 #include <linux/of_device.h> 16 16 17 #include "wm8731.h" 17 #include "wm8731.h" 18 18 19 static const struct of_device_id wm8731_of_mat 19 static const struct of_device_id wm8731_of_match[] = { 20 { .compatible = "wlf,wm8731", }, 20 { .compatible = "wlf,wm8731", }, 21 { } 21 { } 22 }; 22 }; 23 MODULE_DEVICE_TABLE(of, wm8731_of_match); 23 MODULE_DEVICE_TABLE(of, wm8731_of_match); 24 24 25 static int wm8731_spi_probe(struct spi_device 25 static int wm8731_spi_probe(struct spi_device *spi) 26 { 26 { 27 struct wm8731_priv *wm8731; 27 struct wm8731_priv *wm8731; 28 int ret; 28 int ret; 29 29 30 wm8731 = devm_kzalloc(&spi->dev, sizeo 30 wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL); 31 if (wm8731 == NULL) 31 if (wm8731 == NULL) 32 return -ENOMEM; 32 return -ENOMEM; 33 33 34 spi_set_drvdata(spi, wm8731); 34 spi_set_drvdata(spi, wm8731); 35 35 36 wm8731->regmap = devm_regmap_init_spi( 36 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap); 37 if (IS_ERR(wm8731->regmap)) { 37 if (IS_ERR(wm8731->regmap)) { 38 ret = PTR_ERR(wm8731->regmap); 38 ret = PTR_ERR(wm8731->regmap); 39 dev_err(&spi->dev, "Failed to 39 dev_err(&spi->dev, "Failed to allocate register map: %d\n", 40 ret); 40 ret); 41 return ret; 41 return ret; 42 } 42 } 43 43 44 return wm8731_init(&spi->dev, wm8731); 44 return wm8731_init(&spi->dev, wm8731); 45 } 45 } 46 46 47 static struct spi_driver wm8731_spi_driver = { 47 static struct spi_driver wm8731_spi_driver = { 48 .driver = { 48 .driver = { 49 .name = "wm8731", 49 .name = "wm8731", 50 .of_match_table = wm8731_of_ma 50 .of_match_table = wm8731_of_match, 51 }, 51 }, 52 .probe = wm8731_spi_probe, 52 .probe = wm8731_spi_probe, 53 }; 53 }; 54 54 55 module_spi_driver(wm8731_spi_driver); 55 module_spi_driver(wm8731_spi_driver); 56 56 57 MODULE_DESCRIPTION("ASoC WM8731 driver - SPI") 57 MODULE_DESCRIPTION("ASoC WM8731 driver - SPI"); 58 MODULE_AUTHOR("Richard Purdie"); 58 MODULE_AUTHOR("Richard Purdie"); 59 MODULE_LICENSE("GPL"); 59 MODULE_LICENSE("GPL"); 60 60
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.