linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes
@ 2022-10-16 13:26 Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 1/7] ASoC: codecs: jz4725b: add missed Line In power control bit Siarhei Volkau
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

The patchset fixes:
 - Line In path stays powered off during capturing or
   bypass to mixer.
 - incorrectly represented dB values in alsamixer, et al.
 - incorrect represented Capture input selector in alsamixer
   in Playback tab.
 - wrong control selected as Capture Master

The patchset improves:
 - Exposes output stage (post mixer) gain control and makes it new
   Master playback gain, DAC gain was the previous master.
   However, no Master mute now.
 - Exposes all mixer inputs (both Mics, LineIn and DAC) with their
   gain controls.
 - Exposes microphones widgets: single/differential input, boost.

Known issues:
 - Bypass path enablement isn't applied immediately, for make
   things going bit clock needs to be triggered for a bit,
   e.g. by aplay dummy.wav
   It might be a hardware bug, since the bit clock isn't
   declared as required for codec operation.

Tested on:
 - Ritmix RZX-27 (jz4725b).
 - Ritmix RZX-50 (jz4755).

Diff from v2:
 - add microphone widgets

Diff from v1:
 - each change in a separate patch

Tested-by: Siarhei Volkau <lis8215@gmail.com>
Signed-off-by: Siarhei Volkau <lis8215@gmail.com>

Siarhei Volkau (7):
  ASoC: codecs: jz4725b: add missed Line In power control bit
  ASoC: codecs: jz4725b: fix reported volume for Master ctl
  ASoC: codecs: jz4725b: use right control for Capture Volume
  ASoC: codecs: jz4725b: fix capture selector naming
  ASoC: codecs: jz4725b: use right control for Master Playback
  ASoC: codecs: jz4725b: add missed Mixer inputs
  ASoC: codecs: jz4725b: add missed microphone widgets

 sound/soc/codecs/jz4725b.c | 109 +++++++++++++++++++++++++++++++------
 1 file changed, 92 insertions(+), 17 deletions(-)

-- 
2.36.1


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

* [PATCH v3 1/7] ASoC: codecs: jz4725b: add missed Line In power control bit
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 2/7] ASoC: codecs: jz4725b: fix reported volume for Master ctl Siarhei Volkau
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

Line In path stayed powered off during capturing or
bypass to mixer.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index 5201a8f6d..cc7a48c96 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -236,7 +236,8 @@ static const struct snd_soc_dapm_widget jz4725b_codec_dapm_widgets[] = {
 	SND_SOC_DAPM_MIXER("DAC to Mixer", JZ4725B_CODEC_REG_CR1,
 			   REG_CR1_DACSEL_OFFSET, 0, NULL, 0),
 
-	SND_SOC_DAPM_MIXER("Line In", SND_SOC_NOPM, 0, 0, NULL, 0),
+	SND_SOC_DAPM_MIXER("Line In", JZ4725B_CODEC_REG_PMR1,
+			   REG_PMR1_SB_LIN_OFFSET, 1, NULL, 0),
 	SND_SOC_DAPM_MIXER("HP Out", JZ4725B_CODEC_REG_CR1,
 			   REG_CR1_HP_DIS_OFFSET, 1, NULL, 0),
 
-- 
2.36.1


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

* [PATCH v3 2/7] ASoC: codecs: jz4725b: fix reported volume for Master ctl
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 1/7] ASoC: codecs: jz4725b: add missed Line In power control bit Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 3/7] ASoC: codecs: jz4725b: use right control for Capture Volume Siarhei Volkau
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

DAC volume control is the Master Playback Volume at the moment
and it reports wrong levels in alsamixer and other alsa apps.

The patch fixes that, as stated in manual on the jz4725b SoC
(16.6.3.4 Programmable attenuation: GOD) the ctl range varies
from -22.5dB to 0dB with 1.5dB step.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index cc7a48c96..72549ee2e 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -142,8 +142,8 @@ struct jz_icdc {
 	struct clk *clk;
 };
 
-static const SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(jz4725b_dac_tlv, -2250, 0);
 static const SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(jz4725b_line_tlv, -1500, 600);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_dac_tlv, -2250, 150, 0);
 
 static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
 	SOC_DOUBLE_TLV("Master Playback Volume",
-- 
2.36.1


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

* [PATCH v3 3/7] ASoC: codecs: jz4725b: use right control for Capture Volume
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 1/7] ASoC: codecs: jz4725b: add missed Line In power control bit Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 2/7] ASoC: codecs: jz4725b: fix reported volume for Master ctl Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 4/7] ASoC: codecs: jz4725b: fix capture selector naming Siarhei Volkau
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

Line In Bypass control is used as Master Capture at the moment
this is completely incorrect.

Current control routed to Mixer instead of ADC, thus can't affect
Capture path. ADC control shall be used instead.

ADC volume control parameters are different, so the patch fixes that
as well. Manual says (16.6.3.2 Programmable input attenuation amplifier:
PGATM) that gain varies in range 0dB..22.5dB with 1.5dB step.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index 72549ee2e..4363d898a 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -136,13 +136,16 @@ enum {
 #define REG_CGR3_GO1L_OFFSET		0
 #define REG_CGR3_GO1L_MASK		(0x1f << REG_CGR3_GO1L_OFFSET)
 
+#define REG_CGR10_GIL_OFFSET		0
+#define REG_CGR10_GIR_OFFSET		4
+
 struct jz_icdc {
 	struct regmap *regmap;
 	void __iomem *base;
 	struct clk *clk;
 };
 
-static const SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(jz4725b_line_tlv, -1500, 600);
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_adc_tlv,     0, 150, 0);
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_dac_tlv, -2250, 150, 0);
 
 static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
@@ -151,11 +154,11 @@ static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
 		       REG_CGR1_GODL_OFFSET,
 		       REG_CGR1_GODR_OFFSET,
 		       0xf, 1, jz4725b_dac_tlv),
-	SOC_DOUBLE_R_TLV("Master Capture Volume",
-			 JZ4725B_CODEC_REG_CGR3,
-			 JZ4725B_CODEC_REG_CGR2,
-			 REG_CGR2_GO1R_OFFSET,
-			 0x1f, 1, jz4725b_line_tlv),
+	SOC_DOUBLE_TLV("Master Capture Volume",
+		       JZ4725B_CODEC_REG_CGR10,
+		       REG_CGR10_GIL_OFFSET,
+		       REG_CGR10_GIR_OFFSET,
+		       0xf, 0, jz4725b_adc_tlv),
 
 	SOC_SINGLE("Master Playback Switch", JZ4725B_CODEC_REG_CR1,
 		   REG_CR1_DAC_MUTE_OFFSET, 1, 1),
-- 
2.36.1


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

* [PATCH v3 4/7] ASoC: codecs: jz4725b: fix capture selector naming
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
                   ` (2 preceding siblings ...)
  2022-10-16 13:26 ` [PATCH v3 3/7] ASoC: codecs: jz4725b: use right control for Capture Volume Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 5/7] ASoC: codecs: jz4725b: use right control for Master Playback Siarhei Volkau
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

At the moment Capture source selector appears on Playback
tab in the alsamixer and has a senseless name.

Let's fix that.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index 4363d898a..d57c2c6a3 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -183,7 +183,7 @@ static SOC_VALUE_ENUM_SINGLE_DECL(jz4725b_codec_adc_src_enum,
 				  jz4725b_codec_adc_src_texts,
 				  jz4725b_codec_adc_src_values);
 static const struct snd_kcontrol_new jz4725b_codec_adc_src_ctrl =
-			SOC_DAPM_ENUM("Route", jz4725b_codec_adc_src_enum);
+	SOC_DAPM_ENUM("ADC Source Capture Route", jz4725b_codec_adc_src_enum);
 
 static const struct snd_kcontrol_new jz4725b_codec_mixer_controls[] = {
 	SOC_DAPM_SINGLE("Line In Bypass", JZ4725B_CODEC_REG_CR1,
@@ -228,7 +228,7 @@ static const struct snd_soc_dapm_widget jz4725b_codec_dapm_widgets[] = {
 	SND_SOC_DAPM_ADC("ADC", "Capture",
 			 JZ4725B_CODEC_REG_PMR1, REG_PMR1_SB_ADC_OFFSET, 1),
 
-	SND_SOC_DAPM_MUX("ADC Source", SND_SOC_NOPM, 0, 0,
+	SND_SOC_DAPM_MUX("ADC Source Capture Route", SND_SOC_NOPM, 0, 0,
 			 &jz4725b_codec_adc_src_ctrl),
 
 	/* Mixer */
@@ -287,11 +287,11 @@ static const struct snd_soc_dapm_route jz4725b_codec_dapm_routes[] = {
 	{"Mixer", NULL, "DAC to Mixer"},
 
 	{"Mixer to ADC", NULL, "Mixer"},
-	{"ADC Source", "Mixer", "Mixer to ADC"},
-	{"ADC Source", "Line In", "Line In"},
-	{"ADC Source", "Mic 1", "Mic 1"},
-	{"ADC Source", "Mic 2", "Mic 2"},
-	{"ADC", NULL, "ADC Source"},
+	{"ADC Source Capture Route", "Mixer", "Mixer to ADC"},
+	{"ADC Sourc Capture Routee", "Line In", "Line In"},
+	{"ADC Source Capture Route", "Mic 1", "Mic 1"},
+	{"ADC Source Capture Route", "Mic 2", "Mic 2"},
+	{"ADC", NULL, "ADC Source Capture Route"},
 
 	{"Out Stage", NULL, "Mixer"},
 	{"HP Out", NULL, "Out Stage"},
-- 
2.36.1


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

* [PATCH v3 5/7] ASoC: codecs: jz4725b: use right control for Master Playback
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
                   ` (3 preceding siblings ...)
  2022-10-16 13:26 ` [PATCH v3 4/7] ASoC: codecs: jz4725b: fix capture selector naming Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 6/7] ASoC: codecs: jz4725b: add missed Mixer inputs Siarhei Volkau
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

At the moment DAC control is used as Master Playback control, this is
incorrect as DAC's output goes to a Mixer.

The Mixer couples analog input from 4 sources (DAC, Line In, Mic 1,
 Mic 2) each input has its own gain & mute controls.

Output of the Mixer goes to Output Stage control which is the best suite
for the new Playback Master. However, it doesn't have mute capability.

The patch implements Output Stage control as a new master and renames
old Master to DAC. Rest of mixer inputs will be implemented in the next
patch in the series.

Manual states that Output stage control (16.6.3.5 Programmable output
amplifier: PGAT) gain varies from -33.5dB to +4.5dB, gain step isn't
fixed and has 3 opts.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index d57c2c6a3..c39398e0a 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -136,6 +136,12 @@ enum {
 #define REG_CGR3_GO1L_OFFSET		0
 #define REG_CGR3_GO1L_MASK		(0x1f << REG_CGR3_GO1L_OFFSET)
 
+#define REG_CGR8_GOR_OFFSET		0
+#define REG_CGR8_GOR_MASK		(0x1f << REG_CGR8_GOR_OFFSET)
+
+#define REG_CGR9_GOL_OFFSET		0
+#define REG_CGR9_GOL_MASK		(0x1f << REG_CGR9_GOL_OFFSET)
+
 #define REG_CGR10_GIL_OFFSET		0
 #define REG_CGR10_GIR_OFFSET		4
 
@@ -147,9 +153,14 @@ struct jz_icdc {
 
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_adc_tlv,     0, 150, 0);
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_dac_tlv, -2250, 150, 0);
+static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(jz4725b_out_tlv,
+	 0, 11, TLV_DB_SCALE_ITEM(-3350, 200, 0),
+	12, 23, TLV_DB_SCALE_ITEM(-1050, 100, 0),
+	24, 31, TLV_DB_SCALE_ITEM(  100,  50, 0),
+);
 
 static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
-	SOC_DOUBLE_TLV("Master Playback Volume",
+	SOC_DOUBLE_TLV("DAC Playback Volume",
 		       JZ4725B_CODEC_REG_CGR1,
 		       REG_CGR1_GODL_OFFSET,
 		       REG_CGR1_GODR_OFFSET,
@@ -160,7 +171,13 @@ static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
 		       REG_CGR10_GIR_OFFSET,
 		       0xf, 0, jz4725b_adc_tlv),
 
-	SOC_SINGLE("Master Playback Switch", JZ4725B_CODEC_REG_CR1,
+	SOC_DOUBLE_R_TLV("Master Playback Volume",
+			 JZ4725B_CODEC_REG_CGR9,
+			 JZ4725B_CODEC_REG_CGR8,
+			 REG_CGR8_GOR_OFFSET,
+			 0x1f, 1, jz4725b_out_tlv),
+
+	SOC_SINGLE("DAC Playback Switch", JZ4725B_CODEC_REG_CR1,
 		   REG_CR1_DAC_MUTE_OFFSET, 1, 1),
 
 	SOC_SINGLE("Deemphasize Filter Playback Switch",
-- 
2.36.1


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

* [PATCH v3 6/7] ASoC: codecs: jz4725b: add missed Mixer inputs
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
                   ` (4 preceding siblings ...)
  2022-10-16 13:26 ` [PATCH v3 5/7] ASoC: codecs: jz4725b: use right control for Master Playback Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-16 13:26 ` [PATCH v3 7/7] ASoC: codecs: jz4725b: add missed microphone widgets Siarhei Volkau
  2022-10-18 11:28 ` [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Mark Brown
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

The Mixer couples analog input from 4 sources (DAC, Line In, Mic 1,
 Mic 2) each input has its own gain & mute controls.

At the moment only DAC is implemented fully and Line In path can be
switched on/off. The patch implements Mic 1 and Mic 2 paths and fully
implements Line In path.

Manual states that these controls (16.6.3.3 Programmable attenuation:
GOi) gain varies from -22.5dB to +6.0dB with 1.5dB step. Also there's
extra values below the minimum, but they behave the same as the minimum
value.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 42 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index c39398e0a..52b2bb95b 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -136,6 +136,18 @@ enum {
 #define REG_CGR3_GO1L_OFFSET		0
 #define REG_CGR3_GO1L_MASK		(0x1f << REG_CGR3_GO1L_OFFSET)
 
+#define REG_CGR4_GO2R_OFFSET		0
+#define REG_CGR4_GO2R_MASK		(0x1f << REG_CGR4_GO2R_OFFSET)
+
+#define REG_CGR5_GO2L_OFFSET		0
+#define REG_CGR5_GO2L_MASK		(0x1f << REG_CGR5_GO2L_OFFSET)
+
+#define REG_CGR6_GO3R_OFFSET		0
+#define REG_CGR6_GO3R_MASK		(0x1f << REG_CGR6_GO3R_OFFSET)
+
+#define REG_CGR7_GO3L_OFFSET		0
+#define REG_CGR7_GO3L_MASK		(0x1f << REG_CGR7_GO3L_OFFSET)
+
 #define REG_CGR8_GOR_OFFSET		0
 #define REG_CGR8_GOR_MASK		(0x1f << REG_CGR8_GOR_OFFSET)
 
@@ -153,6 +165,11 @@ struct jz_icdc {
 
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_adc_tlv,     0, 150, 0);
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_dac_tlv, -2250, 150, 0);
+static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(jz4725b_mix_tlv,
+	 0, 11, TLV_DB_SCALE_ITEM(-2250,   0, 0),
+	12, 31, TLV_DB_SCALE_ITEM(-2250, 150, 0),
+);
+
 static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(jz4725b_out_tlv,
 	 0, 11, TLV_DB_SCALE_ITEM(-3350, 200, 0),
 	12, 23, TLV_DB_SCALE_ITEM(-1050, 100, 0),
@@ -170,6 +187,21 @@ static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
 		       REG_CGR10_GIL_OFFSET,
 		       REG_CGR10_GIR_OFFSET,
 		       0xf, 0, jz4725b_adc_tlv),
+	SOC_DOUBLE_R_TLV("Mixer Line In Bypass Playback Volume",
+			 JZ4725B_CODEC_REG_CGR3,
+			 JZ4725B_CODEC_REG_CGR2,
+			 REG_CGR2_GO1R_OFFSET,
+			 0x1f, 1, jz4725b_mix_tlv),
+	SOC_DOUBLE_R_TLV("Mixer Mic 1 Bypass Playback Volume",
+			 JZ4725B_CODEC_REG_CGR5,
+			 JZ4725B_CODEC_REG_CGR4,
+			 REG_CGR4_GO2R_OFFSET,
+			 0x1f, 1, jz4725b_mix_tlv),
+	SOC_DOUBLE_R_TLV("Mixer Mic 2 Bypass Playback Volume",
+			 JZ4725B_CODEC_REG_CGR7,
+			 JZ4725B_CODEC_REG_CGR6,
+			 REG_CGR6_GO3R_OFFSET,
+			 0x1f, 1, jz4725b_mix_tlv),
 
 	SOC_DOUBLE_R_TLV("Master Playback Volume",
 			 JZ4725B_CODEC_REG_CGR9,
@@ -203,8 +235,12 @@ static const struct snd_kcontrol_new jz4725b_codec_adc_src_ctrl =
 	SOC_DAPM_ENUM("ADC Source Capture Route", jz4725b_codec_adc_src_enum);
 
 static const struct snd_kcontrol_new jz4725b_codec_mixer_controls[] = {
-	SOC_DAPM_SINGLE("Line In Bypass", JZ4725B_CODEC_REG_CR1,
+	SOC_DAPM_SINGLE("Line In Bypass Playback Switch", JZ4725B_CODEC_REG_CR1,
 			REG_CR1_BYPASS_OFFSET, 1, 0),
+	SOC_DAPM_SINGLE("Mic 1 Bypass Playback Switch", JZ4725B_CODEC_REG_CR3,
+			REG_CR3_SIDETONE1_OFFSET, 1, 0),
+	SOC_DAPM_SINGLE("Mic 2 Bypass Playback Switch", JZ4725B_CODEC_REG_CR3,
+			REG_CR3_SIDETONE2_OFFSET, 1, 0),
 };
 
 static int jz4725b_out_stage_enable(struct snd_soc_dapm_widget *w,
@@ -299,7 +335,9 @@ static const struct snd_soc_dapm_route jz4725b_codec_dapm_routes[] = {
 	{"Line In", NULL, "LLINEIN"},
 	{"Line In", NULL, "RLINEIN"},
 
-	{"Mixer", "Line In Bypass", "Line In"},
+	{"Mixer", "Mic 1 Bypass Playback Switch", "Mic 1"},
+	{"Mixer", "Mic 2 Bypass Playback Switch", "Mic 2"},
+	{"Mixer", "Line In Bypass Playback Switch", "Line In"},
 	{"DAC to Mixer", NULL, "DAC"},
 	{"Mixer", NULL, "DAC to Mixer"},
 
-- 
2.36.1


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

* [PATCH v3 7/7] ASoC: codecs: jz4725b: add missed microphone widgets
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
                   ` (5 preceding siblings ...)
  2022-10-16 13:26 ` [PATCH v3 6/7] ASoC: codecs: jz4725b: add missed Mixer inputs Siarhei Volkau
@ 2022-10-16 13:26 ` Siarhei Volkau
  2022-10-18 11:28 ` [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Mark Brown
  7 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-16 13:26 UTC (permalink / raw)
  Cc: Siarhei Volkau, Paul Cercueil, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-mips, alsa-devel,
	linux-kernel

Microphone input can be single ended or differential, although
known SoCs with that codec expose MIC1P only.

Also there is 20dB mic boost in the Mic1 path.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 sound/soc/codecs/jz4725b.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c
index 52b2bb95b..685ba1d3a 100644
--- a/sound/soc/codecs/jz4725b.c
+++ b/sound/soc/codecs/jz4725b.c
@@ -175,6 +175,15 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(jz4725b_out_tlv,
 	12, 23, TLV_DB_SCALE_ITEM(-1050, 100, 0),
 	24, 31, TLV_DB_SCALE_ITEM(  100,  50, 0),
 );
+static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_mic_boost_tlv, 0, 2000, 0);
+
+static const char * const jz4725b_mic_mode_texts[] = {
+	"Single Ended", "Differential",
+};
+
+static const struct soc_enum jz4725b_mic_mode_enum =
+	SOC_ENUM_SINGLE(JZ4725B_CODEC_REG_CR3, REG_CR3_MICDIFF_OFFSET,
+			2, jz4725b_mic_mode_texts);
 
 static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
 	SOC_DOUBLE_TLV("DAC Playback Volume",
@@ -219,6 +228,13 @@ static const struct snd_kcontrol_new jz4725b_codec_controls[] = {
 	SOC_SINGLE("High-Pass Filter Capture Switch",
 		   JZ4725B_CODEC_REG_CR2,
 		   REG_CR2_ADC_HPF_OFFSET, 1, 0),
+
+	SOC_ENUM("Mic Mode Capture Switch", jz4725b_mic_mode_enum),
+
+	SOC_SINGLE_TLV("Mic1 Boost Capture Volume",
+		       JZ4725B_CODEC_REG_PMR2,
+		       REG_PMR2_GIM_OFFSET,
+		       1, 0, jz4725b_mic_boost_tlv),
 };
 
 static const char * const jz4725b_codec_adc_src_texts[] = {
-- 
2.36.1


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

* Re: [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes
  2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
                   ` (6 preceding siblings ...)
  2022-10-16 13:26 ` [PATCH v3 7/7] ASoC: codecs: jz4725b: add missed microphone widgets Siarhei Volkau
@ 2022-10-18 11:28 ` Mark Brown
  2022-10-20 11:58   ` Siarhei Volkau
  7 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2022-10-18 11:28 UTC (permalink / raw)
  To: Siarhei Volkau
  Cc: Paul Cercueil, Jaroslav Kysela, Takashi Iwai, linux-kernel,
	Liam Girdwood, linux-mips, alsa-devel

On Sun, 16 Oct 2022 16:26:41 +0300, Siarhei Volkau wrote:
> The patchset fixes:
>  - Line In path stays powered off during capturing or
>    bypass to mixer.
>  - incorrectly represented dB values in alsamixer, et al.
>  - incorrect represented Capture input selector in alsamixer
>    in Playback tab.
>  - wrong control selected as Capture Master
> 
> [...]

Applied to

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

Thanks!

[1/7] ASoC: codecs: jz4725b: add missed Line In power control bit
      commit: 1013999b431b4bcdc1f5ae47dd3338122751db31
[2/7] ASoC: codecs: jz4725b: fix reported volume for Master ctl
      commit: 088777bf65b98cfa4b5378119d0a7d49a58ece44
[3/7] ASoC: codecs: jz4725b: use right control for Capture Volume
      commit: 1538e2c8c9b7e7a656effcc6e4e7cfe8c1b405fd
[4/7] ASoC: codecs: jz4725b: fix capture selector naming
      commit: 80852f8268769715db335a22305e81a0c4a38a84
[5/7] ASoC: codecs: jz4725b: use right control for Master Playback
      commit: e6233ee25059de0eeac6ed3d9d49737afdbd5087
[6/7] ASoC: codecs: jz4725b: add missed Mixer inputs
      commit: 616c291820d155cbad258ecae5c7dbca2c01f07f
[7/7] ASoC: codecs: jz4725b: add missed microphone widgets
      commit: 4b192aa09b3c3615c79f8c60704a2efd15e500d0

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

* Re: [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes
  2022-10-18 11:28 ` [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Mark Brown
@ 2022-10-20 11:58   ` Siarhei Volkau
  2022-10-20 12:01     ` Paul Cercueil
  2022-10-20 12:14     ` Mark Brown
  0 siblings, 2 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-20 11:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: Paul Cercueil, Jaroslav Kysela, Takashi Iwai, linux-kernel,
	Liam Girdwood, linux-mips, alsa-devel

вт, 18 окт. 2022 г. в 14:28, Mark Brown <broonie@kernel.org>:
> Applied to
>
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
>
> Thanks!

Great! Thank you!

Unfortunately I found a critical bug in my patchset, yet easy to fix.
So I need some help to make and send the fix.

> 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.

What are mailing lists it needs to be sent to?
Any additional tags needed? I know about Fixes tag.
Do I need to keep a link on this patchset somehow?
Do I need to mail a patch with the fix to this thread or
create a new one?

PS: the patch will look like:
 - {"ADC Sourc Capture Routee", "Line In", "Line In"},
 + {"ADC Source Capture Route", "Line In", "Line In"},

Thanks in advance,
Siarhei

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

* Re: [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes
  2022-10-20 11:58   ` Siarhei Volkau
@ 2022-10-20 12:01     ` Paul Cercueil
  2022-10-20 12:14     ` Mark Brown
  1 sibling, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2022-10-20 12:01 UTC (permalink / raw)
  To: Siarhei Volkau
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, linux-kernel,
	Liam Girdwood, linux-mips, alsa-devel

Hi Siarhei,

Le jeu., oct. 20 2022 at 14:58:51 +0300, Siarhei Volkau 
<lis8215@gmail.com> a écrit :
> вт, 18 окт. 2022 г. в 14:28, Mark Brown <broonie@kernel.org>:
>>  Applied to
>> 
>>     
>> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
>> for-next
>> 
>>  Thanks!
> 
> Great! Thank you!
> 
> Unfortunately I found a critical bug in my patchset, yet easy to fix.
> So I need some help to make and send the fix.
> 
>>  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.
> 
> What are mailing lists it needs to be sent to?
> Any additional tags needed? I know about Fixes tag.
> Do I need to keep a link on this patchset somehow?
> Do I need to mail a patch with the fix to this thread or
> create a new one?
> 
> PS: the patch will look like:
>  - {"ADC Sourc Capture Routee", "Line In", "Line In"},
>  + {"ADC Source Capture Route", "Line In", "Line In"},

Somebody already submitted a fix.

> Thanks in advance,
> Siarhei

Cheers,
-Paul



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

* Re: [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes
  2022-10-20 11:58   ` Siarhei Volkau
  2022-10-20 12:01     ` Paul Cercueil
@ 2022-10-20 12:14     ` Mark Brown
  2022-10-20 12:29       ` Siarhei Volkau
  1 sibling, 1 reply; 13+ messages in thread
From: Mark Brown @ 2022-10-20 12:14 UTC (permalink / raw)
  To: Siarhei Volkau
  Cc: Paul Cercueil, Jaroslav Kysela, Takashi Iwai, linux-kernel,
	Liam Girdwood, linux-mips, alsa-devel

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

On Thu, Oct 20, 2022 at 02:58:51PM +0300, Siarhei Volkau wrote:
> вт, 18 окт. 2022 г. в 14:28, Mark Brown <broonie@kernel.org>:

> > 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.

> What are mailing lists it needs to be sent to?

The same ones as for any other patch submission - alsa-devel in this
case.

> Any additional tags needed? I know about Fixes tag.

No.

> Do I need to keep a link on this patchset somehow?

The fixes tag should be enough.

> Do I need to mail a patch with the fix to this thread or
> create a new one?

Please create a new thread.

> PS: the patch will look like:
>  - {"ADC Sourc Capture Routee", "Line In", "Line In"},
>  + {"ADC Source Capture Route", "Line In", "Line In"},

This was already fixed by Colin...

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

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

* Re: [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes
  2022-10-20 12:14     ` Mark Brown
@ 2022-10-20 12:29       ` Siarhei Volkau
  0 siblings, 0 replies; 13+ messages in thread
From: Siarhei Volkau @ 2022-10-20 12:29 UTC (permalink / raw)
  To: Mark Brown
  Cc: Paul Cercueil, Jaroslav Kysela, Takashi Iwai, linux-kernel,
	Liam Girdwood, linux-mips, alsa-devel

чт, 20 окт. 2022 г. в 15:14, Mark Brown <broonie@kernel.org>:
> This was already fixed by Colin...

Wow! Thank you all, guys!

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

end of thread, other threads:[~2022-10-20 12:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-16 13:26 [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 1/7] ASoC: codecs: jz4725b: add missed Line In power control bit Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 2/7] ASoC: codecs: jz4725b: fix reported volume for Master ctl Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 3/7] ASoC: codecs: jz4725b: use right control for Capture Volume Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 4/7] ASoC: codecs: jz4725b: fix capture selector naming Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 5/7] ASoC: codecs: jz4725b: use right control for Master Playback Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 6/7] ASoC: codecs: jz4725b: add missed Mixer inputs Siarhei Volkau
2022-10-16 13:26 ` [PATCH v3 7/7] ASoC: codecs: jz4725b: add missed microphone widgets Siarhei Volkau
2022-10-18 11:28 ` [PATCH v3 0/7] ASoC: codecs: jz4725b: Various improvements and fixes Mark Brown
2022-10-20 11:58   ` Siarhei Volkau
2022-10-20 12:01     ` Paul Cercueil
2022-10-20 12:14     ` Mark Brown
2022-10-20 12:29       ` Siarhei Volkau

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).