[THINK TANK] Boosting Nexus Audio Even Further

Search This thread

Geniusdog254

Retired Recognized Developer
Jan 2, 2009
1,110
169
St. Louis
Ok, we all know about the volume level changes on CodeAurora. I'm trying to take it a step further, as the speaker is still incredibly soft compared to my G1. I'm working on some kernel mods to boost the audio further.

If you look in q6audio.c where (along with board-mahimahi-audio.c) the audio hacks are made. The current mod just raises the values within the current range settings.

However, in q6audio.c at line 1275-1287 it defines the stream volume. There is code there to check if the min/max ranges set earlier in the file and in board-mahimahi-audio.c are within the ranges of the chip as I'm guessing defined by Qualcomm. My idea is to change those values, thus setting a higher range that we can use to set the volume. I've changed the code to set it at 3200 max & -2000 min which matches the original range of 1200 to -4000.

Then I set the values at 2000 & -400 for the speaker in the ealier min/max definitions at the beginning of q6audio.c & board-mahimahi-audio.c and I hear no discernable difference. Why?

When I change the values back to the original 1200 to -4000 and then just set the min/max values lower to see if it gets quieter, there is no difference yet again. I know my kernel is building right, because if I change kernel freqs/voltages it works, and if I change RAM tables it works, why won't the audio changes work?

Any kernel chefs wanna weigh in here? Any ideas to boost audio more? Thanks all, maybe we can finally get decent volume on our Nexii!
 

ComplexMinded

Senior Member
Feb 14, 2009
267
9
From my own experiences, I think modding the audio on my G1 eventually caused the speaker to blow.. So i bought a N1. I've also heard that it's common with HTC phones. With that said i'm very interested to see where this goes.
 

Geniusdog254

Retired Recognized Developer
Jan 2, 2009
1,110
169
St. Louis
From my own experiences, I think modding the audio on my G1 eventually caused the speaker to blow.. So i bought a N1. I've also heard that it's common with HTC phones. With that said i'm very interested to see where this goes.

Yeah I have no intention of pushing things too far lol. I'll be careful with values & test things on my own before (read: if) I ever release anything.

Still, I have no responsibility if you guys screw up.
 

Geniusdog254

Retired Recognized Developer
Jan 2, 2009
1,110
169
St. Louis
Tried again with slightly different settings. Still a no go.

Gunna look at some more code tomorrow night (maybe ADIE tables & some other ****).

One idea that hit me, though its over my head, would be boosting the voltage running to the speaker? Stupid or no? I'm guessing it would be in a GPIO setting somewhere. Board-mahimahi.c? Something in the qdsp6 folder where the q6audio & ADIE files are?

Sorry just kinda rambling here. Trying to spark some brighter minds than my own. Running out of ideas, any help would be appreciated ;)
 

kelddaug

Senior Member
Dec 2, 2009
248
12
I think that the loudspeaker on Nexus and Desire is screamy(high freq) it needs more bass, but i dont think its made for that.
It sounds terrible strident.
 

Meltus

Senior Member
Jan 11, 2009
1,903
1,023
Manchester
www.androidaudiohacks.com
Some sort of progress

If you push libhtc-acoustic.so from a Desire build to '/system/lib' and restart the media server ("killall mediaserver") it then tries to load a file called 'TPA2018.csv' and when it fails it says something along the lines of "Speaker Amplification Failed". I managed to track this file down and i can get it to successfully load, but then it fails trying to load '/dev/tpa2018d1' and try as i might, i can't find this file anywhere.
I'm not in a position where i can build the source at the moment but if anyone could try building this file (if it's even present in the source) it would be very helpful :D
 

Geniusdog254

Retired Recognized Developer
Jan 2, 2009
1,110
169
St. Louis
Some sort of progress

If you push libhtc-acoustic.so from a Desire build to '/system/lib' and restart the media server ("killall mediaserver") it then tries to load a file called 'TPA2018.csv' and when it fails it says something along the lines of "Speaker Amplification Failed". I managed to track this file down and i can get it to successfully load, but then it fails trying to load '/dev/tpa2018d1' and try as i might, i can't find this file anywhere.
I'm not in a position where i can build the source at the moment but if anyone could try building this file (if it's even present in the source) it would be very helpful :D

The reason its failing is because the Nexus doesn't have that hardware. The TPA2018.c file runs a check to see if your on a CDMA revision device and if you are it enables an extra pin on the chip that amplifies it. That is a dead end since even hardcoding it to try and load that pin will fail since it doesn't exist on UMTS devices.

I did however find some gain settings in a few files that I'm going to try out once I get outta school today though. It should work, but we'll have to wait and see.

Also, interestingly enough it seems as though the CDMA revisions support stereo speakers. The code has support for left/right device speakers in CDMA mode.

It seems those of us that bought GSM/UMTS Nexii are getting continually shafted. Weaker screens, crappy touch sensor on both revisions, worse speaker. Oh well though, I still love my Nexus.
 

Meltus

Senior Member
Jan 11, 2009
1,903
1,023
Manchester
www.androidaudiohacks.com
The reason its failing is because the Nexus doesn't have that hardware. The TPA2018.c file runs a check to see if your on a CDMA revision device and if you are it enables an extra pin on the chip that amplifies it. That is a dead end since even hardcoding it to try and load that pin will fail since it doesn't exist on UMTS devices.

Ah that's a shame. Thanks for the info though, it sucks that i've been chasing a dead end with that, it looked so promising too :(
 

Geniusdog254

Retired Recognized Developer
Jan 2, 2009
1,110
169
St. Louis
Some sort of progress

If you push libhtc-acoustic.so from a Desire build to '/system/lib' and restart the media server ("killall mediaserver") it then tries to load a file called 'TPA2018.csv' and when it fails it says something along the lines of "Speaker Amplification Failed". I managed to track this file down and i can get it to successfully load, but then it fails trying to load '/dev/tpa2018d1' and try as i might, i can't find this file anywhere.
I'm not in a position where i can build the source at the moment but if anyone could try building this file (if it's even present in the source) it would be very helpful :D

Also, /dev/tpa2018d1 isn't a file, its a link to a hardware device. In this case the speaker amplifier pin. Manufacturer page here @ TI page. Obviously a speaker amplifier chip, I would need to see a Nexus board to see if its present or not, but I have no idea how to go about that. I'd have to talk to a disassembly expert.

Anyways, I did a little more work.

To start with, in pmic.h:
  • Lines 39-49 have a speaker gain settings table. This is used in files like board-mahimahi-audio.c. The "SPKR_GAIN_PLUS12DB" is already whats defined. So I added a setting for 16DB gain. More on that later.

Next, in board-mahimahi-audio.c:
  • Lines 71-136 have the speaker enable methods.
    Lines 120-121 already used the pmic_spkr_set_gain method as defined in pmic.h. I added those methods to lines 84-85 & 94-95 in the code where it turns on the speaker.

Still a no go. Does anyone else have any clues on this?
 

Geniusdog254

Retired Recognized Developer
Jan 2, 2009
1,110
169
St. Louis
So with the Desire kernel being released, is there a chance some progress can be made with this?

http://member.america.htc.com/download/RomCode/Source_and_Binaries/bravo_54b7033a.tar.gz

Unfortunately no :(

We know that the Desire uses the TPA2018 speaker amplification chip, like in the CDMA Nexii. There is a config file for it in the Desire ROMs (not Nexus Desire ROMs, real Desire ROMs). The GSM Nexus doesn't have that chip, so that method won't ever boost audio for us.

The best bet is in either the ADIE tables which we can't figure out, or changing the maximum values in the settings for the Snapdragon audio hardware, then boosting it higher, and in my personal tests I don't notice any difference at all.