Loading drivers/media/platform/msm/vidc/venus_hfi.c +28 −38 Original line number Diff line number Diff line Loading @@ -693,29 +693,6 @@ static void __set_registers(struct venus_hfi_device *device) } } static int __core_start_cpu(struct venus_hfi_device *device) { u32 ctrl_status = 0, count = 0, rc = 0; int max_tries = 100; __write_register(device, VIDC_WRAPPER_INTR_MASK, VIDC_WRAPPER_INTR_MASK_A2HVCODEC_BMSK); while (!ctrl_status && count < max_tries) { ctrl_status = __read_register(device, VIDC_CPU_CS_SCIACMDARG0); if ((ctrl_status & 0xFE) == 0x4) { dprintk(VIDC_ERR, "invalid setting for UC_REGION\n"); break; } usleep_range(500, 1000); count++; } if (count >= max_tries) rc = -ETIME; return rc; } static void __iommu_detach(struct venus_hfi_device *device) { struct context_bank_info *cb; Loading Loading @@ -1267,13 +1244,27 @@ static inline int __tzbsp_set_video_state(enum tzbsp_video_state state) return 0; } static inline int __reset_core(struct venus_hfi_device *device) static inline int __boot_firmware(struct venus_hfi_device *device) { int rc = 0; u32 ctrl_status = 0, count = 0, max_tries = 100; __write_register(device, VIDC_CTRL_INIT, 0x1); rc = __core_start_cpu(device); if (rc) dprintk(VIDC_ERR, "Failed to start core\n"); while (!ctrl_status && count < max_tries) { ctrl_status = __read_register(device, VIDC_CPU_CS_SCIACMDARG0); if ((ctrl_status & 0xFE) == 0x4) { dprintk(VIDC_ERR, "invalid setting for UC_REGION\n"); break; } usleep_range(500, 1000); count++; } if (count >= max_tries) { dprintk(VIDC_ERR, "Error booting up vidc firmware\n"); rc = -ETIME; } return rc; } Loading Loading @@ -2145,8 +2136,6 @@ static int venus_hfi_core_init(void *device) __set_state(dev, VENUS_STATE_INIT); dev->intr_status = 0; list_for_each_safe(ptr, next, &dev->sess_head) { /* This means that session list is not empty. Kick stale * sessions out of our valid instance list, but keep the Loading @@ -2161,7 +2150,6 @@ static int venus_hfi_core_init(void *device) __set_registers(dev); enable_irq(dev->hal_data->irq); if (!dev->hal_client) { dev->hal_client = msm_smem_new_client( SMEM_ION, dev->res, MSM_VIDC_UNKNOWN); Loading @@ -2187,8 +2175,7 @@ static int venus_hfi_core_init(void *device) goto err_core_init; } __write_register(dev, VIDC_CTRL_INIT, 0x1); rc = __core_start_cpu(dev); rc = __boot_firmware(dev); if (rc) { dprintk(VIDC_ERR, "Failed to start core\n"); rc = -ENODEV; Loading @@ -2214,7 +2201,6 @@ static int venus_hfi_core_init(void *device) return rc; err_core_init: __set_state(dev, VENUS_STATE_DEINIT); disable_irq_nosync(dev->hal_data->irq); __unload_fw(dev); err_load_fw: mutex_unlock(&dev->lock); Loading @@ -2239,10 +2225,6 @@ static int __core_release(struct venus_hfi_device *device) "Failed to unset and free imem in core release: %d\n", rc); if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) disable_irq_nosync(device->hal_data->irq); device->intr_status = 0; __set_state(device, VENUS_STATE_DEINIT); return rc; Loading Loading @@ -4198,6 +4180,10 @@ static int __venus_power_on(struct venus_hfi_device *device) "Failed to scale clocks, performance might be affected\n"); rc = 0; } __write_register(device, VIDC_WRAPPER_INTR_MASK, VIDC_WRAPPER_INTR_MASK_A2HVCODEC_BMSK); device->intr_status = 0; enable_irq(device->hal_data->irq); /* Hand off control of regulators to h/w _after_ enabling clocks */ if (__enable_hw_power_collapse(device)) Loading @@ -4215,6 +4201,10 @@ fail_vote_buses: static void __venus_power_off(struct venus_hfi_device *device) { if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) disable_irq_nosync(device->hal_data->irq); device->intr_status = 0; /* Halt the AXI to make sure there are no pending transactions. * Clocks should be unprepared after making sure axi is halted. */ Loading Loading @@ -4323,7 +4313,7 @@ static inline int __resume(struct venus_hfi_device *device) __set_registers(device); __setup_ucregion_memory_map(device); /* Wait for boot completion */ rc = __reset_core(device); rc = __boot_firmware(device); if (rc) { dprintk(VIDC_ERR, "Failed to reset venus core\n"); goto err_reset_core; Loading Loading
drivers/media/platform/msm/vidc/venus_hfi.c +28 −38 Original line number Diff line number Diff line Loading @@ -693,29 +693,6 @@ static void __set_registers(struct venus_hfi_device *device) } } static int __core_start_cpu(struct venus_hfi_device *device) { u32 ctrl_status = 0, count = 0, rc = 0; int max_tries = 100; __write_register(device, VIDC_WRAPPER_INTR_MASK, VIDC_WRAPPER_INTR_MASK_A2HVCODEC_BMSK); while (!ctrl_status && count < max_tries) { ctrl_status = __read_register(device, VIDC_CPU_CS_SCIACMDARG0); if ((ctrl_status & 0xFE) == 0x4) { dprintk(VIDC_ERR, "invalid setting for UC_REGION\n"); break; } usleep_range(500, 1000); count++; } if (count >= max_tries) rc = -ETIME; return rc; } static void __iommu_detach(struct venus_hfi_device *device) { struct context_bank_info *cb; Loading Loading @@ -1267,13 +1244,27 @@ static inline int __tzbsp_set_video_state(enum tzbsp_video_state state) return 0; } static inline int __reset_core(struct venus_hfi_device *device) static inline int __boot_firmware(struct venus_hfi_device *device) { int rc = 0; u32 ctrl_status = 0, count = 0, max_tries = 100; __write_register(device, VIDC_CTRL_INIT, 0x1); rc = __core_start_cpu(device); if (rc) dprintk(VIDC_ERR, "Failed to start core\n"); while (!ctrl_status && count < max_tries) { ctrl_status = __read_register(device, VIDC_CPU_CS_SCIACMDARG0); if ((ctrl_status & 0xFE) == 0x4) { dprintk(VIDC_ERR, "invalid setting for UC_REGION\n"); break; } usleep_range(500, 1000); count++; } if (count >= max_tries) { dprintk(VIDC_ERR, "Error booting up vidc firmware\n"); rc = -ETIME; } return rc; } Loading Loading @@ -2145,8 +2136,6 @@ static int venus_hfi_core_init(void *device) __set_state(dev, VENUS_STATE_INIT); dev->intr_status = 0; list_for_each_safe(ptr, next, &dev->sess_head) { /* This means that session list is not empty. Kick stale * sessions out of our valid instance list, but keep the Loading @@ -2161,7 +2150,6 @@ static int venus_hfi_core_init(void *device) __set_registers(dev); enable_irq(dev->hal_data->irq); if (!dev->hal_client) { dev->hal_client = msm_smem_new_client( SMEM_ION, dev->res, MSM_VIDC_UNKNOWN); Loading @@ -2187,8 +2175,7 @@ static int venus_hfi_core_init(void *device) goto err_core_init; } __write_register(dev, VIDC_CTRL_INIT, 0x1); rc = __core_start_cpu(dev); rc = __boot_firmware(dev); if (rc) { dprintk(VIDC_ERR, "Failed to start core\n"); rc = -ENODEV; Loading @@ -2214,7 +2201,6 @@ static int venus_hfi_core_init(void *device) return rc; err_core_init: __set_state(dev, VENUS_STATE_DEINIT); disable_irq_nosync(dev->hal_data->irq); __unload_fw(dev); err_load_fw: mutex_unlock(&dev->lock); Loading @@ -2239,10 +2225,6 @@ static int __core_release(struct venus_hfi_device *device) "Failed to unset and free imem in core release: %d\n", rc); if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) disable_irq_nosync(device->hal_data->irq); device->intr_status = 0; __set_state(device, VENUS_STATE_DEINIT); return rc; Loading Loading @@ -4198,6 +4180,10 @@ static int __venus_power_on(struct venus_hfi_device *device) "Failed to scale clocks, performance might be affected\n"); rc = 0; } __write_register(device, VIDC_WRAPPER_INTR_MASK, VIDC_WRAPPER_INTR_MASK_A2HVCODEC_BMSK); device->intr_status = 0; enable_irq(device->hal_data->irq); /* Hand off control of regulators to h/w _after_ enabling clocks */ if (__enable_hw_power_collapse(device)) Loading @@ -4215,6 +4201,10 @@ fail_vote_buses: static void __venus_power_off(struct venus_hfi_device *device) { if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) disable_irq_nosync(device->hal_data->irq); device->intr_status = 0; /* Halt the AXI to make sure there are no pending transactions. * Clocks should be unprepared after making sure axi is halted. */ Loading Loading @@ -4323,7 +4313,7 @@ static inline int __resume(struct venus_hfi_device *device) __set_registers(device); __setup_ucregion_memory_map(device); /* Wait for boot completion */ rc = __reset_core(device); rc = __boot_firmware(device); if (rc) { dprintk(VIDC_ERR, "Failed to reset venus core\n"); goto err_reset_core; Loading