hal: fix for hph power mode on headphone backends

 -hph power mode is not getting set properly for headphone
  backends if there is no change in backend config params.
 -though there is no change in backend congfigs, set hph mode.

Change-Id: I919a3ddf7a5e4d62edc556e612594f700332512e
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index e282849..6b63919 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -4556,18 +4556,6 @@
             mixer_ctl_set_enum_by_string(ctl, "LPCM");
         }
     }
-    if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
-        SND_DEVICE_OUT_HEADPHONES_44_1) {
-        if (sample_rate > 48000 ||
-            (bit_width >= 24 && (sample_rate == 48000  || sample_rate == 44100))) {
-            ALOGV("%s: apply HPH HQ mode\n", __func__);
-            audio_route_apply_and_update_path(adev->audio_route, "hph-highquality-mode");
-        } else {
-            ALOGV("%s: apply HPH LP mode\n", __func__);
-            audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
-        }
-    }
-
     return ret;
 }
 
@@ -4865,6 +4853,18 @@
                backend_cfg->bit_width, backend_cfg->sample_rate, backend_cfg->channels);
     }
 
+    if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
+        SND_DEVICE_OUT_HEADPHONES_44_1) {
+        if (sample_rate > 48000 ||
+            (bit_width >= 24 && (sample_rate == 48000  || sample_rate == 44100))) {
+            ALOGV("%s: apply HPH HQ mode\n", __func__);
+            audio_route_apply_and_update_path(adev->audio_route, "hph-highquality-mode");
+        } else {
+            ALOGV("%s: apply HPH LP mode\n", __func__);
+            audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
+        }
+    }
+
     return backend_change;
 }
 
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 7f681ab..c7b56ef 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -4528,19 +4528,6 @@
             mixer_ctl_set_enum_by_string(ctl, "LPCM");
         }
     }
-
-    if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
-        SND_DEVICE_OUT_HEADPHONES_44_1) {
-        if (sample_rate > 48000 ||
-            (bit_width >= 24 && (sample_rate == 48000  || sample_rate == 44100))) {
-            ALOGV("%s: apply HPH HQ mode\n", __func__);
-            audio_route_apply_and_update_path(adev->audio_route, "hph-highquality-mode");
-        } else {
-            ALOGV("%s: apply HPH LP mode\n", __func__);
-            audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
-        }
-    }
-
     return ret;
 }
 
@@ -4816,6 +4803,18 @@
               __func__, backend_cfg->bit_width, backend_cfg->sample_rate, backend_cfg->channels);
     }
 
+    if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
+        SND_DEVICE_OUT_HEADPHONES_44_1) {
+        if (sample_rate > 48000 ||
+            (bit_width >= 24 && (sample_rate == 48000  || sample_rate == 44100))) {
+            ALOGI("%s: apply HPH HQ mode\n", __func__);
+            audio_route_apply_and_update_path(adev->audio_route, "hph-highquality-mode");
+        } else {
+            ALOGI("%s: apply HPH LP mode\n", __func__);
+            audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
+        }
+    }
+
     return backend_change;
 }