History log of /haiku-fatelf/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp
Revision Date Author Comments
# 75384e60 19-Nov-2012 Marcus Overhagen <marcus@overhagen.de>

Enable PCI memory access and interrupt


# 25a627d8 12-Nov-2012 Jerome Duval <jerome.duval@gmail.com>

hda: fixes KDL on HDMI, some digital quirks

* avoid crashing in case of lack of playback or record stream
* set format on digital output widgets
* accept digital output on the output path


# 0a361580 05-Nov-2012 Axel Dörfler <axeld@pinc-software.de>

Added HDA quirks for enabling snoop.

* Enabled snoop for all Intel hardware as found in the Linux driver.
* This fixes #8949.


# de62b051 05-Nov-2012 Axel Dörfler <axeld@pinc-software.de>

Disabled HDA MSI for now again.

* At least on my hardware, audio becomes a bit flaky (ie. sometimes it would
just stop doing anything at all).


# 225c8cc5 01-Oct-2012 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup, no functional change.


# 41828f15 23-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Cleanup, no functional change intended.


# 25b89454 23-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

MSI interrupts were not disabled on error.


# 19559d24 23-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Reset controller::active_codec on uninit.

* The controller structure is static, so if you closed the device,
and the driver failed to initialize correctly (ie. finds no codec)
on the second try, it would have crashed accessing an already freed
codec.
* Not sure why it fails to detect any codecs on second open, yet,
though.


# 45732903 20-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Implemented MSI support.

* Does not seem to change anything, though (I'm also a victim of bug
#8949)
* Minor cleanup.


# c95f35ce 09-Aug-2012 Axel Dörfler <axeld@pinc-software.de>

Fixed 64 bit issue for the buffer descriptor base.


# c356b047 08-May-2011 Jérôme Duval <korli@users.berlios.de>

spaces -> tab


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41388 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 882d595f 27-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* If an unknown type is encountered, return immediately. This fixes CID 1504.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38408 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b14ae02b 12-Jun-2010 Jérôme Duval <korli@users.berlios.de>

some verbs use a 16 bits payload


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37114 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a0a4979 12-Jun-2010 Jérôme Duval <korli@users.berlios.de>

* add some helper functions to read/write verbs.
* try at support realtek alc888. alsa uses this init sequence.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37113 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64d79eff 27-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed physical_entry::{address,size} to phys_{addr,size}_t and changed
map_physical_memory()'s physicalAddress parameter type from void* to
phys_addr_t. This breaks source compatibility, but -- as long as
phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with
BeOS.
* Adjusted all code using the affected interfaces (Oh what fun!). Added a few
TODOs in places where the wrong types (e.g. void* for physical addresses
are used). Looks like quite a few drivers aren't 64 bit safe and others
will break with PAE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e25dcf1a 15-Jan-2010 Jérôme Duval <korli@users.berlios.de>

* We now mute internal speakers when using headphones. We don't distinguish between headphones and mic jacks though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dfb72c78 21-Dec-2009 Jérôme Duval <korli@users.berlios.de>

* warn_count is unused.
* the last valid index should be written in HDAC_STREAM_LAST_VALID instead of the fragment count.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34730 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f887c705 16-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Try to detect whether the stream's DMA position is broken and switch to using
the LPIB, if it is.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34684 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e0a187dd 15-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* stream_handle_interrupt():
- Round the DMA position for the buffer cycle computation. Apparently some
chipsets trigger the interrupt before the position has been updated.
- Don't just assume that stream->buffer_length frames have been processed
at that time. Use the exact stream position at that time. This makes the
performance time computation more precise and immune to the interrupt
being delayed.
* Init hda_stream::frames_count.

Audio skips on I/O seem to be gone for me, now. Not obviously motivated skips
still happen.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4673f145 14-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* stream_handle_interrupt(): Fixed a misunderstanding of the SDnLPIB (stream
descriptor n link position in buffer) registers. They contain "the number
of bytes that have been received off the link", which is not to be confused
with the number of bytes that have been transferred by the DMA engine.
The interrupt is triggered when the last byte of the buffer has been fetched
by the DMA engine, at which point the stream's LPIB is still somewhere in
the last buffer. So the interrupt handler could compute the wrong buffer
index, which would lead to the multi audio add-on filling the wrong
(currently being transferred) buffer, resulting in noisy sound. Now we use
the DMA position. Should fix #4072.
* Also removed the not (always) working hack-around for the "wrong" buffer
positions in the interrupt handler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59967f76 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* buffer_ready_sem was released with B_DO_NOT_RESCHEDULE, but without
returning B_INVOKE_SCHEDULER from the interrupt handler, causing
latencies up to a full quantum for the multi audio output thread. This
change improves audio clicks quite a bit on my machine. Though they still
happen from time to time and particulary on FS activity.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34633 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4aafe92a 29-Nov-2009 Jérôme Duval <korli@users.berlios.de>

* cleanup
* use gpio count for gpio quirks


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34355 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 144c4c62 29-Nov-2009 Jérôme Duval <korli@users.berlios.de>

* added vref and unsol responses definitions
* untested unsolicited response support
* added quirk support for vref and gpio
* vref are now enabled for all inputs, and gpio for some Apple Macs
* replaced dprintf with TRACE and ERROR macros


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34352 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c393635 13-Sep-2009 Jérôme Duval <korli@users.berlios.de>

* prints the stream fifo size


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33121 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ea9f99f3 10-Sep-2009 Jérôme Duval <korli@users.berlios.de>

try to align the offset to be more compliant


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33047 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 561c00c9 10-Sep-2009 Jérôme Duval <korli@users.berlios.de>

prints out stream status errors


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33046 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1cab92ad 08-Sep-2009 Jérôme Duval <korli@users.berlios.de>

try at workaround early playback interrupts on non intel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33011 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e21d1251 03-Sep-2009 Jérôme Duval <korli@users.berlios.de>

the flag means no snoop


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32924 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1f5d96af 21-Aug-2009 Jérôme Duval <korli@users.berlios.de>

we now print a warning message in the log when the interrupt comes in the second half of a buffer: this should mean the interrupt comes earlier than expected.
Please report such warnings, they can help to investigate timing issues with some hda codecs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32589 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d936f5e3 28-Jul-2009 Jérôme Duval <korli@users.berlios.de>

* now uses only one buffer_ready semaphore, this way the buffer exchange is done asap, useful when rates/formats are different between playback and record.
* checked what offsets my hardware my hardware really had: it affected only playback, and was 192 for 16 bits and 256 for 20/24 bits. With these values, playback and record are crystal clear.
As I can't find any references for such offset values anywhere, sorry it's not supposed to work out of the box on all hardware. Maybe we could adjust the offset at runtime.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31875 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 94aabcd3 11-May-2009 Stephan Aßmus <superstippi@gmx.de>

* Fix by Cyan: Do the offset calculation taking the rate base into account.
Fixes using the HDA driver with frame rates based on 44100Hz.
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30704 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0bd93b7d 07-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

* Use a default buffer frame count that is adapted to the sample rate
of the audio group. This is supposed to keep the latency about the same
regardless of sample rate and lessen the requirements on the system
performance when using higher sample rates. Currently the multi-audio
addon uses the highest available rate.
* Added TODO about the highest sample rate seemingly being forgotten in one
place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29421 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b5aca78a 26-Feb-2009 Jérôme Duval <korli@users.berlios.de>

* compute offset based on vendor (32 for non intel) and sample rate


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29327 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 346ae57c 25-Feb-2009 Jérôme Duval <korli@users.berlios.de>

* Stream interrupts seem to arrive too early on most HDA chips:
we adjust buffer descriptors to take this into account. It defaults to one sample, but it should depend also on the sample rate or the chip vendor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29322 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6809d0e 09-Feb-2009 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

Do not enable interrupts on codec status change, since we do not handle those. This fixes the lockup on the EeePC, and follows the description in the HDA specs.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29172 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6dec91b4 15-Jan-2009 Jérôme Duval <korli@users.berlios.de>

use uint32 as temp variable, noticed by Marcus. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28914 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 391bf22d 14-Jan-2009 Jérôme Duval <korli@users.berlios.de>

try to complete snooping enablement


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74010f99 06-Jan-2009 Jérôme Duval <korli@users.berlios.de>

* reading CORB_READ_POS_RESET as zero fails on some chips (ie nForce).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28849 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c71a6614 01-Jan-2009 Jérôme Duval <korli@users.berlios.de>

* try to enable EAPD on capable pin widgets
* added a pin capabilities attribute instead of input and output pin attributes
* added ATI and nVidia vendor ids definitions
* uses "mic in" and "line in" when pin colors are undefined


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28839 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 321e633f 01-Jan-2009 Jérôme Duval <korli@users.berlios.de>

Patch from tqh, modified by myself: enable PCIe snooping through vendor specific registers (ATI and nVidia).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 311781df 19-Nov-2008 Jérôme Duval <korli@users.berlios.de>

* uses the default output stream on all audio outputs (and all output paths)
* enable trace to debug mixer controls build


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c3da8dd 16-Nov-2008 Jérôme Duval <korli@users.berlios.de>

added a mixer interface


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28677 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1fb04337 12-Aug-2008 Jérôme Duval <korli@users.berlios.de>

* added pin capabilities and power support constants
* added a record stream, assigned it to input widgets: no recorded sound yet, though buffer cycling is ok


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26953 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0884f0c 07-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a ton of wrong usages of B_CONTIGUOUS + B_FULL_LOCK.
* The use of B_{READ|WRITE}_AREA throughout the drivers is surely alarming.
Defining these flags means that *every user* application can access these
buffers read/write, it becomes visible in userspace like any other memory
(just shared among all apps). I would like to ask each driver maintainer
to see if that is really wished here. If you only need one app to be able
to access it, cloning the area would be more appropriate.
* I came across the use of B_ANY_KERNEL_BLOCK_ADDRESS a number of times. This
is almost completely useless for most usages, as it tries to align the
virtual to a multiple of the size of the area. It just makes the allocation
more likely to fail. Please only use where appropriate, and please review
your code.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26858 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1708513c 06-Aug-2008 Jérôme Duval <korli@users.berlios.de>

* added an ALIGN macro for easing readability and use it for 128 alignments
* use HDAC_STREAM_POSITION register value to check the current buffer cycle in interrupt handler
* added B_FULL_LOCK flags for area allocation, not sure it's handled but at least more correct
* buffer descriptors now use a low and high address fields
* applied a byte mask on format
* enabled PCI bus mastering if not yet done
* the PCI space register TCSEL (Traffic Class Select Register, which sets PCI express QOS) is now reset to TC0 (clear 0-2 bits) as needed on some boards like mine to
ensure good playback

Playback is finally working correctly here on ICH8 HDA!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 06688259 16-Jul-2008 Jérôme Duval <korli@users.berlios.de>

fix alignment


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26446 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3787196a 08-Jul-2008 Jérôme Duval <korli@users.berlios.de>

* some methods to access stream registers were defined with wrong types
* use HDAC_BIDIR_STREAM_OFFSET and HDAC_OUTPUT_STREAM_OFFSET when applicable
* use a PAGE_ALIGN macro


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26330 a95241bf-73f2-0310-859d-f6bbb57e9c96


# df709516 06-Jul-2008 Jérôme Duval <korli@users.berlios.de>

moved stateStatus read/write out of the interrupt handler
added some error verbose


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26282 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9410600 07-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Rewrote controller reset - it now performs a full reset, and does no longer
assume the driver to be in reset when started.
* Major cleanup of the register access: now hda_controller and hda_stream both
have member functions for this, the OREGx() and REGx() macros are gone.
* Made the register names and definitions more descriptive - the short names
of the specs are still mentioned in the comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25352 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 30f55bc9 12-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Rewrote widget output path discovery, it's now very similar to what the
FreeBSD driver is doing.
* hda_codec_new_audio_group() did not free the audio group's widgets on
failure.
* No longer create the input stream for now.
* Reworked multiaudio-support to work regardless if there is only a playback
or record stream.
* With these changes, I hear nothing on my laptop anymore (before there was
noise), but on another system, I can finally hear something that sounds very
much like the sinus wave the multi_audio_test application produces; the
sound quality is pretty bad though (lots of periodical noise and glitches).
* Made B_MULTI_GET_DESCRIPTION safe to be called from userland.
* Minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24383 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 438500b02 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

A bit more meaningful constant names.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24183 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abf12dd8 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Shuffled the functions a bit around to separate private from public functions.
* Renamed some functions, added comments.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24182 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c6073952 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

Accidently read one response less than needed since reworking it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24181 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 340dd4fe 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

Renamed .c to .cpp, and fixed all warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24178 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75384e609293eebaaf9c60dc5c2690bc6e95d74a 19-Nov-2012 Marcus Overhagen <marcus@overhagen.de>

Enable PCI memory access and interrupt


# 25a627d8800361c42b1f29bd2f2d29b323e9cc2d 12-Nov-2012 Jerome Duval <jerome.duval@gmail.com>

hda: fixes KDL on HDMI, some digital quirks

* avoid crashing in case of lack of playback or record stream
* set format on digital output widgets
* accept digital output on the output path


# 0a361580ad81fd49bdb887656e0c934a73020fb4 05-Nov-2012 Axel Dörfler <axeld@pinc-software.de>

Added HDA quirks for enabling snoop.

* Enabled snoop for all Intel hardware as found in the Linux driver.
* This fixes #8949.


# de62b051e4f059d8ebe04e4df7e64afa03f4626a 05-Nov-2012 Axel Dörfler <axeld@pinc-software.de>

Disabled HDA MSI for now again.

* At least on my hardware, audio becomes a bit flaky (ie. sometimes it would
just stop doing anything at all).


# 225c8cc59aac7901a84ca8baf9957037b31e62fb 01-Oct-2012 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup, no functional change.


# 41828f1567c91a86ebcfb331f556e222dd9364c4 23-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Cleanup, no functional change intended.


# 25b89454c4a36470e48f0bc2d1e179391dd1a4dc 23-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

MSI interrupts were not disabled on error.


# 19559d24fc23d18bdabfba839e5198f7f55537d8 23-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Reset controller::active_codec on uninit.

* The controller structure is static, so if you closed the device,
and the driver failed to initialize correctly (ie. finds no codec)
on the second try, it would have crashed accessing an already freed
codec.
* Not sure why it fails to detect any codecs on second open, yet,
though.


# 45732903d07ccec4eec384d839327f47b1321912 20-Sep-2012 Axel Dörfler <axeld@pinc-software.de>

Implemented MSI support.

* Does not seem to change anything, though (I'm also a victim of bug
#8949)
* Minor cleanup.


# c95f35ce9de5f9e8ed86142b19beca3ce6cc3eea 09-Aug-2012 Axel Dörfler <axeld@pinc-software.de>

Fixed 64 bit issue for the buffer descriptor base.


# c356b0477f343fd3942cc521d4823b041d829f8d 08-May-2011 Jérôme Duval <korli@users.berlios.de>

spaces -> tab


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41388 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 882d595fc0dc1a80ac9b69ac149fb814c2526d27 27-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* If an unknown type is encountered, return immediately. This fixes CID 1504.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38408 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b14ae02b959b3dd6f1d681515c445e71df725042 12-Jun-2010 Jérôme Duval <korli@users.berlios.de>

some verbs use a 16 bits payload


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37114 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a0a4979d5dad3a3689e2f8420abec40fdbd2a91 12-Jun-2010 Jérôme Duval <korli@users.berlios.de>

* add some helper functions to read/write verbs.
* try at support realtek alc888. alsa uses this init sequence.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37113 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64d79eff7290437d24b1a420537c3ed5c144ab96 27-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed physical_entry::{address,size} to phys_{addr,size}_t and changed
map_physical_memory()'s physicalAddress parameter type from void* to
phys_addr_t. This breaks source compatibility, but -- as long as
phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with
BeOS.
* Adjusted all code using the affected interfaces (Oh what fun!). Added a few
TODOs in places where the wrong types (e.g. void* for physical addresses
are used). Looks like quite a few drivers aren't 64 bit safe and others
will break with PAE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e25dcf1a96e0fcadf6ce67afae010f6d5e601acf 15-Jan-2010 Jérôme Duval <korli@users.berlios.de>

* We now mute internal speakers when using headphones. We don't distinguish between headphones and mic jacks though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dfb72c7888dc9f25d5868e7698c67706c5705fcb 21-Dec-2009 Jérôme Duval <korli@users.berlios.de>

* warn_count is unused.
* the last valid index should be written in HDAC_STREAM_LAST_VALID instead of the fragment count.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34730 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f887c7059e3604ec8d9bfe77e29f97f0d31fdffe 16-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Try to detect whether the stream's DMA position is broken and switch to using
the LPIB, if it is.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34684 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e0a187dd5931a6bf829ea306f80d28c2a4e3cff9 15-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* stream_handle_interrupt():
- Round the DMA position for the buffer cycle computation. Apparently some
chipsets trigger the interrupt before the position has been updated.
- Don't just assume that stream->buffer_length frames have been processed
at that time. Use the exact stream position at that time. This makes the
performance time computation more precise and immune to the interrupt
being delayed.
* Init hda_stream::frames_count.

Audio skips on I/O seem to be gone for me, now. Not obviously motivated skips
still happen.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4673f145a3c583f903dcc913786131ff99b55bf5 14-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* stream_handle_interrupt(): Fixed a misunderstanding of the SDnLPIB (stream
descriptor n link position in buffer) registers. They contain "the number
of bytes that have been received off the link", which is not to be confused
with the number of bytes that have been transferred by the DMA engine.
The interrupt is triggered when the last byte of the buffer has been fetched
by the DMA engine, at which point the stream's LPIB is still somewhere in
the last buffer. So the interrupt handler could compute the wrong buffer
index, which would lead to the multi audio add-on filling the wrong
(currently being transferred) buffer, resulting in noisy sound. Now we use
the DMA position. Should fix #4072.
* Also removed the not (always) working hack-around for the "wrong" buffer
positions in the interrupt handler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59967f764e0535767d6b24a0613baadf2ed22576 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* buffer_ready_sem was released with B_DO_NOT_RESCHEDULE, but without
returning B_INVOKE_SCHEDULER from the interrupt handler, causing
latencies up to a full quantum for the multi audio output thread. This
change improves audio clicks quite a bit on my machine. Though they still
happen from time to time and particulary on FS activity.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34633 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4aafe92a0e65a2d8ae667548be97a1af72c17abb 29-Nov-2009 Jérôme Duval <korli@users.berlios.de>

* cleanup
* use gpio count for gpio quirks


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34355 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 144c4c6240d02385fc69fe159ecdd253641da0a1 29-Nov-2009 Jérôme Duval <korli@users.berlios.de>

* added vref and unsol responses definitions
* untested unsolicited response support
* added quirk support for vref and gpio
* vref are now enabled for all inputs, and gpio for some Apple Macs
* replaced dprintf with TRACE and ERROR macros


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34352 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c393635e2790a8d2b57a0f2c71efc004d9147bb 13-Sep-2009 Jérôme Duval <korli@users.berlios.de>

* prints the stream fifo size


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33121 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ea9f99f3fb20c068154164ce98740ba55e26ea79 10-Sep-2009 Jérôme Duval <korli@users.berlios.de>

try to align the offset to be more compliant


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33047 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 561c00c9c352564be3581f89be59f10a93c28b1e 10-Sep-2009 Jérôme Duval <korli@users.berlios.de>

prints out stream status errors


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33046 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1cab92ade6d17a408324d89ba2375f175bf27641 08-Sep-2009 Jérôme Duval <korli@users.berlios.de>

try at workaround early playback interrupts on non intel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33011 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e21d12516e8d23ac4a4f7205c461ab9ed3d7adf7 03-Sep-2009 Jérôme Duval <korli@users.berlios.de>

the flag means no snoop


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32924 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1f5d96afb85daf74cabf5eb517d56ff408ddc266 21-Aug-2009 Jérôme Duval <korli@users.berlios.de>

we now print a warning message in the log when the interrupt comes in the second half of a buffer: this should mean the interrupt comes earlier than expected.
Please report such warnings, they can help to investigate timing issues with some hda codecs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32589 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d936f5e31fa2e40a9da45dd4e129153a82b75d0b 28-Jul-2009 Jérôme Duval <korli@users.berlios.de>

* now uses only one buffer_ready semaphore, this way the buffer exchange is done asap, useful when rates/formats are different between playback and record.
* checked what offsets my hardware my hardware really had: it affected only playback, and was 192 for 16 bits and 256 for 20/24 bits. With these values, playback and record are crystal clear.
As I can't find any references for such offset values anywhere, sorry it's not supposed to work out of the box on all hardware. Maybe we could adjust the offset at runtime.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31875 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 94aabcd3938659e201d0ce7bd7c5285354d6143a 11-May-2009 Stephan Aßmus <superstippi@gmx.de>

* Fix by Cyan: Do the offset calculation taking the rate base into account.
Fixes using the HDA driver with frame rates based on 44100Hz.
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30704 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0bd93b7def8c10073f2cec8dad5caeb844acdb78 07-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

* Use a default buffer frame count that is adapted to the sample rate
of the audio group. This is supposed to keep the latency about the same
regardless of sample rate and lessen the requirements on the system
performance when using higher sample rates. Currently the multi-audio
addon uses the highest available rate.
* Added TODO about the highest sample rate seemingly being forgotten in one
place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29421 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b5aca78a043568c5a67b2735331c818ad3313e76 26-Feb-2009 Jérôme Duval <korli@users.berlios.de>

* compute offset based on vendor (32 for non intel) and sample rate


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29327 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 346ae57c93770205d30dd33ed621411c231ccce1 25-Feb-2009 Jérôme Duval <korli@users.berlios.de>

* Stream interrupts seem to arrive too early on most HDA chips:
we adjust buffer descriptors to take this into account. It defaults to one sample, but it should depend also on the sample rate or the chip vendor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29322 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6809d0e5c0aee0c2eebd4687a62761db2e1de34 09-Feb-2009 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

Do not enable interrupts on codec status change, since we do not handle those. This fixes the lockup on the EeePC, and follows the description in the HDA specs.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29172 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6dec91b4e818c263876e9e5e2c239a2988013311 15-Jan-2009 Jérôme Duval <korli@users.berlios.de>

use uint32 as temp variable, noticed by Marcus. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28914 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 391bf22d7945a894afb034e4ccb61fc2b8d151d4 14-Jan-2009 Jérôme Duval <korli@users.berlios.de>

try to complete snooping enablement


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 74010f99115a5276a6e475084070893a8a2f9c5a 06-Jan-2009 Jérôme Duval <korli@users.berlios.de>

* reading CORB_READ_POS_RESET as zero fails on some chips (ie nForce).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28849 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c71a6614e2c46e35d1796191c8fb04d9fb1071b0 01-Jan-2009 Jérôme Duval <korli@users.berlios.de>

* try to enable EAPD on capable pin widgets
* added a pin capabilities attribute instead of input and output pin attributes
* added ATI and nVidia vendor ids definitions
* uses "mic in" and "line in" when pin colors are undefined


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28839 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 321e633fa4b8e858a4bbe9b4de35074a818f99da 01-Jan-2009 Jérôme Duval <korli@users.berlios.de>

Patch from tqh, modified by myself: enable PCIe snooping through vendor specific registers (ATI and nVidia).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 311781dfcccd26454182b1c3ab10467fa05e7e5e 19-Nov-2008 Jérôme Duval <korli@users.berlios.de>

* uses the default output stream on all audio outputs (and all output paths)
* enable trace to debug mixer controls build


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c3da8dd2ca2427d7efa609ef8708bdf7d07da92 16-Nov-2008 Jérôme Duval <korli@users.berlios.de>

added a mixer interface


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28677 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1fb04337f500f048d6c43fd8398ef3bf6c420eec 12-Aug-2008 Jérôme Duval <korli@users.berlios.de>

* added pin capabilities and power support constants
* added a record stream, assigned it to input widgets: no recorded sound yet, though buffer cycling is ok


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26953 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0884f0cb812cdaf8035e6028f69dcf0d7721953 07-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed a ton of wrong usages of B_CONTIGUOUS + B_FULL_LOCK.
* The use of B_{READ|WRITE}_AREA throughout the drivers is surely alarming.
Defining these flags means that *every user* application can access these
buffers read/write, it becomes visible in userspace like any other memory
(just shared among all apps). I would like to ask each driver maintainer
to see if that is really wished here. If you only need one app to be able
to access it, cloning the area would be more appropriate.
* I came across the use of B_ANY_KERNEL_BLOCK_ADDRESS a number of times. This
is almost completely useless for most usages, as it tries to align the
virtual to a multiple of the size of the area. It just makes the allocation
more likely to fail. Please only use where appropriate, and please review
your code.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26858 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1708513ca8a6aca38dd653cd6a982ed4fbb286c0 06-Aug-2008 Jérôme Duval <korli@users.berlios.de>

* added an ALIGN macro for easing readability and use it for 128 alignments
* use HDAC_STREAM_POSITION register value to check the current buffer cycle in interrupt handler
* added B_FULL_LOCK flags for area allocation, not sure it's handled but at least more correct
* buffer descriptors now use a low and high address fields
* applied a byte mask on format
* enabled PCI bus mastering if not yet done
* the PCI space register TCSEL (Traffic Class Select Register, which sets PCI express QOS) is now reset to TC0 (clear 0-2 bits) as needed on some boards like mine to
ensure good playback

Playback is finally working correctly here on ICH8 HDA!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 06688259b6950a886fc3fe760ba10729df085a8e 16-Jul-2008 Jérôme Duval <korli@users.berlios.de>

fix alignment


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26446 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3787196a5a32fc32657a90a062c7d5dc56d2fbd0 08-Jul-2008 Jérôme Duval <korli@users.berlios.de>

* some methods to access stream registers were defined with wrong types
* use HDAC_BIDIR_STREAM_OFFSET and HDAC_OUTPUT_STREAM_OFFSET when applicable
* use a PAGE_ALIGN macro


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26330 a95241bf-73f2-0310-859d-f6bbb57e9c96


# df709516a049ef767e69aacba9878e03649178b3 06-Jul-2008 Jérôme Duval <korli@users.berlios.de>

moved stateStatus read/write out of the interrupt handler
added some error verbose


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26282 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9410600271a751844bc99f643977479d591c07d 07-May-2008 Axel Dörfler <axeld@pinc-software.de>

* Rewrote controller reset - it now performs a full reset, and does no longer
assume the driver to be in reset when started.
* Major cleanup of the register access: now hda_controller and hda_stream both
have member functions for this, the OREGx() and REGx() macros are gone.
* Made the register names and definitions more descriptive - the short names
of the specs are still mentioned in the comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25352 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 30f55bc9908b08803b0fdd7f9f10e3a9f132a63f 12-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Rewrote widget output path discovery, it's now very similar to what the
FreeBSD driver is doing.
* hda_codec_new_audio_group() did not free the audio group's widgets on
failure.
* No longer create the input stream for now.
* Reworked multiaudio-support to work regardless if there is only a playback
or record stream.
* With these changes, I hear nothing on my laptop anymore (before there was
noise), but on another system, I can finally hear something that sounds very
much like the sinus wave the multi_audio_test application produces; the
sound quality is pretty bad though (lots of periodical noise and glitches).
* Made B_MULTI_GET_DESCRIPTION safe to be called from userland.
* Minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24383 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 438500b022361f076e1766b41edfc9d24d89bc70 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

A bit more meaningful constant names.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24183 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abf12dd83fb8a4e1e4f4df7ce91d85a99dcd08b2 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Shuffled the functions a bit around to separate private from public functions.
* Renamed some functions, added comments.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24182 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c607395208f6b82aedd99bd3df3f391532e5b258 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

Accidently read one response less than needed since reworking it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24181 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 340dd4fe3db4608f82f8cd3599d1fe0117233afa 29-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

Renamed .c to .cpp, and fixed all warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24178 a95241bf-73f2-0310-859d-f6bbb57e9c96