* [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage
@ 2018-01-11 8:40 fischerc
2018-01-11 15:07 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: fischerc @ 2018-01-11 8:40 UTC (permalink / raw)
To: alsa-devel
Cc: lgirdwood, broonie, perex, tiwai, richard.leitner, fabio.estevam,
bhumirks, linux-kernel, Christian Fischer
From: Christian Fischer <fischerc@swissphone.de>
The mic-bias-voltage should get powered up/down automatically.
Added missing DAPM_PRE and DAPM_POST widgets to fire up the mic_bias_event function.
Signed-off-by: Christian Fischer <fischerc@swissphone.de>
---
sound/soc/codecs/sgtl5000.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index f2bb4fe..4973365 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -260,6 +260,9 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = {
SND_SOC_DAPM_PRE("VAG_POWER_PRE", power_vag_event),
SND_SOC_DAPM_POST("VAG_POWER_POST", power_vag_event),
+
+ SND_SOC_DAPM_PRE("MIC_BIAS_PRE", mic_bias_event),
+ SND_SOC_DAPM_POST("MIC_BIAS_POST", mic_bias_event),
};
/* routes for sgtl5000 */
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage
2018-01-11 8:40 [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage fischerc
@ 2018-01-11 15:07 ` Mark Brown
2018-01-11 16:14 ` AW: " Fischer, Christian
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2018-01-11 15:07 UTC (permalink / raw)
To: fischerc
Cc: alsa-devel, lgirdwood, perex, tiwai, richard.leitner,
fabio.estevam, bhumirks, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On Thu, Jan 11, 2018 at 09:40:31AM +0100, fischerc@swissphone.de wrote:
> The mic-bias-voltage should get powered up/down automatically.
> Added missing DAPM_PRE and DAPM_POST widgets to fire up the mic_bias_event function.
> + SND_SOC_DAPM_PRE("MIC_BIAS_PRE", mic_bias_event),
> + SND_SOC_DAPM_POST("MIC_BIAS_POST", mic_bias_event),
I don't understand what this is intended to do. The mic_bias_event()
callback is already hooked up to the Mic Bias supply widget, it should
be invoked whenever the bias is turned on and off already?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* AW: [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage
2018-01-11 15:07 ` Mark Brown
@ 2018-01-11 16:14 ` Fischer, Christian
2018-01-11 16:19 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Fischer, Christian @ 2018-01-11 16:14 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.com, richard.leitner@skidata.com,
fabio.estevam@nxp.com, bhumirks@gmail.com,
linux-kernel@vger.kernel.org
Hi Mark,
Unfortunately, this was not the case with my tests.
The supply is switched off at the start of the driver, but when starting a recording not started.
The function "mic_bias_event" only consumes SND_SOC_DAPM_POST_PMU (0x02) and SND_SOC_DAPM_PRE_PMD (0x04).
I changed:
> SND_SOC_DAPM_SUPPLY("Mic Bias", SGTL5000_CHIP_MIC_CTRL, 8, 0,
> mic_bias_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
to:
> SND_SOC_DAPM_SUPPLY("Mic Bias", SGTL5000_CHIP_MIC_CTRL, 8, 0,
> mic_bias_event, 0xFF),
To receive all events.
And added this to "mic_bias_event":
> dev_info(codec->dev, "mic_bias_event event: %d\n", event);
At probing I got this:
sgtl5000 1-000a: mic_bias_event event: 128
sgtl5000 1-000a: mic_bias_event event: 4 --> /* before widget power down, this disables the mic-bias-resistor */
sgtl5000 1-000a: mic_bias_event event: 8 --> /* after widget power down */
Testing:
arecord -D "hw:0,1" -c 2 -f S16_LE -t wav test_recording.wav
Recording WAVE 'test_recording.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
==> no event was fired
With my patch included, at probing:
sgtl5000 1-000a: mic_bias_event event: 128
sgtl5000 1-000a: mic_bias_event event: 4 --> /* before widget power down, this disables the mic-bias-resistor */
sgtl5000 1-000a: mic_bias_event event: 8 --> /* after widget power down */
Testing:
arecord -D "hw:0,1" -c 2 -f S16_LE -t wav test_recording.wav
Recording WAVE 'test_recording.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
[ 82.341376] sgtl5000 1-000a: mic_bias_event event: 1 --> /* before widget power up */
[ 82.762701] sgtl5000 1-000a: mic_bias_event event: 2 --> /* after widget power up, this enables the supply */
^CAborted by signal Interrupt...
[ 90.362685] sgtl5000 1-000a: mic_bias_event event: 4 --> /* before widget power down, this disables the mic-bias-resistor */
[ 90.369561] sgtl5000 1-000a: mic_bias_event event: 8 --> /* after widget power down */
==> events are working
The disadvantage is that this is also done when playing audio:
aplay -D "hw:0,0" -c 2 -f S16_LE -t wav test_recording.wav
sgtl5000 1-000a: mic_bias_event event: 1
sgtl5000 1-000a: mic_bias_event event: 2
Playing WAVE 'test_recording.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
sgtl5000 1-000a: mic_bias_event event: 4
sgtl5000 1-000a: mic_bias_event event: 8
I'm not so into ALSA, maybe there is another way to set the event properly.
Kind regards,
Christian
-----Ursprüngliche Nachricht-----
Von: Mark Brown [mailto:broonie@kernel.org]
Gesendet: Donnerstag, 11. Januar 2018 16:07
An: Fischer, Christian <fischerc@swissphone.de>
Cc: alsa-devel@alsa-project.org; lgirdwood@gmail.com; perex@perex.cz; tiwai@suse.com; richard.leitner@skidata.com; fabio.estevam@nxp.com; bhumirks@gmail.com; linux-kernel@vger.kernel.org
Betreff: Re: [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage
On Thu, Jan 11, 2018 at 09:40:31AM +0100, fischerc@swissphone.de wrote:
> The mic-bias-voltage should get powered up/down automatically.
> Added missing DAPM_PRE and DAPM_POST widgets to fire up the mic_bias_event function.
> + SND_SOC_DAPM_PRE("MIC_BIAS_PRE", mic_bias_event),
> + SND_SOC_DAPM_POST("MIC_BIAS_POST", mic_bias_event),
I don't understand what this is intended to do. The mic_bias_event() callback is already hooked up to the Mic Bias supply widget, it should be invoked whenever the bias is turned on and off already?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: AW: [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage
2018-01-11 16:14 ` AW: " Fischer, Christian
@ 2018-01-11 16:19 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-01-11 16:19 UTC (permalink / raw)
To: Fischer, Christian
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.com, richard.leitner@skidata.com,
fabio.estevam@nxp.com, bhumirks@gmail.com,
linux-kernel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
On Thu, Jan 11, 2018 at 04:14:31PM +0000, Fischer, Christian wrote:
> Hi Mark,
Please don't top post, reply in line with needed context. This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.
> Testing:
> arecord -D "hw:0,1" -c 2 -f S16_LE -t wav test_recording.wav
> Recording WAVE 'test_recording.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
> ==> no event was fired
Has your board connected the bias to the microphone widget it defines?
Unless your board says that the bias is in use on a given board it won't
be enabled.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-11 16:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 8:40 [PATCH] ASoC: sgtl5000: fix powerup/down of micbias-voltage fischerc
2018-01-11 15:07 ` Mark Brown
2018-01-11 16:14 ` AW: " Fischer, Christian
2018-01-11 16:19 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox