[PATCH 15/16] ASoC: cs47l85: Add codec driver for Cirrus Logic CS47L85

2017-04-05 Thread Richard Fitzgerald
Adds the codec driver for the CS47L85 SmartCodec. This is a
multi-functional codec based on the Cirrus Logic Madera platform.

Signed-off-by: Nariman Poushin 
Signed-off-by: Charles Keepax 
Signed-off-by: Richard Fitzgerald 
---
 sound/soc/codecs/Kconfig   |6 +
 sound/soc/codecs/Makefile  |2 +
 sound/soc/codecs/cs47l85.c | 2706 
 3 files changed, 2714 insertions(+)
 create mode 100644 sound/soc/codecs/cs47l85.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index aad4a7e..45fb885 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -63,6 +63,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_CS4349 if I2C
select SND_SOC_CS47L24 if MFD_CS47L24
select SND_SOC_CS47L35 if MFD_CS47L35
+   select SND_SOC_CS47L85 if MFD_CS47L85
select SND_SOC_CS53L30 if I2C
select SND_SOC_CX20442 if TTY
select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -497,6 +498,9 @@ config SND_SOC_CS47L24
 config SND_SOC_CS47L35
tristate
 
+config SND_SOC_CS47L85
+   tristate
+
 # Cirrus Logic Quad-Channel ADC
 config SND_SOC_CS53L30
tristate "Cirrus Logic CS53L30 CODEC"
@@ -585,7 +589,9 @@ config SND_SOC_LM49453
 config SND_SOC_MADERA
tristate
default y if SND_SOC_CS47L35=y
+   default y if SND_SOC_CS47L85=y
default m if SND_SOC_CS47L35=m
+   default m if SND_SOC_CS47L85=m
 
 config SND_SOC_MAX98088
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 1b26ecb..7a07241 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -56,6 +56,7 @@ snd-soc-cs42xx8-i2c-objs := cs42xx8-i2c.o
 snd-soc-cs4349-objs := cs4349.o
 snd-soc-cs47l24-objs := cs47l24.o
 snd-soc-cs47l35-objs := cs47l35.o
+snd-soc-cs47l85-objs := cs47l85.o
 snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
@@ -291,6 +292,7 @@ obj-$(CONFIG_SND_SOC_CS42XX8_I2C) += snd-soc-cs42xx8-i2c.o
 obj-$(CONFIG_SND_SOC_CS4349)   += snd-soc-cs4349.o
 obj-$(CONFIG_SND_SOC_CS47L24)  += snd-soc-cs47l24.o
 obj-$(CONFIG_SND_SOC_CS47L35)  += snd-soc-cs47l35.o
+obj-$(CONFIG_SND_SOC_CS47L85)  += snd-soc-cs47l85.o
 obj-$(CONFIG_SND_SOC_CS53L30)  += snd-soc-cs53l30.o
 obj-$(CONFIG_SND_SOC_CX20442)  += snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_DA7210)   += snd-soc-da7210.o
diff --git a/sound/soc/codecs/cs47l85.c b/sound/soc/codecs/cs47l85.c
new file mode 100644
index 000..9fe76ec
--- /dev/null
+++ b/sound/soc/codecs/cs47l85.c
@@ -0,0 +1,2706 @@
+/*
+ * cs47l85.c  --  ALSA SoC Audio driver for CS47L85 codecs
+ *
+ * Copyright 2015-2017 Cirrus Logic Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "madera.h"
+#include "wm_adsp.h"
+
+#define CS47L85_NUM_ADSP   7
+#define CS47L85_MONO_OUTPUTS   4
+
+struct cs47l85 {
+   struct madera_priv core;
+   struct madera_fll fll[3];
+};
+
+static const struct wm_adsp_region cs47l85_dsp1_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x08 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x0e },
+   { .type = WMFW_ADSP2_XM, .base = 0x0a },
+   { .type = WMFW_ADSP2_YM, .base = 0x0c },
+};
+
+static const struct wm_adsp_region cs47l85_dsp2_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x10 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x16 },
+   { .type = WMFW_ADSP2_XM, .base = 0x12 },
+   { .type = WMFW_ADSP2_YM, .base = 0x14 },
+};
+
+static const struct wm_adsp_region cs47l85_dsp3_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x18 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x1e },
+   { .type = WMFW_ADSP2_XM, .base = 0x1a },
+   { .type = WMFW_ADSP2_YM, .base = 0x1c },
+};
+
+static const struct wm_adsp_region cs47l85_dsp4_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x20 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x26 },
+   { .type = WMFW_ADSP2_XM, .base = 0x22 },
+   { .type = WMFW_ADSP2_YM, .base = 0x24 },
+};
+
+static const struct wm_adsp_region cs47l85_dsp5_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x28 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x2e },
+   { .type = WMFW_ADSP2_XM, .base = 0x2a },
+   { .type = WMFW_ADSP2_YM, .base = 0x2c },
+};
+
+static const struct wm_adsp_region cs47l85_dsp6_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x30 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x36 },
+   { .type = WMFW_ADSP2_XM, .base = 0x32 },

[PATCH 15/16] ASoC: cs47l85: Add codec driver for Cirrus Logic CS47L85

2017-04-05 Thread Richard Fitzgerald
Adds the codec driver for the CS47L85 SmartCodec. This is a
multi-functional codec based on the Cirrus Logic Madera platform.

Signed-off-by: Nariman Poushin 
Signed-off-by: Charles Keepax 
Signed-off-by: Richard Fitzgerald 
---
 sound/soc/codecs/Kconfig   |6 +
 sound/soc/codecs/Makefile  |2 +
 sound/soc/codecs/cs47l85.c | 2706 
 3 files changed, 2714 insertions(+)
 create mode 100644 sound/soc/codecs/cs47l85.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index aad4a7e..45fb885 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -63,6 +63,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_CS4349 if I2C
select SND_SOC_CS47L24 if MFD_CS47L24
select SND_SOC_CS47L35 if MFD_CS47L35
+   select SND_SOC_CS47L85 if MFD_CS47L85
select SND_SOC_CS53L30 if I2C
select SND_SOC_CX20442 if TTY
select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -497,6 +498,9 @@ config SND_SOC_CS47L24
 config SND_SOC_CS47L35
tristate
 
+config SND_SOC_CS47L85
+   tristate
+
 # Cirrus Logic Quad-Channel ADC
 config SND_SOC_CS53L30
tristate "Cirrus Logic CS53L30 CODEC"
@@ -585,7 +589,9 @@ config SND_SOC_LM49453
 config SND_SOC_MADERA
tristate
default y if SND_SOC_CS47L35=y
+   default y if SND_SOC_CS47L85=y
default m if SND_SOC_CS47L35=m
+   default m if SND_SOC_CS47L85=m
 
 config SND_SOC_MAX98088
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 1b26ecb..7a07241 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -56,6 +56,7 @@ snd-soc-cs42xx8-i2c-objs := cs42xx8-i2c.o
 snd-soc-cs4349-objs := cs4349.o
 snd-soc-cs47l24-objs := cs47l24.o
 snd-soc-cs47l35-objs := cs47l35.o
+snd-soc-cs47l85-objs := cs47l85.o
 snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
@@ -291,6 +292,7 @@ obj-$(CONFIG_SND_SOC_CS42XX8_I2C) += snd-soc-cs42xx8-i2c.o
 obj-$(CONFIG_SND_SOC_CS4349)   += snd-soc-cs4349.o
 obj-$(CONFIG_SND_SOC_CS47L24)  += snd-soc-cs47l24.o
 obj-$(CONFIG_SND_SOC_CS47L35)  += snd-soc-cs47l35.o
+obj-$(CONFIG_SND_SOC_CS47L85)  += snd-soc-cs47l85.o
 obj-$(CONFIG_SND_SOC_CS53L30)  += snd-soc-cs53l30.o
 obj-$(CONFIG_SND_SOC_CX20442)  += snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_DA7210)   += snd-soc-da7210.o
diff --git a/sound/soc/codecs/cs47l85.c b/sound/soc/codecs/cs47l85.c
new file mode 100644
index 000..9fe76ec
--- /dev/null
+++ b/sound/soc/codecs/cs47l85.c
@@ -0,0 +1,2706 @@
+/*
+ * cs47l85.c  --  ALSA SoC Audio driver for CS47L85 codecs
+ *
+ * Copyright 2015-2017 Cirrus Logic Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "madera.h"
+#include "wm_adsp.h"
+
+#define CS47L85_NUM_ADSP   7
+#define CS47L85_MONO_OUTPUTS   4
+
+struct cs47l85 {
+   struct madera_priv core;
+   struct madera_fll fll[3];
+};
+
+static const struct wm_adsp_region cs47l85_dsp1_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x08 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x0e },
+   { .type = WMFW_ADSP2_XM, .base = 0x0a },
+   { .type = WMFW_ADSP2_YM, .base = 0x0c },
+};
+
+static const struct wm_adsp_region cs47l85_dsp2_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x10 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x16 },
+   { .type = WMFW_ADSP2_XM, .base = 0x12 },
+   { .type = WMFW_ADSP2_YM, .base = 0x14 },
+};
+
+static const struct wm_adsp_region cs47l85_dsp3_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x18 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x1e },
+   { .type = WMFW_ADSP2_XM, .base = 0x1a },
+   { .type = WMFW_ADSP2_YM, .base = 0x1c },
+};
+
+static const struct wm_adsp_region cs47l85_dsp4_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x20 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x26 },
+   { .type = WMFW_ADSP2_XM, .base = 0x22 },
+   { .type = WMFW_ADSP2_YM, .base = 0x24 },
+};
+
+static const struct wm_adsp_region cs47l85_dsp5_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x28 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x2e },
+   { .type = WMFW_ADSP2_XM, .base = 0x2a },
+   { .type = WMFW_ADSP2_YM, .base = 0x2c },
+};
+
+static const struct wm_adsp_region cs47l85_dsp6_regions[] = {
+   { .type = WMFW_ADSP2_PM, .base = 0x30 },
+   { .type = WMFW_ADSP2_ZM, .base = 0x36 },
+   { .type = WMFW_ADSP2_XM, .base = 0x32 },
+   { .type = WMFW_ADSP2_YM, .base = 0x34 },
+};
+
+static const struct wm_adsp_region