Parcourir la source

Expose NSP status via sys fs node

NSP device status is exposed via SOC API.
On cat to this sys fs node, NSP status will be
returned. NSP status flag renamed to maintain
backward compatibility.

Change-Id: I67ae19e51fd58e02d78a40b30563f147bef5b20e
Signed-off-by: Ansa Ahmed <[email protected]>
Ansa Ahmed il y a 2 ans
Parent
commit
dabc96ecf3
2 fichiers modifiés avec 24 ajouts et 35 suppressions
  1. 22 33
      dsp/adsprpc.c
  2. 2 2
      dsp/adsprpc_shared.h

+ 22 - 33
dsp/adsprpc.c

@@ -55,6 +55,7 @@
 #include <linux/iommu.h>
 #include <asm/arch_timer.h>
 #include <linux/genalloc.h>
+#include <soc/qcom/socinfo.h>
 
 #ifdef CONFIG_HIBERNATION
 #include <linux/suspend.h>
@@ -2949,34 +2950,22 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
 	return err;
 }
 
-/*
- * Reads the property string from device node
- * and updates the cdsp device avialbility status
- * if the node belongs to cdsp device.
+/* fastrpc_get_nsp_status() - Reads the property string from soc_info
+ * denoted for nsp part, and updates the nsp device avialbility status
+ * if the nsp is not defective.
  * @me  : pointer to fastrpc_apps.
  */
 
-static void fastrpc_get_dsp_status(struct fastrpc_apps *me)
+static void fastrpc_get_nsp_status(struct fastrpc_apps *me)
 {
-	int ret = -1;
-	struct device_node *node = NULL;
-	const char *name = NULL;
-
-	do {
-		node = of_find_compatible_node(node, NULL, "qcom,pil-tz-generic");
-		if (node) {
-			ret = of_property_read_string(node, "qcom,firmware-name", &name);
-			if (!strcmp(name, "cdsp")) {
-				ret =  of_device_is_available(node);
-				me->remote_cdsp_status = ret;
-				ADSPRPC_INFO("cdsp node found with ret:%x\n", ret);
-				break;
-			}
-		} else {
-			ADSPRPC_ERR("cdsp node not found\n");
-			break;
-		}
-	} while (1);
+	if (socinfo_get_part_info(PART_NSP)) {
+		me->fastrpc_nsp_status = 0;
+		ADSPRPC_ERR(
+			"nsp part defective with status:%x\n", me->fastrpc_nsp_status);
+	} else {
+		me->fastrpc_nsp_status = 1;
+		ADSPRPC_INFO("nsp available with status: %x\n", me->fastrpc_nsp_status);
+	}
 }
 
 /*
@@ -8069,15 +8058,15 @@ bail:
 }
 
 /*
- * remote_cdsp_status_show - Updates the buffer with remote cdsp status
- *                           by reading the fastrpc node.
+ * fastrpc_nsp_status_show() - Updates the buffer with remote nsp status
+ * by reading the fastrpc node.
  * @dev : pointer to device node.
  * @attr: pointer to device attribute.
- * @buf : Output parameter to be updated with remote cdsp status.
+ * @buf : Output parameter to be updated with remote nsp status.
  * Return : bytes written to buffer.
  */
 
-static ssize_t remote_cdsp_status_show(struct device *dev,
+static ssize_t fastrpc_nsp_status_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct fastrpc_apps *me = &gfa;
@@ -8094,15 +8083,15 @@ static ssize_t remote_cdsp_status_show(struct device *dev,
 	}
 
 	return scnprintf(buf, PAGE_SIZE, "%d",
-			me->remote_cdsp_status);
+			me->fastrpc_nsp_status);
 }
 
-/* Remote cdsp status attribute declaration as read only */
-static DEVICE_ATTR_RO(remote_cdsp_status);
+/* Remote nsp status attribute declaration as read only */
+static DEVICE_ATTR_RO(fastrpc_nsp_status);
 
 /* Declaring attribute for remote dsp */
 static struct attribute *msm_remote_dsp_attrs[] = {
-	&dev_attr_remote_cdsp_status.attr,
+	&dev_attr_fastrpc_nsp_status.attr,
 	NULL
 };
 
@@ -8674,7 +8663,7 @@ static int __init fastrpc_device_init(void)
 	}
 	memset(me, 0, sizeof(*me));
 	fastrpc_init(me);
-	fastrpc_get_dsp_status(me);
+	fastrpc_get_nsp_status(me);
 	me->dev = NULL;
 	me->legacy_remote_heap = false;
 	err = bus_register(&fastrpc_bus_type);

+ 2 - 2
dsp/adsprpc_shared.h

@@ -738,8 +738,8 @@ struct fastrpc_apps {
 	struct hlist_head frpc_devices;
 	struct hlist_head frpc_drivers;
 	struct mutex mut_uid;
-	/* Indicates cdsp device status */
-	int remote_cdsp_status;
+	/* Indicates nsp status */
+	int fastrpc_nsp_status;
 	/* Indicates secure context bank to be shared */
 	int share_securecb;
 	/* Indicates process type is configured for SMMU context bank */