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
diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c
index 9338bc9..643739f 100644
--- a/hal/audio_extn/usb.c
+++ b/hal/audio_extn/usb.c
@@ -1269,6 +1269,10 @@
                     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 @@
     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);