qcacmn: Add API in HIF to read Runtime State in readable format

Improve Runtime PM state logging for debugging purposes.
Log transport layer tag as well.

Change-Id: I90b74693c8c84a09a8cca64276ad62b7157160cb
CRs-Fixed: 1072520
diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c
index c8b47ba..8e44418 100644
--- a/hif/src/pcie/if_pci.c
+++ b/hif/src/pcie/if_pci.c
@@ -924,6 +924,22 @@
 }
 
 #ifdef FEATURE_RUNTIME_PM
+static const char *hif_pm_runtime_state_to_string(uint32_t state)
+{
+	switch (state) {
+	case HIF_PM_RUNTIME_STATE_NONE:
+		return "INIT_STATE";
+	case HIF_PM_RUNTIME_STATE_ON:
+		return "ON";
+	case HIF_PM_RUNTIME_STATE_INPROGRESS:
+		return "INPROGRESS";
+	case HIF_PM_RUNTIME_STATE_SUSPENDED:
+		return "SUSPENDED";
+	default:
+		return "INVALID STATE";
+	}
+}
+
 #define HIF_PCI_RUNTIME_PM_STATS(_s, _sc, _name) \
 	seq_printf(_s, "%30s: %u\n", #_name, _sc->pm_stats._name)
 /**
@@ -939,9 +955,10 @@
 {
 	struct hif_pm_runtime_lock *ctx;
 
-	HIF_ERROR("%s: usage_count: %d, pm_state: %d, prevent_suspend_cnt: %d",
+	HIF_ERROR("%s: usage_count: %d, pm_state: %s, prevent_suspend_cnt: %d",
 			msg, atomic_read(&sc->dev->power.usage_count),
-			atomic_read(&sc->pm_state),
+			hif_pm_runtime_state_to_string(
+					atomic_read(&sc->pm_state)),
 			sc->prevent_suspend_cnt);
 
 	HIF_ERROR("runtime_status: %d, runtime_error: %d, disable_depth: %d autosuspend_delay: %d",
@@ -3820,8 +3837,10 @@
 
 	hif_sc->pm_stats.prevent_suspend++;
 
-	HIF_ERROR("%s: in pm_state:%d ret: %d", __func__,
-			qdf_atomic_read(&hif_sc->pm_state), ret);
+	HIF_ERROR("%s: in pm_state:%s ret: %d", __func__,
+		hif_pm_runtime_state_to_string(
+			qdf_atomic_read(&hif_sc->pm_state)),
+					ret);
 
 	return ret;
 }
@@ -3865,8 +3884,10 @@
 	hif_pm_runtime_mark_last_busy(hif_sc->dev);
 	ret = hif_pm_runtime_put_auto(hif_sc->dev);
 
-	HIF_ERROR("%s: in pm_state:%d ret: %d", __func__,
-			qdf_atomic_read(&hif_sc->pm_state), ret);
+	HIF_ERROR("%s: in pm_state:%s ret: %d", __func__,
+		hif_pm_runtime_state_to_string(
+			qdf_atomic_read(&hif_sc->pm_state)),
+					ret);
 
 	hif_sc->pm_stats.allow_suspend++;
 	return ret;
@@ -4050,8 +4071,10 @@
 
 	spin_unlock_irqrestore(&hif_sc->runtime_lock, flags);
 
-	HIF_ERROR("%s: pm_state: %d delay: %dms ret: %d\n", __func__,
-			qdf_atomic_read(&hif_sc->pm_state), delay, ret);
+	HIF_ERROR("%s: pm_state: %s delay: %dms ret: %d\n", __func__,
+		hif_pm_runtime_state_to_string(
+			qdf_atomic_read(&hif_sc->pm_state)),
+					delay, ret);
 
 	return ret;
 }