mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Read and report AC'97 codec revision
This might help with debugging on bare metal. Since the minimum version that can be specified is revision 2.1, and we do not use any feature from revision 2.2 or newer, this is merely future-proofing ourselves for new features yet to be built. Additionally, removing the `VERIFY()` ensures we will not crash on cards that only support earlier revisions.
This commit is contained in:
parent
9a46573ffc
commit
694ff12272
Notes:
sideshowbarker
2024-07-17 18:09:49 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/694ff12272 Pull-request: https://github.com/SerenityOS/serenity/pull/12798
2 changed files with 7 additions and 1 deletions
|
@ -87,8 +87,12 @@ UNMAP_AFTER_INIT ErrorOr<void> AC97::initialize()
|
|||
// Reset mixer
|
||||
m_io_mixer_base.offset(NativeAudioMixerRegister::Reset).out<u16>(1);
|
||||
|
||||
// Read out AC'97 codec revision
|
||||
auto extended_audio_id = m_io_mixer_base.offset(NativeAudioMixerRegister::ExtendedAudioID).in<u16>();
|
||||
VERIFY((extended_audio_id & ExtendedAudioMask::Revision) >> 10 == AC97Revision::Revision23);
|
||||
m_codec_revision = static_cast<AC97Revision>(((extended_audio_id & ExtendedAudioMask::Revision) >> 10) & 0b11);
|
||||
dbgln_if(AC97_DEBUG, "AC97 @ {}: codec revision {:#02b}", pci_address(), to_underlying(m_codec_revision));
|
||||
if (m_codec_revision == AC97Revision::Reserved)
|
||||
return ENOTSUP;
|
||||
|
||||
// Enable variable and double rate PCM audio if supported
|
||||
auto extended_audio_status_control_register = m_io_mixer_base.offset(NativeAudioMixerRegister::ExtendedAudioStatusControl);
|
||||
|
|
|
@ -57,6 +57,7 @@ private:
|
|||
Revision21OrEarlier = 0b00,
|
||||
Revision22 = 0b01,
|
||||
Revision23 = 0b10,
|
||||
Reserved = 0b11,
|
||||
};
|
||||
|
||||
enum NativeAudioBusChannel : u8 {
|
||||
|
@ -162,6 +163,7 @@ private:
|
|||
|
||||
OwnPtr<Memory::Region> m_buffer_descriptor_list;
|
||||
u8 m_buffer_descriptor_list_index { 0 };
|
||||
AC97Revision m_codec_revision;
|
||||
bool m_double_rate_pcm_enabled { false };
|
||||
IOAddress m_io_mixer_base;
|
||||
IOAddress m_io_bus_base;
|
||||
|
|
Loading…
Reference in a new issue