Opened 18 years ago

Closed 14 years ago

#1072 closed enhancement (fixed)

Write an HDA audio driver and add-on

Reported by: axeld Owned by: ithamar
Priority: normal Milestone: R1
Component: Drivers/Audio/HDA Version: R1/pre-alpha1
Keywords: Cc: pieter@…, fredrik.holmqvist@…, harakash@…, HubertNG@…
Blocked By: Blocking: #3193
Platform: x86

Description

We need to support HD-Audio chipsets.

Because of the features of this standard, it might be feasible to create a new media add-on for this as well, instead of using the current hmulti-audio add-on.

Attachments (11)

syslog (115.0 KB ) - added by PieterPanman 16 years ago.
Syslog of HDA boot and trying to play a file
syslog.txt (139.9 KB ) - added by PieterPanman 16 years ago.
New syslog (now attaching works)
hda_ati_nvidia.patch (2.5 KB ) - added by tqh 16 years ago.
Preliminary patch, works for ATI
syslog_tqh.txt (120.9 KB ) - added by tqh 16 years ago.
My syslog as korli asked for on IRC.
syslog.1 (268.6 KB ) - added by Adek336 16 years ago.
DSC00368.JPG (252.4 KB ) - added by Hubert 16 years ago.
freezes and KDL
hda_syslog.txt (19.8 KB ) - added by mmlr 16 years ago.
syslog.2.txt (95.4 KB ) - added by Hubert 16 years ago.
r.30068
listdev-CQ50-215NR.txt (3.1 KB ) - added by scottmc 15 years ago.
cq50-215nr-syslog.txt (396.7 KB ) - added by scottmc 15 years ago.
syslog from my compaq cq50-215nr laptop
syslog.r37174 (76.9 KB ) - added by atomozero 14 years ago.

Download all attachments as: .zip

Change History (76)

comment:1 by korli, 18 years ago

Owner: korli removed

comment:2 by ithamar, 18 years ago

just a quick note to officially register that I am working on this driver. It is approaching reasonable usability/stability, and should arrive in SVN pretty soon.

It is using the Haiku multi_audio API, as that seems sufficient for the features supported, and if multi_audio would/will not fit, that would be a good reason to reevaluate this API :)

comment:3 by axeld, 18 years ago

Since Haiku's multi-audio API is not compatible anyway, that would definitely be the preferred solution :-) Anyway, I guess you don't mind if I assign this ticket to you? There is a "colacoder" user, but I can't find an ithamar in the user list...

comment:4 by wkornewald, 18 years ago

I added "colacoder" because that was your (Ithamar's) SVN user name and I thought you'd use that for the website, too. I've added "ithamar" to the devs, so you can now accept tickets yourself (just choose "accept ticket").

comment:5 by axeld, 18 years ago

Owner: set to ithamar

comment:6 by ithamar, 18 years ago

Status: newassigned

Ok, accepted the ticket now. There's already quite some code in SVN, though the driver is far from finished. So many possible audio features to implement.... ;)

comment:7 by PieterPanman, 16 years ago

HDA does not work on my laptop yet. It does show up as recognized at the Media panel, but without any controls on its control page. I can try to play files, but I get no output. Attached the syslog.

by PieterPanman, 16 years ago

Attachment: syslog added

Syslog of HDA boot and trying to play a file

comment:8 by PieterPanman, 16 years ago

Cc: pieter@… added

comment:9 by korli, 16 years ago

FWIW I don't have sound either at 192khz/24 bits. I'll probably stick the driver to 48khz/16bits for the time being until fixed. The problem might be related to Haiku media kit/addons.

comment:10 by PieterPanman, 16 years ago

Thanks, when something might work again, let me know I'll try it. I can also test things if you need.

in reply to:  10 comment:11 by korli, 16 years ago

Replying to PieterPanman:

Thanks, when something might work again, let me know I'll try it. I can also test things if you need.

PieterPanman, could you try if playback work for you with a current revision (and adding hda to the hd image) ?

comment:12 by PieterPanman, 16 years ago

I tried it just now. It seems to want to play sound, however the audio device has no control view in the media preflet. Also, no sound when I play. I will attach the latest syslog. Let me know if I can do anything else.

comment:13 by PieterPanman, 16 years ago

hmm cannot add it. I emailed the haiku-develop with the error message.

Meanwhile, see http://panman.eu/haiku/syslog

by PieterPanman, 16 years ago

Attachment: syslog.txt added

New syslog (now attaching works)

comment:14 by tqh, 16 years ago

Cc: fredrik.holmqvist@… added

I only get noise when I try to play something, ATI SB600 and Realtek ALC889A Audio Codec.

comment:15 by aljen, 16 years ago

Cc: harakash@… added

comment:16 by tqh, 16 years ago

Still only noise, actually you can hear the sound, but it's like a square wave reverb or something is adding and amplifying it to noise. When stopping Mediaplayer it plays around 2 secs afterwards, also kind of like a reverb.

Tested in hrev28696 with ATI SB600 and Realtek ALC889A and trying a lot of changes to controls in Media panel.

comment:17 by mmlr, 16 years ago

Blocking: 3193 added

(In #3193) Yes, this device should eventually be supported by the HDA driver. Since there is another enhancement ticket for the HDA driver in general, I guess this can be closed as a duplicate of #1072.

comment:18 by tqh, 16 years ago

I made a quick hack for getting HDA working on ATI SBX00 chips, after looking at what ALSA HDA does on init. It's choppy but otherwise correct, as opposed to the noise without it. It needs to setup 'snooping':

Basically same as reading/writing TCSEL in hdacontroller.cpp but on register 0x42 OR'ing what is written back with 0x2. (See the lines ~731 /* TCSEL is reset to TC0 (clear 0-2 bits) */ I added my hack before the /* Enable controller interrupts */ section )

For Nvidia the register is 0x4e and the value to OR with is 0x0F.

Sorry for the cryptic explanation, but don't want to introduce any license complications.

by tqh, 16 years ago

Attachment: hda_ati_nvidia.patch added

Preliminary patch, works for ATI

comment:19 by scottmc, 16 years ago

I just tried the hda_ati_nvidia.patch on my laptop and it didn't detect my chipset. My listdev is posted on in the comments on #3217. This is on hrev28837 with the patch applied and built to a partition. My syslog is available in case it's of any help.

comment:20 by korli, 16 years ago

Reworked and applied the patch in hrev28838. The mask for nVidia wasn't correct IMO. Thanks!

comment:21 by tqh, 16 years ago

Audio seems to play fine without stutter if I run GLTeapot or other cpu-using app at the same time on ATI SB600. After a while it seems it worked well even without other apps running. Revision hrev28839.

comment:22 by tqh, 16 years ago

I found a nice MS reference to why snooping is needed: http://msdn.microsoft.com/en-us/library/ms790324.aspx when reading the FreeBSD code: http://fxr.watson.org/fxr/source/dev/sound/pci/hda/hdac.c

comment:23 by tqh, 16 years ago

Looking at scottmc's and #3193 it seems it has the right class_base and class_sub:

device Multimedia controller (Audio device) [4|3|0]
  vendor 10de: nVidia Corporation
  device 0774: MCP78S [GeForce 8200] High Definition Audio

So first question to scottmc or luposian, have you enabled the hda driver, before building? To do so, add it to BEOS_ADD_ONS_DRIVERS_AUDIO in build/jam/HaikuImage, so it looks something like this:

BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki hda ;

If you have we need more info from syslog, and maybe add more debugging to driver.

by tqh, 16 years ago

Attachment: syslog_tqh.txt added

My syslog as korli asked for on IRC.

comment:24 by tqh, 16 years ago

Btw korli, you forgot to check in the defs for snooping in hrev28906.

comment:25 by scottmc, 16 years ago

Sound is now working on my nvidia based laptop now (Compaq cq50-215nr). Nice work!

comment:26 by Adek336, 16 years ago

device Multimedia controller (Audio device) [4|3|0]
  vendor 8086: Intel Corporation
  device 284b: 82801H (ICH8 Family) HD Audio Controller

on Lenovo 3000 N200 laptop works well, great job!

After plugging my headphones in the sound is still on the loudspeaker and silence goes to the headphones.

by Adek336, 16 years ago

Attachment: syslog.1 added

in reply to:  26 comment:27 by korli, 16 years ago

Replying to Adek336:

After plugging my headphones in the sound is still on the loudspeaker and silence goes to the headphones.

Thanks for the report. The switch between headphones and speaker is not yet managed (via unsollicited responses btw).

comment:28 by Hubert, 16 years ago

Cc: HubertNG@… added
Component: Drivers/AudioDrivers/Audio/HDA

Which runs some time, often near starting Deskbara freezes. listdev: http://dev.haiku-os.org/attachment/ticket/3260/listdev-mypc.txt

by Hubert, 16 years ago

Attachment: DSC00368.JPG added

freezes and KDL

comment:29 by tqh, 16 years ago

I found out that if I disable one core on my AMD64x2 sound plays without any stutter at all. So I guess it might not be the driver, although bigger buffers might help.

comment:30 by tqh, 16 years ago

Just adding reference to #3356 as it contains useful information.

comment:31 by tqh, 16 years ago

Tried disabling serial debug on my machine, but it doesn't affect my stutters.

comment:32 by luroh, 16 years ago

Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller [8086:27d8] (rev 02)

Briefly tested ok with revision 29165 on a Lenovo T60 (Intel Centrino Duo T2300), no stutter. Nice work!

comment:33 by ithamar, 16 years ago

Since my commit hrev29172 it actually works on both my EeePC 900 as well as on my other notebooks.

comment:34 by tqh, 16 years ago

It still works here, with less stutters, but not stutterfree when several cpus active. I wonder if Rudolf's drift-changes in the other bug might correct that.

comment:35 by luroh, 16 years ago

Still works here too, revision 29180.

comment:36 by mmlr, 16 years ago

It seems to work, but I don't get any sound out of any of the outputs I have. Stuff's visible in the media prefs however including gains for the different output streams. When the driver loads a "click" is hearable, but other than that I can't hear anything. I'm usually using the headphone out with headphones connected. I know that this works because it works with OSS. Attaching relevant syslog output. Please tell if I can be of any help.

by mmlr, 16 years ago

Attachment: hda_syslog.txt added

comment:37 by tqh, 16 years ago

Unless you are using the default output headphones might not work as hda uses jack-sensing to detect what is connected, and jack-sensing isn't implemented in the driver.

in reply to:  36 ; comment:38 by korli, 16 years ago

Replying to mmlr:

It seems to work, but I don't get any sound out of any of the outputs I have. Stuff's visible in the media prefs however including gains for the different output streams. When the driver loads a "click" is hearable, but other than that I can't hear anything. I'm usually using the headphone out with headphones connected. I know that this works because it works with OSS. Attaching relevant syslog output. Please tell if I can be of any help.

Could you give the relevant PCI info for this device in the syslog ?

in reply to:  38 comment:39 by mmlr, 16 years ago

Replying to korli:

Could you give the relevant PCI info for this device in the syslog ?

KERN: PCI: [dom 0, bus  0] bus   0, device 27, function  0: vendor 8086, device 293e, revision 02
KERN: PCI:   class_base 04, class_function 03, class_api 00
KERN: PCI:   vendor 8086: Intel Corporation
KERN: PCI:   device 293e: 82801I (ICH9 Family) HD Audio Controller
KERN: PCI:   info: Multimedia controller (Audio device)
KERN: PCI:   line_size 10, latency 00, header_type 00, BIST 00
KERN: PCI:   ROM base host 00000000, pci 00000000, size 00000000
KERN: PCI:   cardbus_CIS 00000000, subsystem_id 4001, subsystem_vendor_id 8086
KERN: PCI:   interrupt_line 0a, interrupt_pin 01, min_grant 00, max_latency 00
KERN: PCI:   base reg 0: host 48220000, pci 48220000, size 00004000, flags 04
KERN: PCI:   base reg 1: host 00000000, pci 00000000, size 00000010, flags 0f
KERN: PCI:   base reg 2: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI:   base reg 3: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI:   base reg 4: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI:   base reg 5: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI:   Capabilities: PM, MSI, PCIe

comment:40 by Luposian, 16 years ago

Platform: Allx86

Thanks to tqh's advice, I enabled "hda". as instructed, and now it works on my Acer Aspire X1200. I get a lot of staticy garbled sound out of the speaker, whenever I play an .aif or .mp3, but turning on GLTeapot seems to make it all go away, for the most part. Just a couple ticks/pops now and then. Turning off one CPU does nothing beneficial.

What is it about bogging the CPU down a bit (I assume GLTeapot not special, in this regard, except that it likes to take up lotsa CPU cycles, which I assume means something) that seems to more or less "solve" the grungy sound output? Anyone have any idea?

comment:41 by anevilyak, 16 years ago

Have you tried disabling serial output? If not, try doing so by uncommenting the line "#serial_debug_output false" in ~/config/settings/kernel/drivers/kernel. If so, did that make any difference at all?

in reply to:  40 comment:42 by korli, 16 years ago

Replying to Luposian:

What is it about bogging the CPU down a bit (I assume GLTeapot not special, in this regard, except that it likes to take up lotsa CPU cycles, which I assume means something) that seems to more or less "solve" the grungy sound output? Anyone have any idea?

Please give detail on your specific audio chipset (extract from syslog would fit).

comment:43 by tqh, 16 years ago

Tested again in hrev29343. The sound no longer stutter it seems, but everything sounds like it's overamped and clipping instead. It's unlistenable. I tried lowering/muting channels so I don't think it's a mixing problem.

comment:44 by Luposian, 16 years ago

Korli...

This is about the best info I can offer, as to what my audio chipset is:

http://dev.haiku-os.org/ticket/3193

comment:45 by Luposian, 16 years ago

Type: enhancementbug

Well, criminy! I JAM my first GCC 4-built Haiku, turn HDA on, and while Haiku sees the HDA chip and puts up all the little sliders and stuff in the Media preferences... I get absolutely NO audio whatsoever, no matter what I do/try.

It was working before, in my last GCC 2.95 build of Haiku... now it dun work at all! :-(

Any idea if this is specifically related to GCC 4 builds or if it's just a recent "crunch" (code problem/glitch/bug/whatever) that has reared it's head (regardless of GCC version) and will (hopefully) be resolved shortly?

comment:46 by anevilyak, 16 years ago

Type: bugenhancement

Please don't arbitrarily change ticket information without asking. This was marked enhancement for a reason.

comment:47 by Luposian, 16 years ago

Sorry about that. I figured I could be mark it as "bug", because I thought it would only show what *I* thought of it as (and only on my post(s)), not change the entire thread to that classification. Again, my apologies. I'll be sure to remember that from now on.

As a side note, any idea why my GCC 4 build of Haiku is exhibiting total silence, even though I set it up to see HDA? Like I said, it was working well in the last GGC 2.95 build of Haiku I did several weeks back, on this same system. Thus, logically, it can't be the hardware... can it?

comment:48 by anevilyak, 16 years ago

There are issues that currently only show up on gcc4 due to differences in how the compilers do memory alignment and such. Those haven't yet been looked into in too much detail for various reasons, so for the time being you probably don't want to be using a gcc4 build unless you have a pressing reason to do so (i.e. trying to port software that requires it to compile).

comment:49 by tqh, 16 years ago

For me it behaves the same under gcc2.95 and gcc4.

comment:50 by tqh, 16 years ago

Audio now sounds as it should except tick/thumps several times per second, might be depending on music. Revision hrev29436.

comment:51 by stippi, 16 years ago

Are you trying to play Techno? I hate Techno and have added deliberate audio stuttering upon detection of Techno-music.

comment:52 by stippi, 16 years ago

Seriously though, for me, audio sounds perfect when playing in VLC. In MediaPlayer, I get varying results, seemingly depending on the file in question (?). Maybe there is a problem in our MP3 decoder yet? I wanted to make some tests with WAV and generated test-tones to be sure. But since the ToneProducer-Demo in Cortex as well as playback in VLC sound perfect here, I can be sure that the problem is neither in the System Mixer, nor HDA, nor the Multi-Audio node. If you can reproduce clicks in with the ToneProducer test node in Cortex, then a problem is most likely in HDA with your specific parameters (what audio format it defaults to).

comment:53 by tqh, 16 years ago

No, no techno. So maybe I shouldn't use Mediaplayer to test with...

comment:54 by tqh, 16 years ago

Cortex produces clicks on sine wave as well.

comment:55 by mmlr, 16 years ago

From my experience the MediaPlayer is at least responsible form some of the clicks. When I play some file that has clicks in MediaPlayer with playfile instead, it sounds perfectly fine. Also in case of AAC files the files sometimes just restart from the beginning in MediaPlayer while it plays fine in playfile, which uses the native APIs as well.

comment:56 by PieterPanman, 16 years ago

I posted this on the developer mailing list, when trac was down. Now I'm reporting this at the proper place:

I've just compiled in the HDA driver, and I'm running it on my santa rosa laptop. It works, but stutters every so often. Playfile also stutters. I remember that with the opensound driver there was no stutter.

Haiku revision 29543, gcc2.95

device Multimedia controller (Audio device) [4|3|0]

vendor 8086: Intel Corporation device 284b: 82801H (ICH8 Family) HD Audio Controller

If you need more info, let me know.

comment:57 by Luposian, 16 years ago

Ok, after JAMing the latest GCC4 revision of Haiku last night (3/21/09), and seeing that audio still didn't work (I enabled HDA as suggested above), I deleted the whole /develop folder, re-downloaded everything and went back to GCC 2.95.x, enabled HDA, and JAM'd a GCC 2.95.x revision of Haiku. The GCC 2.95 revision of Haiku worked fine before, but... guess what... still no audio. So, I've just ruled out that it's exclusively a GCC4 thing.

As far as I can tell, someone broke HDA somewhere and it doesn't work (at least for me, on my system) in GCC 2.95 *or* GCC 4 anymore... :-(

in reply to:  57 comment:58 by korli, 16 years ago

Replying to Luposian: Feel free to post a syslog or find the breaking revision by binary search.

comment:59 by Hubert, 16 years ago

Unfortunately. Despite, that HDA be seen, Media Player and CD Player work, but I haven't any sound. On OSS work correctly. Anyway, on my laptop HDA driver work correctly.

device Multimedia controller (Audio device) [4|3|0]
vendor 10de: nVidia Corporation
device 03f0: MCP61 High Definition Audio

by Hubert, 16 years ago

Attachment: syslog.2.txt added

r.30068

in reply to:  25 ; comment:60 by scottmc, 15 years ago

Replying to scottmc:

Sound is now working on my nvidia based laptop now (Compaq cq50-215nr). Nice work!

It used to work on my cq50-215nr, but hasn't for the last month or two. Media prefs show that it's detected, but I get no sound.

by scottmc, 15 years ago

Attachment: listdev-CQ50-215NR.txt added

by scottmc, 15 years ago

Attachment: cq50-215nr-syslog.txt added

syslog from my compaq cq50-215nr laptop

in reply to:  60 comment:61 by scottmc, 15 years ago

Replying to scottmc:

Replying to scottmc:

Sound is now working on my nvidia based laptop now (Compaq cq50-215nr). Nice work!

It used to work on my cq50-215nr, but hasn't for the last month or two. Media prefs show that it's detected, but I get no sound.

I've attached a syslog and the output of listdev in case that can be of any help tracking down why it's no longer working on this model.

comment:62 by axeld, 15 years ago

Resolution: fixed
Status: assignedclosed

In any case, we do have a HD audio driver since quite some time, so I'm closing this ticket.

comment:63 by atomozero, 14 years ago

Resolution: fixed
Status: closedreopened

on my Intel Atom D510 the HDA driver dont see the audio card :(

device Multimedia controller (Audio device) [4|3|0]

vendor 8086: Intel Corporation device 27d8: N10/ICH 7 Family High Definition Audio Controller

by atomozero, 14 years ago

Attachment: syslog.r37174 added

in reply to:  63 comment:64 by korli, 14 years ago

Replying to atomozero:

on my Intel Atom D510 the HDA driver dont see the audio card :(

device Multimedia controller (Audio device) [4|3|0]

vendor 8086: Intel Corporation device 27d8: N10/ICH 7 Family High Definition Audio Controller

You should maybe check first if OSS is installed :/ It seems to be the case.

comment:65 by bonefish, 14 years ago

Resolution: fixed
Status: reopenedclosed

At any rate, please open a new ticket for problems with the driver. The driver had been written (which is what this ticket is about) and the ticket gets really convoluted, if everyone adds bug reports for the driver here.

Note: See TracTickets for help on using tickets.