audio: use of audio_route_{apply/reset}_and_update_path APIs

1) Update enable/disable device and route to use the new APIs.
   With this change, mixer controls will be updated in the order
   listed in mixer paths XML file.
2) update_mixer is now an unused var.

Change-Id: Ic0a8874e4a2080347cfa0c2e66af606a08a207a7
CRs-Fixed: 581453
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index ded07f4..e8d0d20 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -239,7 +239,7 @@
 
 int enable_audio_route(struct audio_device *adev,
                               struct audio_usecase *usecase,
-                              bool update_mixer)
+                              bool __unused update_mixer)
 {
     snd_device_t snd_device;
     char mixer_path[MIXER_PATH_MAX_LENGTH];
@@ -260,18 +260,15 @@
 #endif
     strcpy(mixer_path, use_case_table[usecase->id]);
     platform_add_backend_name(mixer_path, snd_device);
-    ALOGV("%s: apply mixer path: %s", __func__, mixer_path);
-    audio_route_apply_path(adev->audio_route, mixer_path);
-    if (update_mixer)
-        audio_route_update_mixer(adev->audio_route);
-
+    ALOGV("%s: apply mixer and update path: %s", __func__, mixer_path);
+    audio_route_apply_and_update_path(adev->audio_route, mixer_path);
     ALOGV("%s: exit", __func__);
     return 0;
 }
 
 int disable_audio_route(struct audio_device *adev,
                         struct audio_usecase *usecase,
-                        bool update_mixer)
+                        bool __unused update_mixer)
 {
     snd_device_t snd_device;
     char mixer_path[MIXER_PATH_MAX_LENGTH];
@@ -286,18 +283,15 @@
         snd_device = usecase->out_snd_device;
     strcpy(mixer_path, use_case_table[usecase->id]);
     platform_add_backend_name(mixer_path, snd_device);
-    ALOGV("%s: reset mixer path: %s", __func__, mixer_path);
-    audio_route_reset_path(adev->audio_route, mixer_path);
-    if (update_mixer)
-        audio_route_update_mixer(adev->audio_route);
-
+    ALOGV("%s: reset and update mixer path: %s", __func__, mixer_path);
+    audio_route_reset_and_update_path(adev->audio_route, mixer_path);
     ALOGV("%s: exit", __func__);
     return 0;
 }
 
 int enable_snd_device(struct audio_device *adev,
                              snd_device_t snd_device,
-                             bool update_mixer)
+                             bool __unused update_mixer)
 {
     char device_name[DEVICE_NAME_MAX_SIZE] = {0};
 
@@ -325,12 +319,10 @@
      */
     if ((snd_device == SND_DEVICE_OUT_BT_SCO) ||
         (snd_device == SND_DEVICE_IN_BT_SCO_MIC)) {
-        audio_route_apply_path(adev->audio_route, BT_SCO_SAMPLE_RATE);
-        audio_route_update_mixer(adev->audio_route);
+        audio_route_apply_and_update_path(adev->audio_route, BT_SCO_SAMPLE_RATE);
     } else if ((snd_device == SND_DEVICE_OUT_BT_SCO_WB) ||
                (snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB)) {
-        audio_route_apply_path(adev->audio_route, BT_SCO_WB_SAMPLE_RATE);
-        audio_route_update_mixer(adev->audio_route);
+        audio_route_apply_and_update_path(adev->audio_route, BT_SCO_WB_SAMPLE_RATE);
     }
 
     /* start usb playback thread */
@@ -362,17 +354,14 @@
                            LISTEN_EVENT_SND_DEVICE_FREE);
             return -EINVAL;
         }
-        audio_route_apply_path(adev->audio_route, device_name);
+        audio_route_apply_and_update_path(adev->audio_route, device_name);
     }
-    if (update_mixer)
-        audio_route_update_mixer(adev->audio_route);
-
     return 0;
 }
 
 int disable_snd_device(struct audio_device *adev,
                        snd_device_t snd_device,
-                       bool update_mixer)
+                       bool __unused update_mixer)
 {
     char device_name[DEVICE_NAME_MAX_SIZE] = {0};
 
@@ -410,10 +399,7 @@
             audio_extn_spkr_prot_is_enabled()) {
             audio_extn_spkr_prot_stop_processing();
         } else
-            audio_route_reset_path(adev->audio_route, device_name);
-
-        if (update_mixer)
-            audio_route_update_mixer(adev->audio_route);
+            audio_route_reset_and_update_path(adev->audio_route, device_name);
 
         audio_extn_listen_update_status(snd_device,
                                         LISTEN_EVENT_SND_DEVICE_FREE);
@@ -462,8 +448,7 @@
     }
 
     if (num_uc_to_switch) {
-        /* Make sure all the streams are de-routed before disabling the device */
-        audio_route_update_mixer(adev->audio_route);
+        /* All streams have been de-routed. Disable the device */
 
         /* Make sure the previous devices to be disabled first and then enable the
            selected devices */
@@ -531,8 +516,7 @@
     }
 
     if (num_uc_to_switch) {
-        /* Make sure all the streams are de-routed before disabling the device */
-        audio_route_update_mixer(adev->audio_route);
+        /* All streams have been de-routed. Disable the device */
 
         /* Make sure the previous devices to be disabled first and then enable the
            selected devices */
@@ -759,8 +743,6 @@
                                                         out_snd_device,
                                                         in_snd_device);
 
-    audio_route_update_mixer(adev->audio_route);
-
     usecase->in_snd_device = in_snd_device;
     usecase->out_snd_device = out_snd_device;