瀏覽代碼

msm: adsprpc: FastRPC driver interface to get HLOS PID

Currently there is no interface request to get HLOS PID of
the device attached to FastRPC bus driver. Add new request
FASTRPC_DEV_GET_HLOS_PID, to get HLOS PID of the attached
device.

Signed-off-by: Himateja Reddy <[email protected]>
Himateja Reddy 2 年之前
父節點
當前提交
2c1d233879
共有 2 個文件被更改,包括 42 次插入0 次删除
  1. 33 0
      dsp/adsprpc.c
  2. 9 0
      include/linux/fastrpc.h

+ 33 - 0
dsp/adsprpc.c

@@ -8148,6 +8148,7 @@ static struct platform_driver fastrpc_driver = {
 union fastrpc_dev_param {
 	struct fastrpc_dev_map_dma *map;
 	struct fastrpc_dev_unmap_dma *unmap;
+	struct fastrpc_dev_get_hlos_pid *hpid;
 };
 
 long fastrpc_dev_map_dma(struct fastrpc_device *dev, unsigned long invoke_param)
@@ -8281,6 +8282,35 @@ bail:
 	return err;
 }
 
+long fastrpc_dev_get_hlos_pid(struct fastrpc_device *dev, unsigned long invoke_param)
+{
+	int err = 0;
+	union fastrpc_dev_param p;
+	struct fastrpc_file *fl = NULL;
+	struct fastrpc_apps *me = &gfa;
+	unsigned long irq_flags = 0;
+
+	p.hpid = (struct fastrpc_dev_get_hlos_pid *)invoke_param;
+	spin_lock_irqsave(&me->hlock, irq_flags);
+	/* Verify if fastrpc device is closed*/
+	VERIFY(err, dev && !dev->dev_close);
+	if (err) {
+		err = -ESRCH;
+		spin_unlock_irqrestore(&me->hlock, irq_flags);
+		return err;
+	}
+	fl = dev->fl;
+	/* Verify if fastrpc file is not NULL*/
+	if (!fl) {
+		err = -EBADF;
+		spin_unlock_irqrestore(&me->hlock, irq_flags);
+		return err;
+	}
+	p.hpid->hlos_pid = fl->tgid;
+	spin_unlock_irqrestore(&me->hlock, irq_flags);
+	return err;
+}
+
 long fastrpc_driver_invoke(struct fastrpc_device *dev, unsigned int invoke_num,
 								unsigned long invoke_param)
 {
@@ -8293,6 +8323,9 @@ long fastrpc_driver_invoke(struct fastrpc_device *dev, unsigned int invoke_num,
 	case FASTRPC_DEV_UNMAP_DMA:
 		err = fastrpc_dev_unmap_dma(dev, invoke_param);
 		break;
+	case FASTRPC_DEV_GET_HLOS_PID:
+		err = fastrpc_dev_get_hlos_pid(dev, invoke_param);
+		break;
 	default:
 		err = -ENOTTY;
 		break;

+ 9 - 0
include/linux/fastrpc.h

@@ -18,6 +18,7 @@ enum fastrpc_driver_status {
 enum fastrpc_driver_invoke_nums {
 	FASTRPC_DEV_MAP_DMA = 1,
 	FASTRPC_DEV_UNMAP_DMA,
+	FASTRPC_DEV_GET_HLOS_PID,
 };
 
 /**
@@ -44,6 +45,14 @@ struct fastrpc_dev_unmap_dma {
 	size_t size;
 };
 
+/**
+ * struct fastrpc_dev_get_hlos_pid - fastrpc dma buffer unmap structure
+ * @hlos_pid   : HLOS PID of attached device
+ */
+struct fastrpc_dev_get_hlos_pid {
+	int hlos_pid;
+};
+
 /**
  * fastrpc_device - device that belong to the fastrpc bus
  * @hn: Head node to add to fastrpc device list