1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * ALSA SoC TLV320AIC23 codec driver SPI interface
4  *
5  * Author:      Arun KS, <arunks@mistralsolutions.com>
6  * Copyright:   (C) 2008 Mistral Solutions Pvt Ltd.,
7  *
8  * Based on sound/soc/codecs/wm8731.c by Richard Purdie
9  */
10 
11 #include <linux/module.h>
12 #include <linux/regmap.h>
13 #include <linux/spi/spi.h>
14 #include <sound/soc.h>
15 
16 #include "tlv320aic23.h"
17 
18 static int aic23_spi_probe(struct spi_device *spi)
19 {
20 	int ret;
21 	struct regmap *regmap;
22 
23 	dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n");
24 
25 	spi->mode = SPI_MODE_0;
26 	ret = spi_setup(spi);
27 	if (ret < 0)
28 		return ret;
29 
30 	regmap = devm_regmap_init_spi(spi, &tlv320aic23_regmap);
31 	return tlv320aic23_probe(&spi->dev, regmap);
32 }
33 
34 static struct spi_driver aic23_spi = {
35 	.driver = {
36 		.name = "tlv320aic23",
37 	},
38 	.probe = aic23_spi_probe,
39 };
40 
41 module_spi_driver(aic23_spi);
42 
43 MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver SPI");
44 MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>");
45 MODULE_LICENSE("GPL");
46