Loading drivers/media/platform/msm/cvp/cvp_core_hfi.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -266,6 +266,7 @@ struct iris_hfi_device { unsigned int skip_pc_count; unsigned int skip_pc_count; struct msm_cvp_capability *sys_init_capabilities; struct msm_cvp_capability *sys_init_capabilities; struct iris_hfi_vpu_ops *vpu_ops; struct iris_hfi_vpu_ops *vpu_ops; struct delayed_work dsp_init_work; }; }; void cvp_iris_hfi_delete_device(void *device); void cvp_iris_hfi_delete_device(void *device); Loading drivers/media/platform/msm/cvp/cvp_hfi.c +48 −3 Original line number Original line Diff line number Diff line Loading @@ -266,6 +266,7 @@ const int cvp_max_packets = 32; static void iris_hfi_pm_handler(struct work_struct *work); static void iris_hfi_pm_handler(struct work_struct *work); static DECLARE_DELAYED_WORK(iris_hfi_pm_work, iris_hfi_pm_handler); static DECLARE_DELAYED_WORK(iris_hfi_pm_work, iris_hfi_pm_handler); static void dsp_init_work_handler(struct work_struct *work); static inline int __resume(struct iris_hfi_device *device); static inline int __resume(struct iris_hfi_device *device); static inline int __suspend(struct iris_hfi_device *device); static inline int __suspend(struct iris_hfi_device *device); static int __disable_regulators(struct iris_hfi_device *device); static int __disable_regulators(struct iris_hfi_device *device); Loading Loading @@ -506,7 +507,7 @@ static int __dsp_send_hfi_queue(struct iris_hfi_device *device) (phys_addr_t *)device->dsp_iface_q_table.mem_data.dma_handle, (phys_addr_t *)device->dsp_iface_q_table.mem_data.dma_handle, device->dsp_iface_q_table.mem_data.size); device->dsp_iface_q_table.mem_data.size); if (rc) { if (rc) { dprintk(CVP_ERR, "%s: dsp init failed\n", __func__); dprintk(CVP_ERR, "%s: dsp hfi queue init failed\n", __func__); return rc; return rc; } } Loading Loading @@ -2154,6 +2155,43 @@ static int __sys_set_power_control(struct iris_hfi_device *device, return 0; return 0; } } static void dsp_init_work_handler(struct work_struct *work) { int rc = 0; static int retry_count; struct iris_hfi_device *device; if (!work) { dprintk(CVP_ERR, "%s: NULL device\n", __func__); return; } device = container_of(work, struct iris_hfi_device, dsp_init_work.work); if (!device) { dprintk(CVP_ERR, "%s: NULL device\n", __func__); return; } dprintk(CVP_PROF, "Entering %s\n", __func__); mutex_lock(&device->lock); rc = __dsp_send_hfi_queue(device); mutex_unlock(&device->lock); if (rc) { if (retry_count > MAX_DSP_INIT_ATTEMPTS) { dprintk(CVP_ERR, "%s: max trials exceeded\n", __func__); return; } dprintk(CVP_PROF, "%s: Attempt to init DSP %d\n", __func__, retry_count); schedule_delayed_work(&device->dsp_init_work, msecs_to_jiffies(CVP_MAX_WAIT_TIME)); ++retry_count; } } static int iris_hfi_core_init(void *device) static int iris_hfi_core_init(void *device) { { int rc = 0; int rc = 0; Loading Loading @@ -2231,7 +2269,6 @@ static int iris_hfi_core_init(void *device) __enable_subcaches(device); __enable_subcaches(device); __set_subcaches(device); __set_subcaches(device); __dsp_send_hfi_queue(device); __set_ubwc_config(device); __set_ubwc_config(device); __sys_set_idle_indicator(device, true); __sys_set_idle_indicator(device, true); Loading @@ -2244,9 +2281,15 @@ static int iris_hfi_core_init(void *device) pm_qos_add_request(&dev->qos, PM_QOS_CPU_DMA_LATENCY, pm_qos_add_request(&dev->qos, PM_QOS_CPU_DMA_LATENCY, dev->res->pm_qos_latency_us); dev->res->pm_qos_latency_us); } } rc = __dsp_send_hfi_queue(device); if (rc) schedule_delayed_work(&dev->dsp_init_work, msecs_to_jiffies(CVP_MAX_WAIT_TIME)); dprintk(CVP_DBG, "Core inited successfully\n"); dprintk(CVP_DBG, "Core inited successfully\n"); mutex_unlock(&dev->lock); mutex_unlock(&dev->lock); return rc; return 0; err_core_init: err_core_init: __set_state(dev, IRIS_STATE_DEINIT); __set_state(dev, IRIS_STATE_DEINIT); __unload_fw(dev); __unload_fw(dev); Loading Loading @@ -4852,6 +4895,8 @@ static struct iris_hfi_device *__add_device(u32 device_id, mutex_init(&hdevice->lock); mutex_init(&hdevice->lock); INIT_LIST_HEAD(&hdevice->sess_head); INIT_LIST_HEAD(&hdevice->sess_head); INIT_DELAYED_WORK(&hdevice->dsp_init_work, dsp_init_work_handler); return hdevice; return hdevice; err_cleanup: err_cleanup: Loading drivers/media/platform/msm/cvp/msm_cvp_dsp.c +23 −19 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ static int cvp_dsp_send_cmd(void *msg, uint32_t len) int err = 0; int err = 0; if (IS_ERR_OR_NULL(me->chan)) { if (IS_ERR_OR_NULL(me->chan)) { dprintk(CVP_ERR, "%s: DSP GLink is not ready\n", __func__); err = -EINVAL; err = -EINVAL; goto bail; goto bail; } } Loading Loading @@ -211,6 +212,8 @@ int cvp_dsp_send_cmd_hfi_queue(phys_addr_t *phys_addr, dprintk(CVP_ERR, dprintk(CVP_ERR, "%s: Incorrect DDR type value %d\n", "%s: Incorrect DDR type value %d\n", __func__, local_cmd_msg.ddr_type); __func__, local_cmd_msg.ddr_type); err = -EINVAL; goto exit; } } mutex_lock(&me->smd_mutex); mutex_lock(&me->smd_mutex); Loading @@ -219,7 +222,7 @@ int cvp_dsp_send_cmd_hfi_queue(phys_addr_t *phys_addr, mutex_unlock(&me->smd_mutex); mutex_unlock(&me->smd_mutex); dprintk(CVP_DBG, dprintk(CVP_DBG, "%s :: address of buffer, PA=0x%pK size_buff=%d ddr_type=%d\n", "%s: address of buffer, PA=0x%pK size_buff=%d ddr_type=%d\n", __func__, phys_addr, size_in_bytes, local_cmd_msg.ddr_type); __func__, phys_addr, size_in_bytes, local_cmd_msg.ddr_type); err = hyp_assign_phys((uint64_t)local_cmd_msg.msg_ptr, err = hyp_assign_phys((uint64_t)local_cmd_msg.msg_ptr, Loading @@ -229,33 +232,34 @@ int cvp_dsp_send_cmd_hfi_queue(phys_addr_t *phys_addr, dprintk(CVP_ERR, dprintk(CVP_ERR, "%s: Failed in hyp_assign. err=%d\n", "%s: Failed in hyp_assign. err=%d\n", __func__, err); __func__, err); return err; goto exit; } } err = cvp_dsp_send_cmd err = cvp_dsp_send_cmd (&local_cmd_msg, sizeof(struct cvp_dsp_cmd_msg)); (&local_cmd_msg, sizeof(struct cvp_dsp_cmd_msg)); if (err != 0) if (err) { dprintk(CVP_ERR, dprintk(CVP_ERR, "%s: cvp_dsp_send_cmd failed with err=%d\n", "%s: cvp_dsp_send_cmd faidmesgled with err=%d\n", __func__, err); __func__, err); else { goto exit; } core = list_first_entry(&cvp_driver->cores, core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list); struct msm_cvp_core, list); timeout = msecs_to_jiffies( timeout = msecs_to_jiffies( core->resources.msm_cvp_dsp_rsp_timeout); core->resources.msm_cvp_dsp_rsp_timeout); err = wait_for_completion_timeout( if (!wait_for_completion_timeout(&me->cmdqueue_send_work, timeout)) { &me->cmdqueue_send_work, timeout); if (!err) { dprintk(CVP_ERR, "failed to send cmdqueue\n"); dprintk(CVP_ERR, "failed to send cmdqueue\n"); return -ETIMEDOUT; err = -ETIMEDOUT; goto exit; } } mutex_lock(&me->smd_mutex); mutex_lock(&me->smd_mutex); me->cvp_shutdown = STATUS_OK; me->cvp_shutdown = STATUS_OK; me->cdsp_state = STATUS_OK; me->cdsp_state = STATUS_OK; mutex_unlock(&me->smd_mutex); mutex_unlock(&me->smd_mutex); } exit: return err; return err; } } Loading drivers/media/platform/msm/cvp/msm_cvp_internal.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,7 @@ #define MAX_SUPPORTED_INSTANCES 16 #define MAX_SUPPORTED_INSTANCES 16 #define MAX_NAME_LENGTH 64 #define MAX_NAME_LENGTH 64 #define MAX_DEBUGFS_NAME 50 #define MAX_DEBUGFS_NAME 50 #define DCVS_FTB_WINDOW 16 #define MAX_DSP_INIT_ATTEMPTS 16 #define SYS_MSG_START HAL_SYS_INIT_DONE #define SYS_MSG_START HAL_SYS_INIT_DONE #define SYS_MSG_END HAL_SYS_ERROR #define SYS_MSG_END HAL_SYS_ERROR Loading Loading
drivers/media/platform/msm/cvp/cvp_core_hfi.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -266,6 +266,7 @@ struct iris_hfi_device { unsigned int skip_pc_count; unsigned int skip_pc_count; struct msm_cvp_capability *sys_init_capabilities; struct msm_cvp_capability *sys_init_capabilities; struct iris_hfi_vpu_ops *vpu_ops; struct iris_hfi_vpu_ops *vpu_ops; struct delayed_work dsp_init_work; }; }; void cvp_iris_hfi_delete_device(void *device); void cvp_iris_hfi_delete_device(void *device); Loading
drivers/media/platform/msm/cvp/cvp_hfi.c +48 −3 Original line number Original line Diff line number Diff line Loading @@ -266,6 +266,7 @@ const int cvp_max_packets = 32; static void iris_hfi_pm_handler(struct work_struct *work); static void iris_hfi_pm_handler(struct work_struct *work); static DECLARE_DELAYED_WORK(iris_hfi_pm_work, iris_hfi_pm_handler); static DECLARE_DELAYED_WORK(iris_hfi_pm_work, iris_hfi_pm_handler); static void dsp_init_work_handler(struct work_struct *work); static inline int __resume(struct iris_hfi_device *device); static inline int __resume(struct iris_hfi_device *device); static inline int __suspend(struct iris_hfi_device *device); static inline int __suspend(struct iris_hfi_device *device); static int __disable_regulators(struct iris_hfi_device *device); static int __disable_regulators(struct iris_hfi_device *device); Loading Loading @@ -506,7 +507,7 @@ static int __dsp_send_hfi_queue(struct iris_hfi_device *device) (phys_addr_t *)device->dsp_iface_q_table.mem_data.dma_handle, (phys_addr_t *)device->dsp_iface_q_table.mem_data.dma_handle, device->dsp_iface_q_table.mem_data.size); device->dsp_iface_q_table.mem_data.size); if (rc) { if (rc) { dprintk(CVP_ERR, "%s: dsp init failed\n", __func__); dprintk(CVP_ERR, "%s: dsp hfi queue init failed\n", __func__); return rc; return rc; } } Loading Loading @@ -2154,6 +2155,43 @@ static int __sys_set_power_control(struct iris_hfi_device *device, return 0; return 0; } } static void dsp_init_work_handler(struct work_struct *work) { int rc = 0; static int retry_count; struct iris_hfi_device *device; if (!work) { dprintk(CVP_ERR, "%s: NULL device\n", __func__); return; } device = container_of(work, struct iris_hfi_device, dsp_init_work.work); if (!device) { dprintk(CVP_ERR, "%s: NULL device\n", __func__); return; } dprintk(CVP_PROF, "Entering %s\n", __func__); mutex_lock(&device->lock); rc = __dsp_send_hfi_queue(device); mutex_unlock(&device->lock); if (rc) { if (retry_count > MAX_DSP_INIT_ATTEMPTS) { dprintk(CVP_ERR, "%s: max trials exceeded\n", __func__); return; } dprintk(CVP_PROF, "%s: Attempt to init DSP %d\n", __func__, retry_count); schedule_delayed_work(&device->dsp_init_work, msecs_to_jiffies(CVP_MAX_WAIT_TIME)); ++retry_count; } } static int iris_hfi_core_init(void *device) static int iris_hfi_core_init(void *device) { { int rc = 0; int rc = 0; Loading Loading @@ -2231,7 +2269,6 @@ static int iris_hfi_core_init(void *device) __enable_subcaches(device); __enable_subcaches(device); __set_subcaches(device); __set_subcaches(device); __dsp_send_hfi_queue(device); __set_ubwc_config(device); __set_ubwc_config(device); __sys_set_idle_indicator(device, true); __sys_set_idle_indicator(device, true); Loading @@ -2244,9 +2281,15 @@ static int iris_hfi_core_init(void *device) pm_qos_add_request(&dev->qos, PM_QOS_CPU_DMA_LATENCY, pm_qos_add_request(&dev->qos, PM_QOS_CPU_DMA_LATENCY, dev->res->pm_qos_latency_us); dev->res->pm_qos_latency_us); } } rc = __dsp_send_hfi_queue(device); if (rc) schedule_delayed_work(&dev->dsp_init_work, msecs_to_jiffies(CVP_MAX_WAIT_TIME)); dprintk(CVP_DBG, "Core inited successfully\n"); dprintk(CVP_DBG, "Core inited successfully\n"); mutex_unlock(&dev->lock); mutex_unlock(&dev->lock); return rc; return 0; err_core_init: err_core_init: __set_state(dev, IRIS_STATE_DEINIT); __set_state(dev, IRIS_STATE_DEINIT); __unload_fw(dev); __unload_fw(dev); Loading Loading @@ -4852,6 +4895,8 @@ static struct iris_hfi_device *__add_device(u32 device_id, mutex_init(&hdevice->lock); mutex_init(&hdevice->lock); INIT_LIST_HEAD(&hdevice->sess_head); INIT_LIST_HEAD(&hdevice->sess_head); INIT_DELAYED_WORK(&hdevice->dsp_init_work, dsp_init_work_handler); return hdevice; return hdevice; err_cleanup: err_cleanup: Loading
drivers/media/platform/msm/cvp/msm_cvp_dsp.c +23 −19 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ static int cvp_dsp_send_cmd(void *msg, uint32_t len) int err = 0; int err = 0; if (IS_ERR_OR_NULL(me->chan)) { if (IS_ERR_OR_NULL(me->chan)) { dprintk(CVP_ERR, "%s: DSP GLink is not ready\n", __func__); err = -EINVAL; err = -EINVAL; goto bail; goto bail; } } Loading Loading @@ -211,6 +212,8 @@ int cvp_dsp_send_cmd_hfi_queue(phys_addr_t *phys_addr, dprintk(CVP_ERR, dprintk(CVP_ERR, "%s: Incorrect DDR type value %d\n", "%s: Incorrect DDR type value %d\n", __func__, local_cmd_msg.ddr_type); __func__, local_cmd_msg.ddr_type); err = -EINVAL; goto exit; } } mutex_lock(&me->smd_mutex); mutex_lock(&me->smd_mutex); Loading @@ -219,7 +222,7 @@ int cvp_dsp_send_cmd_hfi_queue(phys_addr_t *phys_addr, mutex_unlock(&me->smd_mutex); mutex_unlock(&me->smd_mutex); dprintk(CVP_DBG, dprintk(CVP_DBG, "%s :: address of buffer, PA=0x%pK size_buff=%d ddr_type=%d\n", "%s: address of buffer, PA=0x%pK size_buff=%d ddr_type=%d\n", __func__, phys_addr, size_in_bytes, local_cmd_msg.ddr_type); __func__, phys_addr, size_in_bytes, local_cmd_msg.ddr_type); err = hyp_assign_phys((uint64_t)local_cmd_msg.msg_ptr, err = hyp_assign_phys((uint64_t)local_cmd_msg.msg_ptr, Loading @@ -229,33 +232,34 @@ int cvp_dsp_send_cmd_hfi_queue(phys_addr_t *phys_addr, dprintk(CVP_ERR, dprintk(CVP_ERR, "%s: Failed in hyp_assign. err=%d\n", "%s: Failed in hyp_assign. err=%d\n", __func__, err); __func__, err); return err; goto exit; } } err = cvp_dsp_send_cmd err = cvp_dsp_send_cmd (&local_cmd_msg, sizeof(struct cvp_dsp_cmd_msg)); (&local_cmd_msg, sizeof(struct cvp_dsp_cmd_msg)); if (err != 0) if (err) { dprintk(CVP_ERR, dprintk(CVP_ERR, "%s: cvp_dsp_send_cmd failed with err=%d\n", "%s: cvp_dsp_send_cmd faidmesgled with err=%d\n", __func__, err); __func__, err); else { goto exit; } core = list_first_entry(&cvp_driver->cores, core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list); struct msm_cvp_core, list); timeout = msecs_to_jiffies( timeout = msecs_to_jiffies( core->resources.msm_cvp_dsp_rsp_timeout); core->resources.msm_cvp_dsp_rsp_timeout); err = wait_for_completion_timeout( if (!wait_for_completion_timeout(&me->cmdqueue_send_work, timeout)) { &me->cmdqueue_send_work, timeout); if (!err) { dprintk(CVP_ERR, "failed to send cmdqueue\n"); dprintk(CVP_ERR, "failed to send cmdqueue\n"); return -ETIMEDOUT; err = -ETIMEDOUT; goto exit; } } mutex_lock(&me->smd_mutex); mutex_lock(&me->smd_mutex); me->cvp_shutdown = STATUS_OK; me->cvp_shutdown = STATUS_OK; me->cdsp_state = STATUS_OK; me->cdsp_state = STATUS_OK; mutex_unlock(&me->smd_mutex); mutex_unlock(&me->smd_mutex); } exit: return err; return err; } } Loading
drivers/media/platform/msm/cvp/msm_cvp_internal.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,7 @@ #define MAX_SUPPORTED_INSTANCES 16 #define MAX_SUPPORTED_INSTANCES 16 #define MAX_NAME_LENGTH 64 #define MAX_NAME_LENGTH 64 #define MAX_DEBUGFS_NAME 50 #define MAX_DEBUGFS_NAME 50 #define DCVS_FTB_WINDOW 16 #define MAX_DSP_INIT_ATTEMPTS 16 #define SYS_MSG_START HAL_SYS_INIT_DONE #define SYS_MSG_START HAL_SYS_INIT_DONE #define SYS_MSG_END HAL_SYS_ERROR #define SYS_MSG_END HAL_SYS_ERROR Loading