Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#10082 : Full range volume control for WM8758 (iPod 5G)



FS#10082 - Full range volume control for WM8758 (iPod 5G)

Attached to Project: Rockbox
Opened by Andree Buschmann (Buschel) - Tuesday, 31 March 2009, 22:02 GMT
Last edited by Andree Buschmann (Buschel) - Saturday, 23 January 2010, 19:35 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System iPod 5G
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch enables volume control for headphones from -90..+6 dB when using a WM8758 Wolfson Codec (e.g. iPod 5G). The advantage is that users may lower the volume even below svn's -57dB limitation -- at least I find it helpful as I mostly listen to music via my iPod at night.
The full range control is achieved through separating volume control into two 4 steps:
1) all max (>=+6 dB)
2) amplifier output is controlled, DAC output is max (for better snr) (-57..+6 dB)
3) amplifier output is min but not muted, DAC output is controlled (-89..-58 dB)
4) all muted (<=-90 dB)
When lowering the volume below -57dB the lineout is also affected.
This task depends upon

Closed by  Andree Buschmann (Buschel)
Saturday, 23 January 2010, 19:35 GMT
Reason for closing:  Accepted
Additional comments about closing:  Commited with r24318
Comment by Michael Sevakis (MikeS) - Tuesday, 31 March 2009, 22:17 GMT
The WM8978 code (Gigabeat S) did exactly this at first but had to resort to strangeness to get full volume range with uniform spacing throughout on the analog inputs as well for both recording and playback of FM Radio and PCM.
Comment by Andree Buschmann (Buschel) - Wednesday, 01 April 2009, 07:37 GMT
In fact I have kind of stolen the idea from the WM8978. First I did only change volume via DAC, but of course this lead to baaad noise floor :-)
I did not have a look into analog input or recording yet (as I do and did not use it).
Comment by Boris Gjenero (dreamlayers) - Thursday, 02 April 2009, 04:59 GMT
I normally use an inline volume control between the device and my headphones. It broke on Monday, and I got to see how bad the present volume control is with efficient low impedance headphones which seal against the ear canal. Based on that experience, this patch is definitely necessary. The math seems correct, the volume control seems reasonably linear, and it's still totally usable for adjusting volume at higher levels. I don't like how line out isn't fixed at low volumes, but that's far better than inability to lower headphone volume sufficiently.
Comment by Andree Buschmann (Buschel) - Thursday, 02 April 2009, 06:02 GMT
I do not see any reasonable way to keep the lineout stable below -57 dB. For the playback usecase: The DAC output is the only input for the mixer. The mixer settings do only allow to set gains for mixing the input signal to the output signal. The single output of the mixer is then handed over to OUT1 and OUT2. The only way to compensate for the DAC output reduction is to lower the output volume of OUT2 (lineout) by -32 dB as default. When the DAC is reduced in 1dB-steps the OUT2 volume is raised in 1dB-steps. This will keep the volume stabe, but we will loose 32 dB SNR on the lineouts. This is not reasonable in my opinion.

Edit1: Added some more thoughts.
Edit2: Corrected numbers...
Comment by Douglas Valentine (Dwyloc) - Sunday, 05 April 2009, 21:19 GMT
Patch works very nicely on my 80GB 5.5G ipod video. Finally I can use my ipod video at a comfortable volume in a quiet environment instead of having to swap over to one of my other rockboxed players.
Comment by Andree Buschmann (Buschel) - Monday, 06 April 2009, 07:45 GMT
Michael, I tried to get into the WM8978-code. Lots of weird calculations, but logical after a while. If I see it correctly from your code and the WM8758 spec, your code could be easily adapted to the WM8758 -- same mixers are used and the signal flow matches the volume control logic of your code. Some things I am concerned of:
1. Does changing both DAC and OUTVOL at the same time lead to fuzzy output volume? (e.g. lowering DAC by 3dB and raising OUTVOL by 2dB at the same time)
2. From the signal flow diagrams of the WM8758 I see that the ADCBOOST is done before ADC conversion. Isn't the rec volume affected by this?
3. For the iPod 5.5G the lineout also has to be taken care of. As described above I see no way of keeping it stable over the full volume range.
Comment by Michael Sevakis (MikeS) - Friday, 10 April 2009, 03:51 GMT
1. Volume control is quite smooth actually. These adjustment happen quickly enough that there isn't time to hear anything and the adjustments are not large which helps to mask it.
2. Gigabeat S needs to use the +20dB gain for the FM and so things have to be routed there. It's using the MIC inputs as single ended and so the PGA control there doesn't really work properly (otherwise it could have alot of signal boost but I could only manage +8dB by keeping PGA constant using other gain stages).
3. True, Line Out will need handling to compensate the strange DAC adjustments. DAC volume will affect Line Out and I see no way around that.

I worked it out for Gigabeat S in a particular way but other schemes could possibly be done. Gigabeat S needs alot of attenuation because it's so loud.
Comment by piper (piper17) - Sunday, 10 May 2009, 14:53 GMT
hi, how do you use this patch? do it make it so you can use the new ipod headphones with the remote and mic for the ipod 5G?
Comment by Rosso Maltese (asettico) - Tuesday, 19 January 2010, 16:16 GMT
I'm using this patch since ever and I never got any problems.
I think it can be committed in trunk.
Comment by Andree Buschmann (Buschel) - Saturday, 23 January 2010, 19:29 GMT
Commited with r24318