summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs530x-spi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-12-02 07:12:56 +0100
committerTakashi Iwai <tiwai@suse.de>2025-12-02 07:12:56 +0100
commit9747b22a417d2a7c478678143863b9777de104e4 (patch)
tree2690242ac1e95570c3e56a3106752af4cc2b5472 /sound/soc/codecs/cs530x-spi.c
parentef5e0a02d842b2c6dfcfd9b80feb185769b892ef (diff)
parentc5fae31f60a91dbe884ef2789fb3440bb4cddf05 (diff)
Merge tag 'asoc-v6.19' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v6.19 This is a very large set of updates, as well as some more extensive cleanup work from Morimto-san we've also added a generic SCDA class driver for SoundWire devices enabling us to support many chips with no custom code. There's also a batch of new drivers added for both SoCs and CODECs. - Added a SoundWire SCDA generic class driver, pulling in a little regmap work to support it. - A *lot* of cleaup and API improvement work from Morimoto-san. - Lots of work on the existing Cirrus, Intel, Maxim and Qualcomm drivers. - Support for Allwinner A523, Mediatek MT8189, Qualcomm QCM2290, QRB2210 and SM6115, SpacemiT K1, and TI TAS2568, TAS5802, TAS5806, TAS5815, TAS5828 and TAS5830. This also pulls in some gpiolib changes supporting shared GPIOs in the core there so we can convert some of the ASoC drivers open coding handling of that to the core functionality.
Diffstat (limited to 'sound/soc/codecs/cs530x-spi.c')
-rw-r--r--sound/soc/codecs/cs530x-spi.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/sound/soc/codecs/cs530x-spi.c b/sound/soc/codecs/cs530x-spi.c
new file mode 100644
index 000000000000..dbf1e7bbec19
--- /dev/null
+++ b/sound/soc/codecs/cs530x-spi.c
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// CS530x CODEC driver
+//
+// Copyright (C) 2025 Cirrus Logic, Inc. and
+// Cirrus Logic International Semiconductor Ltd.
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+
+#include "cs530x.h"
+
+static const struct of_device_id cs530x_of_match[] = {
+ {
+ .compatible = "cirrus,cs4282",
+ .data = (void *)CS4282,
+ }, {
+ .compatible = "cirrus,cs4302",
+ .data = (void *)CS4302,
+ }, {
+ .compatible = "cirrus,cs4304",
+ .data = (void *)CS4304,
+ }, {
+ .compatible = "cirrus,cs4308",
+ .data = (void *)CS4308,
+ }, {
+ .compatible = "cirrus,cs5302",
+ .data = (void *)CS5302,
+ }, {
+ .compatible = "cirrus,cs5304",
+ .data = (void *)CS5304,
+ }, {
+ .compatible = "cirrus,cs5304",
+ .data = (void *)CS5308,
+ },
+ {}
+};
+MODULE_DEVICE_TABLE(of, cs530x_of_match);
+
+static const struct spi_device_id cs530x_spi_id[] = {
+ { "cs4282", CS4282 },
+ { "cs4302", CS4302 },
+ { "cs4304", CS4304 },
+ { "cs4308", CS4308 },
+ { "cs5302", CS5302 },
+ { "cs5304", CS5304 },
+ { "cs5308", CS5308 },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, cs530x_spi_id);
+
+static int cs530x_spi_probe(struct spi_device *spi)
+{
+ struct cs530x_priv *cs530x;
+ struct device *dev = &spi->dev;
+ int ret;
+
+ cs530x = devm_kzalloc(dev, sizeof(struct cs530x_priv), GFP_KERNEL);
+ if (cs530x == NULL)
+ return -ENOMEM;
+
+ spi_set_drvdata(spi, cs530x);
+
+ cs530x->regmap = devm_regmap_init_spi(spi, &cs530x_regmap_spi);
+ if (IS_ERR(cs530x->regmap)) {
+ ret = PTR_ERR(cs530x->regmap);
+ dev_err(dev, "Failed to allocate register map: %d\n", ret);
+ return ret;
+ }
+
+ cs530x->devtype = (unsigned long)spi_get_device_match_data(spi);
+ cs530x->dev = &spi->dev;
+
+ return cs530x_probe(cs530x);
+}
+
+static struct spi_driver cs530x_spi_driver = {
+ .driver = {
+ .name = "cs530x",
+ .of_match_table = cs530x_of_match,
+ },
+ .id_table = cs530x_spi_id,
+ .probe = cs530x_spi_probe,
+};
+
+module_spi_driver(cs530x_spi_driver);
+
+MODULE_DESCRIPTION("SPI CS530X driver");
+MODULE_IMPORT_NS("SND_SOC_CS530X");
+MODULE_AUTHOR("Vitaly Rodionov <vitalyr@opensource.cirrus.com>");
+MODULE_LICENSE("GPL");