[HDA] When controller has multiple codecs, make sure we try to use the one with audio features. This should improve laptop support. More to come ;)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23295 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ithamar R. Adema
2008-01-09 10:20:07 +00:00
parent 789091541e
commit afc104a083
4 changed files with 24 additions and 16 deletions
@@ -190,6 +190,7 @@ struct hda_controller_s {
rirb_t* rirb; rirb_t* rirb;
hda_codec* codecs[HDA_MAXCODECS]; hda_codec* codecs[HDA_MAXCODECS];
hda_codec* active_codec;
uint32 num_codecs; uint32 num_codecs;
hda_stream* streams[HDA_MAXSTREAMS]; hda_stream* streams[HDA_MAXSTREAMS];
@@ -499,7 +499,14 @@ hda_hw_init(hda_controller* ctrlr)
if (ctrlr->codecsts & (1 << idx)) if (ctrlr->codecsts & (1 << idx))
hda_codec_new(ctrlr, idx); hda_codec_new(ctrlr, idx);
if (ctrlr->codecs[0] != NULL) for (idx=0; idx < HDA_MAXCODECS; idx++) {
if (ctrlr->codecs[idx] && ctrlr->codecs[idx]->num_afgs) {
ctrlr->active_codec = ctrlr->codecs[idx];
break;
}
}
if (ctrlr->active_codec != NULL)
return B_OK; return B_OK;
else else
rc = ENODEV; rc = ENODEV;
@@ -272,7 +272,7 @@ multi_audio_control(void* cookie, uint32 op, void* arg, size_t len)
hda_codec* codec = (hda_codec*)cookie; hda_codec* codec = (hda_codec*)cookie;
hda_afg* afg; hda_afg* afg;
/* FIXME: Make sure we have a valid codec & afg... */ /* FIXME: We should simply pass the afg into here... */
if (!codec || codec->num_afgs == 0) if (!codec || codec->num_afgs == 0)
return ENODEV; return ENODEV;
+2 -2
View File
@@ -47,8 +47,8 @@ static status_t
hda_control (void* cookie, uint32 op, void* arg, size_t len) hda_control (void* cookie, uint32 op, void* arg, size_t len)
{ {
hda_controller* hc = (hda_controller*)cookie; hda_controller* hc = (hda_controller*)cookie;
if (hc->codecs[0]) if (hc->active_codec)
return multi_audio_control(hc->codecs[0], op, arg, len); return multi_audio_control(hc->active_codec, op, arg, len);
return B_BAD_VALUE; return B_BAD_VALUE;
} }