linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In
@ 2017-06-24  6:24 Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 01/14] ASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 Danny Milosavljevic
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

This patchset adds some mixer controls to sun4i-codec for the Allwinner A10
and the Allwinner A20.

It also adds a mux for the capture source and the PGA for the MIC2 preamp.

Where possible, it uses SOC_DAPM_DOUBLE in order to cut down on the number
of distinct controls in alsamixer.

v13 changes compared to v12 are:
 - Added my "Signed-off-by".
 - Clarified some commit message text.

v12 changes compared to v11 are:
 - Split up patchset in another way.
 - Renamed "Mic1 Capture Volume" to "Mic1 Boost Volume".
 - Renamed "Mic2 Capture Volume" to "Mic2 Boost Volume".
 - Renamed "Line Capture Volume" to "Line Boost Volume".
 - Renamed "Differential Line Capture Switch" to "Differential Line Source".

v11 changes compared to v10 are:
 - Split up patchset.
 - Fixed typo in Differential Line Capture Switch.
 - Renamed "Non-Differential" value to "Stereo".
 - Removed duplicate PA Volume mixer control.

v10 changes compared to v9 are:
 - Use SOC_DAPM_DOUBLE where possible and it makes sense in order to cut
   down on the number of controls.

v9 changes compared to v8 are:
 - added Line Differential Capture Switch.
 - split Capture Source into Left Capture Select, Right Capture Select.
 - added Line Capture Volume.
 - rename "sun4i_codec_widgets" to "sun4i_codec_controls" for 
   consistency with the struct field it's used in.
 - rename "Line-In" to "Line".
 - rename "Power Amplifier Playback Volume" to "Headphone Playback Volume".

v8 changes compared to v7 are:
 - fixed the routes for line and mic capturing.

v7 changes compared to v6 are:
 - preparation for different A20, A10 controls is now in an extra patch.
 - all register definitions are now at the top.
 - sun7i-specific things (A20-specific things) are now less
   grouped-together.
 - rename "Power Amplifier Volume" to "Power Amplifier Playback Volume".

v6 changes compared to v5 are:
 - Mic preamplifier special cases for A20 and A10 now are now not
   icky: There are two different _widget arrays and the probe() function
   now selects the right one to pass to snd_soc_register_codec() unmodified.
 - sun7i-specific things (A20-specific things) are now grouped together.

v5 changes compared to v4 are:
 - Mic preamplifier controls have more common names now.
 - Mic preamplifier scale has a 0 dB entry as well now, as documented in the 
   A20 user manual.
 - Mic preamplifier has special cases for A20 and A10 now.
 - Gain controls have "Gain" in the name now.

v4 changes compared to v3 are:
 - names of the input are not uppercase anymore.
 - bit index constants are now named as in the A20 user manual v1.4.
 - added Mic1-In, Mac2-In.
 - added Mic1 and Mic2 Pre-Amplifiers.

v3 changes compared to v2 are:
 - added DAPM routes.

v2 changes compared to v1 are:
 - moved Line-In and FM-In playback switches to their respective 
   sun4i_codec_*_mixer_controls.

v1 changes:
 - added linein, fmin output volumes and switches.

Danny Milosavljevic (14):
  sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 input, Mic2 routes.
  sun4i-codec: Add Mic Playback Volume.
  sun4i-codec: Add support for extra controls to struct
    sun4i_codec_quirks and use them.
  sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume.
  sun4i-codec: Merge sun4i_codec_left_mixer_controls and    
    sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch.
  sun4i-codec: Add FM Playback Volume.
  sun4i-codec: Add FM Left, FM Right, FM Playback Switch.
  sun4i-codec: Add Line Playback Volume.
  sun4i-codec: Add Line Boost Volume.
  sun4i-codec: Add Line Right, Line Left, Line Playback Switch.
  sun4i-codec: Add Differential Line Source.
  sun4i-codec: Add Left Capture Select, Right Capture Select.
  sun4i-codec: Add Capture Volume.

 sound/soc/sunxi/sun4i-codec.c | 233 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 210 insertions(+), 23 deletions(-)

-- 
2.1.4

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

* [PATCH v13 01/14] ASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 02/14] ASoC: sun4i-codec: Add Mic Playback Volume Danny Milosavljevic
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add MIC2 Pre-Amplifier and Mic2 for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 1500699..f703293 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -711,6 +711,8 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 	/* Mic Pre-Amplifiers */
 	SND_SOC_DAPM_PGA("MIC1 Pre-Amplifier", SUN4I_CODEC_ADC_ACTL,
 			 SUN4I_CODEC_ADC_ACTL_PREG1EN, 0, NULL, 0),
+	SND_SOC_DAPM_PGA("MIC2 Pre-Amplifier", SUN4I_CODEC_ADC_ACTL,
+			 SUN4I_CODEC_ADC_ACTL_PREG2EN, 0, NULL, 0),
 
 	/* Power Amplifier */
 	SND_SOC_DAPM_MIXER("Power Amplifier", SUN4I_CODEC_ADC_ACTL,
@@ -721,6 +723,7 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 			    &sun4i_codec_pa_mute),
 
 	SND_SOC_DAPM_INPUT("Mic1"),
+	SND_SOC_DAPM_INPUT("Mic2"),
 
 	SND_SOC_DAPM_OUTPUT("HP Right"),
 	SND_SOC_DAPM_OUTPUT("HP Left"),
@@ -760,6 +763,12 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	{ "Right ADC", NULL, "MIC1 Pre-Amplifier" },
 	{ "MIC1 Pre-Amplifier", NULL, "Mic1"},
 	{ "Mic1", NULL, "VMIC" },
+
+	/* Mic2 Routes */
+	{ "Left ADC", NULL, "MIC2 Pre-Amplifier" },
+	{ "Right ADC", NULL, "MIC2 Pre-Amplifier" },
+	{ "MIC2 Pre-Amplifier", NULL, "Mic2"},
+	{ "Mic2", NULL, "VMIC" },
 };
 
 static struct snd_soc_codec_driver sun4i_codec_codec = {
-- 
2.1.4

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

* [PATCH v13 02/14] ASoC: sun4i-codec: Add Mic Playback Volume.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 01/14] ASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 03/14] ASoC: sun4i-codec: Add support for extra controls to struct sun4i_codec_quirks and use them Danny Milosavljevic
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Mic Playback Volume for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index f703293..49b9cd1 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -64,6 +64,7 @@
 #define SUN4I_CODEC_DAC_ACTL_DACAENR			(31)
 #define SUN4I_CODEC_DAC_ACTL_DACAENL			(30)
 #define SUN4I_CODEC_DAC_ACTL_MIXEN			(29)
+#define SUN4I_CODEC_DAC_ACTL_MICG			(20)
 #define SUN4I_CODEC_DAC_ACTL_LDACLMIXS			(15)
 #define SUN4I_CODEC_DAC_ACTL_RDACRMIXS			(14)
 #define SUN4I_CODEC_DAC_ACTL_LDACRMIXS			(13)
@@ -643,11 +644,16 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
 			SUN4I_CODEC_DAC_ACTL_PA_MUTE, 1, 0);
 
 static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
+static DECLARE_TLV_DB_SCALE(sun4i_codec_micin_loopback_gain_scale, -450, 150,
+			    0);
 
 static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
 		       sun4i_codec_pa_volume_scale),
+	SOC_SINGLE_TLV("Mic Playback Volume", SUN4I_CODEC_DAC_ACTL,
+		       SUN4I_CODEC_DAC_ACTL_MICG, 7, 0,
+		       sun4i_codec_micin_loopback_gain_scale),
 };
 
 static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
-- 
2.1.4

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

* [PATCH v13 03/14] ASoC: sun4i-codec: Add support for extra controls to struct sun4i_codec_quirks and use them.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 01/14] ASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 02/14] ASoC: sun4i-codec: Add Mic Playback Volume Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 04/14] ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume Danny Milosavljevic
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Some controls use different registers depending on which Allwinner chip it is.
Provide a means of specifying and adding those controls.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 49b9cd1..42952af 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -777,7 +777,30 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	{ "Mic2", NULL, "VMIC" },
 };
 
+struct sun4i_codec_quirks {
+	const struct regmap_config *regmap_config;
+	const struct snd_soc_codec_driver *codec;
+	struct snd_soc_card * (*create_card)(struct device *dev);
+	struct reg_field reg_adc_fifoc;	/* used for regmap_field */
+	unsigned int reg_dac_txdata;	/* TX FIFO offset for DMA config */
+	unsigned int reg_adc_rxdata;	/* RX FIFO offset for DMA config */
+	bool has_reset;
+	const struct snd_kcontrol_new *controls;
+	unsigned int num_controls;
+};
+
+static int sun4i_codec_codec_probe(struct snd_soc_codec *scodec)
+{
+	const struct sun4i_codec_quirks *quirks;
+
+	quirks = of_device_get_match_data(scodec->dev);
+	return snd_soc_add_codec_controls(scodec,
+					  quirks->controls,
+					  quirks->num_controls);
+}
+
 static struct snd_soc_codec_driver sun4i_codec_codec = {
+	.probe = sun4i_codec_codec_probe,
 	.component_driver = {
 		.controls		= sun4i_codec_controls,
 		.num_controls		= ARRAY_SIZE(sun4i_codec_controls),
@@ -1434,16 +1457,6 @@ static const struct regmap_config sun8i_v3s_codec_regmap_config = {
 	.max_register	= SUN8I_H3_CODEC_ADC_DBG,
 };
 
-struct sun4i_codec_quirks {
-	const struct regmap_config *regmap_config;
-	const struct snd_soc_codec_driver *codec;
-	struct snd_soc_card * (*create_card)(struct device *dev);
-	struct reg_field reg_adc_fifoc;	/* used for regmap_field */
-	unsigned int reg_dac_txdata;	/* TX FIFO offset for DMA config */
-	unsigned int reg_adc_rxdata;	/* RX FIFO offset for DMA config */
-	bool has_reset;
-};
-
 static const struct sun4i_codec_quirks sun4i_codec_quirks = {
 	.regmap_config	= &sun4i_codec_regmap_config,
 	.codec		= &sun4i_codec_codec,
-- 
2.1.4

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

* [PATCH v13 04/14] ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (2 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 03/14] ASoC: sun4i-codec: Add support for extra controls to struct sun4i_codec_quirks and use them Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls Danny Milosavljevic
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Mic1 Boost Volume and Mic2 Boost Volume for Allwinner A10 and Allwinner
A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 42952af..c69b55c 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -95,6 +95,8 @@
 #define SUN4I_CODEC_ADC_ACTL_PREG1EN			(29)
 #define SUN4I_CODEC_ADC_ACTL_PREG2EN			(28)
 #define SUN4I_CODEC_ADC_ACTL_VMICEN			(27)
+#define SUN4I_CODEC_ADC_ACTL_PREG1			(25)
+#define SUN4I_CODEC_ADC_ACTL_PREG2			(23)
 #define SUN4I_CODEC_ADC_ACTL_VADCG			(20)
 #define SUN4I_CODEC_ADC_ACTL_ADCIS			(17)
 #define SUN4I_CODEC_ADC_ACTL_PA_EN			(4)
@@ -111,6 +113,9 @@
 /* Microphone controls (sun7i only) */
 #define SUN7I_CODEC_AC_MIC_PHONE_CAL		(0x3c)
 
+#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PREG1		(29)
+#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PREG2		(26)
+
 /*
  * sun6i specific registers
  *
@@ -646,6 +651,12 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
 static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_micin_loopback_gain_scale, -450, 150,
 			    0);
+static DECLARE_TLV_DB_RANGE(sun4i_codec_micin_preamp_gain_scale,
+			    0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
+			    1, 7, TLV_DB_SCALE_ITEM(3500, 300, 0));
+static DECLARE_TLV_DB_RANGE(sun7i_codec_micin_preamp_gain_scale,
+			    0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
+			    1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0));
 
 static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
@@ -656,6 +667,24 @@ static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 		       sun4i_codec_micin_loopback_gain_scale),
 };
 
+static const struct snd_kcontrol_new sun4i_codec_extra_controls[] = {
+	SOC_SINGLE_TLV("Mic1 Boost Volume", SUN4I_CODEC_ADC_ACTL,
+		       SUN4I_CODEC_ADC_ACTL_PREG1, 3, 0,
+		       sun4i_codec_micin_preamp_gain_scale),
+	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN4I_CODEC_ADC_ACTL,
+		       SUN4I_CODEC_ADC_ACTL_PREG2, 3, 0,
+		       sun4i_codec_micin_preamp_gain_scale),
+};
+
+static const struct snd_kcontrol_new sun7i_codec_extra_controls[] = {
+	SOC_SINGLE_TLV("Mic1 Boost Volume", SUN7I_CODEC_AC_MIC_PHONE_CAL,
+		       SUN7I_CODEC_AC_MIC_PHONE_CAL_PREG1, 7, 0,
+		       sun7i_codec_micin_preamp_gain_scale),
+	SOC_SINGLE_TLV("Mic2 Boost Volume", SUN7I_CODEC_AC_MIC_PHONE_CAL,
+		       SUN7I_CODEC_AC_MIC_PHONE_CAL_PREG2, 7, 0,
+		       sun7i_codec_micin_preamp_gain_scale),
+};
+
 static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
 	SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
@@ -1464,6 +1493,8 @@ static const struct sun4i_codec_quirks sun4i_codec_quirks = {
 	.reg_adc_fifoc	= REG_FIELD(SUN4I_CODEC_ADC_FIFOC, 0, 31),
 	.reg_dac_txdata	= SUN4I_CODEC_DAC_TXDATA,
 	.reg_adc_rxdata	= SUN4I_CODEC_ADC_RXDATA,
+	.controls = sun4i_codec_extra_controls,
+	.num_controls = ARRAY_SIZE(sun4i_codec_extra_controls),
 };
 
 static const struct sun4i_codec_quirks sun6i_a31_codec_quirks = {
@@ -1483,6 +1514,8 @@ static const struct sun4i_codec_quirks sun7i_codec_quirks = {
 	.reg_adc_fifoc	= REG_FIELD(SUN4I_CODEC_ADC_FIFOC, 0, 31),
 	.reg_dac_txdata	= SUN4I_CODEC_DAC_TXDATA,
 	.reg_adc_rxdata	= SUN4I_CODEC_ADC_RXDATA,
+	.controls = sun7i_codec_extra_controls,
+	.num_controls = ARRAY_SIZE(sun7i_codec_extra_controls),
 };
 
 static const struct sun4i_codec_quirks sun8i_a23_codec_quirks = {
-- 
2.1.4

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

* [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (3 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 04/14] ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-26  1:48   ` Chen-Yu Tsai
  2017-06-24  6:24 ` [PATCH v13 06/14] ASoC: sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch Danny Milosavljevic
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Since it's now possible to have a DAPM mixer control with multiple channels,
use it to cut down the total number of controls.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index c69b55c..3718137 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -685,15 +685,12 @@ static const struct snd_kcontrol_new sun7i_codec_extra_controls[] = {
 		       sun7i_codec_micin_preamp_gain_scale),
 };
 
-static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
-	SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
-			SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
-};
-
-static const struct snd_kcontrol_new sun4i_codec_right_mixer_controls[] = {
-	SOC_DAPM_SINGLE("Right DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
+static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
+	SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
+			SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
 			SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),
-	SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
+	SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
+			SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
 };
 
@@ -729,11 +726,11 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 
 	/* Mixers */
 	SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0,
-			   sun4i_codec_left_mixer_controls,
-			   ARRAY_SIZE(sun4i_codec_left_mixer_controls)),
+			   sun4i_codec_mixer_controls,
+			   ARRAY_SIZE(sun4i_codec_mixer_controls)),
 	SND_SOC_DAPM_MIXER("Right Mixer", SND_SOC_NOPM, 0, 0,
-			   sun4i_codec_right_mixer_controls,
-			   ARRAY_SIZE(sun4i_codec_right_mixer_controls)),
+			   sun4i_codec_mixer_controls,
+			   ARRAY_SIZE(sun4i_codec_mixer_controls)),
 
 	/* Global Mixer Enable */
 	SND_SOC_DAPM_SUPPLY("Mixer Enable", SUN4I_CODEC_DAC_ACTL,
@@ -775,12 +772,12 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 
 	/* Right Mixer Routes */
 	{ "Right Mixer", NULL, "Mixer Enable" },
-	{ "Right Mixer", "Left DAC Playback Switch", "Left DAC" },
-	{ "Right Mixer", "Right DAC Playback Switch", "Right DAC" },
+	{ "Right Mixer", "DAC Playback Switch", "Left DAC" },
+	{ "Right Mixer", "Right Mixer Left DAC Playback Switch", "Left DAC" },
 
 	/* Left Mixer Routes */
 	{ "Left Mixer", NULL, "Mixer Enable" },
-	{ "Left Mixer", "Left DAC Playback Switch", "Left DAC" },
+	{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
 
 	/* Power Amplifier Routes */
 	{ "Power Amplifier", "Mixer Playback Switch", "Left Mixer" },
-- 
2.1.4

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

* [PATCH v13 06/14] ASoC: sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (4 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 07/14] ASoC: sun4i-codec: Add FM Playback Volume Danny Milosavljevic
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Mic1 Playback Switch and Mic2 Playback Switch for Allwinner A10 and
Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 3718137..55687f9 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -68,6 +68,10 @@
 #define SUN4I_CODEC_DAC_ACTL_LDACLMIXS			(15)
 #define SUN4I_CODEC_DAC_ACTL_RDACRMIXS			(14)
 #define SUN4I_CODEC_DAC_ACTL_LDACRMIXS			(13)
+#define SUN4I_CODEC_DAC_ACTL_MIC1LS			(12)
+#define SUN4I_CODEC_DAC_ACTL_MIC1RS			(11)
+#define SUN4I_CODEC_DAC_ACTL_MIC2LS			(10)
+#define SUN4I_CODEC_DAC_ACTL_MIC2RS			(9)
 #define SUN4I_CODEC_DAC_ACTL_DACPAS			(8)
 #define SUN4I_CODEC_DAC_ACTL_MIXPAS			(7)
 #define SUN4I_CODEC_DAC_ACTL_PA_MUTE			(6)
@@ -692,6 +696,12 @@ static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
 	SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
 			SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
+	SOC_DAPM_DOUBLE("Mic1 Playback Switch", SUN4I_CODEC_DAC_ACTL,
+			SUN4I_CODEC_DAC_ACTL_MIC1LS,
+			SUN4I_CODEC_DAC_ACTL_MIC1RS, 1, 0),
+	SOC_DAPM_DOUBLE("Mic2 Playback Switch", SUN4I_CODEC_DAC_ACTL,
+			SUN4I_CODEC_DAC_ACTL_MIC2LS,
+			SUN4I_CODEC_DAC_ACTL_MIC2RS, 1, 0),
 };
 
 static const struct snd_kcontrol_new sun4i_codec_pa_mixer_controls[] = {
@@ -774,10 +784,14 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	{ "Right Mixer", NULL, "Mixer Enable" },
 	{ "Right Mixer", "DAC Playback Switch", "Left DAC" },
 	{ "Right Mixer", "Right Mixer Left DAC Playback Switch", "Left DAC" },
+	{ "Right Mixer", "Mic1 Playback Switch", "MIC1 Pre-Amplifier" },
+	{ "Right Mixer", "Mic2 Playback Switch", "MIC2 Pre-Amplifier" },
 
 	/* Left Mixer Routes */
 	{ "Left Mixer", NULL, "Mixer Enable" },
 	{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
+	{ "Left Mixer", "Mic1 Playback Switch", "MIC1 Pre-Amplifier" },
+	{ "Left Mixer", "Mic2 Playback Switch", "MIC2 Pre-Amplifier" },
 
 	/* Power Amplifier Routes */
 	{ "Power Amplifier", "Mixer Playback Switch", "Left Mixer" },
-- 
2.1.4

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

* [PATCH v13 07/14] ASoC: sun4i-codec: Add FM Playback Volume.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (5 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 06/14] ASoC: sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 08/14] ASoC: sun4i-codec: Add FM Left, FM Right, FM Playback Switch Danny Milosavljevic
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add FM Playback Volume for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 55687f9..5b6f100 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -64,6 +64,7 @@
 #define SUN4I_CODEC_DAC_ACTL_DACAENR			(31)
 #define SUN4I_CODEC_DAC_ACTL_DACAENL			(30)
 #define SUN4I_CODEC_DAC_ACTL_MIXEN			(29)
+#define SUN4I_CODEC_DAC_ACTL_FMG			(23)
 #define SUN4I_CODEC_DAC_ACTL_MICG			(20)
 #define SUN4I_CODEC_DAC_ACTL_LDACLMIXS			(15)
 #define SUN4I_CODEC_DAC_ACTL_RDACRMIXS			(14)
@@ -653,6 +654,8 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
 			SUN4I_CODEC_DAC_ACTL_PA_MUTE, 1, 0);
 
 static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
+static DECLARE_TLV_DB_SCALE(sun4i_codec_fmin_loopback_gain_scale, -450, 150,
+			    0);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_micin_loopback_gain_scale, -450, 150,
 			    0);
 static DECLARE_TLV_DB_RANGE(sun4i_codec_micin_preamp_gain_scale,
@@ -666,6 +669,9 @@ static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
 		       sun4i_codec_pa_volume_scale),
+	SOC_SINGLE_TLV("FM Playback Volume", SUN4I_CODEC_DAC_ACTL,
+		       SUN4I_CODEC_DAC_ACTL_FMG, 3, 0,
+		       sun4i_codec_fmin_loopback_gain_scale),
 	SOC_SINGLE_TLV("Mic Playback Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_MICG, 7, 0,
 		       sun4i_codec_micin_loopback_gain_scale),
-- 
2.1.4

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

* [PATCH v13 08/14] ASoC: sun4i-codec: Add FM Left, FM Right, FM Playback Switch.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (6 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 07/14] ASoC: sun4i-codec: Add FM Playback Volume Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-27  6:09   ` kbuild test robot
  2017-06-24  6:24 ` [PATCH v13 09/14] ASoC: sun4i-codec: Add Line Playback Volume Danny Milosavljevic
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add FM Left, FM Right, FM Playback Switch for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 5b6f100..234ded2 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -702,6 +702,9 @@ static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
 	SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
 			SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
+	SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
+			SUN4I_CODEC_DAC_ACTL_LFMS,
+			SUN4I_CODEC_DAC_ACTL_RFMS, 1, 0),
 	SOC_DAPM_DOUBLE("Mic1 Playback Switch", SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_MIC1LS,
 			SUN4I_CODEC_DAC_ACTL_MIC1RS, 1, 0),
@@ -770,6 +773,8 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 	SND_SOC_DAPM_SWITCH("Power Amplifier Mute", SND_SOC_NOPM, 0, 0,
 			    &sun4i_codec_pa_mute),
 
+	SND_SOC_DAPM_INPUT("FM Right"),
+	SND_SOC_DAPM_INPUT("FM Left"),
 	SND_SOC_DAPM_INPUT("Mic1"),
 	SND_SOC_DAPM_INPUT("Mic2"),
 
@@ -790,12 +795,14 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	{ "Right Mixer", NULL, "Mixer Enable" },
 	{ "Right Mixer", "DAC Playback Switch", "Left DAC" },
 	{ "Right Mixer", "Right Mixer Left DAC Playback Switch", "Left DAC" },
+	{ "Right Mixer", "FM Playback Switch", "FM Right" },
 	{ "Right Mixer", "Mic1 Playback Switch", "MIC1 Pre-Amplifier" },
 	{ "Right Mixer", "Mic2 Playback Switch", "MIC2 Pre-Amplifier" },
 
 	/* Left Mixer Routes */
 	{ "Left Mixer", NULL, "Mixer Enable" },
 	{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
+	{ "Left Mixer", "FM Playback Switch", "FM Left" },
 	{ "Left Mixer", "Mic1 Playback Switch", "MIC1 Pre-Amplifier" },
 	{ "Left Mixer", "Mic2 Playback Switch", "MIC2 Pre-Amplifier" },
 
-- 
2.1.4

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

* [PATCH v13 09/14] ASoC: sun4i-codec: Add Line Playback Volume.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (7 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 08/14] ASoC: sun4i-codec: Add FM Left, FM Right, FM Playback Switch Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 10/14] ASoC: sun4i-codec: Add Line Boost Volume Danny Milosavljevic
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Line Playback Volume for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 234ded2..c47ffd5 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -64,8 +64,11 @@
 #define SUN4I_CODEC_DAC_ACTL_DACAENR			(31)
 #define SUN4I_CODEC_DAC_ACTL_DACAENL			(30)
 #define SUN4I_CODEC_DAC_ACTL_MIXEN			(29)
+#define SUN4I_CODEC_DAC_ACTL_LNG			(26)
 #define SUN4I_CODEC_DAC_ACTL_FMG			(23)
 #define SUN4I_CODEC_DAC_ACTL_MICG			(20)
+#define SUN4I_CODEC_DAC_ACTL_LFMS			(17)
+#define SUN4I_CODEC_DAC_ACTL_RFMS			(16)
 #define SUN4I_CODEC_DAC_ACTL_LDACLMIXS			(15)
 #define SUN4I_CODEC_DAC_ACTL_RDACRMIXS			(14)
 #define SUN4I_CODEC_DAC_ACTL_LDACRMIXS			(13)
@@ -654,6 +657,8 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
 			SUN4I_CODEC_DAC_ACTL_PA_MUTE, 1, 0);
 
 static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
+static DECLARE_TLV_DB_SCALE(sun4i_codec_linein_loopback_gain_scale, -150, 150,
+			    0);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_fmin_loopback_gain_scale, -450, 150,
 			    0);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_micin_loopback_gain_scale, -450, 150,
@@ -669,6 +674,9 @@ static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
 		       sun4i_codec_pa_volume_scale),
+	SOC_SINGLE_TLV("Line Playback Volume", SUN4I_CODEC_DAC_ACTL,
+		       SUN4I_CODEC_DAC_ACTL_LNG, 1, 0,
+		       sun4i_codec_linein_loopback_gain_scale),
 	SOC_SINGLE_TLV("FM Playback Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_FMG, 3, 0,
 		       sun4i_codec_fmin_loopback_gain_scale),
-- 
2.1.4

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

* [PATCH v13 10/14] ASoC: sun4i-codec: Add Line Boost Volume.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (8 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 09/14] ASoC: sun4i-codec: Add Line Playback Volume Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 11/14] ASoC: sun4i-codec: Add Line Right, Line Left, Line Playback Switch Danny Milosavljevic
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Line Boost Volume for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index c47ffd5..564df33 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -107,6 +107,7 @@
 #define SUN4I_CODEC_ADC_ACTL_PREG2			(23)
 #define SUN4I_CODEC_ADC_ACTL_VADCG			(20)
 #define SUN4I_CODEC_ADC_ACTL_ADCIS			(17)
+#define SUN4I_CODEC_ADC_ACTL_LNPREG			(13)
 #define SUN4I_CODEC_ADC_ACTL_PA_EN			(4)
 #define SUN4I_CODEC_ADC_ACTL_DDE			(3)
 #define SUN4I_CODEC_ADC_DEBUG			(0x2c)
@@ -659,6 +660,8 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute =
 static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_linein_loopback_gain_scale, -150, 150,
 			    0);
+static DECLARE_TLV_DB_SCALE(sun4i_codec_linein_preamp_gain_scale, -1200, 300,
+			    0);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_fmin_loopback_gain_scale, -450, 150,
 			    0);
 static DECLARE_TLV_DB_SCALE(sun4i_codec_micin_loopback_gain_scale, -450, 150,
@@ -677,6 +680,9 @@ static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Line Playback Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_LNG, 1, 0,
 		       sun4i_codec_linein_loopback_gain_scale),
+	SOC_SINGLE_TLV("Line Boost Volume", SUN4I_CODEC_ADC_ACTL,
+		       SUN4I_CODEC_ADC_ACTL_LNPREG, 7, 0,
+		       sun4i_codec_linein_preamp_gain_scale),
 	SOC_SINGLE_TLV("FM Playback Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_FMG, 3, 0,
 		       sun4i_codec_fmin_loopback_gain_scale),
-- 
2.1.4

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

* [PATCH v13 11/14] ASoC: sun4i-codec: Add Line Right, Line Left, Line Playback Switch.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (9 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 10/14] ASoC: sun4i-codec: Add Line Boost Volume Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 12/14] ASoC: sun4i-codec: Add Differential Line Source Danny Milosavljevic
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Line Right, Line Left, Line Playback Switch for Allwinner A10 and
Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 564df33..bcd665d 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -67,6 +67,8 @@
 #define SUN4I_CODEC_DAC_ACTL_LNG			(26)
 #define SUN4I_CODEC_DAC_ACTL_FMG			(23)
 #define SUN4I_CODEC_DAC_ACTL_MICG			(20)
+#define SUN4I_CODEC_DAC_ACTL_LLNS			(19)
+#define SUN4I_CODEC_DAC_ACTL_RLNS			(18)
 #define SUN4I_CODEC_DAC_ACTL_LFMS			(17)
 #define SUN4I_CODEC_DAC_ACTL_RFMS			(16)
 #define SUN4I_CODEC_DAC_ACTL_LDACLMIXS			(15)
@@ -716,6 +718,9 @@ static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
 	SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
 			SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
+	SOC_DAPM_DOUBLE("Line Playback Switch", SUN4I_CODEC_DAC_ACTL,
+			SUN4I_CODEC_DAC_ACTL_LLNS,
+			SUN4I_CODEC_DAC_ACTL_RLNS, 1, 0),
 	SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
 			SUN4I_CODEC_DAC_ACTL_LFMS,
 			SUN4I_CODEC_DAC_ACTL_RFMS, 1, 0),
@@ -787,6 +792,8 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 	SND_SOC_DAPM_SWITCH("Power Amplifier Mute", SND_SOC_NOPM, 0, 0,
 			    &sun4i_codec_pa_mute),
 
+	SND_SOC_DAPM_INPUT("Line Right"),
+	SND_SOC_DAPM_INPUT("Line Left"),
 	SND_SOC_DAPM_INPUT("FM Right"),
 	SND_SOC_DAPM_INPUT("FM Left"),
 	SND_SOC_DAPM_INPUT("Mic1"),
@@ -809,6 +816,7 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	{ "Right Mixer", NULL, "Mixer Enable" },
 	{ "Right Mixer", "DAC Playback Switch", "Left DAC" },
 	{ "Right Mixer", "Right Mixer Left DAC Playback Switch", "Left DAC" },
+	{ "Right Mixer", "Line Playback Switch", "Line Right" },
 	{ "Right Mixer", "FM Playback Switch", "FM Right" },
 	{ "Right Mixer", "Mic1 Playback Switch", "MIC1 Pre-Amplifier" },
 	{ "Right Mixer", "Mic2 Playback Switch", "MIC2 Pre-Amplifier" },
@@ -816,6 +824,7 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	/* Left Mixer Routes */
 	{ "Left Mixer", NULL, "Mixer Enable" },
 	{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
+	{ "Left Mixer", "Line Playback Switch", "Line Left" },
 	{ "Left Mixer", "FM Playback Switch", "FM Left" },
 	{ "Left Mixer", "Mic1 Playback Switch", "MIC1 Pre-Amplifier" },
 	{ "Left Mixer", "Mic2 Playback Switch", "MIC2 Pre-Amplifier" },
-- 
2.1.4

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

* [PATCH v13 12/14] ASoC: sun4i-codec: Add Differential Line Source.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (10 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 11/14] ASoC: sun4i-codec: Add Line Right, Line Left, Line Playback Switch Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 13/14] ASoC: sun4i-codec: Add Left Capture Select, Right Capture Select Danny Milosavljevic
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Differential Line Source for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index bcd665d..085a603 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -110,6 +110,7 @@
 #define SUN4I_CODEC_ADC_ACTL_VADCG			(20)
 #define SUN4I_CODEC_ADC_ACTL_ADCIS			(17)
 #define SUN4I_CODEC_ADC_ACTL_LNPREG			(13)
+#define SUN4I_CODEC_ADC_ACTL_LNRDF			(16)
 #define SUN4I_CODEC_ADC_ACTL_PA_EN			(4)
 #define SUN4I_CODEC_ADC_ACTL_DDE			(3)
 #define SUN4I_CODEC_ADC_DEBUG			(0x2c)
@@ -675,6 +676,20 @@ static DECLARE_TLV_DB_RANGE(sun7i_codec_micin_preamp_gain_scale,
 			    0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
 			    1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0));
 
+static const char * const sun4i_codec_difflinein_source[] = {
+	"Stereo",
+	"Differential",
+};
+
+static SOC_ENUM_SINGLE_DECL(sun4i_codec_enum_difflinein_source,
+			    SUN4I_CODEC_ADC_ACTL,
+			    SUN4I_CODEC_ADC_ACTL_LNRDF,
+			    sun4i_codec_difflinein_source);
+
+static const struct snd_kcontrol_new sun4i_codec_difflinein_source_controls =
+	SOC_DAPM_ENUM("Differential Line Source",
+		      sun4i_codec_enum_difflinein_source);
+
 static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0,
@@ -792,6 +807,11 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 	SND_SOC_DAPM_SWITCH("Power Amplifier Mute", SND_SOC_NOPM, 0, 0,
 			    &sun4i_codec_pa_mute),
 
+	/* MUX */
+	SND_SOC_DAPM_MUX("Differential Line Source", SND_SOC_NOPM,
+			 0, 0,
+			 &sun4i_codec_difflinein_source_controls),
+
 	SND_SOC_DAPM_INPUT("Line Right"),
 	SND_SOC_DAPM_INPUT("Line Left"),
 	SND_SOC_DAPM_INPUT("FM Right"),
@@ -851,6 +871,10 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	{ "Right ADC", NULL, "MIC2 Pre-Amplifier" },
 	{ "MIC2 Pre-Amplifier", NULL, "Mic2"},
 	{ "Mic2", NULL, "VMIC" },
+
+	/* LNRDF Routes */
+	{ "Differential Line Source", "Differential", "Line Left" },
+	{ "Differential Line Source", "Differential", "Line Right" },
 };
 
 struct sun4i_codec_quirks {
-- 
2.1.4

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

* [PATCH v13 13/14] ASoC: sun4i-codec: Add Left Capture Select, Right Capture Select.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (11 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 12/14] ASoC: sun4i-codec: Add Differential Line Source Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-24  6:24 ` [PATCH v13 14/14] ASoC: sun4i-codec: Add Capture Volume Danny Milosavljevic
  2017-06-28  9:10 ` [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Chen-Yu Tsai
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Left Capture Select and Right Capture Select for Allwinner A10 and
Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 50 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 085a603..65a4685 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -676,6 +676,25 @@ static DECLARE_TLV_DB_RANGE(sun7i_codec_micin_preamp_gain_scale,
 			    0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
 			    1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0));
 
+static const char * const sun4i_codec_capture_source[] = {
+	"Line",
+	"FM",
+	"Mic1",
+	"Mic2",
+	"Mic1,Mic2",
+	"Mic1+Mic2",
+	"Output Mixer",
+	"Line,Mic1",
+};
+
+static SOC_ENUM_SINGLE_DECL(sun4i_codec_enum_capture_source,
+			    SUN4I_CODEC_ADC_ACTL,
+			    SUN4I_CODEC_ADC_ACTL_ADCIS,
+			    sun4i_codec_capture_source);
+
+static const struct snd_kcontrol_new sun4i_codec_capture_source_controls =
+	SOC_DAPM_ENUM("Capture Source", sun4i_codec_enum_capture_source);
+
 static const char * const sun4i_codec_difflinein_source[] = {
 	"Stereo",
 	"Differential",
@@ -808,6 +827,10 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
 			    &sun4i_codec_pa_mute),
 
 	/* MUX */
+	SND_SOC_DAPM_MUX("Left Capture Select", SND_SOC_NOPM, 0, 0,
+			 &sun4i_codec_capture_source_controls),
+	SND_SOC_DAPM_MUX("Right Capture Select", SND_SOC_NOPM, 0, 0,
+			 &sun4i_codec_capture_source_controls),
 	SND_SOC_DAPM_MUX("Differential Line Source", SND_SOC_NOPM,
 			 0, 0,
 			 &sun4i_codec_difflinein_source_controls),
@@ -875,6 +898,33 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
 	/* LNRDF Routes */
 	{ "Differential Line Source", "Differential", "Line Left" },
 	{ "Differential Line Source", "Differential", "Line Right" },
+
+	/* Right ADC Input Routes */
+	{ "Right Capture Select", "Line", "Line Right" },
+	{ "Right Capture Select", "Line", "Differential Line Capture Switch" },
+	{ "Right Capture Select", "FM", "FM Right" },
+	{ "Right Capture Select", "Mic1", "MIC1 Pre-Amplifier" },
+	{ "Right Capture Select", "Mic2", "MIC2 Pre-Amplifier" },
+	{ "Right Capture Select", "Mic1,Mic2", "MIC2 Pre-Amplifier" },
+	{ "Right Capture Select", "Mic1+Mic2", "MIC2 Pre-Amplifier" },
+	{ "Right Capture Select", "Mic1+Mic2", "MIC1 Pre-Amplifier" },
+	{ "Right Capture Select", "Output Mixer", "Right Mixer" },
+	{ "Right Capture Select", "Line,Mic1", "MIC1 Pre-Amplifier" },
+	{ "Right ADC", NULL, "Right Capture Select" },
+
+	/* Left ADC Input Routes */
+	{ "Left Capture Select", "Line", "Line Left" },
+	{ "Left Capture Select", "Line", "Differential Line Capture Switch" },
+	{ "Left Capture Select", "FM", "FM Left" },
+	{ "Left Capture Select", "Mic1", "MIC1 Pre-Amplifier" },
+	{ "Left Capture Select", "Mic2", "MIC2 Pre-Amplifier" },
+	{ "Left Capture Select", "Mic1,Mic2", "MIC1 Pre-Amplifier" },
+	{ "Left Capture Select", "Mic1+Mic2", "MIC1 Pre-Amplifier" },
+	{ "Left Capture Select", "Mic1+Mic2", "MIC2 Pre-Amplifier" },
+	{ "Left Capture Select", "Output Mixer", "Left Mixer" },
+	{ "Left Capture Select", "Line,Mic1", "Line Left" },
+	{ "Left Capture Select", "Line,Mic1", "Differential Line Capture Switch" },
+	{ "Left ADC", NULL, "Left Capture Select" },
 };
 
 struct sun4i_codec_quirks {
-- 
2.1.4

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

* [PATCH v13 14/14] ASoC: sun4i-codec: Add Capture Volume.
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (12 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 13/14] ASoC: sun4i-codec: Add Left Capture Select, Right Capture Select Danny Milosavljevic
@ 2017-06-24  6:24 ` Danny Milosavljevic
  2017-06-28  9:10 ` [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Chen-Yu Tsai
  14 siblings, 0 replies; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-24  6:24 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, alsa-devel, linux-arm-kernel,
	linux-kernel, linux-sunxi
  Cc: Danny Milosavljevic

Add Capture Volume for Allwinner A10 and Allwinner A20.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
---
 sound/soc/sunxi/sun4i-codec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index 65a4685..a596249 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -675,6 +675,7 @@ static DECLARE_TLV_DB_RANGE(sun4i_codec_micin_preamp_gain_scale,
 static DECLARE_TLV_DB_RANGE(sun7i_codec_micin_preamp_gain_scale,
 			    0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
 			    1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0));
+static DECLARE_TLV_DB_SCALE(sun4i_codec_adc_gain_scale, -450, 150, 0);
 
 static const char * const sun4i_codec_capture_source[] = {
 	"Line",
@@ -725,6 +726,10 @@ static const struct snd_kcontrol_new sun4i_codec_controls[] = {
 	SOC_SINGLE_TLV("Mic Playback Volume", SUN4I_CODEC_DAC_ACTL,
 		       SUN4I_CODEC_DAC_ACTL_MICG, 7, 0,
 		       sun4i_codec_micin_loopback_gain_scale),
+	/* ADC */
+	SOC_SINGLE_TLV("Capture Volume", SUN4I_CODEC_ADC_ACTL,
+		       SUN4I_CODEC_ADC_ACTL_VADCG, 4, 0,
+		       sun4i_codec_adc_gain_scale),
 };
 
 static const struct snd_kcontrol_new sun4i_codec_extra_controls[] = {
-- 
2.1.4

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

* Re: [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  2017-06-24  6:24 ` [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls Danny Milosavljevic
@ 2017-06-26  1:48   ` Chen-Yu Tsai
  2017-06-26 19:21     ` Maxime Ripard
  2017-06-28 18:12     ` Mark Brown
  0 siblings, 2 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2017-06-26  1:48 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Danny Milosavljevic, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Chen-Yu Tsai, Linux-ALSA, linux-arm-kernel,
	linux-kernel, linux-sunxi

On Sat, Jun 24, 2017 at 2:24 PM, Danny Milosavljevic
<dannym@scratchpost.org> wrote:
> Since it's now possible to have a DAPM mixer control with multiple channels,
> use it to cut down the total number of controls.
>
> Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
> ---
>  sound/soc/sunxi/sun4i-codec.c | 27 ++++++++++++---------------
>  1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> index c69b55c..3718137 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -685,15 +685,12 @@ static const struct snd_kcontrol_new sun7i_codec_extra_controls[] = {
>                        sun7i_codec_micin_preamp_gain_scale),
>  };
>
> -static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
> -       SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> -                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
> -};
> -
> -static const struct snd_kcontrol_new sun4i_codec_right_mixer_controls[] = {
> -       SOC_DAPM_SINGLE("Right DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> +static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
> +       SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> +                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
>                         SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),

This changes the mixer control names exposed to userspace. While I think
consolidating mixer controls is nice, giving the user a less cluttered
view, I'm not sure about the changing a possible userspace ABI.

Maxime, ALSA and ASoC people, any comments about this?

ChenYu

> -       SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> +       SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
> +                       SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
>  };
>
> @@ -729,11 +726,11 @@ static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
>
>         /* Mixers */
>         SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0,
> -                          sun4i_codec_left_mixer_controls,
> -                          ARRAY_SIZE(sun4i_codec_left_mixer_controls)),
> +                          sun4i_codec_mixer_controls,
> +                          ARRAY_SIZE(sun4i_codec_mixer_controls)),
>         SND_SOC_DAPM_MIXER("Right Mixer", SND_SOC_NOPM, 0, 0,
> -                          sun4i_codec_right_mixer_controls,
> -                          ARRAY_SIZE(sun4i_codec_right_mixer_controls)),
> +                          sun4i_codec_mixer_controls,
> +                          ARRAY_SIZE(sun4i_codec_mixer_controls)),
>
>         /* Global Mixer Enable */
>         SND_SOC_DAPM_SUPPLY("Mixer Enable", SUN4I_CODEC_DAC_ACTL,
> @@ -775,12 +772,12 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
>
>         /* Right Mixer Routes */
>         { "Right Mixer", NULL, "Mixer Enable" },
> -       { "Right Mixer", "Left DAC Playback Switch", "Left DAC" },
> -       { "Right Mixer", "Right DAC Playback Switch", "Right DAC" },
> +       { "Right Mixer", "DAC Playback Switch", "Left DAC" },
> +       { "Right Mixer", "Right Mixer Left DAC Playback Switch", "Left DAC" },
>
>         /* Left Mixer Routes */
>         { "Left Mixer", NULL, "Mixer Enable" },
> -       { "Left Mixer", "Left DAC Playback Switch", "Left DAC" },
> +       { "Left Mixer", "DAC Playback Switch", "Left DAC" },
>
>         /* Power Amplifier Routes */
>         { "Power Amplifier", "Mixer Playback Switch", "Left Mixer" },
> --
> 2.1.4
>

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

* Re: [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  2017-06-26  1:48   ` Chen-Yu Tsai
@ 2017-06-26 19:21     ` Maxime Ripard
  2017-06-28  8:25       ` [linux-sunxi] " Danny Milosavljevic
  2017-06-28 18:12     ` Mark Brown
  1 sibling, 1 reply; 22+ messages in thread
From: Maxime Ripard @ 2017-06-26 19:21 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Danny Milosavljevic, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Linux-ALSA, linux-arm-kernel, linux-kernel,
	linux-sunxi

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

On Mon, Jun 26, 2017 at 09:48:59AM +0800, Chen-Yu Tsai wrote:
> On Sat, Jun 24, 2017 at 2:24 PM, Danny Milosavljevic
> <dannym@scratchpost.org> wrote:
> > Since it's now possible to have a DAPM mixer control with multiple channels,
> > use it to cut down the total number of controls.
> >
> > Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
> > ---
> >  sound/soc/sunxi/sun4i-codec.c | 27 ++++++++++++---------------
> >  1 file changed, 12 insertions(+), 15 deletions(-)
> >
> > diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> > index c69b55c..3718137 100644
> > --- a/sound/soc/sunxi/sun4i-codec.c
> > +++ b/sound/soc/sunxi/sun4i-codec.c
> > @@ -685,15 +685,12 @@ static const struct snd_kcontrol_new sun7i_codec_extra_controls[] = {
> >                        sun7i_codec_micin_preamp_gain_scale),
> >  };
> >
> > -static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
> > -       SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > -                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
> > -};
> > -
> > -static const struct snd_kcontrol_new sun4i_codec_right_mixer_controls[] = {
> > -       SOC_DAPM_SINGLE("Right DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > +static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
> > +       SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > +                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
> >                         SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),
> 
> This changes the mixer control names exposed to userspace. While I think
> consolidating mixer controls is nice, giving the user a less cluttered
> view, I'm not sure about the changing a possible userspace ABI.
> 
> Maxime, ALSA and ASoC people, any comments about this?

Yeah, breaking userspace is definitely not ok.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

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

* Re: [PATCH v13 08/14] ASoC: sun4i-codec: Add FM Left, FM Right, FM Playback Switch.
  2017-06-24  6:24 ` [PATCH v13 08/14] ASoC: sun4i-codec: Add FM Left, FM Right, FM Playback Switch Danny Milosavljevic
@ 2017-06-27  6:09   ` kbuild test robot
  0 siblings, 0 replies; 22+ messages in thread
From: kbuild test robot @ 2017-06-27  6:09 UTC (permalink / raw)
  To: Danny Milosavljevic
  Cc: kbuild-all, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Maxime Ripard, Chen-Yu Tsai, alsa-devel,
	linux-arm-kernel, linux-kernel, linux-sunxi, Danny Milosavljevic

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

Hi Danny,

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20170626]
[cannot apply to v4.12-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Danny-Milosavljevic/ASoC-sun4i-codec-Add-MIC2-Pre-Amplifier-Mic2/20170626-090107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

Note: the linux-review/Danny-Milosavljevic/ASoC-sun4i-codec-Add-MIC2-Pre-Amplifier-Mic2/20170626-090107 HEAD 44ff3730ffe45aa10f8cfeaf31443f0b7a78227f builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

   In file included from sound/soc/sunxi/sun4i-codec.c:39:0:
>> sound/soc/sunxi/sun4i-codec.c:706:4: error: 'SUN4I_CODEC_DAC_ACTL_LFMS' undeclared here (not in a function)
       SUN4I_CODEC_DAC_ACTL_LFMS,
       ^
   include/sound/soc.h:36:39: note: in definition of macro 'SOC_DOUBLE_VALUE'
     {.reg = xreg, .rreg = xreg, .shift = shift_left, \
                                          ^~~~~~~~~~
>> sound/soc/sunxi/sun4i-codec.c:705:2: note: in expansion of macro 'SOC_DAPM_DOUBLE'
     SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
     ^~~~~~~~~~~~~~~
>> sound/soc/sunxi/sun4i-codec.c:707:4: error: 'SUN4I_CODEC_DAC_ACTL_RFMS' undeclared here (not in a function)
       SUN4I_CODEC_DAC_ACTL_RFMS, 1, 0),
       ^
   include/sound/soc.h:37:12: note: in definition of macro 'SOC_DOUBLE_VALUE'
     .rshift = shift_right, .max = xmax, .platform_max = xmax, \
               ^~~~~~~~~~~
>> sound/soc/sunxi/sun4i-codec.c:705:2: note: in expansion of macro 'SOC_DAPM_DOUBLE'
     SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
     ^~~~~~~~~~~~~~~

vim +/SUN4I_CODEC_DAC_ACTL_LFMS +706 sound/soc/sunxi/sun4i-codec.c

   699		SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
   700				SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
   701				SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),
   702		SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
   703				SUN4I_CODEC_DAC_ACTL,
   704				SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
 > 705		SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
 > 706				SUN4I_CODEC_DAC_ACTL_LFMS,
 > 707				SUN4I_CODEC_DAC_ACTL_RFMS, 1, 0),
   708		SOC_DAPM_DOUBLE("Mic1 Playback Switch", SUN4I_CODEC_DAC_ACTL,
   709				SUN4I_CODEC_DAC_ACTL_MIC1LS,
   710				SUN4I_CODEC_DAC_ACTL_MIC1RS, 1, 0),

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 44869 bytes --]

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

* Re: [linux-sunxi] Re: [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  2017-06-26 19:21     ` Maxime Ripard
@ 2017-06-28  8:25       ` Danny Milosavljevic
  2017-06-28  8:38         ` Chen-Yu Tsai
  0 siblings, 1 reply; 22+ messages in thread
From: Danny Milosavljevic @ 2017-06-28  8:25 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Linux-ALSA, linux-arm-kernel, linux-kernel,
	linux-sunxi

Hi,

> > > -static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
> > > -       SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > > -                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
> > > -};
> > > -
> > > -static const struct snd_kcontrol_new sun4i_codec_right_mixer_controls[] = {
> > > -       SOC_DAPM_SINGLE("Right DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > > +static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
> > > +       SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > > +                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
> > >                         SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),  
> > 
> > This changes the mixer control names exposed to userspace. While I think
> > consolidating mixer controls is nice, giving the user a less cluttered
> > view, I'm not sure about the changing a possible userspace ABI.
> > 
> > Maxime, ALSA and ASoC people, any comments about this?  

>Yeah, breaking userspace is definitely not ok.

Okay.  I can restore DAC Playback Switch as two different controls with the same
names as before.

Is the mixer itself (SND_SOC_DAPM_MIXER) - not talking about its controls -
exposed to userspace?

Because if not, I can still merge the left mixer and right mixer and just fix up
the control names for DAC Playback Switch to be the same as before, something
like this:

static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
        SOC_DAPM_SINGLE("Left Mixer Left DAC Playback Switch", // !!!
                        SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
        SOC_DAPM_SINGLE("Right Mixer Right DAC Playback Switch", // !!!
                        SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),
        SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
                        SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
        SOC_DAPM_DOUBLE("Line Playback Switch", SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_LLNS,
                        SUN4I_CODEC_DAC_ACTL_RLNS, 1, 0),
        SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_LFMS,
                        SUN4I_CODEC_DAC_ACTL_RFMS, 1, 0),
        SOC_DAPM_DOUBLE("Mic1 Playback Switch", SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_MIC1LS,
                        SUN4I_CODEC_DAC_ACTL_MIC1RS, 1, 0),
        SOC_DAPM_DOUBLE("Mic2 Playback Switch", SUN4I_CODEC_DAC_ACTL,
                        SUN4I_CODEC_DAC_ACTL_MIC2LS,
                        SUN4I_CODEC_DAC_ACTL_MIC2RS, 1, 0),
};

static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
...
        SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0,
                           sun4i_codec_mixer_controls,
                           ARRAY_SIZE(sun4i_codec_mixer_controls)), // !!!
        SND_SOC_DAPM_MIXER("Right Mixer", SND_SOC_NOPM, 0, 0,
                           sun4i_codec_mixer_controls,
                           ARRAY_SIZE(sun4i_codec_mixer_controls)), // !!!
};

Would this be a good way?

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

* Re: [linux-sunxi] Re: [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  2017-06-28  8:25       ` [linux-sunxi] " Danny Milosavljevic
@ 2017-06-28  8:38         ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2017-06-28  8:38 UTC (permalink / raw)
  To: Danny Milosavljevic
  Cc: Maxime Ripard, Chen-Yu Tsai, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linux-ALSA, linux-arm-kernel,
	linux-kernel, linux-sunxi

On Wed, Jun 28, 2017 at 4:25 PM, Danny Milosavljevic
<dannym@scratchpost.org> wrote:
> Hi,
>
>> > > -static const struct snd_kcontrol_new sun4i_codec_left_mixer_controls[] = {
>> > > -       SOC_DAPM_SINGLE("Left DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
>> > > -                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
>> > > -};
>> > > -
>> > > -static const struct snd_kcontrol_new sun4i_codec_right_mixer_controls[] = {
>> > > -       SOC_DAPM_SINGLE("Right DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
>> > > +static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
>> > > +       SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
>> > > +                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
>> > >                         SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),
>> >
>> > This changes the mixer control names exposed to userspace. While I think
>> > consolidating mixer controls is nice, giving the user a less cluttered
>> > view, I'm not sure about the changing a possible userspace ABI.
>> >
>> > Maxime, ALSA and ASoC people, any comments about this?
>
>>Yeah, breaking userspace is definitely not ok.
>
> Okay.  I can restore DAC Playback Switch as two different controls with the same
> names as before.
>
> Is the mixer itself (SND_SOC_DAPM_MIXER) - not talking about its controls -
> exposed to userspace?

Other than debugfs, no it is not.

> Because if not, I can still merge the left mixer and right mixer and just fix up
> the control names for DAC Playback Switch to be the same as before, something
> like this:
>
> static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
>         SOC_DAPM_SINGLE("Left Mixer Left DAC Playback Switch", // !!!
>                         SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_LDACLMIXS, 1, 0),
>         SOC_DAPM_SINGLE("Right Mixer Right DAC Playback Switch", // !!!
>                         SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),
>         SOC_DAPM_SINGLE("Right Mixer Left DAC Playback Switch",
>                         SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_LDACRMIXS, 1, 0),
>         SOC_DAPM_DOUBLE("Line Playback Switch", SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_LLNS,
>                         SUN4I_CODEC_DAC_ACTL_RLNS, 1, 0),
>         SOC_DAPM_DOUBLE("FM Playback Switch", SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_LFMS,
>                         SUN4I_CODEC_DAC_ACTL_RFMS, 1, 0),
>         SOC_DAPM_DOUBLE("Mic1 Playback Switch", SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_MIC1LS,
>                         SUN4I_CODEC_DAC_ACTL_MIC1RS, 1, 0),
>         SOC_DAPM_DOUBLE("Mic2 Playback Switch", SUN4I_CODEC_DAC_ACTL,
>                         SUN4I_CODEC_DAC_ACTL_MIC2LS,
>                         SUN4I_CODEC_DAC_ACTL_MIC2RS, 1, 0),
> };
>
> static const struct snd_soc_dapm_widget sun4i_codec_codec_dapm_widgets[] = {
> ...
>         SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0,
>                            sun4i_codec_mixer_controls,
>                            ARRAY_SIZE(sun4i_codec_mixer_controls)), // !!!
>         SND_SOC_DAPM_MIXER("Right Mixer", SND_SOC_NOPM, 0, 0,
>                            sun4i_codec_mixer_controls,
>                            ARRAY_SIZE(sun4i_codec_mixer_controls)), // !!!
> };
>
> Would this be a good way?

I think that would work. We would need to verify that the DAPM routing
graph for the existing single channel controls work as intended though.

ChenYu

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

* Re: [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In
  2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
                   ` (13 preceding siblings ...)
  2017-06-24  6:24 ` [PATCH v13 14/14] ASoC: sun4i-codec: Add Capture Volume Danny Milosavljevic
@ 2017-06-28  9:10 ` Chen-Yu Tsai
  14 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2017-06-28  9:10 UTC (permalink / raw)
  To: Danny Milosavljevic
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Maxime Ripard, Chen-Yu Tsai, Linux-ALSA, linux-arm-kernel,
	linux-kernel, linux-sunxi

Hi,

On Sat, Jun 24, 2017 at 2:24 PM, Danny Milosavljevic
<dannym@scratchpost.org> wrote:
> This patchset adds some mixer controls to sun4i-codec for the Allwinner A10
> and the Allwinner A20.
>
> It also adds a mux for the capture source and the PGA for the MIC2 preamp.
>
> Where possible, it uses SOC_DAPM_DOUBLE in order to cut down on the number
> of distinct controls in alsamixer.
>
> v13 changes compared to v12 are:
>  - Added my "Signed-off-by".
>  - Clarified some commit message text.
>
> v12 changes compared to v11 are:
>  - Split up patchset in another way.
>  - Renamed "Mic1 Capture Volume" to "Mic1 Boost Volume".
>  - Renamed "Mic2 Capture Volume" to "Mic2 Boost Volume".
>  - Renamed "Line Capture Volume" to "Line Boost Volume".
>  - Renamed "Differential Line Capture Switch" to "Differential Line Source".
>
> v11 changes compared to v10 are:
>  - Split up patchset.
>  - Fixed typo in Differential Line Capture Switch.
>  - Renamed "Non-Differential" value to "Stereo".
>  - Removed duplicate PA Volume mixer control.
>
> v10 changes compared to v9 are:
>  - Use SOC_DAPM_DOUBLE where possible and it makes sense in order to cut
>    down on the number of controls.
>
> v9 changes compared to v8 are:
>  - added Line Differential Capture Switch.
>  - split Capture Source into Left Capture Select, Right Capture Select.
>  - added Line Capture Volume.
>  - rename "sun4i_codec_widgets" to "sun4i_codec_controls" for
>    consistency with the struct field it's used in.
>  - rename "Line-In" to "Line".
>  - rename "Power Amplifier Playback Volume" to "Headphone Playback Volume".
>
> v8 changes compared to v7 are:
>  - fixed the routes for line and mic capturing.
>
> v7 changes compared to v6 are:
>  - preparation for different A20, A10 controls is now in an extra patch.
>  - all register definitions are now at the top.
>  - sun7i-specific things (A20-specific things) are now less
>    grouped-together.
>  - rename "Power Amplifier Volume" to "Power Amplifier Playback Volume".
>
> v6 changes compared to v5 are:
>  - Mic preamplifier special cases for A20 and A10 now are now not
>    icky: There are two different _widget arrays and the probe() function
>    now selects the right one to pass to snd_soc_register_codec() unmodified.
>  - sun7i-specific things (A20-specific things) are now grouped together.
>
> v5 changes compared to v4 are:
>  - Mic preamplifier controls have more common names now.
>  - Mic preamplifier scale has a 0 dB entry as well now, as documented in the
>    A20 user manual.
>  - Mic preamplifier has special cases for A20 and A10 now.
>  - Gain controls have "Gain" in the name now.
>
> v4 changes compared to v3 are:
>  - names of the input are not uppercase anymore.
>  - bit index constants are now named as in the A20 user manual v1.4.
>  - added Mic1-In, Mac2-In.
>  - added Mic1 and Mic2 Pre-Amplifiers.
>
> v3 changes compared to v2 are:
>  - added DAPM routes.
>
> v2 changes compared to v1 are:
>  - moved Line-In and FM-In playback switches to their respective
>    sun4i_codec_*_mixer_controls.
>
> v1 changes:
>  - added linein, fmin output volumes and switches.
>
> Danny Milosavljevic (14):
>   sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 input, Mic2 routes.
>   sun4i-codec: Add Mic Playback Volume.
>   sun4i-codec: Add support for extra controls to struct
>     sun4i_codec_quirks and use them.
>   sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume.
>   sun4i-codec: Merge sun4i_codec_left_mixer_controls and
>     sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
>   sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch.
>   sun4i-codec: Add FM Playback Volume.
>   sun4i-codec: Add FM Left, FM Right, FM Playback Switch.
>   sun4i-codec: Add Line Playback Volume.
>   sun4i-codec: Add Line Boost Volume.
>   sun4i-codec: Add Line Right, Line Left, Line Playback Switch.
>   sun4i-codec: Add Differential Line Source.
>   sun4i-codec: Add Left Capture Select, Right Capture Select.
>   sun4i-codec: Add Capture Volume.

I think there's still room for improvement regarding the structure
of this patch series.

What I would like to see is one patch for each new feature or rework
of existing code. One major guideline is each patch should be
independently verifiable. If you add controls related to Mic2 across
multiple patches, and only the last one enables Mic2 playback, you
can't really verify if your "Mic2 Boost Volume" or "Mic2 routes"
were implemented correctly.

Also I suggest doing rework first, then adding controls that are
missing for widgets that already exist (such as Mic Playback Volume),
and adding new stuff last.

So something like the following, one patch per item:

* Add missing Mic1 Playback Switch
* Add missing Mic Playback Volume
* Add extra controls to sun4i_codec_quirks
* Add missing Mic1 Boost Volume
* Merge/rework left/right mixer controls
* Add Mic2 playback support (including pre-amp, input, routes, boost
  volume, playback switch)
* Add FM playback support (widgets, routes, volume, switch)
* Add Line playback support (widgets, routes, volume, switch,
  boost volume, differential)
* Add Capture Source mux widget and controls
* Add Capture Volume control

For each new item added, you can immediately test if all the controls
and routes work as intended by toggling them and listening to the
output and looking at DAPM debugfs output.

Thanks
ChenYu


>
>  sound/soc/sunxi/sun4i-codec.c | 233 +++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 210 insertions(+), 23 deletions(-)
>
> --
> 2.1.4
>

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

* Re: [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls.
  2017-06-26  1:48   ` Chen-Yu Tsai
  2017-06-26 19:21     ` Maxime Ripard
@ 2017-06-28 18:12     ` Mark Brown
  1 sibling, 0 replies; 22+ messages in thread
From: Mark Brown @ 2017-06-28 18:12 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Danny Milosavljevic, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Linux-ALSA, linux-arm-kernel,
	linux-kernel, linux-sunxi

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

On Mon, Jun 26, 2017 at 09:48:59AM +0800, Chen-Yu Tsai wrote:
> On Sat, Jun 24, 2017 at 2:24 PM, Danny Milosavljevic

> > +static const struct snd_kcontrol_new sun4i_codec_mixer_controls[] = {
> > +       SOC_DAPM_DOUBLE("DAC Playback Switch", SUN4I_CODEC_DAC_ACTL,
> > +                       SUN4I_CODEC_DAC_ACTL_LDACLMIXS,
> >                         SUN4I_CODEC_DAC_ACTL_RDACRMIXS, 1, 0),

> This changes the mixer control names exposed to userspace. While I think
> consolidating mixer controls is nice, giving the user a less cluttered
> view, I'm not sure about the changing a possible userspace ABI.

> Maxime, ALSA and ASoC people, any comments about this?

It's better not to change things but on the other hand it really depends
if there's any users who will notice - if nobody notices it doesn't
matter.

Can we *please* get some review of the rest of this series?  It's
enormous, we're on version *13* and the first review on this version
here is on patch 5.  If the first four patches are fine then please says
so, if they're not then let's have some review comments so things can
move towards merging them.

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

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

end of thread, other threads:[~2017-06-28 18:15 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24  6:24 [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 01/14] ASoC: sun4i-codec: Add MIC2 Pre-Amplifier, Mic2 Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 02/14] ASoC: sun4i-codec: Add Mic Playback Volume Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 03/14] ASoC: sun4i-codec: Add support for extra controls to struct sun4i_codec_quirks and use them Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 04/14] ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 05/14] ASoC: sun4i-codec: Merge sun4i_codec_left_mixer_controls and sun4i_codec_right_mixer_controls into sun4i_codec_mixer_controls Danny Milosavljevic
2017-06-26  1:48   ` Chen-Yu Tsai
2017-06-26 19:21     ` Maxime Ripard
2017-06-28  8:25       ` [linux-sunxi] " Danny Milosavljevic
2017-06-28  8:38         ` Chen-Yu Tsai
2017-06-28 18:12     ` Mark Brown
2017-06-24  6:24 ` [PATCH v13 06/14] ASoC: sun4i-codec: Add Mic1 Playback Switch, Mic2 Playback Switch Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 07/14] ASoC: sun4i-codec: Add FM Playback Volume Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 08/14] ASoC: sun4i-codec: Add FM Left, FM Right, FM Playback Switch Danny Milosavljevic
2017-06-27  6:09   ` kbuild test robot
2017-06-24  6:24 ` [PATCH v13 09/14] ASoC: sun4i-codec: Add Line Playback Volume Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 10/14] ASoC: sun4i-codec: Add Line Boost Volume Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 11/14] ASoC: sun4i-codec: Add Line Right, Line Left, Line Playback Switch Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 12/14] ASoC: sun4i-codec: Add Differential Line Source Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 13/14] ASoC: sun4i-codec: Add Left Capture Select, Right Capture Select Danny Milosavljevic
2017-06-24  6:24 ` [PATCH v13 14/14] ASoC: sun4i-codec: Add Capture Volume Danny Milosavljevic
2017-06-28  9:10 ` [PATCH v13 00/14] ASoC: sun4i-codec: Add Line-In, FM-In, Mic 2, Capture Source, Differential Line-In Chen-Yu Tsai

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