Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 003d9ea0 authored by Garmond Leung's avatar Garmond Leung
Browse files

usb: update altset function to pick proper settings for AFE

Target sample rate was not taken into consideration previously
as the default sample rate was returned. Updating helper
function to use the desired sample rate.

Modify macro to look for best match instead of max value for
bitwidth / channels.

Change-Id: Ifb32a0fd869b911f6cb0790508372f3e7319dc48
CRs-Fixed: 2294095
parent 6ad12456
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1269,6 +1269,10 @@ int audio_extn_usb_altset_for_service_interval(bool playback,
                    bool match = (playback && (dev_info->type == USB_PLAYBACK)) ||   \
                            (!playback && (dev_info->type == USB_CAPTURE));          \
                    if (match && (cond)) {                                           \
                        if (dev_info->field == *field) {                             \
                          local_var = dev_info->field;                               \
                          break;                                                     \
                        }                                                            \
                        local_var = _MAX(local_var, dev_info->field);                \
                    }                                                                \
            }                                                                        \
@@ -1279,6 +1283,7 @@ int audio_extn_usb_altset_for_service_interval(bool playback,
    FIND_BEST_MATCH(ch, channels, \
                    dev_info->service_interval_us == service_interval && \
                    dev_info->bit_width == bw);
    sr = *sample_rate;
    list_for_each(node_i, &usbmod->usb_card_conf_list) {
        /* Currently only apply the first playback sound card configuration */
        card_info = node_to_item(node_i, struct usb_card_config, list);