From: Peter Ujfalusi Subject: Re: [PATCH 1/1] ASoC: TWL4030: Wait RAMP_DELAY on headsetl_event: POST_PMD Date: Wed, 13 May 2009 15:57:09 +0300 Message-ID: <200905131557.09731.peter.ujfalusi@nokia.com> References: <1242040465-10835-1-git-send-email-peter.ujfalusi@nokia.com> <200905121616.08596.peter.ujfalusi@nokia.com> <20090512165625.e9852d18.jhnikula@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mgw-mx09.nokia.com (smtp.nokia.com [192.100.105.134]) by alsa0.perex.cz (Postfix) with ESMTP id F134B10388D for ; Wed, 13 May 2009 14:57:32 +0200 (CEST) In-Reply-To: <20090512165625.e9852d18.jhnikula@gmail.com> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: ext Jarkko Nikula Cc: "sakoman@gmail.com" , "anuj.aggarwal@ti.com" , "alsa-devel@alsa-project.org" , "broonie@opensource.wolfsonmicro.com" , "getarunks@gmail.com" List-Id: alsa-devel@alsa-project.org 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 boa= rd = 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 no= ise = 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 he= ar = # 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 mu= te = 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_de= lay = for the given board, on my board: MCLK =3D 38.4MHz and RAMP_DELAY =3D 2 (109/81/55 ms) works best (meaning 55= ms 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 th= ey = 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 da= ys = (I hope). -- = P=E9ter