From e9bf517d51fbe938c12914f743dd3ae749471862 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 | 25 +++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/msm/vidc/venus_hfi.c b/drivers/media/platform/msm/vidc/venus_hfi.c index 6eb08efec874..a3d4fa64f189 100644 --- a/drivers/media/platform/msm/vidc/venus_hfi.c +++ b/drivers/media/platform/msm/vidc/venus_hfi.c @@ -1656,7 +1656,9 @@ static inline int venus_hfi_power_off(struct venus_hfi_device *device) dprintk(VIDC_DBG, "Entering power collapse\n"); - pm_qos_remove_request(&device->qos); + if (device->res->pm_qos_latency_us && + pm_qos_request_active(&device->qos)) + pm_qos_remove_request(&device->qos); rc = venus_hfi_tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND); if (rc) { dprintk(VIDC_WARN, "Failed to suspend video core %d\n", rc); @@ -1800,9 +1802,15 @@ static inline int venus_hfi_power_on(struct venus_hfi_device *device) } device->power_enabled = true; - 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"); return rc; @@ -2620,9 +2628,14 @@ static int venus_hfi_core_init(void *device) if (rc || venus_hfi_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); + } return rc; err_core_init: @@ -2669,7 +2682,11 @@ static int venus_hfi_core_release(void *device) dev->intr_status = 0; } - pm_qos_remove_request(&dev->qos); + + if (dev->res->pm_qos_latency_us && + pm_qos_request_active(&dev->qos)) + pm_qos_remove_request(&dev->qos); + venus_hfi_set_state(dev, VENUS_STATE_DEINIT); dprintk(VIDC_INFO, "HAL exited\n");