18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * ALSA SoC TLV320AIC23 codec driver SPI interface
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author:      Arun KS, <arunks@mistralsolutions.com>
68c2ecf20Sopenharmony_ci * Copyright:   (C) 2008 Mistral Solutions Pvt Ltd.,
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Based on sound/soc/codecs/wm8731.c by Richard Purdie
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/module.h>
128c2ecf20Sopenharmony_ci#include <linux/regmap.h>
138c2ecf20Sopenharmony_ci#include <linux/spi/spi.h>
148c2ecf20Sopenharmony_ci#include <sound/soc.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "tlv320aic23.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistatic int aic23_spi_probe(struct spi_device *spi)
198c2ecf20Sopenharmony_ci{
208c2ecf20Sopenharmony_ci	int ret;
218c2ecf20Sopenharmony_ci	struct regmap *regmap;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n");
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	spi->mode = SPI_MODE_0;
268c2ecf20Sopenharmony_ci	ret = spi_setup(spi);
278c2ecf20Sopenharmony_ci	if (ret < 0)
288c2ecf20Sopenharmony_ci		return ret;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	regmap = devm_regmap_init_spi(spi, &tlv320aic23_regmap);
318c2ecf20Sopenharmony_ci	return tlv320aic23_probe(&spi->dev, regmap);
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic struct spi_driver aic23_spi = {
358c2ecf20Sopenharmony_ci	.driver = {
368c2ecf20Sopenharmony_ci		.name = "tlv320aic23",
378c2ecf20Sopenharmony_ci	},
388c2ecf20Sopenharmony_ci	.probe = aic23_spi_probe,
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cimodule_spi_driver(aic23_spi);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver SPI");
448c2ecf20Sopenharmony_ciMODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>");
458c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
46