[alsa-devel] [PATCH 1/1] ASoC: TWL4030: Wait RAMP_DELAY on headsetl_event: POST_PMD

Peter Ujfalusi peter.ujfalusi at nokia.com
Wed May 13 14:57:09 CEST 2009


On Tuesday 12 May 2009 16:56:25 ext Jarkko Nikula wrote:
> On Tue, 12 May 2009 16:16:08 +0300
>
> Hopefully I didn't confuse you too much :-)

You did :D

But now I can hear what you are hearing... I have soldered to my custom board 
a connector so I can connect a headset to HeadsetL of TWL codec.
On the scope it looked OK, but it does makes a sound...


> So with your patches reverted, the low-frequency pop was gone in
> power-down since there were no ramp implemented but there still were
> the sharp snap. I didn't notice were there any difference on that.

For me the snap is really sharp and sound bad.

> I think for me this low-frequency power-up and -down (when your
> patches are in) pops are caused when the capasitors connected into
> HSOL/HSOR are charging/discharging through the headphones.

I have also observed - if the ramp delay is longish - the 'beep' type of noise 
on the headset (can not be seen on the scope).
It is generated by the ramp up/down, you can verify it:
aplay -f dat -q /dev/urandom
# Now adjust the volumes (analog, digital) to a level that you can still hear 
# the noise, but as low as you could.
mkdir /debug
mount -t debugfs none /debug
amixer sset 'HS ramp delay' '3495/2581/1748 ms'
cat /debug/soc-audio/codec_reg | grep 24:
# it is 5e for the maximum ramp time.
# now you can initiate the ramp-down with flipping bit 1:
echo 24 5c > /debug/soc-audio/codec_reg
# you will still hear the noise, but underneath you will hear the beep tone.
# Now set the ramp-up:
echo 24 5e > /debug/soc-audio/codec_reg
# you will hear a click, than the beep tone and the noise from the playback

>
> What I'm wondering how it is possible to hear such a slow ramp like 100
> ms?

So now that I can hear the thing, here is what I got at the moment:
- really small and low volume click on playback start
- going to standby mode is almost unnoticeable (I usually miss it, if I did 
not look at the console printouts)
- Enabling/disabling the HeadsetL (flipping the DACL2 route): disable is 
unnoticeable, enable has a click, but the audio can be muted with Analog mute 
with really small click.

I have to check what exactly has been changed, but what I can recall:
- I have changed the power_up and power_down sequences a bit in soc-dapm.c
- I have the ramp delay patch with the mdelay (I have to check if it is the 
same as I have sent)
- Restructured the DAPM routing of the twl4030 codec (this was in my plans 
anyway)
- I have changed the way how the bias events are handled in the 
twl4030_set_bias_level function.
- While I was there I have fixed the Handsfree sequences, since that also 
generated quite a bit of click.

So quite a few changes...

What I have figured out that the user has to select the appropriate ramp_delay 
for the given board, on my board:
MCLK = 38.4MHz and RAMP_DELAY = 2 (109/81/55 ms) works best (meaning 55ms ramp 
delay), if it is shorter, than it clicks, if it is longer, than it does not 
click, but the beep tone can be observed.

On the way I have noticed some other things, which I will ask tomorrow.

Mark: About the  power up and down sequences in the soc-dapm.c file: are they 
written in stone, or is it possible to make some - I think - minor 
modification to the sequences?

I'll try to clean up the code and structure it for review in a couple of days 
(I hope).

-- 
Péter


More information about the Alsa-devel mailing list