/srv/irclogs.ubuntu.com/2009/12/27/#ubuntu-classroom.txt

* shriekout $decode(s60gwKe068fRILDHtOPAzLTZISEhDQpuaWNrILDHtOMNCnF1aXQgOrDHtOMgx9ewocfXsKE=,m)03:11
=== yofel_ is now known as yofel
=== mac_v is now known as \vish
crimsun(sorry, waylaid by travel wifi)22:16
crimsunWelcome to this $timeofday's impromptu session on triaging ALSA bugs in Ubuntu and submitting fixes upstream22:17
crimsunA couple things to note: you'll need ubuntu-dev-tools, patchutils, git-core installed22:17
crimsunyou'll also need some familiarity with C, though it doesn't need to be deep magic guru stuff22:18
crimsunAgendum: 1. Low-hanging fruit: bugs with known-working quirks commented in the bug reports22:19
crimsun2. Not really fruit: Powerdown bugs22:19
crimsun3. Submitting patches upstream22:19
crimsunSome required reading: https://wiki.ubuntu.com/DebuggingSoundProblems, in particular https://wiki.ubuntu.com/DebuggingSoundProblems/KarmicCaveats22:21
crimsunNext, free space requirements: you'll need about 300 MB free for git trees22:22
crimsunWe'll be checking out three git trees: upstream linux-2.6 (Linus's tree), sound-2.6 (upstream ALSA kernel tree), ubuntu-lucid22:24
crimsunAfter ensuring that you have the prerequisites above installed, you'll do:22:24
crimsungit clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6.git22:24
crimsunthen:22:25
crimsungit clone --referenc linux-2.6.git/ git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git22:25
crimsunsorry, that's --reference22:25
crimsunthen: git clone --reference linux-2.6.git/ git://kernel.ubuntu.com/ubuntu/ubuntu-lucid.git22:26
crimsunLet's look at examples in the meantime (if you're waiting for them to complete)22:27
apparlecrimsun: can I interrupt22:28
crimsunhttps://bugs.launchpad.net/bugs/48788422:28
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed]22:28
ubottuUbuntu bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed]22:28
ubot2Ubuntu bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:28
ubottuLaunchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:28
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:28
crimsunapparle: can it wait for about 10 minutes?22:29
apparlecrimsun: no problem...22:29
crimsunapparle: thanks22:30
crimsunSo, some background:22:30
crimsunthere are a lot of AC'97 codecs that need some sort of quirk applied22:30
crimsunAbout four to five years ago, I spent a good long while getting the most common ones applied22:31
crimsunThose were mostly binding of 'Master' and 'Headphone' mixer controls and binding 'Headphone' to an indicator LED (for mute status)22:32
crimsunThese days, for AC'97, we'll see a few stragglers that need inverted external amplifier power down (EAPD) applied22:32
crimsunThis symptom most frequently manifests itself in needing 'External Amplifier' to be muted for sound to be audible.22:33
crimsunThere's an existing quirk for this called inv_eapd22:33
crimsunIf you were to pass this option on the command line or in /etc/modprobe.d/alsa-base.conf, it would look similar to:22:34
crimsunac97_quirk=inv_eapd22:34
crimsune.g., modprobe snd-intel8x0 ac97_quirk=inv_eapd22:34
crimsun[after which point you could use 'External Amplifier' being unmuted for sound to be audible, which is the accepted norm]22:35
crimsunmost AC'97 quirks live in their respective drivers22:36
crimsunthe three most common ones are sound/pci/intel8x0.c, sound/pci/atiixp.c, and sound/pci/via82xx.c [though there are numerous others in sound/pci/]22:37
crimsunso, for bug 487884, we're looking specifically at applying this quirk22:37
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:37
ubottuLaunchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:37
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:37
ubottuUbuntu bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed]22:37
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed]22:37
ubottuLaunchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:37
ubot2Ubuntu bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:37
crimsunhttp://launchpadlibrarian.net/36040747/Card0.Codecs.codec97.0.ac97.0.0.txt has the important information22:38
crimsunNamely, we need the PCI SSID, which in this case is 0x161f203a22:39
crimsunwe next look at the source file that needs to be modified, which is sound/pci/intel8x0.c22:39
crimsunat this point, we should change working directories to wherever we cloned ubuntu-lucid.git22:40
crimsunnext, we'll create a separate branch (some people use topic namespace)22:40
crimsun$ git checkout -b lp48788422:40
crimsunthen, we'll edit the source file22:41
crimsun$ $EDITOR sound/pci/intel8x0.c22:41
crimsunAC'97 quirks live in the ac97_quirks[] struct, and they should be ordered by subvendor ID22:41
crimsunFrom this point the addition should be fairly straightforward. Add another stanza, fill in the human-friendly model name, add the quirk type22:42
crimsun$ git commit -a -e -s22:42
crimsunThe first line of your commit message should briefly describe the change22:43
crimsunALSA: intel8x0: Mute External Amplifier by default for Gateway 4525GZ22:43
crimsunthe next line (delimited by a blank line) should be the BugLink id, which is something that is Ubuntu syntax-specific for the kernel team22:44
crimsunBugLink: https://bugs.launchpad.net/bugs/48788422:44
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed]22:44
ubottuUbuntu bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed]22:44
ubot2Ubuntu bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:44
ubottuLaunchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:44
ubot2Launchpad bug 487884 in linux "No sound driver for Gateway 4525GZ" [Low,Fix committed] https://launchpad.net/bugs/48788422:44
crimsunNext, describe the change:22:44
crimsunThis Gateway model needs External Amplifier muted for audible playback,22:44
crimsunso set the inv_eapd quirk for it.22:44
crimsun.22:45
crimsunMake sure that you keep lines wrapped at 80 characters; many maintainers prefer 72 characters.22:45
crimsunFinally, if the change is very simple (like this one), then you should submit it to the stable tree so that it ends up in Ubuntu22:46
crimsunAbove your Signed-off-by line you should have:22:46
crimsunCC: stable@kernel.org22:46
crimsun.22:47
crimsunAfter saving your commit message, the change will be committed, and you can generate a patch to send upstream.22:47
crimsunThere are several ways of doing this, but upstream ALSA likes separate patches.22:47
crimsunSo, we'll use:22:48
crimsungit format-patch -o ~ master22:48
crimsunYou'll end up with ~/0001-ALSA-...22:48
crimsunThis is the patch that you'll attach to your e-mail message. The e-mail should be sent to alsa-devel@alsa-project.org, with Takashi Iwai and myself CCed22:50
crimsunAnd that's pretty much the process for bite-sized fixes.22:50
crimsunapparle: you're up22:51
apparlegot it clear22:51
apparlebut I am having a problem22:51
apparlewhat to do abt this22:51
apparlegit.kernel.org[0: 149.20.20.136]: errno=Connection refused git.kernel.org[0: 199.6.1.166]: errno=Connection refused git.kernel.org[0: 204.152.191.40]: errno=Connection refused git.kernel.org[0: 130.239.17.7]: errno=Connection refused fatal: unable to connect a socket (Connection refused)22:51
apparleI am behing a stringent firewall(university)22:52
crimsunapparle: you'll need to use another protocol, then, like http22:52
crimsun(which is unfortunate, because it's less optimized, but it's one of the few ways to continue if you're behind a firewall)22:53
apparleInitialized empty Git repository in /home/apparle/linux-2.6.git/.git/ fatal: http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/info/refs download error - Failed connect to git.kernel.org:80; Operation now in progress22:54
apparlewhat to do?22:54
crimsunapparle: firewalls are a bit beyond the scope of this discussion22:55
crimsunin brief, see git-clone(1)'s "GIT URLS" section for a description22:55
apparlecrimsun: you mean in the man page?22:56
crimsunapparle: yes22:56
crimsunOkay, continuing.22:56
crimsunThe next bug we'll consider is no more difficult, but it moves into problematic areas of HDA.22:57
crimsunIn bug 461062, we need to ensure that the reporter's hardware doesn't suffer from distortion when the PCM volume is set to max.22:58
ubot2Launchpad bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed] https://launchpad.net/bugs/46106222:58
ubottuLaunchpad bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed] https://launchpad.net/bugs/46106222:58
ubot2Launchpad bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed]22:58
ubottuUbuntu bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed]22:58
ubot2Launchpad bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed] https://launchpad.net/bugs/46106222:58
ubottuLaunchpad bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed] https://launchpad.net/bugs/46106222:58
ubot2Ubuntu bug 461062 in linux "0x11d41981 on 0x103c30d8 misreports dB information, needs PCM capped at 0 dB" [Undecided,Fix committed] https://launchpad.net/bugs/46106222:58
crimsunTo do this, we need to inspect the reporter's HDA codec, which is attached at http://launchpadlibrarian.net/34413094/Card0.Codecs.codec.0.txt22:59
crimsunSo, I'll walk through doing this from the top.23:00
crimsunFirstly, we need to know which codec patch to modify. That information is given at the beginning of the codec information, so, Analog Devices AD198123:00
crimsunWhen you've triaged enough bugs, you no longer look at the ^Codec line but at the ^Vendor Id line23:01
crimsunSo, knowing that it's an Analog Devices HDA codec, we'll need to look at sound/pci/hda/patch_analog.c23:01
crimsunNext, we look at the ^Vendor Id line and match it with the entry in the snd_hda_preset_analog[] struct23:03
crimsun(which is located toward the end of the file)23:03
crimsun{ .id = 0x11d41981, .name = "AD1981", .patch = patch_ad1981 },23:03
crimsunso, now we know which function to inspect (patch_ad1981())23:04
crimsunWe need one more piece of information: whether the reporter's hardware is using a specific model quirk.23:04
crimsunTo do that, we look at the ^Subsystem Id in the codec output23:05
crimsunIn this case, it's 0x103c30d823:05
crimsunNow, in patch_ad1981(), ad1981_cfg_tbl[] is used to see if any quirks are necessary23:06
crimsunSo we scroll up in the source file to it, and we see that there's a vendor mask already applied:23:07
crimsunSND_PCI_QUIRK_VENDOR(0x103c, "HP nx", AD1981_HP),23:07
crimsunThis tells us that we need to look at the AD1981_HP model quirk in patch_ad1981()23:07
crimsunSo we return to patch_ad1981() and look at the section for that model.23:07
crimsunSure enough, there's no existing cap being set for that model.23:08
crimsunNext, we verify our finding again by looking at the codec output23:08
crimsunTo do this, we need to look a bit more closely at the pin routing. So, back to the source file, where we look for the mixer setup for the AD1981_HP model quirk23:10
crimsunmixer setups are of type struct snd_kcontrol_new23:10
crimsunso we're looking at ad1981_hp_mixers[]23:11
crimsunNext, find the PCM Playback elements23:11
crimsunThe brief version, without referring to the AD1981 data sheet, is that we're looking at the 0x11 node id23:11
crimsunSo, go back to the codec output and look at Node 0x1123:12
crimsunThe critical piece of information is in:23:13
crimsunAmp-Out caps: ofs=0x17, nsteps=0x1f,23:13
crimsunso, we need to override the amp setup by using snd_hda_override_amp_caps()23:13
crimsunnote that 0x1f will give distortion over and beyond 0x1723:14
crimsunso we need to cap the nsteps at the offset value23:14
crimsun(the offset value is known as 0 dB)23:14
crimsunso, this function ends up looking like:23:15
crimsun                snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,23:15
crimsun                                          (0x17 << AC_AMPCAP_OFFSET_SHIFT) |23:15
crimsun                                          (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |23:15
crimsun                                          (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |23:15
crimsun                                          (1 << AC_AMPCAP_MUTE_SHIFT));23:15
crimsunso we take this addition, put it in the AD1981_HP case of patch_ad1981(), commit the change, and so on.23:16
crimsun(to complicate things, you can also do this from alsactl init, but that's a story for another day)23:16
crimsunFor the sake of time, I'm going to skip the powerdown stuff and just send an e-mail to ubuntu-devel@ .23:17
crimsunAnyhow, that's it.23:17

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!