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 <quic_hmreddy@quicinc.com>
This commit is contained in:
Himateja Reddy
2023-05-03 11:44:06 -07:00
parent d0ad5cc2d5
commit 2c1d233879
2 changed files with 42 additions and 0 deletions

33
dsp/adsprpc.c Executable file → Normal file
View File

@@ -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;