Changeset 0d59ea7e in mainline for uspace/drv/audio/hdaudio/codec.c


Ignore:
Timestamp:
2022-07-02T14:34:36Z (22 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ab7aad4, a247c32, baa2a33, d9dda26
Parents:
9e9d9bc6
Message:

Multiple HD Audio converters cannot pull from a single stream

We select one arbitrary output converter for out PCM output, similar to what
we do for input.

We filter the 'other' VirtualBox output converters based on rates/formats
being zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/codec.c

    r9e9d9bc6 r0d59ea7e  
    11/*
    2  * Copyright (c) 2014 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    512512        codec->address = address;
    513513        codec->in_aw = -1;
     514        codec->out_aw = -1;
    514515
    515516        rc = hda_get_subnc(codec, 0, &sfg, &nfg);
     
    584585                                        goto error;
    585586                        } else if (awtype == awt_audio_output) {
    586                                 codec->out_aw_list[codec->out_aw_num++] = aw;
    587 
    588587                                rc = hda_get_supp_rates(codec, aw, &rates);
    589588                                if (rc != EOK)
     
    594593                                        goto error;
    595594
    596                                 ddf_msg(LVL_DEBUG, "Output widget %d: rates=0x%x formats=0x%x",
     595                                if (rates != 0 && formats != 0 &&
     596                                    codec->out_aw < 0) {
     597                                        ddf_msg(LVL_DEBUG, "Selected output "
     598                                            "widget %d\n", aw);
     599                                        codec->out_aw = aw;
     600                                } else {
     601                                        ddf_msg(LVL_DEBUG, "Ignoring output "
     602                                            "widget %d\n", aw);
     603                                }
     604
     605                                ddf_msg(LVL_NOTE, "Output widget %d: rates=0x%x formats=0x%x",
    597606                                    aw, rates, formats);
     607                                codec->out_aw_rates = rates;
     608                                codec->out_aw_formats = formats;
    598609                        } else if (awtype == awt_audio_input) {
    599610                                if (codec->in_aw < 0) {
     
    616627                                ddf_msg(LVL_DEBUG, "Input widget %d: rates=0x%x formats=0x%x",
    617628                                    aw, rates, formats);
     629                                codec->in_aw_rates = rates;
     630                                codec->in_aw_formats = formats;
    618631                        }
    619632
     
    644657{
    645658        errno_t rc;
    646         int out_aw;
    647         int i;
    648 
    649         for (i = 0; i < codec->out_aw_num; i++) {
    650                 out_aw = codec->out_aw_list[i];
    651 
    652                 /* Configure converter */
    653 
    654                 ddf_msg(LVL_DEBUG, "Configure output converter format");
    655                 rc = hda_set_converter_fmt(codec, out_aw, stream->fmt);
    656                 if (rc != EOK)
    657                         goto error;
    658 
    659                 ddf_msg(LVL_DEBUG, "Configure output converter stream, channel");
    660                 rc = hda_set_converter_ctl(codec, out_aw, stream->sid, 0);
    661                 if (rc != EOK)
    662                         goto error;
    663         }
     659
     660        /* Configure converter */
     661        ddf_msg(LVL_DEBUG, "Configure output converter format / %d",
     662            codec->out_aw);
     663        rc = hda_set_converter_fmt(codec, codec->out_aw, stream->fmt);
     664        if (rc != EOK)
     665                goto error;
     666
     667        ddf_msg(LVL_DEBUG, "Configure output converter stream, channel");
     668        rc = hda_set_converter_ctl(codec, codec->out_aw, stream->sid, 0);
     669        if (rc != EOK)
     670                goto error;
    664671
    665672        return EOK;
Note: See TracChangeset for help on using the changeset viewer.