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