Skip to contentSkip to conversation

ASoC: da7219: Extend CCF support to allow WCLK/BCLK config

PATCH In review Adam Thomson 2 participants 9 messages Mar 19, 2019 – Mar 21, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover ASoC: da7219: Extend CCF support to allow WCLK/BCLK config

This patch set extends the existing CCF support in the DA7219 codec driver by splitting the DAI clock gate into clocks to cover WCLK and BCLK, to enable the configuration of these clocks from audio machine drivers when this codec is the clock master of the DAI.

Adam Thomson (3):
ASoC: da7219: Update DAI clock binding info to cover WCLK/BCLK
ASoC: da7219: Expose BCLK and WCLK control through CCF
ASoC: AMD: Update DA7219 DAI clock name to align with codec updates

 Documentation/devicetree/bindings/sound/da7219.txt |   8 +-
 include/sound/da7219.h                             |   8 +-
 sound/soc/amd/acp-da7219-max98357a.c               |   2 +-
 sound/soc/codecs/da7219.c                          | 523 ++++++++++++++++-----
 sound/soc/codecs/da7219.h                          |   6 +-
 5 files changed, 412 insertions(+), 135 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 ASoC: da7219: Update DAI clock binding info to cover WCLK/BCLK

With the need to expose WCLK and BCLK as separate clocks, the 'clock-cells' and 'clock-output-names' descriptions need to be updated as now the codec is providing 2 clocks. The example is also updated accordingly.

---
 Documentation/devicetree/bindings/sound/da7219.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/sound/da7219.txt +4 -4
index e9d0bae..add1caf 100644
@@ -23,8 +23,8 @@ Optional properties:
   interrupt is to be used to wake system, otherwise "irq" should be used.
 - wakeup-source: Flag to indicate this device can wake system (suspend/resume).
 
-- #clock-cells :  Should be set to '<0>', only one clock source provided;
-- clock-output-names : Name given for DAI clocks output;
+- #clock-cells :  Should be set to '<1>', two clock sources provided;
+- clock-output-names : Names given for DAI clock outputs (WCLK & BCLK);
 
 - clocks : phandle and clock specifier for codec MCLK.
 - clock-names : Clock name string for 'clocks' attribute, should be "mclk".
@@ -84,8 +84,8 @@ Example:
 		VDDMIC-supply = <&reg_audio>;
 		VDDIO-supply = <&reg_audio>;
 
-		#clock-cells = <0>;
-		clock-output-names = "dai-clks";
+		#clock-cells = <1>;
+		clock-output-names = "dai-wclk", "dai-bclk";
 
 		clocks = <&clks 201>;
 		clock-names = "mclk";
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH 1/3] ASoC: da7219: Update DAI clock binding info to cover WCLK/BCLK

Quoted 4 lines · Adam Thomson

-- #clock-cells : Should be set to '<0>', only one clock source provided; -- clock-output-names : Name given for DAI clocks output;

+- #clock-cells :  Should be set to '<1>', two clock sources provided;
+- clock-output-names : Names given for DAI clock outputs (WCLK & BCLK);

This might need some handling later on as it's a binding change, however I can't see any current users so hopefully nobody will notice.

#3 lore raw

RE: [PATCH 1/3] ASoC: da7219: Update DAI clock binding info to cover WCLK/BCLK

Quoted 11 lines · Mark Brown
Quoted 6 lines · Adam Thomson

-- #clock-cells : Should be set to '<0>', only one clock source provided;
-- clock-output-names : Name given for DAI clocks output;

+- #clock-cells :  Should be set to '<1>', two clock sources provided;
+- clock-output-names : Names given for DAI clock outputs (WCLK &

+BCLK);

This might need some handling later on as it's a binding change, however I can't see any current users so hopefully nobody will notice.

No I do not believe there are users of this, other than the AMD board which doesn't use these bindings. Actually given they're the same bindings, albeit with a different number of cells, I've tested the code with just 1 cell and 1 clock in the DTS and this still works as before so the driver should be backwards compatible.

maintainer
#4 lore raw

Applied "ASoC: da7219: Update DAI clock binding info to cover WCLK/BCLK" to the asoc tree

In reply to Adam Thomson

The patch

ASoC: da7219: Update DAI clock binding info to cover WCLK/BCLK

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 41d176d3ec147f499614adc773080f244d47e3cd Mon Sep 17 00:00:00 2001

From: Adam Thomson <[email protected]>
Date: Tue, 19 Mar 2019 17:49:30 +0000
Subject: [PATCH] ASoC: da7219: Update DAI clock binding info to cover
WCLK/BCLK

With the need to expose WCLK and BCLK as separate clocks, the 'clock-cells' and 'clock-output-names' descriptions need to be updated as now the codec is providing 2 clocks. The example is also updated accordingly.

---
 Documentation/devicetree/bindings/sound/da7219.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/sound/da7219.txt +4 -4
index e9d0baeb94e2..add1caf26ac2 100644
@@ -23,8 +23,8 @@ Optional properties:
   interrupt is to be used to wake system, otherwise "irq" should be used.
 - wakeup-source: Flag to indicate this device can wake system (suspend/resume).
 
-- #clock-cells :  Should be set to '<0>', only one clock source provided;
-- clock-output-names : Name given for DAI clocks output;
+- #clock-cells :  Should be set to '<1>', two clock sources provided;
+- clock-output-names : Names given for DAI clock outputs (WCLK & BCLK);
 
 - clocks : phandle and clock specifier for codec MCLK.
 - clock-names : Clock name string for 'clocks' attribute, should be "mclk".
@@ -84,8 +84,8 @@ Example:
 		VDDMIC-supply = <&reg_audio>;
 		VDDIO-supply = <&reg_audio>;
 
-		#clock-cells = <0>;
-		clock-output-names = "dai-clks";
+		#clock-cells = <1>;
+		clock-output-names = "dai-wclk", "dai-bclk";
 
 		clocks = <&clks 201>;
 		clock-names = "mclk";
Signature · 1 line
2.20.1
#5 lore raw

PATCH 2/3 ASoC: da7219: Expose BCLK and WCLK control through CCF

In reply to Adam Thomson

For the purposes of platforms which use the codec as DAI clock master for the CPU and other codec devices, there is the need to not only expose the clock gating of BCLK and WCLK but also the ability to set those rates without going through the ASoC APIs.

To make this possible, the previous CCF implementation in the driver has been extended to separate BCLK and WCLK out. WCLK is the parent clock to BCLK, and is also the clock gate for both. BCLK in HW is a factor/multiplier of WCLK so derives from whatever SR is chosen for WCLK, hence the need to make it a child of WCLK for the purposes of CCF. Enabling/disabling either BCLK or WCLK will result in clocks being ungated/gated accordingly. To simplify matters, these clocks can only be configured if the codec is set as master, otherwise CCF control is disallowed.

---
 include/sound/da7219.h    |   8 +-
 sound/soc/codecs/da7219.c | 523 +++++++++++++++++++++++++++++++++++-----------
 sound/soc/codecs/da7219.h |   6 +-
 3 files changed, 407 insertions(+), 130 deletions(-)
include/sound/da7219.h +7 -1
index 1bfcb16..4a36954 100644
@@ -33,10 +33,16 @@ enum da7219_mic_amp_in_sel {
 
 struct da7219_aad_pdata;
 
+enum da7219_dai_clks {
+	DA7219_DAI_WCLK_IDX = 0,
+	DA7219_DAI_BCLK_IDX,
+	DA7219_DAI_NUM_CLKS,
+};
+
 struct da7219_pdata {
 	bool wakeup_source;
 
-	const char *dai_clks_name;
+	const char *dai_clk_names[DA7219_DAI_NUM_CLKS];
 
 	/* Mic */
 	enum da7219_micbias_voltage micbias_lvl;
sound/soc/codecs/da7219.c +397 -126

668 lines not on this page · raw message

sound/soc/codecs/da7219.h +3 -3
index 018819c..f3b180b 100644
@@ -820,10 +820,10 @@ struct da7219_priv {
 	struct mutex pll_lock;
 
 #ifdef CONFIG_COMMON_CLK
-	struct clk_hw dai_clks_hw;
+	struct clk_hw dai_clks_hw[DA7219_DAI_NUM_CLKS];
 #endif
-	struct clk_lookup *dai_clks_lookup;
-	struct clk *dai_clks;
+	struct clk_lookup *dai_clks_lookup[DA7219_DAI_NUM_CLKS];
+	struct clk *dai_clks[DA7219_DAI_NUM_CLKS];
 
 	struct clk *mclk;
 	unsigned int mclk_rate;
Signature · 1 line
1.9.1
maintainer
#6 lore raw

Applied "ASoC: da7219: Expose BCLK and WCLK control through CCF" to the asoc tree

The patch

ASoC: da7219: Expose BCLK and WCLK control through CCF

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From d90ba6c8b53e541913a181638c353cf7a0856256 Mon Sep 17 00:00:00 2001

From: Adam Thomson <[email protected]>
Date: Tue, 19 Mar 2019 17:49:31 +0000
Subject: [PATCH] ASoC: da7219: Expose BCLK and WCLK control through CCF

For the purposes of platforms which use the codec as DAI clock master for the CPU and other codec devices, there is the need to not only expose the clock gating of BCLK and WCLK but also the ability to set those rates without going through the ASoC APIs.

To make this possible, the previous CCF implementation in the driver has been extended to separate BCLK and WCLK out. WCLK is the parent clock to BCLK, and is also the clock gate for both. BCLK in HW is a factor/multiplier of WCLK so derives from whatever SR is chosen for WCLK, hence the need to make it a child of WCLK for the purposes of CCF. Enabling/disabling either BCLK or WCLK will result in clocks being ungated/gated accordingly. To simplify matters, these clocks can only be configured if the codec is set as master, otherwise CCF control is disallowed.

---
 include/sound/da7219.h    |   8 +-
 sound/soc/codecs/da7219.c | 523 +++++++++++++++++++++++++++++---------
 sound/soc/codecs/da7219.h |   6 +-
 3 files changed, 407 insertions(+), 130 deletions(-)
include/sound/da7219.h +7 -1
index 1bfcb16f2d10..4a36954c86c5 100644
@@ -33,10 +33,16 @@ enum da7219_mic_amp_in_sel {
 
 struct da7219_aad_pdata;
 
+enum da7219_dai_clks {
+	DA7219_DAI_WCLK_IDX = 0,
+	DA7219_DAI_BCLK_IDX,
+	DA7219_DAI_NUM_CLKS,
+};
+
 struct da7219_pdata {
 	bool wakeup_source;
 
-	const char *dai_clks_name;
+	const char *dai_clk_names[DA7219_DAI_NUM_CLKS];
 
 	/* Mic */
 	enum da7219_micbias_voltage micbias_lvl;
sound/soc/codecs/da7219.c +397 -126

668 lines not on this page · raw message

sound/soc/codecs/da7219.h +3 -3
index 018819c631fb..f3b180bc986f 100644
@@ -820,10 +820,10 @@ struct da7219_priv {
 	struct mutex pll_lock;
 
 #ifdef CONFIG_COMMON_CLK
-	struct clk_hw dai_clks_hw;
+	struct clk_hw dai_clks_hw[DA7219_DAI_NUM_CLKS];
 #endif
-	struct clk_lookup *dai_clks_lookup;
-	struct clk *dai_clks;
+	struct clk_lookup *dai_clks_lookup[DA7219_DAI_NUM_CLKS];
+	struct clk *dai_clks[DA7219_DAI_NUM_CLKS];
 
 	struct clk *mclk;
 	unsigned int mclk_rate;
Signature · 1 line
2.20.1
#7 lore raw

PATCH 3/3 ASoC: AMD: Update DA7219 DAI clock name to align with codec updates

In reply to Adam Thomson

As the DAI clocks for DA7219 have now been split into BCLK and WCLK, the clock lookup name needs to be udpated here to select BCLK to achieve the same functionality as before with regards to DAI clock gating.

---
 sound/soc/amd/acp-da7219-max98357a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp-da7219-max98357a.c +1 -1
index a5daad9..f37a588 100644
@@ -72,7 +72,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
-	da7219_dai_clk = clk_get(component->dev, "da7219-dai-clks");
+	da7219_dai_clk = clk_get(component->dev, "da7219-dai-bclk");
 
 	ret = snd_soc_card_jack_new(card, "Headset Jack",
 				SND_JACK_HEADSET | SND_JACK_LINEOUT |
Signature · 1 line
1.9.1
maintainer
#8 lore raw

Applied "ASoC: AMD: Update DA7219 DAI clock name to align with codec updates" to the asoc tree

The patch

ASoC: AMD: Update DA7219 DAI clock name to align with codec updates

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 883149027a989dc121ad277785a4b4a901b7fd31 Mon Sep 17 00:00:00 2001

From: Adam Thomson <[email protected]>
Date: Tue, 19 Mar 2019 17:49:32 +0000
Subject: [PATCH] ASoC: AMD: Update DA7219 DAI clock name to align with codec
updates

As the DAI clocks for DA7219 have now been split into BCLK and WCLK, the clock lookup name needs to be udpated here to select BCLK to achieve the same functionality as before with regards to DAI clock gating.

---
 sound/soc/amd/acp-da7219-max98357a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp-da7219-max98357a.c +1 -1
index a5daad973ce5..f37a588ba345 100644
@@ -72,7 +72,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
-	da7219_dai_clk = clk_get(component->dev, "da7219-dai-clks");
+	da7219_dai_clk = clk_get(component->dev, "da7219-dai-bclk");
 
 	ret = snd_soc_card_jack_new(card, "Headset Jack",
 				SND_JACK_HEADSET | SND_JACK_LINEOUT |
Signature · 1 line
2.20.1