Skip to contentSkip to conversation

ASoC: madera: Add DT bindings for Cirrus Logic Madera codecs

PATCH Superseded Charles Keepax 3 participants 11 messages May 24, 2019 – May 27, 2019

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Charles Keepax

author maintainer
#0 lore raw

PATCH 1/5 ASoC: madera: Add DT bindings for Cirrus Logic Madera codecs

From: Richard Fitzgerald <[email protected]>

The Cirrus Logic Madera codecs are a family of related codecs with extensive digital and analogue I/O, digital mixing and routing, signal processing and programmable DSPs.

---
 Documentation/devicetree/bindings/sound/madera.txt | 67 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 include/dt-bindings/sound/madera.h                 | 29 ++++++++++
 3 files changed, 97 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/madera.txt
 create mode 100644 include/dt-bindings/sound/madera.h
Documentation/devicetree/bindings/sound/madera.txt new file +67 -0
new file mode 100644
index 0000000000000..1114fcf1aa4c2
@@ -0,0 +1,67 @@
+Cirrus Logic Madera class audio codecs
+
+This describes audio configuration bindings for these codecs.
+
+See also the core bindings for the parent MFD driver:
+See Documentation/devicetree/bindings/mfd/madera.txt
+
+and defines for values used in these bindings:
+include/dt-bindings/sound/madera.h
+
+These properties are all contained in the parent MFD node.
+
+Optional properties:
+  - cirrus,dmic-ref : Indicates how the MICBIAS pins have been externally
+    connected to DMICs on each input, one cell per input.
+    <IN1 IN2 IN3 ...>
+    A value of 0 indicates MICVDD and is the default, other values depend on the
+    codec:
+    For CS47L35 one of the CS47L35_DMIC_REF_xxx values
+    For all other codecs one of the MADERA_DMIC_REF_xxx values
+    Also see the datasheet for a description of the INn_DMIC_SUP field.
+
+  - cirrus,inmode : A list of input mode settings for each input. A maximum of
+    16 cells, with four cells per input in the order INnAL, INnAR INnBL INnBR.
+    For non-muxed inputs the first two cells for that input set the mode for
+    the left and right channel and the second two cells must be 0.
+    For muxed inputs the first two cells for that input set the mode of the
+    left and right A inputs and the second two cells set the mode of the left
+    and right B inputs.
+    Valid mode values are one of the MADERA_INMODE_xxx. If the array is shorter
+    than the number of inputs the unspecified inputs default to
+    MADERA_INMODE_DIFF.
+
+  - cirrus,out-mono : Mono bit for each output, must contain six cells if
+    specified. A non-zero value indicates the corresponding output is mono.
+
+  - cirrus,max-channels-clocked : Maximum number of channels that I2S clocks
+    will be generated for. Useful when clock master for systems where the I2S
+    bus has multiple data lines.
+    One cell for each AIF, use a value of zero for AIFs that should be handled
+    normally.
+
+  - cirrus,pdm-fmt : PDM speaker data format, must contain 2 cells
+    (OUT5 and OUT6). See the PDM_SPKn_FMT field in the datasheet for a
+    description of this value.
+    The second cell is ignored for codecs that do not have OUT6.
+
+  - cirrus,pdm-mute : PDM mute format, must contain 2 cells
+    (OUT5 and OUT6). See the PDM_SPKn_CTRL_1 register in the datasheet for a
+    description of this value.
+    The second cell is ignored for codecs that do not have OUT6.
+
+Example:
+
+cs47l35@0 {
+	compatible = "cirrus,cs47l35";
+
+	cirrus,dmic-ref = <0 0 CS47L35_DMIC_REF_MICBIAS1B 0>;
+	cirrus,inmode = <
+		MADERA_INMODE_DMIC MADERA_INMODE_DMIC /* IN1A digital */
+		MADERA_INMODE_SE   MADERA_INMODE_SE   /* IN1B single-ended */
+		MADERA_INMODE_DIFF MADERA_INMODE_DIFF /* IN2 differential */
+		0 0 	/* not used on this codec */
+	>;
+	cirrus,out-mono = <0 0 0 0 0 0>;
+	cirrus,max-channels-clocked = <2 0 0>;
+};
MAINTAINERS +1 -0
index 5cfbea4ce5750..642cb5610dd50 100644
@@ -3915,6 +3915,7 @@ W:	https://github.com/CirrusLogic/linux-drivers/wiki
 S:	Supported
 F:	Documentation/devicetree/bindings/mfd/madera.txt
 F:	Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt
+F:	include/dt-bindings/sound/madera*
 F:	include/linux/irqchip/irq-madera*
 F:	include/linux/mfd/madera/*
 F:	drivers/gpio/gpio-madera*
include/dt-bindings/sound/madera.h new file +29 -0
new file mode 100644
index 0000000000000..9ff4eae5259b0
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device Tree defines for Madera codecs
+ *
+ * Copyright (C) 2016-2017 Cirrus Logic, Inc. and
+ *                         Cirrus Logic International Semiconductor Ltd.
+ *
+ * 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.
+ */
+
+#ifndef DT_BINDINGS_SOUND_MADERA_H
+#define DT_BINDINGS_SOUND_MADERA_H
+
+#define MADERA_INMODE_DIFF		0
+#define MADERA_INMODE_SE		1
+#define MADERA_INMODE_DMIC		2
+
+#define MADERA_DMIC_REF_MICVDD		0
+#define MADERA_DMIC_REF_MICBIAS1	1
+#define MADERA_DMIC_REF_MICBIAS2	2
+#define MADERA_DMIC_REF_MICBIAS3	3
+
+#define CS47L35_DMIC_REF_MICBIAS1B	1
+#define CS47L35_DMIC_REF_MICBIAS2A	2
+#define CS47L35_DMIC_REF_MICBIAS2B	3
+
+#endif
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

PATCH 2/5 ASoC: madera: Add common support for Cirrus Logic Madera codecs

From: Richard Fitzgerald <[email protected]>

The Cirrus Logic Madera codecs are a family of related codecs with extensive digital and analogue I/O, digital mixing and routing, signal processing and programmable DSPs. This patch adds common support code shared by all Madera codecs.

This patch also adds the pdata to the parent mfd pdata struct. Since there is a circular build dependency it's convenient to patch them both atomically.

---
 MAINTAINERS                      |    4 +
 include/linux/mfd/madera/pdata.h |    4 +
 include/sound/madera-pdata.h     |   63 +
 sound/soc/codecs/Kconfig         |    5 +
 sound/soc/codecs/Makefile        |    2 +
 sound/soc/codecs/madera.c        | 4466 ++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/madera.h        |  445 ++++
 7 files changed, 4989 insertions(+)
 create mode 100644 include/sound/madera-pdata.h
 create mode 100644 sound/soc/codecs/madera.c
 create mode 100644 sound/soc/codecs/madera.h
MAINTAINERS +4 -0
index 642cb5610dd50..793dbe7e57897 100644
@@ -3915,14 +3915,18 @@ W:	https://github.com/CirrusLogic/linux-drivers/wiki
 S:	Supported
 F:	Documentation/devicetree/bindings/mfd/madera.txt
 F:	Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt
+F:	Documentation/devicetree/bindings/sound/madera.txt
 F:	include/dt-bindings/sound/madera*
 F:	include/linux/irqchip/irq-madera*
 F:	include/linux/mfd/madera/*
+F:	include/sound/madera*
 F:	drivers/gpio/gpio-madera*
 F:	drivers/irqchip/irq-madera*
 F:	drivers/mfd/madera*
 F:	drivers/mfd/cs47l*
 F:	drivers/pinctrl/cirrus/*
+F:	sound/soc/codecs/cs47l*
+F:	sound/soc/codecs/madera*
 
 CLANG-FORMAT FILE
 M:	Miguel Ojeda <[email protected]>
include/linux/mfd/madera/pdata.h +4 -0
index 8dc852402dbb1..60cd8ec985637 100644
@@ -16,6 +16,7 @@
 #include <linux/regulator/arizona-ldo1.h>
 #include <linux/regulator/arizona-micsupp.h>
 #include <linux/regulator/machine.h>
+#include <sound/madera-pdata.h>
 
 #define MADERA_MAX_MICBIAS		4
 #define MADERA_MAX_CHILD_MICBIAS	4
@@ -39,6 +40,7 @@ struct madera_codec_pdata;
  * @gpsw:	    General purpose switch mode setting. Depends on the external
  *		    hardware connected to the switch. (See the SW1_MODE field
  *		    in the datasheet for the available values for your codec)
+ * @codec:	    Substruct of pdata for the ASoC codec driver
  */
 struct madera_pdata {
 	struct gpio_desc *reset;
@@ -53,6 +55,8 @@ struct madera_pdata {
 	int n_gpio_configs;
 
 	u32 gpsw[MADERA_MAX_GPSW];
+
+	struct madera_codec_pdata codec;
 };
 
 #endif
include/sound/madera-pdata.h new file +63 -0

63 lines not on this page · raw message

sound/soc/codecs/Kconfig +5 -0
index 8f577258080bd..fbfceec0e1998 100644
@@ -282,10 +282,12 @@ config SND_SOC_WM_HUBS
 config SND_SOC_WM_ADSP
 	tristate
 	select SND_SOC_COMPRESS
+	default y if SND_SOC_MADERA=y
 	default y if SND_SOC_CS47L24=y
 	default y if SND_SOC_WM5102=y
 	default y if SND_SOC_WM5110=y
 	default y if SND_SOC_WM2200=y
+	default m if SND_SOC_MADERA=m
 	default m if SND_SOC_CS47L24=m
 	default m if SND_SOC_WM5102=m
 	default m if SND_SOC_WM5110=m
@@ -696,6 +698,9 @@ config SND_SOC_LOCHNAGAR_SC
 	  This driver support the sound card functionality of the Cirrus
 	  Logic Lochnagar audio development board.
 
+config SND_SOC_MADERA
+	tristate
+
 config SND_SOC_MAX98088
 	tristate "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index aa7720a7a0aa2..442c580bf1d4d 100644
@@ -92,6 +92,7 @@ snd-soc-l3-objs := l3.o
 snd-soc-lm4857-objs := lm4857.o
 snd-soc-lm49453-objs := lm49453.o
 snd-soc-lochnagar-sc-objs := lochnagar-sc.o
+snd-soc-madera-objs := madera.o
 snd-soc-max9759-objs := max9759.o
 snd-soc-max9768-objs := max9768.o
 snd-soc-max98088-objs := max98088.o
@@ -366,6 +367,7 @@ obj-$(CONFIG_SND_SOC_L3)	+= snd-soc-l3.o
 obj-$(CONFIG_SND_SOC_LM4857)	+= snd-soc-lm4857.o
 obj-$(CONFIG_SND_SOC_LM49453)   += snd-soc-lm49453.o
 obj-$(CONFIG_SND_SOC_LOCHNAGAR_SC)	+= snd-soc-lochnagar-sc.o
+obj-$(CONFIG_SND_SOC_MADERA)	+= snd-soc-madera.o
 obj-$(CONFIG_SND_SOC_MAX9759)	+= snd-soc-max9759.o
 obj-$(CONFIG_SND_SOC_MAX9768)	+= snd-soc-max9768.o
 obj-$(CONFIG_SND_SOC_MAX98088)	+= snd-soc-max98088.o
sound/soc/codecs/madera.c new file +4466 -0

2,862 lines not on this page · raw message

sound/soc/codecs/madera.h new file +445 -0

445 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.11.0

Part of the diff is not shown here. View the raw message.

author maintainer
#8 lore raw

PATCH 3/5 ASoC: cs47l35: Add codec driver for Cirrus Logic CS47L35

In reply to Charles Keepax

From: Richard Fitzgerald <[email protected]>

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

---
 sound/soc/codecs/Kconfig   |    6 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cs47l35.c | 1748 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1756 insertions(+)
 create mode 100644 sound/soc/codecs/cs47l35.c
sound/soc/codecs/Kconfig +6 -0
index fbfceec0e1998..ce5d1efb6e7d0 100644
@@ -70,6 +70,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_CS47L35 if MFD_CS47L35
 	select SND_SOC_CS53L30 if I2C
 	select SND_SOC_CX20442 if TTY
 	select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -577,6 +578,9 @@ config SND_SOC_CS4349
 config SND_SOC_CS47L24
 	tristate
 
+config SND_SOC_CS47L35
+	tristate
+
 # Cirrus Logic Quad-Channel ADC
 config SND_SOC_CS53L30
 	tristate "Cirrus Logic CS53L30 CODEC"
@@ -700,6 +704,8 @@ config SND_SOC_LOCHNAGAR_SC
 
 config SND_SOC_MADERA
 	tristate
+	default y if SND_SOC_CS47L35=y
+	default m if SND_SOC_CS47L35=m
 
 config SND_SOC_MAX98088
 	tristate "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
sound/soc/codecs/Makefile +2 -0
index 442c580bf1d4d..1092ac195d04a 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-cs47l35-objs := cs47l35.o
 snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
@@ -340,6 +341,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_CS47L35)	+= snd-soc-cs47l35.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
sound/soc/codecs/cs47l35.c new file +1748 -0

1,748 lines not on this page · raw message

Signature · 1 line
2.11.0
author maintainer
#9 lore raw

PATCH 4/5 ASoC: cs47l85: Add codec driver for Cirrus Logic CS47L85

In reply to Charles Keepax

From: Richard Fitzgerald <[email protected]>

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

---
 sound/soc/codecs/Kconfig   |    6 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cs47l85.c | 2686 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 2694 insertions(+)
 create mode 100644 sound/soc/codecs/cs47l85.c
sound/soc/codecs/Kconfig +6 -0
index ce5d1efb6e7d0..40804e844069c 100644
@@ -71,6 +71,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
@@ -581,6 +582,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"
@@ -705,7 +709,9 @@ config SND_SOC_LOCHNAGAR_SC
 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 "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
sound/soc/codecs/Makefile +2 -0
index 1092ac195d04a..109b565855f5b 100644
@@ -66,6 +66,7 @@ snd-soc-cs4341-objs := cs4341.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
@@ -342,6 +343,7 @@ 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_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
sound/soc/codecs/cs47l85.c new file +2686 -0

2,686 lines not on this page · raw message

Signature · 1 line
2.11.0
author maintainer
#10 lore raw

PATCH 5/5 ASoC: cs47l90: Add codec driver for Cirrus Logic CS47L90

In reply to Charles Keepax

From: Richard Fitzgerald <[email protected]>

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

---
 sound/soc/codecs/Kconfig   |    6 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/cs47l90.c | 2624 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 2632 insertions(+)
 create mode 100644 sound/soc/codecs/cs47l90.c
sound/soc/codecs/Kconfig +6 -0
index 40804e844069c..15e17c850b98a 100644
@@ -72,6 +72,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_CS47L24 if MFD_CS47L24
 	select SND_SOC_CS47L35 if MFD_CS47L35
 	select SND_SOC_CS47L85 if MFD_CS47L85
+	select SND_SOC_CS47L90 if MFD_CS47L90
 	select SND_SOC_CS53L30 if I2C
 	select SND_SOC_CX20442 if TTY
 	select SND_SOC_DA7210 if SND_SOC_I2C_AND_SPI
@@ -585,6 +586,9 @@ config SND_SOC_CS47L35
 config SND_SOC_CS47L85
 	tristate
 
+config SND_SOC_CS47L90
+	tristate
+
 # Cirrus Logic Quad-Channel ADC
 config SND_SOC_CS53L30
 	tristate "Cirrus Logic CS53L30 CODEC"
@@ -710,8 +714,10 @@ config SND_SOC_MADERA
 	tristate
 	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_CS47L35=m
 	default m if SND_SOC_CS47L85=m
+	default m if SND_SOC_CS47L90=m
 
 config SND_SOC_MAX98088
 	tristate "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
sound/soc/codecs/Makefile +2 -0
index 109b565855f5b..b1b12ec3cd120 100644
@@ -67,6 +67,7 @@ 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-cs47l90-objs := cs47l90.o
 snd-soc-cs53l30-objs := cs53l30.o
 snd-soc-cx20442-objs := cx20442.o
 snd-soc-da7210-objs := da7210.o
@@ -344,6 +345,7 @@ 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_CS47L90)	+= snd-soc-cs47l90.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
sound/soc/codecs/cs47l90.c new file +2624 -0

2,624 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer
#2 lore raw

Re: [PATCH 2/5] ASoC: madera: Add common support for Cirrus Logic Madera codecs

In reply to Charles Keepax

sound/soc/codecs/madera.c line 177

Quoted 10 lines · Charles Keepax
sound/soc/codecs/madera.c new file +10 -0
+	/*
+	 * Just read a register a few times to ensure the internal
+	 * oscillator sends out a few clocks.
+	 */
+	for (i = 0; i < 4; i++) {
+		ret = regmap_read(madera->regmap, MADERA_SOFTWARE_RESET, &val);
+		if (ret)
+			dev_err(madera->dev,
+				"%s Failed to read register: %d (%d)\n",
+				__func__, ret, i);

Why use %s to format the __func__ rather than just concatenate?

sound/soc/codecs/madera.c line 180

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+	}
+
+	udelay(300);

So we read the register a few times then add a few hundred us of delay after? Surely that delay is going to be negligable compared to the time spent on I/O?

sound/soc/codecs/madera.c line 193

Quoted 11 lines
sound/soc/codecs/madera.c new file +11 -0
+int madera_sysclk_ev(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+	struct madera_priv *priv = snd_soc_component_get_drvdata(component);
+
+	madera_spin_sysclk(priv);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(madera_sysclk_ev);

This will delay both before and after every power up and power down. Are you sure that makes sense?

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+
+	ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
+	if (ret)
+		shutdown = true; /* for safety attempt to shutdown on error */
+
+	if (shutdown) {
+		dev_crit(madera->dev, "Thermal shutdown\n");
+		ret = regmap_update_bits(madera->regmap,
+					 MADERA_OUTPUT_ENABLES_1,
+					 MADERA_OUT4L_ENA |

sound/soc/codecs/madera.c line 276

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+					 MADERA_OUT4R_ENA, 0);
+		if (ret != 0)
+			dev_crit(madera->dev,
+				 "Failed to disable speaker outputs: %d\n",
+				 ret);
+	} else if (warn) {
+		dev_crit(madera->dev, "Thermal warning\n");
+	}
+
+	return IRQ_HANDLED;

We will flag the interrupt as handled if there was neither a warning nor a critical overheat? I'd expect some warning about a spurious interrupt at least.

Quoted 22 lines
sound/soc/codecs/madera.c new file +22 -0
+static int madera_get_variable_u32_array(struct madera_priv *priv,
+					 const char *propname,
+					 u32 *dest,
+					 int n_max,
+					 int multiple)
+{
+	struct madera *madera = priv->madera;
+	int n, ret;
+
+	n = device_property_read_u32_array(madera->dev, propname, NULL, 0);
+	if (n == -EINVAL) {
+		return 0;	/* missing, ignore */
+	} else if (n < 0) {
+		dev_warn(madera->dev, "%s malformed (%d)\n",
+			 propname, n);
+		return n;
+	} else if ((n % multiple) != 0) {
+		dev_warn(madera->dev, "%s not a multiple of %d entries\n",
+			 propname, multiple);
+		return -EINVAL;
+	}
+

sound/soc/codecs/madera.c line 344

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+	if (n > n_max)
+		n = n_max;
+
+	ret = device_property_read_u32_array(madera->dev, propname, dest, n);
+
+	if (ret < 0)
+		return ret;
+	else
+		return n;
+}

This feels like it should perhaps be a generic OF helper function - there's nothing driver specific I'm seeing here and arrays that need to be a multiple of N entries aren't that uncommon I think.

sound/soc/codecs/madera.c line 922

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+	mutex_lock(&priv->rate_lock);
+	cached_rate = priv->adsp_rate_cache[adsp_num];
+	mutex_unlock(&priv->rate_lock);

What's this lock protecting? The value can we read can change as soon as the lock is released and we're just reading a single word here rather than traversing a data structure that might change under us or something.

sound/soc/codecs/madera.c line 1349

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+void madera_destroy_bus_error_irq(struct madera_priv *priv, int dsp_num)
+{
+	struct madera *madera = priv->madera;
+
+	madera_free_irq(madera,
+			madera_dsp_bus_error_irqs[dsp_num],
+			&priv->adsp[dsp_num]);
+}
+EXPORT_SYMBOL_GPL(madera_destroy_bus_error_irq);

We use free rather than destroy normally?

sound/soc/codecs/madera.c line 1686

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+static const char * const madera_dfc_width_text[MADERA_DFC_WIDTH_ENUM_SIZE] = {
+	"8bit", "16bit", "20bit", "24bit", "32bit",
+};

Spaces might make these more readable.

sound/soc/codecs/madera.c line 2365

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+static void madera_sleep(unsigned int delay)
+{
+	if (delay < 20) {
+		delay *= 1000;
+		usleep_range(delay, delay + 500);
+	} else {
+		msleep(delay);
+	}
+}

This feels like it might make sense as a helper function as well - I could've sworn there was one already but I can't immediately find it.

#3 lore raw

Re: [PATCH 2/5] ASoC: madera: Add common support for Cirrus Logic Madera codecs

Quoted 14 lines · Mark Brown

sound/soc/codecs/madera.c line 177

Quoted 10 lines · Charles Keepax
sound/soc/codecs/madera.c new file +10 -0
+	/*
+	 * Just read a register a few times to ensure the internal
+	 * oscillator sends out a few clocks.
+	 */
+	for (i = 0; i < 4; i++) {
+		ret = regmap_read(madera->regmap, MADERA_SOFTWARE_RESET, &val);
+		if (ret)
+			dev_err(madera->dev,
+				"%s Failed to read register: %d (%d)\n",
+				__func__, ret, i);

Why use %s to format the __func__ rather than just concatenate?

GCC docs say that it's a magic variable so cannot be concatenated with string literals. Though I never tried concatenation to see if it works.

Quoted 8 lines

sound/soc/codecs/madera.c line 180

Quoted 4 lines
sound/soc/codecs/madera.c new file +3 -0
+	}
+
+	udelay(300);

So we read the register a few times then add a few hundred us of delay after? Surely that delay is going to be negligable compared to the time spent on I/O?

The register reads are to create clock cycles in the silicon, not to generate delay.

Quoted 16 lines

sound/soc/codecs/madera.c line 193

Quoted 12 lines
sound/soc/codecs/madera.c new file +11 -0
+int madera_sysclk_ev(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+	struct madera_priv *priv = snd_soc_component_get_drvdata(component);
+
+	madera_spin_sysclk(priv);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(madera_sysclk_ev);

This will delay both before and after every power up and power down. Are you sure that makes sense?

I think that's correct but we can re-check with hardware people. It's not just a delay, it needs to ensure there are always a certain number of SYSCLK cycles in the hardware to avoid leaving certain state machines in limbo.

Quoted 102 lines
Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+
+	ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
+	if (ret)
+		shutdown = true; /* for safety attempt to shutdown on error */
+
+	if (shutdown) {
+		dev_crit(madera->dev, "Thermal shutdown\n");
+		ret = regmap_update_bits(madera->regmap,
+					 MADERA_OUTPUT_ENABLES_1,
+					 MADERA_OUT4L_ENA |

sound/soc/codecs/madera.c line 276

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+					 MADERA_OUT4R_ENA, 0);
+		if (ret != 0)
+			dev_crit(madera->dev,
+				 "Failed to disable speaker outputs: %d\n",
+				 ret);
+	} else if (warn) {
+		dev_crit(madera->dev, "Thermal warning\n");
+	}
+
+	return IRQ_HANDLED;

We will flag the interrupt as handled if there was neither a warning nor a critical overheat? I'd expect some warning about a spurious interrupt at least.

Quoted 22 lines
sound/soc/codecs/madera.c new file +22 -0
+static int madera_get_variable_u32_array(struct madera_priv *priv,
+					 const char *propname,
+					 u32 *dest,
+					 int n_max,
+					 int multiple)
+{
+	struct madera *madera = priv->madera;
+	int n, ret;
+
+	n = device_property_read_u32_array(madera->dev, propname, NULL, 0);
+	if (n == -EINVAL) {
+		return 0;	/* missing, ignore */
+	} else if (n < 0) {
+		dev_warn(madera->dev, "%s malformed (%d)\n",
+			 propname, n);
+		return n;
+	} else if ((n % multiple) != 0) {
+		dev_warn(madera->dev, "%s not a multiple of %d entries\n",
+			 propname, multiple);
+		return -EINVAL;
+	}
+

sound/soc/codecs/madera.c line 344

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+	if (n > n_max)
+		n = n_max;
+
+	ret = device_property_read_u32_array(madera->dev, propname, dest, n);
+
+	if (ret < 0)
+		return ret;
+	else
+		return n;
+}

This feels like it should perhaps be a generic OF helper function - there's nothing driver specific I'm seeing here and arrays that need to be a multiple of N entries aren't that uncommon I think.

sound/soc/codecs/madera.c line 922

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+	mutex_lock(&priv->rate_lock);
+	cached_rate = priv->adsp_rate_cache[adsp_num];
+	mutex_unlock(&priv->rate_lock);

What's this lock protecting? The value can we read can change as soon as the lock is released and we're just reading a single word here rather than traversing a data structure that might change under us or something.

sound/soc/codecs/madera.c line 1349

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+void madera_destroy_bus_error_irq(struct madera_priv *priv, int dsp_num)
+{
+	struct madera *madera = priv->madera;
+
+	madera_free_irq(madera,
+			madera_dsp_bus_error_irqs[dsp_num],
+			&priv->adsp[dsp_num]);
+}
+EXPORT_SYMBOL_GPL(madera_destroy_bus_error_irq);

We use free rather than destroy normally?

sound/soc/codecs/madera.c line 1686

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+static const char * const madera_dfc_width_text[MADERA_DFC_WIDTH_ENUM_SIZE] = {
+	"8bit", "16bit", "20bit", "24bit", "32bit",
+};

Spaces might make these more readable.

sound/soc/codecs/madera.c line 2365

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+static void madera_sleep(unsigned int delay)
+{
+	if (delay < 20) {
+		delay *= 1000;
+		usleep_range(delay, delay + 500);
+	} else {
+		msleep(delay);
+	}
+}

This feels like it might make sense as a helper function as well - I could've sworn there was one already but I can't immediately find it.

#4 lore raw

Re: [PATCH 2/5] ASoC: madera: Add common support for Cirrus Logic Madera codecs

Quoted 24 lines · Richard Fitzgerald
Quoted 13 lines · Mark Brown
Quoted 10 lines · Charles Keepax

+    /*
+     * Just read a register a few times to ensure the internal +     * oscillator sends out a few clocks.
+     */
+    for (i = 0; i < 4; i++) {
+        ret = regmap_read(madera->regmap, MADERA_SOFTWARE_RESET, &val); +        if (ret)
+            dev_err(madera->dev,
+                "%s Failed to read register: %d (%d)\n",
+                __func__, ret, i);

Quoted 1 line

Why use %s to format the __func__ rather than just concatenate?

GCC docs say that it's a magic variable so cannot be concatenated with string literals. Though I never tried concatenation to see if it works.

Quoted 5 lines
Quoted 4 lines

+    }
+
+    udelay(300);

Quoted 6 lines
Quoted 3 lines

So we read the register a few times then add a few hundred us of delay after?  Surely that delay is going to be negligable compared to the time spent on I/O?

The register reads are to create clock cycles in the silicon, not to generate delay.

Sorry, just re-read your comment and realized I'd misread it. It's a hardware requirement that after generating the internal clocks there must be a delay. I.e. we require a combination of a guaranteed number of SYSCLKs followed by a guaranteed minimum delay.

Quoted 124 lines
Quoted 16 lines

sound/soc/codecs/madera.c line 193

Quoted 12 lines
sound/soc/codecs/madera.c new file +11 -0
+int madera_sysclk_ev(struct snd_soc_dapm_widget *w,
+             struct snd_kcontrol *kcontrol, int event)
+{
+    struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+    struct madera_priv *priv = snd_soc_component_get_drvdata(component);
+
+    madera_spin_sysclk(priv);
+
+    return 0;
+}
+EXPORT_SYMBOL_GPL(madera_sysclk_ev);

This will delay both before and after every power up and power down. Are you sure that makes sense?

I think that's correct but we can re-check with hardware people. It's not just a delay, it needs to ensure there are always a certain number of SYSCLK cycles in the hardware to avoid leaving certain state machines in limbo.

Quoted 102 lines
Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+
+    ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
+    if (ret)
+        shutdown = true; /* for safety attempt to shutdown on error */
+
+    if (shutdown) {
+        dev_crit(madera->dev, "Thermal shutdown\n");
+        ret = regmap_update_bits(madera->regmap,
+                     MADERA_OUTPUT_ENABLES_1,
+                     MADERA_OUT4L_ENA |

sound/soc/codecs/madera.c line 276

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+                     MADERA_OUT4R_ENA, 0);
+        if (ret != 0)
+            dev_crit(madera->dev,
+                 "Failed to disable speaker outputs: %d\n",
+                 ret);
+    } else if (warn) {
+        dev_crit(madera->dev, "Thermal warning\n");
+    }
+
+    return IRQ_HANDLED;

We will flag the interrupt as handled if there was neither a warning nor a critical overheat?  I'd expect some warning about a spurious interrupt at least.

Quoted 22 lines
sound/soc/codecs/madera.c new file +22 -0
+static int madera_get_variable_u32_array(struct madera_priv *priv,
+                     const char *propname,
+                     u32 *dest,
+                     int n_max,
+                     int multiple)
+{
+    struct madera *madera = priv->madera;
+    int n, ret;
+
+    n = device_property_read_u32_array(madera->dev, propname, NULL, 0);
+    if (n == -EINVAL) {
+        return 0;    /* missing, ignore */
+    } else if (n < 0) {
+        dev_warn(madera->dev, "%s malformed (%d)\n",
+             propname, n);
+        return n;
+    } else if ((n % multiple) != 0) {
+        dev_warn(madera->dev, "%s not a multiple of %d entries\n",
+             propname, multiple);
+        return -EINVAL;
+    }
+

sound/soc/codecs/madera.c line 344

Quoted 10 lines
sound/soc/codecs/madera.c new file +10 -0
+    if (n > n_max)
+        n = n_max;
+
+    ret = device_property_read_u32_array(madera->dev, propname, dest, n);
+
+    if (ret < 0)
+        return ret;
+    else
+        return n;
+}

This feels like it should perhaps be a generic OF helper function - there's nothing driver specific I'm seeing here and arrays that need to be a multiple of N entries aren't that uncommon I think.

Quoted 3 lines

+    mutex_lock(&priv->rate_lock);
+    cached_rate = priv->adsp_rate_cache[adsp_num]; +    mutex_unlock(&priv->rate_lock);

What's this lock protecting?  The value can we read can change as soon as the lock is released and we're just reading a single word here rather than traversing a data structure that might change under us or something.

sound/soc/codecs/madera.c line 1349

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+void madera_destroy_bus_error_irq(struct madera_priv *priv, int dsp_num)
+{
+    struct madera *madera = priv->madera;
+
+    madera_free_irq(madera,
+            madera_dsp_bus_error_irqs[dsp_num],
+            &priv->adsp[dsp_num]);
+}
+EXPORT_SYMBOL_GPL(madera_destroy_bus_error_irq);

We use free rather than destroy normally?

sound/soc/codecs/madera.c line 1686

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+static const char * const madera_dfc_width_text[MADERA_DFC_WIDTH_ENUM_SIZE] = {
+    "8bit", "16bit", "20bit", "24bit", "32bit",
+};

Spaces might make these more readable.

sound/soc/codecs/madera.c line 2365

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+static void madera_sleep(unsigned int delay)
+{
+    if (delay < 20) {
+        delay *= 1000;
+        usleep_range(delay, delay + 500);
+    } else {
+        msleep(delay);
+    }
+}

This feels like it might make sense as a helper function as well - I could've sworn there was one already but I can't immediately find it.

author maintainer
#7 lore raw

Re: [PATCH 2/5] ASoC: madera: Add common support for Cirrus Logic Madera codecs

In reply to Mark Brown
Quoted 15 lines · Mark Brown

sound/soc/codecs/madera.c line 177

Quoted 10 lines · Charles Keepax
sound/soc/codecs/madera.c new file +10 -0
+	/*
+	 * Just read a register a few times to ensure the internal
+	 * oscillator sends out a few clocks.
+	 */
+	for (i = 0; i < 4; i++) {
+		ret = regmap_read(madera->regmap, MADERA_SOFTWARE_RESET, &val);
+		if (ret)
+			dev_err(madera->dev,
+				"%s Failed to read register: %d (%d)\n",
+				__func__, ret, i);

Why use %s to format the __func__ rather than just concatenate?

Really the error message is quite out of character in general, we don't normally print the func and it doesn't really say what failed. I will refactor it.

Quoted 8 lines

sound/soc/codecs/madera.c line 180

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+	}
+
+	udelay(300);

So we read the register a few times then add a few hundred us of delay after? Surely that delay is going to be negligable compared to the time spent on I/O?

This is one of those technically situations. We have to do the reads and we have to have at least 300uS after those. Normally there will be enough slack in the system but better to guarantee it. Maybe a comment?

Quoted 6 lines
Quoted 6 lines
sound/soc/codecs/madera.c new file +6 -0
+int madera_sysclk_ev(struct snd_soc_dapm_widget *w,
+		     struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+	struct madera_priv *priv = snd_soc_component_get_drvdata(component);
+
Quoted 9 lines

sound/soc/codecs/madera.c line 193

Quoted 5 lines
sound/soc/codecs/madera.c new file +5 -0
+	madera_spin_sysclk(priv);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(madera_sysclk_ev);

This will delay both before and after every power up and power down. Are you sure that makes sense?

Regrettably yes, or well at least I am sure that despite a lot of complaining this is what the hardware guys insisted needed done.

Quoted 16 lines
Quoted 16 lines
sound/soc/codecs/madera.c new file +16 -0
+
+	ret = madera_check_speaker_overheat(madera, &warn, &shutdown);
+	if (ret)
+		shutdown = true; /* for safety attempt to shutdown on error */
+
+	if (shutdown) {
+		dev_crit(madera->dev, "Thermal shutdown\n");
+		ret = regmap_update_bits(madera->regmap,
+					 MADERA_OUTPUT_ENABLES_1,
+					 MADERA_OUT4L_ENA |
+					 MADERA_OUT4R_ENA, 0);
+		if (ret != 0)
+			dev_crit(madera->dev,
+				 "Failed to disable speaker outputs: %d\n",
+				 ret);
+	} else if (warn) {
Quoted 9 lines

sound/soc/codecs/madera.c line 276

Quoted 4 lines
sound/soc/codecs/madera.c new file +4 -0
+		dev_crit(madera->dev, "Thermal warning\n");
+	}
+
+	return IRQ_HANDLED;

We will flag the interrupt as handled if there was neither a warning nor a critical overheat? I'd expect some warning about a spurious interrupt at least.

Yeah I will update that one.

Quoted 28 lines
Quoted 28 lines
sound/soc/codecs/madera.c new file +28 -0
+static int madera_get_variable_u32_array(struct madera_priv *priv,
+					 const char *propname,
+					 u32 *dest,
+					 int n_max,
+					 int multiple)
+{
+	struct madera *madera = priv->madera;
+	int n, ret;
+
+	n = device_property_read_u32_array(madera->dev, propname, NULL, 0);
+	if (n == -EINVAL) {
+		return 0;	/* missing, ignore */
+	} else if (n < 0) {
+		dev_warn(madera->dev, "%s malformed (%d)\n",
+			 propname, n);
+		return n;
+	} else if ((n % multiple) != 0) {
+		dev_warn(madera->dev, "%s not a multiple of %d entries\n",
+			 propname, multiple);
+		return -EINVAL;
+	}
+
+	if (n > n_max)
+		n = n_max;
+
+	ret = device_property_read_u32_array(madera->dev, propname, dest, n);
+
+	if (ret < 0)
Quoted 9 lines

sound/soc/codecs/madera.c line 344

Quoted 4 lines
sound/soc/codecs/madera.c new file +4 -0
+		return ret;
+	else
+		return n;
+}

This feels like it should perhaps be a generic OF helper function - there's nothing driver specific I'm seeing here and arrays that need to be a multiple of N entries aren't that uncommon I think.

I will have a look and see if we might do a generic helper function for this one.

Quoted 9 lines

sound/soc/codecs/madera.c line 922

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+	mutex_lock(&priv->rate_lock);
+	cached_rate = priv->adsp_rate_cache[adsp_num];
+	mutex_unlock(&priv->rate_lock);

What's this lock protecting? The value can we read can change as soon as the lock is released and we're just reading a single word here rather than traversing a data structure that might change under us or something.

Overall the lock protects anything that changes a rate on the chip, since we have to do that weird spin_sysclk thing before/after anything that does that.

It might normally be safe without the lock here I guess, since you are only really protecting against the reads of adsp_rate_cache. But suppose that might depend on the architecture if the read/writes arn't effectively atomic (although that is probably unlikely on most modern architectures).

Quoted 12 lines

sound/soc/codecs/madera.c line 1349

Quoted 9 lines
sound/soc/codecs/madera.c new file +9 -0
+void madera_destroy_bus_error_irq(struct madera_priv *priv, int dsp_num)
+{
+	struct madera *madera = priv->madera;
+
+	madera_free_irq(madera,
+			madera_dsp_bus_error_irqs[dsp_num],
+			&priv->adsp[dsp_num]);
+}
+EXPORT_SYMBOL_GPL(madera_destroy_bus_error_irq);

We use free rather than destroy normally?

Yup will fix that.

Quoted 6 lines

sound/soc/codecs/madera.c line 1686

Quoted 3 lines
sound/soc/codecs/madera.c new file +3 -0
+static const char * const madera_dfc_width_text[MADERA_DFC_WIDTH_ENUM_SIZE] = {
+	"8bit", "16bit", "20bit", "24bit", "32bit",
+};

Spaces might make these more readable.

No problem to fix that too.

Quoted 4 lines
Quoted 4 lines
sound/soc/codecs/madera.c new file +4 -0
+static void madera_sleep(unsigned int delay)
+{
+	if (delay < 20) {
+		delay *= 1000;
Quoted 8 lines

sound/soc/codecs/madera.c line 2365

Quoted 5 lines
sound/soc/codecs/madera.c new file +5 -0
+		usleep_range(delay, delay + 500);
+	} else {
+		msleep(delay);
+	}
+}

This feels like it might make sense as a helper function as well - I could've sworn there was one already but I can't immediately find it.

I do vaguely remember some discussion that it was preferred that people had to think about which delay function to call, rather than having a generic helper. TBF I could probably just switch it all to use msleep, for the most part this is a quite small optimisation of path bring up (although it was asked for by one of our customers).

Thanks,
Charles

maintainer
#5 lore raw

Re: [PATCH 2/5] ASoC: madera: Add common support for Cirrus Logic Madera codecs

In reply to Richard Fitzgerald
Quoted 2 lines · Richard Fitzgerald
Quoted 1 line · Richard Fitzgerald

On 24/05/19 15:56, Mark Brown wrote:

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to. You've also got some replies inserted at the wrong quote level.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

So we read the register a few times then add a few hundred us of delay after?  Surely that delay is going to be negligable compared to the time spent on I/O?

The register reads are to create clock cycles in the silicon, not to generate delay.

Sorry, just re-read your comment and realized I'd misread it. It's a hardware requirement that after generating the internal clocks there must be a delay. I.e. we require a combination of a guaranteed number of SYSCLKs followed by a guaranteed minimum delay.

OK, the comment could use a bit of clarification then to say that reads are explicitly required as opposed to being purely to generate a delay.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

This will delay both before and after every power up and power down. Are you sure that makes sense?

I think that's correct but we can re-check with hardware people. It's not just a delay, it needs to ensure there are always a certain number of SYSCLK cycles in the hardware to avoid leaving certain state machines in limbo.

That sounds like you might want both _POST_PMU and _POST_PMD but do you really need the _PREs as well?

author maintainer
#6 lore raw

Re: [PATCH 2/5] ASoC: madera: Add common support for Cirrus Logic Madera codecs

Quoted 6 lines · Mark Brown
Quoted 4 lines · Richard Fitzgerald
Quoted 3 lines · Richard Fitzgerald
Quoted 2 lines · Mark Brown

This will delay both before and after every power up and power down. Are you sure that makes sense?

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

I think that's correct but we can re-check with hardware people. It's not just a delay, it needs to ensure there are always a certain number of SYSCLK cycles in the hardware to avoid leaving certain state machines in limbo.

That sounds like you might want both _POST_PMU and _POST_PMD but do you really need the _PREs as well?

Yeah the requirement from the hardware guys was that we needed a guard band between changing the SYSCLK state and other things happening. So it has to happen both before and after the state of SYSCLK changes. It is certainly far from ideal but it is what it is.

Thanks,
Charles