linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] ASoC: sun8i-codec driver cleanup
@ 2020-08-31  3:48 Samuel Holland
  2020-08-31  3:48 ` [PATCH 1/9] ASoC: sun8i-codec: Remove extraneous widgets Samuel Holland
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

Now that the fixes series is merged, here is a series of small cleanups
to the sun8i-codec driver. These help shorten the patch stack for the
next series, which will add support for the other two DAIs in this
codec: AIF2 and AIF3.

Samuel Holland (9):
  ASoC: sun8i-codec: Remove extraneous widgets
  ASoC: sun8i-codec: Fix AIF1 MODCLK widget name
  ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names
  ASoC: sun8i-codec: Fix AIF1_MXR_SRC field names
  ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name
  ASoC: sun8i-codec: Fix field bit number indentation
  ASoC: sun8i-codec: Sort masks in a consistent order
  ASoC: sun8i-codec: Attach the bus clock to the regmap
  ASoC: sun8i-codec: Manage module clock via DAPM

 sound/soc/sunxi/sun8i-codec.c | 104 ++++++++++++----------------------
 1 file changed, 37 insertions(+), 67 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/9] ASoC: sun8i-codec: Remove extraneous widgets
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 2/9] ASoC: sun8i-codec: Fix AIF1 MODCLK widget name Samuel Holland
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

This driver is for the digital part of the codec only. The analog part,
including the microphone inputs, is managed by a separate driver. These
widgets look like they were copied from sun4i-codec. Since they do not
perform any function in this driver, remove them.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index e3a1347d7ecd..52ef0f9ec79e 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -455,10 +455,6 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
 			    SUN8I_MOD_RST_CTL_DAC, 0, NULL, 0),
 	SND_SOC_DAPM_SUPPLY("RST ADC", SUN8I_MOD_RST_CTL,
 			    SUN8I_MOD_RST_CTL_ADC, 0, NULL, 0),
-
-	SND_SOC_DAPM_MIC("Headset Mic", NULL),
-	SND_SOC_DAPM_MIC("Mic", NULL),
-
 };
 
 static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/9] ASoC: sun8i-codec: Fix AIF1 MODCLK widget name
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
  2020-08-31  3:48 ` [PATCH 1/9] ASoC: sun8i-codec: Remove extraneous widgets Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 3/9] ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names Samuel Holland
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

The name should reference "AIF1", not "AFI1".

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 52ef0f9ec79e..263c1e7c3cc2 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -431,7 +431,7 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
 			sun8i_input_mixer_controls),
 
 	/* Clocks */
-	SND_SOC_DAPM_SUPPLY("MODCLK AFI1", SUN8I_MOD_CLK_ENA,
+	SND_SOC_DAPM_SUPPLY("MODCLK AIF1", SUN8I_MOD_CLK_ENA,
 			    SUN8I_MOD_CLK_ENA_AIF1, 0, NULL, 0),
 	SND_SOC_DAPM_SUPPLY("MODCLK DAC", SUN8I_MOD_CLK_ENA,
 			    SUN8I_MOD_CLK_ENA_DAC, 0, NULL, 0),
@@ -464,11 +464,11 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
 	{ "SYSCLK", NULL, "AIF1 PLL" },
 
 	{ "RST AIF1", NULL, "SYSCLK" },
-	{ "MODCLK AFI1", NULL, "RST AIF1" },
-	{ "AIF1 AD0L", NULL, "MODCLK AFI1" },
-	{ "AIF1 AD0R", NULL, "MODCLK AFI1" },
-	{ "AIF1 DA0L", NULL, "MODCLK AFI1" },
-	{ "AIF1 DA0R", NULL, "MODCLK AFI1" },
+	{ "MODCLK AIF1", NULL, "RST AIF1" },
+	{ "AIF1 AD0L", NULL, "MODCLK AIF1" },
+	{ "AIF1 AD0R", NULL, "MODCLK AIF1" },
+	{ "AIF1 DA0L", NULL, "MODCLK AIF1" },
+	{ "AIF1 DA0R", NULL, "MODCLK AIF1" },
 
 	{ "RST DAC", NULL, "SYSCLK" },
 	{ "MODCLK DAC", NULL, "RST DAC" },
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/9] ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
  2020-08-31  3:48 ` [PATCH 1/9] ASoC: sun8i-codec: Remove extraneous widgets Samuel Holland
  2020-08-31  3:48 ` [PATCH 2/9] ASoC: sun8i-codec: Fix AIF1 MODCLK widget name Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 4/9] ASoC: sun8i-codec: Fix AIF1_MXR_SRC " Samuel Holland
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

They are controlling "AD0" (AIF1 slot 0 ADC), not "DA0".

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 263c1e7c3cc2..68c8edae9084 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -49,8 +49,8 @@
 #define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_16		(1 << 4)
 #define SUN8I_AIF1CLK_CTRL_AIF1_DATA_FMT		2
 #define SUN8I_AIF1_ADCDAT_CTRL				0x044
-#define SUN8I_AIF1_ADCDAT_CTRL_AIF1_DA0L_ENA		15
-#define SUN8I_AIF1_ADCDAT_CTRL_AIF1_DA0R_ENA		14
+#define SUN8I_AIF1_ADCDAT_CTRL_AIF1_AD0L_ENA		15
+#define SUN8I_AIF1_ADCDAT_CTRL_AIF1_AD0R_ENA		14
 #define SUN8I_AIF1_DACDAT_CTRL				0x048
 #define SUN8I_AIF1_DACDAT_CTRL_AIF1_DA0L_ENA		15
 #define SUN8I_AIF1_DACDAT_CTRL_AIF1_DA0R_ENA		14
@@ -407,10 +407,10 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
 	/* AIF "ADC" Outputs */
 	SND_SOC_DAPM_AIF_IN("AIF1 AD0L", "Capture", 0,
 			    SUN8I_AIF1_ADCDAT_CTRL,
-			    SUN8I_AIF1_ADCDAT_CTRL_AIF1_DA0L_ENA, 0),
+			    SUN8I_AIF1_ADCDAT_CTRL_AIF1_AD0L_ENA, 0),
 	SND_SOC_DAPM_AIF_IN("AIF1 AD0R", "Capture", 0,
 			    SUN8I_AIF1_ADCDAT_CTRL,
-			    SUN8I_AIF1_ADCDAT_CTRL_AIF1_DA0R_ENA, 0),
+			    SUN8I_AIF1_ADCDAT_CTRL_AIF1_AD0R_ENA, 0),
 
 	/* ADC Inputs (connected to analog codec DAPM context) */
 	SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 0, 0),
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/9] ASoC: sun8i-codec: Fix AIF1_MXR_SRC field names
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (2 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 3/9] ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 5/9] ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name Samuel Holland
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

Even though they are for the left channel mixer, they are documented as
"MXR_SRC". This matches the naming scheme used for the main DAC. The "R"
is part of the abbreviation for "mixer", not a reference to the channel.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 68c8edae9084..def3a0059c3d 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -55,10 +55,10 @@
 #define SUN8I_AIF1_DACDAT_CTRL_AIF1_DA0L_ENA		15
 #define SUN8I_AIF1_DACDAT_CTRL_AIF1_DA0R_ENA		14
 #define SUN8I_AIF1_MXR_SRC				0x04c
-#define SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_AIF1DA0L	15
-#define SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_AIF2DACL	14
-#define SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_ADCL		13
-#define SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_AIF2DACR	12
+#define SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_AIF1DA0L	15
+#define SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_AIF2DACL	14
+#define SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_ADCL		13
+#define SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_AIF2DACR	12
 #define SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF1DA0R	11
 #define SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF2DACR	10
 #define SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_ADCR		9
@@ -374,18 +374,18 @@ static const struct snd_kcontrol_new sun8i_dac_mixer_controls[] = {
 static const struct snd_kcontrol_new sun8i_input_mixer_controls[] = {
 	SOC_DAPM_DOUBLE("AIF1 Slot 0 Digital ADC Capture Switch",
 			SUN8I_AIF1_MXR_SRC,
-			SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_AIF1DA0L,
+			SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_AIF1DA0L,
 			SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF1DA0R, 1, 0),
 	SOC_DAPM_DOUBLE("AIF2 Digital ADC Capture Switch", SUN8I_AIF1_MXR_SRC,
-			SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_AIF2DACL,
+			SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_AIF2DACL,
 			SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF2DACR, 1, 0),
 	SOC_DAPM_DOUBLE("AIF1 Data Digital ADC Capture Switch",
 			SUN8I_AIF1_MXR_SRC,
-			SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_ADCL,
+			SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_ADCL,
 			SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_ADCR, 1, 0),
 	SOC_DAPM_DOUBLE("AIF2 Inv Digital ADC Capture Switch",
 			SUN8I_AIF1_MXR_SRC,
-			SUN8I_AIF1_MXR_SRC_AD0L_MXL_SRC_AIF2DACR,
+			SUN8I_AIF1_MXR_SRC_AD0L_MXR_SRC_AIF2DACR,
 			SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF2DACL, 1, 0),
 };
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/9] ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (3 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 4/9] ASoC: sun8i-codec: Fix AIF1_MXR_SRC " Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 6/9] ASoC: sun8i-codec: Fix field bit number indentation Samuel Holland
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

This is the enable bit for the "AD"C, not the "DA"C.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index def3a0059c3d..4218a00a9aba 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -64,7 +64,7 @@
 #define SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_ADCR		9
 #define SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF2DACL	8
 #define SUN8I_ADC_DIG_CTRL				0x100
-#define SUN8I_ADC_DIG_CTRL_ENDA			15
+#define SUN8I_ADC_DIG_CTRL_ENAD				15
 #define SUN8I_ADC_DIG_CTRL_ADOUT_DTS			2
 #define SUN8I_ADC_DIG_CTRL_ADOUT_DLY			1
 #define SUN8I_DAC_DIG_CTRL				0x120
@@ -393,7 +393,7 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
 	/* Digital parts of the DACs and ADC */
 	SND_SOC_DAPM_SUPPLY("DAC", SUN8I_DAC_DIG_CTRL, SUN8I_DAC_DIG_CTRL_ENDA,
 			    0, NULL, 0),
-	SND_SOC_DAPM_SUPPLY("ADC", SUN8I_ADC_DIG_CTRL, SUN8I_ADC_DIG_CTRL_ENDA,
+	SND_SOC_DAPM_SUPPLY("ADC", SUN8I_ADC_DIG_CTRL, SUN8I_ADC_DIG_CTRL_ENAD,
 			    0, NULL, 0),
 
 	/* AIF "DAC" Inputs */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/9] ASoC: sun8i-codec: Fix field bit number indentation
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (4 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 5/9] ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 7/9] ASoC: sun8i-codec: Sort masks in a consistent order Samuel Holland
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

Several fields have inconsistent indentation, presumably because the
patch "looked correct" due to the additional "+" character at the
beginning of the line.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 4218a00a9aba..62d4b1b44e76 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -68,15 +68,15 @@
 #define SUN8I_ADC_DIG_CTRL_ADOUT_DTS			2
 #define SUN8I_ADC_DIG_CTRL_ADOUT_DLY			1
 #define SUN8I_DAC_DIG_CTRL				0x120
-#define SUN8I_DAC_DIG_CTRL_ENDA			15
+#define SUN8I_DAC_DIG_CTRL_ENDA				15
 #define SUN8I_DAC_MXR_SRC				0x130
-#define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA0L	15
-#define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA1L	14
-#define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF2DACL	13
+#define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA0L		15
+#define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA1L		14
+#define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF2DACL		13
 #define SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_ADCL		12
-#define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA0R	11
-#define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA1R	10
-#define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF2DACR	9
+#define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA0R		11
+#define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA1R		10
+#define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF2DACR		9
 #define SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_ADCR		8
 
 #define SUN8I_SYS_SR_CTRL_AIF1_FS_MASK		GENMASK(15, 12)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/9] ASoC: sun8i-codec: Sort masks in a consistent order
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (5 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 6/9] ASoC: sun8i-codec: Fix field bit number indentation Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-08-31  3:48 ` [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap Samuel Holland
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

All other definitions are sorted from largest to smallest bit number.
This makes the AIF1CLK_CTRL mask constants consistent with them.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 62d4b1b44e76..c25cdd3f3057 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -81,10 +81,10 @@
 
 #define SUN8I_SYS_SR_CTRL_AIF1_FS_MASK		GENMASK(15, 12)
 #define SUN8I_SYS_SR_CTRL_AIF2_FS_MASK		GENMASK(11, 8)
-#define SUN8I_AIF1CLK_CTRL_AIF1_DATA_FMT_MASK	GENMASK(3, 2)
-#define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_MASK	GENMASK(5, 4)
-#define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK	GENMASK(8, 6)
 #define SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV_MASK	GENMASK(12, 9)
+#define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK	GENMASK(8, 6)
+#define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_MASK	GENMASK(5, 4)
+#define SUN8I_AIF1CLK_CTRL_AIF1_DATA_FMT_MASK	GENMASK(3, 2)
 
 struct sun8i_codec_quirks {
 	bool legacy_widgets	: 1;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (6 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 7/9] ASoC: sun8i-codec: Sort masks in a consistent order Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-09-04  9:17   ` Maxime Ripard
  2020-08-31  3:48 ` [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM Samuel Holland
  2020-09-07 18:05 ` [PATCH 0/9] ASoC: sun8i-codec driver cleanup Mark Brown
  9 siblings, 1 reply; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

When attached to the regmap, the bus clock is automatically enabled as
needed to access device registers. This avoids needing code to manage it
separately in the driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index c25cdd3f3057..8a7f98910347 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -94,7 +94,6 @@ struct sun8i_codec_quirks {
 struct sun8i_codec {
 	struct regmap			*regmap;
 	struct clk			*clk_module;
-	struct clk			*clk_bus;
 	const struct sun8i_codec_quirks	*quirks;
 };
 
@@ -109,12 +108,6 @@ static int sun8i_codec_runtime_resume(struct device *dev)
 		return ret;
 	}
 
-	ret = clk_prepare_enable(scodec->clk_bus);
-	if (ret) {
-		dev_err(dev, "Failed to enable the bus clock\n");
-		goto err_disable_modclk;
-	}
-
 	regcache_cache_only(scodec->regmap, false);
 
 	ret = regcache_sync(scodec->regmap);
@@ -126,9 +119,6 @@ static int sun8i_codec_runtime_resume(struct device *dev)
 	return 0;
 
 err_disable_clk:
-	clk_disable_unprepare(scodec->clk_bus);
-
-err_disable_modclk:
 	clk_disable_unprepare(scodec->clk_module);
 
 	return ret;
@@ -142,7 +132,6 @@ static int sun8i_codec_runtime_suspend(struct device *dev)
 	regcache_mark_dirty(scodec->regmap);
 
 	clk_disable_unprepare(scodec->clk_module);
-	clk_disable_unprepare(scodec->clk_bus);
 
 	return 0;
 }
@@ -612,20 +601,14 @@ static int sun8i_codec_probe(struct platform_device *pdev)
 		return PTR_ERR(scodec->clk_module);
 	}
 
-	scodec->clk_bus = devm_clk_get(&pdev->dev, "bus");
-	if (IS_ERR(scodec->clk_bus)) {
-		dev_err(&pdev->dev, "Failed to get the bus clock\n");
-		return PTR_ERR(scodec->clk_bus);
-	}
-
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base)) {
 		dev_err(&pdev->dev, "Failed to map the registers\n");
 		return PTR_ERR(base);
 	}
 
-	scodec->regmap = devm_regmap_init_mmio(&pdev->dev, base,
-					       &sun8i_codec_regmap_config);
+	scodec->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "bus", base,
+						   &sun8i_codec_regmap_config);
 	if (IS_ERR(scodec->regmap)) {
 		dev_err(&pdev->dev, "Failed to create our regmap\n");
 		return PTR_ERR(scodec->regmap);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (7 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap Samuel Holland
@ 2020-08-31  3:48 ` Samuel Holland
  2020-09-04  9:17   ` Maxime Ripard
  2020-09-07 18:05 ` [PATCH 0/9] ASoC: sun8i-codec driver cleanup Mark Brown
  9 siblings, 1 reply; 13+ messages in thread
From: Samuel Holland @ 2020-08-31  3:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Maxime Ripard, Chen-Yu Tsai,
	Jaroslav Kysela, Takashi Iwai
  Cc: Ondrej Jirman, alsa-devel, linux-arm-kernel, linux-kernel,
	Samuel Holland

By representing the module clock as a DAPM widget, we ensure that the
clock is only enabled when the module is actually in use, without
additional code in runtime PM hooks.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 sound/soc/sunxi/sun8i-codec.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 8a7f98910347..178f6fb31fd4 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -102,26 +102,15 @@ static int sun8i_codec_runtime_resume(struct device *dev)
 	struct sun8i_codec *scodec = dev_get_drvdata(dev);
 	int ret;
 
-	ret = clk_prepare_enable(scodec->clk_module);
-	if (ret) {
-		dev_err(dev, "Failed to enable the module clock\n");
-		return ret;
-	}
-
 	regcache_cache_only(scodec->regmap, false);
 
 	ret = regcache_sync(scodec->regmap);
 	if (ret) {
 		dev_err(dev, "Failed to sync regmap cache\n");
-		goto err_disable_clk;
+		return ret;
 	}
 
 	return 0;
-
-err_disable_clk:
-	clk_disable_unprepare(scodec->clk_module);
-
-	return ret;
 }
 
 static int sun8i_codec_runtime_suspend(struct device *dev)
@@ -131,8 +120,6 @@ static int sun8i_codec_runtime_suspend(struct device *dev)
 	regcache_cache_only(scodec->regmap, true);
 	regcache_mark_dirty(scodec->regmap);
 
-	clk_disable_unprepare(scodec->clk_module);
-
 	return 0;
 }
 
@@ -379,6 +366,8 @@ static const struct snd_kcontrol_new sun8i_input_mixer_controls[] = {
 };
 
 static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
+	SND_SOC_DAPM_CLOCK_SUPPLY("mod"),
+
 	/* Digital parts of the DACs and ADC */
 	SND_SOC_DAPM_SUPPLY("DAC", SUN8I_DAC_DIG_CTRL, SUN8I_DAC_DIG_CTRL_ENDA,
 			    0, NULL, 0),
@@ -448,6 +437,8 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
 
 static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
 	/* Clock Routes */
+	{ "AIF1", NULL, "mod" },
+
 	{ "AIF1", NULL, "SYSCLK AIF1" },
 	{ "AIF1 PLL", NULL, "AIF1" },
 	{ "SYSCLK", NULL, "AIF1 PLL" },
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap
  2020-08-31  3:48 ` [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap Samuel Holland
@ 2020-09-04  9:17   ` Maxime Ripard
  0 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2020-09-04  9:17 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Mark Brown, Liam Girdwood, Chen-Yu Tsai, Jaroslav Kysela,
	Takashi Iwai, Ondrej Jirman, alsa-devel, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

On Sun, Aug 30, 2020 at 10:48:51PM -0500, Samuel Holland wrote:
> When attached to the regmap, the bus clock is automatically enabled as
> needed to access device registers. This avoids needing code to manage it
> separately in the driver.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM
  2020-08-31  3:48 ` [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM Samuel Holland
@ 2020-09-04  9:17   ` Maxime Ripard
  0 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2020-09-04  9:17 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Mark Brown, Liam Girdwood, Chen-Yu Tsai, Jaroslav Kysela,
	Takashi Iwai, Ondrej Jirman, alsa-devel, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Hi,

On Sun, Aug 30, 2020 at 10:48:52PM -0500, Samuel Holland wrote:
> By representing the module clock as a DAPM widget, we ensure that the
> clock is only enabled when the module is actually in use, without
> additional code in runtime PM hooks.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/9] ASoC: sun8i-codec driver cleanup
  2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
                   ` (8 preceding siblings ...)
  2020-08-31  3:48 ` [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM Samuel Holland
@ 2020-09-07 18:05 ` Mark Brown
  9 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2020-09-07 18:05 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Holland, Chen-Yu Tsai, Jaroslav Kysela,
	Takashi Iwai, Liam Girdwood
  Cc: linux-kernel, linux-arm-kernel, Ondrej Jirman, alsa-devel

On Sun, 30 Aug 2020 22:48:43 -0500, Samuel Holland wrote:
> Now that the fixes series is merged, here is a series of small cleanups
> to the sun8i-codec driver. These help shorten the patch stack for the
> next series, which will add support for the other two DAIs in this
> codec: AIF2 and AIF3.
> 
> Samuel Holland (9):
>   ASoC: sun8i-codec: Remove extraneous widgets
>   ASoC: sun8i-codec: Fix AIF1 MODCLK widget name
>   ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names
>   ASoC: sun8i-codec: Fix AIF1_MXR_SRC field names
>   ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name
>   ASoC: sun8i-codec: Fix field bit number indentation
>   ASoC: sun8i-codec: Sort masks in a consistent order
>   ASoC: sun8i-codec: Attach the bus clock to the regmap
>   ASoC: sun8i-codec: Manage module clock via DAPM
> 
> [...]

Applied to

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

Thanks!

[1/9] ASoC: sun8i-codec: Remove extraneous widgets
      commit: b8cbb1cab70342756725c1beded6b81031a95762
[2/9] ASoC: sun8i-codec: Fix AIF1 MODCLK widget name
      commit: 2455e37adef39bf7fd12df963b86fa7f313f1ad4
[3/9] ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names
      commit: fa5c0ca1f90aaadb6539ec6c407221f2ab7b7608
[4/9] ASoC: sun8i-codec: Fix AIF1_MXR_SRC field names
      commit: 0ba95493023de45744962af41ef5ad90bad7d8bb
[5/9] ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name
      commit: 30aff91ec7840fb72daef7ce389a9414e5db4075
[6/9] ASoC: sun8i-codec: Fix field bit number indentation
      commit: fcb7b39ee3d877e4eb79fb2abf15644d1b36285c
[7/9] ASoC: sun8i-codec: Sort masks in a consistent order
      commit: f30ef55c332935c1d7c5f4ae3d084bec8d05712e
[8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap
      commit: efb736fb9eceac6ce335bbaa3d788a05649160b5
[9/9] ASoC: sun8i-codec: Manage module clock via DAPM
      commit: 6b3bb3c82b94521d6d61c1bf7c766c8c3bddacf5

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-09-07 18:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31  3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
2020-08-31  3:48 ` [PATCH 1/9] ASoC: sun8i-codec: Remove extraneous widgets Samuel Holland
2020-08-31  3:48 ` [PATCH 2/9] ASoC: sun8i-codec: Fix AIF1 MODCLK widget name Samuel Holland
2020-08-31  3:48 ` [PATCH 3/9] ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names Samuel Holland
2020-08-31  3:48 ` [PATCH 4/9] ASoC: sun8i-codec: Fix AIF1_MXR_SRC " Samuel Holland
2020-08-31  3:48 ` [PATCH 5/9] ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name Samuel Holland
2020-08-31  3:48 ` [PATCH 6/9] ASoC: sun8i-codec: Fix field bit number indentation Samuel Holland
2020-08-31  3:48 ` [PATCH 7/9] ASoC: sun8i-codec: Sort masks in a consistent order Samuel Holland
2020-08-31  3:48 ` [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap Samuel Holland
2020-09-04  9:17   ` Maxime Ripard
2020-08-31  3:48 ` [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM Samuel Holland
2020-09-04  9:17   ` Maxime Ripard
2020-09-07 18:05 ` [PATCH 0/9] ASoC: sun8i-codec driver cleanup Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).