[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:
@@ -190,6 +190,7 @@ struct hda_controller_s {
|
||||
rirb_t* rirb;
|
||||
|
||||
hda_codec* codecs[HDA_MAXCODECS];
|
||||
hda_codec* active_codec;
|
||||
uint32 num_codecs;
|
||||
|
||||
hda_stream* streams[HDA_MAXSTREAMS];
|
||||
|
||||
@@ -499,7 +499,14 @@ hda_hw_init(hda_controller* ctrlr)
|
||||
if (ctrlr->codecsts & (1 << 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;
|
||||
else
|
||||
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_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)
|
||||
return ENODEV;
|
||||
|
||||
@@ -282,20 +282,20 @@ multi_audio_control(void* cookie, uint32 op, void* arg, size_t len)
|
||||
case B_MULTI_GET_DESCRIPTION: return get_description(afg, arg);
|
||||
case B_MULTI_GET_EVENT_INFO: return B_ERROR;
|
||||
case B_MULTI_SET_EVENT_INFO: return B_ERROR;
|
||||
case B_MULTI_GET_EVENT: return B_ERROR;
|
||||
case B_MULTI_GET_EVENT: return B_ERROR;
|
||||
case B_MULTI_GET_ENABLED_CHANNELS: return get_enabled_channels(afg, arg);
|
||||
case B_MULTI_SET_ENABLED_CHANNELS: return B_OK;
|
||||
case B_MULTI_GET_GLOBAL_FORMAT: return get_global_format(afg, arg);
|
||||
case B_MULTI_SET_GLOBAL_FORMAT: return set_global_format(afg, arg);
|
||||
case B_MULTI_GET_CHANNEL_FORMATS: return B_ERROR;
|
||||
case B_MULTI_SET_CHANNEL_FORMATS: return B_ERROR;
|
||||
case B_MULTI_GET_MIX: return B_ERROR;
|
||||
case B_MULTI_SET_MIX: return B_ERROR;
|
||||
case B_MULTI_GET_MIX: return B_ERROR;
|
||||
case B_MULTI_SET_MIX: return B_ERROR;
|
||||
case B_MULTI_LIST_MIX_CHANNELS: return list_mix_channels(afg, arg);
|
||||
case B_MULTI_LIST_MIX_CONTROLS: return list_mix_controls(afg, arg);
|
||||
case B_MULTI_LIST_MIX_CONNECTIONS: return list_mix_connections(afg, arg);
|
||||
case B_MULTI_GET_BUFFERS: return get_buffers(afg, arg);
|
||||
case B_MULTI_SET_BUFFERS: return B_ERROR;
|
||||
case B_MULTI_GET_BUFFERS: return get_buffers(afg, arg);
|
||||
case B_MULTI_SET_BUFFERS: return B_ERROR;
|
||||
case B_MULTI_SET_START_TIME: return B_ERROR;
|
||||
case B_MULTI_BUFFER_EXCHANGE: return buffer_exchange(afg, arg);
|
||||
case B_MULTI_BUFFER_FORCE_STOP: return buffer_force_stop(afg);
|
||||
|
||||
@@ -24,7 +24,7 @@ hda_open (const char *name, uint32 flags, void** cookie)
|
||||
return rc;
|
||||
|
||||
hc->opened++;
|
||||
|
||||
|
||||
*cookie = hc;
|
||||
return B_OK;
|
||||
}
|
||||
@@ -47,9 +47,9 @@ static status_t
|
||||
hda_control (void* cookie, uint32 op, void* arg, size_t len)
|
||||
{
|
||||
hda_controller* hc = (hda_controller*)cookie;
|
||||
if (hc->codecs[0])
|
||||
return multi_audio_control(hc->codecs[0], op, arg, len);
|
||||
|
||||
if (hc->active_codec)
|
||||
return multi_audio_control(hc->active_codec, op, arg, len);
|
||||
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
@@ -73,10 +73,10 @@ hda_free (void* cookie)
|
||||
}
|
||||
|
||||
device_hooks driver_hooks = {
|
||||
hda_open, /* -> open entry point */
|
||||
hda_close, /* -> close entry point */
|
||||
hda_free, /* -> free cookie */
|
||||
hda_open, /* -> open entry point */
|
||||
hda_close, /* -> close entry point */
|
||||
hda_free, /* -> free cookie */
|
||||
hda_control, /* -> control entry point */
|
||||
hda_read, /* -> read entry point */
|
||||
hda_write /* -> write entry point */
|
||||
hda_read, /* -> read entry point */
|
||||
hda_write /* -> write entry point */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user