Skip to contentSkip to conversation

ASoC: ssm2602: switch to SPDX identifier

PATCH Superseded Marco Felsch 3 participants 6 messages Feb 6, 2019

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ASoC: ssm2602: switch to SPDX identifier

Drop old license header and switch to SPDX-License-Identifier.

---
Changelog:
v2:
- new created

 sound/soc/codecs/ssm2602.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
sound/soc/codecs/ssm2602.c +1 -15
index 501a4e73b185..580ab8916854 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * File:         sound/soc/codecs/ssm2602.c
  * Author:       Cliff Cai <[email protected]>
@@ -9,21 +10,6 @@
  *               Copyright 2008 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see the file COPYING, or write
- * to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <linux/module.h>
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/2 ASoC: ssm2602: Fix ADC powerup sequencing

From: Philipp Zabel <[email protected]>

According to the ssm2603 data sheet (control register sequencing), the digital core should be activated only after all necessary bits in the power register are enabled, and a delay determined by the decoupling capacitor on the VMID pin has passed. If the digital core is activated too early, or even before the ADC is powered up, audible artifacts appear at the beginning of the recorded signal.

The digital core is also needed for playback, so when recording starts it may already be enabled. This means we cannot get the power sequence correct when we want to be able to start recording after playback.

As a workaround put the MIC mute switch into the DAPM routes. This way we can keep the recording disabled until the MIC Bias has settled and thus get rid of audible artifacts.

[email protected]: adapt commit message [email protected]: drop of configuration as mentioned by Mark:

			 https://patchwork.kernel.org/patch/10407449/

---
Changelog:
v2:
- drop OF timeout configuration
- adapt commit message

 sound/soc/codecs/ssm2602.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
sound/soc/codecs/ssm2602.c +28 -2
index 580ab8916854..fa042b340c6d 100644
@@ -12,6 +12,7 @@
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  */
 
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
@@ -97,7 +98,6 @@ SOC_SINGLE_TLV("Sidetone Playback Volume", SSM2602_APANA, 6, 3, 1,
 
 SOC_SINGLE("Mic Boost (+20dB)", SSM2602_APANA, 0, 1, 0),
 SOC_SINGLE("Mic Boost2 (+20dB)", SSM2602_APANA, 8, 1, 0),
-SOC_SINGLE("Mic Switch", SSM2602_APANA, 1, 1, 1),
 };
 
 /* Output Mixer */
@@ -107,10 +107,31 @@ SOC_DAPM_SINGLE("HiFi Playback Switch", SSM2602_APANA, 4, 1, 0),
 SOC_DAPM_SINGLE("Mic Sidetone Switch", SSM2602_APANA, 5, 1, 0),
 };
 
+static const struct snd_kcontrol_new mic_ctl =
+	SOC_DAPM_SINGLE("Switch", SSM2602_APANA, 1, 1, 1);
+
 /* Input mux */
 static const struct snd_kcontrol_new ssm2602_input_mux_controls =
 SOC_DAPM_ENUM("Input Select", ssm2602_enum[0]);
 
+static int ssm2602_mic_switch_event(struct snd_soc_dapm_widget *w,
+				struct snd_kcontrol *kcontrol, int event)
+{
+	/*
+	 * According to the ssm2603 data sheet (control register sequencing),
+	 * the digital core should be activated only after all necessary bits
+	 * in the power register are enabled, and a delay determined by the
+	 * decoupling capacitor on the VMID pin has passed. If the digital core
+	 * is activated too early, or even before the ADC is powered up, audible
+	 * artifacts appear at the beginning and end of the recorded signal.
+	 *
+	 * In practice, audible artifacts disappear well over 500 ms.
+	 */
+	msleep(500);
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget ssm260x_dapm_widgets[] = {
 SND_SOC_DAPM_DAC("DAC", "HiFi Playback", SSM2602_PWR, 3, 1),
 SND_SOC_DAPM_ADC("ADC", "HiFi Capture", SSM2602_PWR, 2, 1),
@@ -132,6 +153,9 @@ SND_SOC_DAPM_MIXER("Output Mixer", SSM2602_PWR, 4, 1,
 SND_SOC_DAPM_MUX("Input Mux", SND_SOC_NOPM, 0, 0, &ssm2602_input_mux_controls),
 SND_SOC_DAPM_MICBIAS("Mic Bias", SSM2602_PWR, 1, 1),
 
+SND_SOC_DAPM_SWITCH_E("Mic Switch", SSM2602_APANA, 1, 1, &mic_ctl,
+		ssm2602_mic_switch_event, SND_SOC_DAPM_PRE_PMU),
+
 SND_SOC_DAPM_OUTPUT("LHPOUT"),
 SND_SOC_DAPM_OUTPUT("RHPOUT"),
 SND_SOC_DAPM_INPUT("MICIN"),
@@ -164,9 +188,11 @@ static const struct snd_soc_dapm_route ssm2602_routes[] = {
 	{"LHPOUT", NULL, "Output Mixer"},
 
 	{"Input Mux", "Line", "Line Input"},
-	{"Input Mux", "Mic", "Mic Bias"},
+	{"Input Mux", "Mic", "Mic Switch"},
 	{"ADC", NULL, "Input Mux"},
 
+	{"Mic Switch", NULL, "Mic Bias"},
+
 	{"Mic Bias", NULL, "MICIN"},
 };
 
Signature · 1 line
2.20.1
maintainer
#2 lore raw
In reply to Marco Felsch

sound/soc/codecs/ssm2602.c line 4

Quoted 5 lines · Marco Felsch
sound/soc/codecs/ssm2602.c +1 -0
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * File:         sound/soc/codecs/ssm2602.c
  * Author:       Cliff Cai <[email protected]>

Please convert the entire comment to C++ style so it looks more intentional and is consistent with other ASoC stuff.

#3 lore raw

Hi Mark,

Quoted 10 lines · Mark Brown

sound/soc/codecs/ssm2602.c line 4

Quoted 5 lines · Marco Felsch
sound/soc/codecs/ssm2602.c +1 -0
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * File:         sound/soc/codecs/ssm2602.c
  * Author:       Cliff Cai <[email protected]>

Please convert the entire comment to C++ style so it looks more intentional and is consistent with other ASoC stuff.

Okay, I will do this in the v3.

Regards,
Marco

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#4 lore raw
In reply to Mark Brown
Quoted 10 lines · Mark Brown

sound/soc/codecs/ssm2602.c line 4

Quoted 5 lines · Marco Felsch
sound/soc/codecs/ssm2602.c +1 -0
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * File:         sound/soc/codecs/ssm2602.c
  * Author:       Cliff Cai <[email protected]>

Please convert the entire comment to C++ style so it looks more intentional and is consistent with other ASoC stuff.

I don't know about how ASoC is special here, but I've seen the style picked by Marco quite often and considered that the "usual" style. Usually kernel code mandates C style comments and I though only the SPDX-specifier is special.

So ASoC is different in this aspect?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
maintainer
#5 lore raw
Quoted 11 lines · Uwe Kleine-König
Quoted 2 lines · Mark Brown

Please convert the entire comment to C++ style so it looks more intentional and is consistent with other ASoC stuff.

I don't know about how ASoC is special here, but I've seen the style picked by Marco quite often and considered that the "usual" style. Usually kernel code mandates C style comments and I though only the SPDX-specifier is special.

So ASoC is different in this aspect?

I'm doing the same for other subsystems - I was getting patches from people converting the SPDX headers back to C comments and it just looks ugly to me anyway to mix the styles on adjacent lines.