hal: Reset HPH power mode to class AB for wcd9370 variant

As wcd9370 codec only supports Class AB HPH power mode,
reset the power mode for that variant

Change-Id: I791aad8447c89bf43e573f080f6c610c6c7c539b
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 91a04e7..742b1a4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -298,6 +298,7 @@
     bool ec_ref_enabled;
     bool is_wsa_speaker;
     bool hifi_audio;
+    bool is_cls_ab_only_supported;
     bool is_i2s_ext_modem;
     bool is_acdb_initialized;
     /* Vbat monitor related flags */
@@ -3194,7 +3195,6 @@
         my_data->hifi_audio = true;
     set_platform_defaults(my_data);
 
-
     /* Initialize ACDB ID's */
     if (my_data->is_i2s_ext_modem && !is_auto_snd_card(snd_card_name))
         platform_info_init(PLATFORM_INFO_XML_PATH_I2S, my_data, PLATFORM);
@@ -3685,6 +3685,11 @@
                                              my_data->adev->snd_card,
                                              my_data->codec_version);
 
+    /* WCD9370 codec variant only supports Class AB power mode */
+    if (strstr(my_data->codec_variant, "WCD9370")) {
+        my_data->is_cls_ab_only_supported = true;
+    }
+
     if (NATIVE_AUDIO_MODE_INVALID != platform_get_native_support()) {
         /*
          * Native playback is enabled from the UI.
@@ -8881,13 +8886,18 @@
 
     if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
         SND_DEVICE_OUT_HEADPHONES_44_1 || snd_device == SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER) {
-        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");
+        if (my_data->is_cls_ab_only_supported) {
+           ALOGI("%s: apply CLS AB HPH power mode\n", __func__);
+           audio_route_apply_and_update_path(adev->audio_route, "hph-class-ab-mode");
         } else {
-            ALOGI("%s: apply HPH LP mode\n", __func__);
-            audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
+            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");
+            }
         }
     }