Skip to contentSkip to conversation

ASoC: cs47l15: Add codec driver for Cirrus Logic CS47L15

PATCH Superseded Charles Keepax 2 participants 4 messages Jul 25, 2019

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Charles Keepax

author maintainer
#0 lore raw

PATCH v2 1/2 ASoC: cs47l15: Add codec driver for Cirrus Logic CS47L15

From: Richard Fitzgerald <[email protected]>

Adds the codec driver for the CS47L15 SmartCodec. This is a multi-functional codec based on the Cirrus Logic Madera platform.

---

Changes since v1:
- Minor tweak to commit message

Thanks,
Charles

 sound/soc/codecs/Kconfig   |    6 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cs47l15.c | 1498 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/madera.c  |    4 +
 4 files changed, 1510 insertions(+)
 create mode 100644 sound/soc/codecs/cs47l15.c
sound/soc/codecs/Kconfig +6 -0
index 9f89a5346299d..b027af8e9f39f 100644
@@ -71,6 +71,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CS4341 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_CS4349 if I2C
 	select SND_SOC_CS47L24 if MFD_CS47L24
+	select SND_SOC_CS47L15 if MFD_CS47L15
 	select SND_SOC_CS47L35 if MFD_CS47L35
 	select SND_SOC_CS47L85 if MFD_CS47L85
 	select SND_SOC_CS47L90 if MFD_CS47L90
@@ -584,6 +585,9 @@ config SND_SOC_CS4349
 config SND_SOC_CS47L24
 	tristate
 
+config SND_SOC_CS47L15
+	tristate
+
 config SND_SOC_CS47L35
 	tristate
 
@@ -722,9 +726,11 @@ config SND_SOC_LOCHNAGAR_SC
 
 config SND_SOC_MADERA
 	tristate
+	default y if SND_SOC_CS47L15=y
 	default y if SND_SOC_CS47L35=y
 	default y if SND_SOC_CS47L85=y
 	default y if SND_SOC_CS47L90=y
+	default m if SND_SOC_CS47L15=m
 	default m if SND_SOC_CS47L35=m
 	default m if SND_SOC_CS47L85=m
 	default m if SND_SOC_CS47L90=m
sound/soc/codecs/Makefile +2 -0
index 5b4bb8cf43256..2de423621ba4a 100644
@@ -65,6 +65,7 @@ snd-soc-cs43130-objs := cs43130.o
 snd-soc-cs4341-objs := cs4341.o
 snd-soc-cs4349-objs := cs4349.o
 snd-soc-cs47l24-objs := cs47l24.o
+snd-soc-cs47l15-objs := cs47l15.o
 snd-soc-cs47l35-objs := cs47l35.o
 snd-soc-cs47l85-objs := cs47l85.o
 snd-soc-cs47l90-objs := cs47l90.o
@@ -346,6 +347,7 @@ obj-$(CONFIG_SND_SOC_CS43130)   += snd-soc-cs43130.o
 obj-$(CONFIG_SND_SOC_CS4341)	+= snd-soc-cs4341.o
 obj-$(CONFIG_SND_SOC_CS4349)	+= snd-soc-cs4349.o
 obj-$(CONFIG_SND_SOC_CS47L24)	+= snd-soc-cs47l24.o
+obj-$(CONFIG_SND_SOC_CS47L15)	+= snd-soc-cs47l15.o
 obj-$(CONFIG_SND_SOC_CS47L35)	+= snd-soc-cs47l35.o
 obj-$(CONFIG_SND_SOC_CS47L85)	+= snd-soc-cs47l85.o
 obj-$(CONFIG_SND_SOC_CS47L90)	+= snd-soc-cs47l90.o
sound/soc/codecs/cs47l15.c new file +1498 -0

1,498 lines not on this page · raw message

sound/soc/codecs/madera.c +4 -0
index 5f1e32a5a8556..1c00e2a115bcd 100644
@@ -1041,6 +1041,10 @@ static void madera_configure_input_mode(struct madera *madera)
 	int max_analogue_inputs, max_dmic_sup, i;
 
 	switch (madera->type) {
+	case CS47L15:
+		max_analogue_inputs = 1;
+		max_dmic_sup = 2;
+		break;
 	case CS47L35:
 		max_analogue_inputs = 2;
 		max_dmic_sup = 2;
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

PATCH v2 2/2 ASoC: cs47l92: Add codec driver for Cirrus Logic CS47L92

From: Stuart Henderson <[email protected]>

Adds the codec driver for the CS47L92 SmartCodec. This is a multi-functional codec based on the Cirrus Logic Madera platform.

---

Changes since v1:
- Removed some audpdm stuff that needs a bit more work before being upstreamed.

Thanks,
Charles

 sound/soc/codecs/Kconfig   |    6 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cs47l92.c | 2047 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/madera.c  |  430 +++++++++-
 sound/soc/codecs/madera.h  |   10 +
 5 files changed, 2486 insertions(+), 9 deletions(-)
 create mode 100644 sound/soc/codecs/cs47l92.c
sound/soc/codecs/Kconfig +6 -0
index b027af8e9f39f..9034f85455fb9 100644
@@ -75,6 +75,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CS47L35 if MFD_CS47L35
 	select SND_SOC_CS47L85 if MFD_CS47L85
 	select SND_SOC_CS47L90 if MFD_CS47L90
+	select SND_SOC_CS47L92 if MFD_CS47L92
 	select SND_SOC_CS53L30 if I2C
 	select SND_SOC_CX20442 if TTY
 	select SND_SOC_CX2072X if I2C
@@ -597,6 +598,9 @@ config SND_SOC_CS47L85
 config SND_SOC_CS47L90
 	tristate
 
+config SND_SOC_CS47L92
+	tristate
+
 # Cirrus Logic Quad-Channel ADC
 config SND_SOC_CS53L30
 	tristate "Cirrus Logic CS53L30 CODEC"
@@ -730,10 +734,12 @@ config SND_SOC_MADERA
 	default y if SND_SOC_CS47L35=y
 	default y if SND_SOC_CS47L85=y
 	default y if SND_SOC_CS47L90=y
+	default y if SND_SOC_CS47L92=y
 	default m if SND_SOC_CS47L15=m
 	default m if SND_SOC_CS47L35=m
 	default m if SND_SOC_CS47L85=m
 	default m if SND_SOC_CS47L90=m
+	default m if SND_SOC_CS47L92=m
 
 config SND_SOC_MAX98088
 	tristate "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
sound/soc/codecs/Makefile +2 -0
index 2de423621ba4a..1ce7ab6d08dd4 100644
@@ -69,6 +69,7 @@ snd-soc-cs47l15-objs := cs47l15.o
 snd-soc-cs47l35-objs := cs47l35.o
 snd-soc-cs47l85-objs := cs47l85.o
 snd-soc-cs47l90-objs := cs47l90.o
+snd-soc-cs47l92-objs := cs47l92.o
 snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-cx2072x-objs := cx2072x.o
@@ -351,6 +352,7 @@ obj-$(CONFIG_SND_SOC_CS47L15)	+= snd-soc-cs47l15.o
 obj-$(CONFIG_SND_SOC_CS47L35)	+= snd-soc-cs47l35.o
 obj-$(CONFIG_SND_SOC_CS47L85)	+= snd-soc-cs47l85.o
 obj-$(CONFIG_SND_SOC_CS47L90)	+= snd-soc-cs47l90.o
+obj-$(CONFIG_SND_SOC_CS47L92)	+= snd-soc-cs47l92.o
 obj-$(CONFIG_SND_SOC_CS53L30)	+= snd-soc-cs53l30.o
 obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_CX2072X)	+= snd-soc-cx2072x.o
sound/soc/codecs/cs47l92.c new file +2047 -0

2,047 lines not on this page · raw message

sound/soc/codecs/madera.c +421 -9

502 lines not on this page · raw message

sound/soc/codecs/madera.h +10 -0
index 0af66f2807708..1f3e8e230cf25 100644
@@ -47,6 +47,7 @@
 #define MADERA_CLK_SYSCLK_3		6
 #define MADERA_CLK_ASYNCCLK_2		7
 #define MADERA_CLK_DSPCLK		8
+#define MADERA_CLK_OUTCLK		9
 
 #define MADERA_CLK_SRC_MCLK1		0x0
 #define MADERA_CLK_SRC_MCLK2		0x1
@@ -61,6 +62,12 @@
 #define MADERA_CLK_SRC_AIF4BCLK		0xB
 #define MADERA_CLK_SRC_FLLAO		0xF
 
+#define MADERA_OUTCLK_SYSCLK		0
+#define MADERA_OUTCLK_ASYNCCLK		1
+#define MADERA_OUTCLK_MCLK1		4
+#define MADERA_OUTCLK_MCLK2		5
+#define MADERA_OUTCLK_MCLK3		6
+
 #define MADERA_MIXER_VOL_MASK		0x00FE
 #define MADERA_MIXER_VOL_SHIFT		1
 #define MADERA_MIXER_VOL_WIDTH		7
@@ -326,6 +333,7 @@ extern const struct soc_enum madera_sample_rate[];
 extern const struct soc_enum madera_isrc_fsl[];
 extern const struct soc_enum madera_isrc_fsh[];
 extern const struct soc_enum madera_asrc1_rate[];
+extern const struct soc_enum madera_asrc1_bidir_rate[];
 extern const struct soc_enum madera_asrc2_rate[];
 extern const struct soc_enum madera_dfc_width[];
 extern const struct soc_enum madera_dfc_type[];
@@ -403,6 +411,8 @@ int madera_set_fll_syncclk(struct madera_fll *fll, int source,
 			   unsigned int fref, unsigned int fout);
 int madera_set_fll_ao_refclk(struct madera_fll *fll, int source,
 			     unsigned int fin, unsigned int fout);
+int madera_fllhj_set_refclk(struct madera_fll *fll, int source,
+			    unsigned int fin, unsigned int fout);
 
 int madera_core_init(struct madera_priv *priv);
 int madera_core_free(struct madera_priv *priv);
Signature · 1 line
2.11.0
maintainer
#2 lore raw
In reply to Charles Keepax

sound/soc/codecs/Kconfig config SND_SOC_ALL_CODECS · line 75

Quoted 3 lines · Charles Keepax
sound/soc/codecs/Kconfig +1 -0
 	select SND_SOC_CS47L24 if MFD_CS47L24
+	select SND_SOC_CS47L15 if MFD_CS47L15
 	select SND_SOC_CS47L35 if MFD_CS47L35

The Makefile and Kconfig sorting is a bit off. Please send a followup fixing this.

Quoted 12 lines
sound/soc/codecs/cs47l15.c new file +12 -0
+static irqreturn_t cs47l15_adsp2_irq(int irq, void *data)
+{
+	struct cs47l15 *cs47l15 = data;
+	struct madera_priv *priv = &cs47l15->core;
+	struct madera *madera = priv->madera;
+	int ret;
+
+	ret = wm_adsp_compr_handle_irq(&priv->adsp[0]);
+	if (ret == -ENODEV) {
+		dev_err(madera->dev, "Spurious compressed data IRQ\n");
+		return IRQ_NONE;
+	}

sound/soc/codecs/cs47l15.c line 1269

Quoted 10 lines
sound/soc/codecs/cs47l15.c new file +10 -0
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t cs47l15_dsp_bus_error(int irq, void *data)
+{
+	struct wm_adsp *dsp = (struct wm_adsp *)data;
+
+	return wm_adsp2_bus_error(dsp);
+}

Noticeable difference in pattern between these two interrupt helpers (and makes me wonder why we need the wrappers at all).

author maintainer
#3 lore raw
Quoted 9 lines · Mark Brown

sound/soc/codecs/Kconfig config SND_SOC_ALL_CODECS · line 75

Quoted 3 lines · Charles Keepax
sound/soc/codecs/Kconfig +1 -0
 	select SND_SOC_CS47L24 if MFD_CS47L24
+	select SND_SOC_CS47L15 if MFD_CS47L15
 	select SND_SOC_CS47L35 if MFD_CS47L35

The Makefile and Kconfig sorting is a bit off. Please send a followup fixing this.

Can do.

Quoted 17 lines
Quoted 17 lines
sound/soc/codecs/cs47l15.c new file +17 -0
+static irqreturn_t cs47l15_adsp2_irq(int irq, void *data)
+{
+	struct cs47l15 *cs47l15 = data;
+	struct madera_priv *priv = &cs47l15->core;
+	struct madera *madera = priv->madera;
+	int ret;
+
+	ret = wm_adsp_compr_handle_irq(&priv->adsp[0]);
+	if (ret == -ENODEV) {
+		dev_err(madera->dev, "Spurious compressed data IRQ\n");
+		return IRQ_NONE;
+	}
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t cs47l15_dsp_bus_error(int irq, void *data)
Quoted 8 lines

sound/soc/codecs/cs47l15.c line 1269

Quoted 5 lines
sound/soc/codecs/cs47l15.c new file +5 -0
+{
+	struct wm_adsp *dsp = (struct wm_adsp *)data;
+
+	return wm_adsp2_bus_error(dsp);
+}

Noticeable difference in pattern between these two interrupt helpers (and makes me wonder why we need the wrappers at all).

Yeah there doesn't seem to be any need for the wrappers.

I will respin the series and fixup these two issues.

Thanks,
Charles