hal: fix mismatch in configuration for NOIRQ record path

- Initialization of 'realtime' mode for an input stream got
  moved down its usage during propagation of compress input
  changes to 2.2 component. Incorrect mode causes legacy low-latency
  configuration being used even for NOIRQ pcm devices and hence
  the error in setting hw and sw parameters.

- Realign initialization of 'realtime' mode to place it properly
  before the usage and hence fix this issue.

Change-Id: Ifdc7b8ff9d129e93a48d34c622e5a76bd83617eb
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 7d60af3..8c37bae 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -4705,6 +4705,16 @@
     in->capture_handle = handle;
     in->flags = flags;
 
+    in->usecase = USECASE_AUDIO_RECORD;
+    if (config->sample_rate == LOW_LATENCY_CAPTURE_SAMPLE_RATE &&
+            (flags & AUDIO_INPUT_FLAG_FAST) != 0) {
+        is_low_latency = true;
+#if LOW_LATENCY_CAPTURE_USE_CASE
+        in->usecase = USECASE_AUDIO_RECORD_LOW_LATENCY;
+#endif
+        in->realtime = may_use_noirq_mode(adev, in->usecase, in->flags);
+    }
+
     in->format = config->format;
     if (in->realtime) {
         in->config = pcm_config_audio_capture_rt;
@@ -4759,16 +4769,6 @@
         }
     }
 
-    in->usecase = USECASE_AUDIO_RECORD;
-    if (config->sample_rate == LOW_LATENCY_CAPTURE_SAMPLE_RATE &&
-            (flags & AUDIO_INPUT_FLAG_FAST) != 0) {
-        is_low_latency = true;
-#if LOW_LATENCY_CAPTURE_USE_CASE
-        in->usecase = USECASE_AUDIO_RECORD_LOW_LATENCY;
-#endif
-        in->realtime = may_use_noirq_mode(adev, in->usecase, in->flags);
-    }
-
     /* Update config params with the requested sample rate and channels */
     if ((in->device == AUDIO_DEVICE_IN_TELEPHONY_RX) &&
           (adev->mode != AUDIO_MODE_IN_CALL)) {