Skip to contentSkip to conversation

ASoC: cs4349: Add support for Cirrus Logic CS4349

PATCH Superseded [email protected] 2 participants 2 messages Jul 15, 2015

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: cs4349: Add support for Cirrus Logic CS4349

From: Tim Howe <[email protected]>

---
 Documentation/devicetree/bindings/sound/cs4349.txt |  19 +
 sound/soc/codecs/Kconfig                           |   6 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/cs4349.c                          | 414 +++++++++++++++++++++
 sound/soc/codecs/cs4349.h                          | 146 ++++++++
 5 files changed, 587 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cs4349.txt
 create mode 100644 sound/soc/codecs/cs4349.c
 create mode 100644 sound/soc/codecs/cs4349.h
Documentation/devicetree/bindings/sound/cs4349.txt new file +19 -0
new file mode 100644
index 0000000..54c117b
@@ -0,0 +1,19 @@
+CS4349 audio CODEC
+
+Required properties:
+
+  - compatible : "cirrus,cs4349"
+
+  - reg : the I2C address of the device for I2C
+
+Optional properties:
+
+  - reset-gpios : a GPIO spec for the reset pin.
+
+Example:
+
+codec: cs4349@48 {
+        compatible = "cirrus,cs4349";
+        reg = <0x48>;
+        reset-gpios = <&gpio 54 0>;
+};
sound/soc/codecs/Kconfig +6 -0
index 7223c7f..4a78606 100644
@@ -54,6 +54,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CS4271_I2C if I2C
 	select SND_SOC_CS4271_SPI if SPI_MASTER
 	select SND_SOC_CS42XX8_I2C if I2C
+	select SND_SOC_CS4349 if I2C
 	select SND_SOC_CX20442 if TTY
 	select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_DA7213 if I2C
@@ -413,6 +414,11 @@ config SND_SOC_CS42XX8_I2C
 	select SND_SOC_CS42XX8
 	select REGMAP_I2C
 
+# Cirrus Logic CS4349 HiFi DAC
+config SND_SOC_CS4349
+	tristate "Cirrus Logic CS4349 CODEC"
+	depends on I2C
+
 config SND_SOC_CX20442
 	tristate
 	depends on TTY
sound/soc/codecs/Makefile +2 -0
index 9f7136c..36a9f37 100644
@@ -46,6 +46,7 @@ snd-soc-cs4271-i2c-objs := cs4271-i2c.o
 snd-soc-cs4271-spi-objs := cs4271-spi.o
 snd-soc-cs42xx8-objs := cs42xx8.o
 snd-soc-cs42xx8-i2c-objs := cs42xx8-i2c.o
+snd-soc-cs4349-objs := cs4349.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
 snd-soc-da7213-objs := da7213.o
@@ -237,6 +238,7 @@ obj-$(CONFIG_SND_SOC_CS4271_I2C)	+= snd-soc-cs4271-i2c.o
 obj-$(CONFIG_SND_SOC_CS4271_SPI)	+= snd-soc-cs4271-spi.o
 obj-$(CONFIG_SND_SOC_CS42XX8)	+= snd-soc-cs42xx8.o
 obj-$(CONFIG_SND_SOC_CS42XX8_I2C) += snd-soc-cs42xx8-i2c.o
+obj-$(CONFIG_SND_SOC_CS4349)	+= snd-soc-cs4349.o
 obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_DA7210)	+= snd-soc-da7210.o
 obj-$(CONFIG_SND_SOC_DA7213)	+= snd-soc-da7213.o
sound/soc/codecs/cs4349.c new file +414 -0

414 lines not on this page · raw message

sound/soc/codecs/cs4349.h new file +146 -0

146 lines not on this page · raw message

Signature · 1 line
2.4.5
maintainer
#1 lore raw

sound/soc/codecs/cs4349.c line 80

Quoted 9 lines · On Tue, Jul 14, 2015 at 08:23:39PM -0500, [email protected] wrote:
sound/soc/codecs/cs4349.c new file +9 -0
+static int cs4349_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
+				   int source, unsigned int freq, int dir)
+{
+	struct cs4349_private *cs4349 = snd_soc_codec_get_drvdata(codec);
+
+	cs4349->mclk = freq;
+
+	return 0;
+}

On a more detailed look I'm not seeing anywhere where mclk is referenced, it appears to be write only. Better to remove this function and the private data for it if it's not needed.

sound/soc/codecs/cs4349.c line 351

Quoted 13 lines
sound/soc/codecs/cs4349.c new file +13 -0
+#ifdef CONFIG_PM
+static int cs4349_runtime_suspend(struct device *dev)
+{
+	struct cs4349_private *cs4349 = dev_get_drvdata(dev);
+	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
+	int ret;
+
+	ret = snd_soc_update_bits(rtd->codec, CS4349_MISC, PWR_DWN, 1);
+	if (ret < 0)
+		return ret;
+
+	regcache_cache_only(cs4349->regmap, true);
+	regcache_sync(cs4349->regmap);

This doesn't make sense to me - we're syncing the register map right after we put the device into cache only mode. I think it's just a cut'n'paste thing?