From 2b1343d5a52d54615f4d1c88fe75c4c0f614a9a3 Mon Sep 17 00:00:00 2001 From: Srinu Gorle Date: Tue, 5 Apr 2016 15:01:21 +0530 Subject: [PATCH] msm: vidc: pm qos stability fixes for video driver Stability issues are observed, if pm qos request removes without adding it. Check pm qos request status before remove it. The default request type PM_QOS_REQ_ALL_CORES is applicable to all CPU cores that are online and would have a power impact when there are more number of CPUs. Specify a request type as PM_QOS_REQ_AFFINE_IRQ. CRs-Fixed: 995426 Change-Id: I738f201ed126c6be4076c582c37999362e1d0e88 Signed-off-by: Srinu Gorle --- drivers/media/platform/msm/vidc/venus_hfi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c index ee4e7aef2fa3..2a080eba6419 100644 --- a/drivers/media/platform/msm/vidc/venus_hfi.c +++ b/drivers/media/platform/msm/vidc/venus_hfi.c @@ -2211,9 +2211,14 @@ static int venus_hfi_core_init(void *device) if (rc || __iface_cmdq_write(dev, &version_pkt)) dprintk(VIDC_WARN, "Failed to send image version pkt to f/w\n"); - if (dev->res->pm_qos_latency_us) + if (dev->res->pm_qos_latency_us) { +#ifdef CONFIG_SMP + dev->qos.type = PM_QOS_REQ_AFFINE_IRQ; + dev->qos.irq = dev->hal_data->irq; +#endif pm_qos_add_request(&dev->qos, PM_QOS_CPU_DMA_LATENCY, dev->res->pm_qos_latency_us); + } mutex_unlock(&dev->lock); return rc; @@ -2237,7 +2242,8 @@ static int venus_hfi_core_release(void *dev) mutex_lock(&device->lock); - if (device->res->pm_qos_latency_us) + if (device->res->pm_qos_latency_us && + pm_qos_request_active(&device->qos)) pm_qos_remove_request(&device->qos); __set_state(device, VENUS_STATE_DEINIT); __unload_fw(device); @@ -4201,7 +4207,8 @@ static inline int __suspend(struct venus_hfi_device *device) dprintk(VIDC_DBG, "Entering power collapse\n"); - if (device->res->pm_qos_latency_us) + if (device->res->pm_qos_latency_us && + pm_qos_request_active(&device->qos)) pm_qos_remove_request(&device->qos); rc = __tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND); @@ -4263,9 +4270,14 @@ static inline int __resume(struct venus_hfi_device *device) */ __set_threshold_registers(device); - if (device->res->pm_qos_latency_us) + if (device->res->pm_qos_latency_us) { +#ifdef CONFIG_SMP + device->qos.type = PM_QOS_REQ_AFFINE_IRQ; + device->qos.irq = device->hal_data->irq; +#endif pm_qos_add_request(&device->qos, PM_QOS_CPU_DMA_LATENCY, device->res->pm_qos_latency_us); + } dprintk(VIDC_INFO, "Resumed from power collapse\n"); exit: device->skip_pc_count = 0;