msm: smd: Add edge-to-subsystem lookup call

Add support for looking up the name of a subsystem
given an SMD edge.

This enables moving the PIL subsystem naming to
platform data instead of hard coding it in SMD,
SMD PKT, and SMD TTY.

Change-Id: I5f9325baff6eb8f414efa67e136164181aed9be3
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index f6a4f32..d31df6b 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -607,19 +607,20 @@
 struct edge_to_pid {
 	uint32_t	local_pid;
 	uint32_t	remote_pid;
+	char		subsys_name[SMD_MAX_CH_NAME_LEN];
 };
 
 /**
  * Maps edge type to local and remote processor ID's.
  */
 static struct edge_to_pid edge_to_pids[] = {
-	[SMD_APPS_MODEM] = {SMSM_APPS, SMSM_MODEM},
-	[SMD_APPS_QDSP] = {SMSM_APPS, SMSM_Q6},
+	[SMD_APPS_MODEM] = {SMSM_APPS, SMSM_MODEM, "modem"},
+	[SMD_APPS_QDSP] = {SMSM_APPS, SMSM_Q6, "q6"},
 	[SMD_MODEM_QDSP] = {SMSM_MODEM, SMSM_Q6},
-	[SMD_APPS_DSPS] = {SMSM_APPS, SMSM_DSPS},
+	[SMD_APPS_DSPS] = {SMSM_APPS, SMSM_DSPS, "dsps"},
 	[SMD_MODEM_DSPS] = {SMSM_MODEM, SMSM_DSPS},
 	[SMD_QDSP_DSPS] = {SMSM_Q6, SMSM_DSPS},
-	[SMD_APPS_WCNSS] = {SMSM_APPS, SMSM_WCNSS},
+	[SMD_APPS_WCNSS] = {SMSM_APPS, SMSM_WCNSS, "wcnss"},
 	[SMD_MODEM_WCNSS] = {SMSM_MODEM, SMSM_WCNSS},
 	[SMD_QDSP_WCNSS] = {SMSM_Q6, SMSM_WCNSS},
 	[SMD_DSPS_WCNSS] = {SMSM_DSPS, SMSM_WCNSS},
@@ -739,6 +740,26 @@
 	return ret;
 }
 
+/*
+ * Returns a pointer to the subsystem name or NULL if no
+ * subsystem name is available.
+ *
+ * @type - Edge definition
+ */
+const char *smd_edge_to_subsystem(uint32_t type)
+{
+	const char *subsys = NULL;
+
+	if (type < ARRAY_SIZE(edge_to_pids)) {
+		subsys = edge_to_pids[type].subsys_name;
+		if (subsys[0] == 0x0)
+			subsys = NULL;
+	}
+	return subsys;
+}
+EXPORT_SYMBOL(smd_edge_to_subsystem);
+
+
 static void smd_reset_edge(struct smd_half_channel *ch, unsigned new_state)
 {
 	if (ch->state != SMD_SS_CLOSED) {
@@ -2788,6 +2809,9 @@
 				cfg->smsm_int.irq_name);
 			break;
 		}
+
+		strncpy(edge_to_pids[cfg->edge].subsys_name,
+				cfg->subsys_name, SMD_MAX_CH_NAME_LEN);
 	}
 
 	if (err_ret < 0) {