Loading drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c +17 −17 Original line number Diff line number Diff line Loading @@ -214,22 +214,22 @@ static int cam_jpeg_mgr_get_free_ctx(struct cam_jpeg_hw_mgr *hw_mgr) static int cam_jpeg_mgr_release_ctx( struct cam_jpeg_hw_mgr *hw_mgr, int ctx_id) struct cam_jpeg_hw_mgr *hw_mgr, struct cam_jpeg_hw_ctx_data *ctx_data) { if (ctx_id >= CAM_JPEG_CTX_MAX) { CAM_ERR(CAM_JPEG, "ctx_id is wrong: %d", ctx_id); if (!ctx_data) { CAM_ERR(CAM_JPEG, "invalid ctx_data %pK", ctx_data); return -EINVAL; } mutex_lock(&hw_mgr->ctx_data[ctx_id].ctx_mutex); if (!hw_mgr->ctx_data[ctx_id].in_use) { CAM_ERR(CAM_JPEG, "ctx is already in use: %d", ctx_id); mutex_unlock(&hw_mgr->ctx_data[ctx_id].ctx_mutex); mutex_lock(&ctx_data->ctx_mutex); if (!ctx_data->in_use) { CAM_ERR(CAM_JPEG, "ctx is already un-used: %pK", ctx_data); mutex_unlock(&ctx_data->ctx_mutex); return -EINVAL; } hw_mgr->ctx_data[ctx_id].in_use = 0; mutex_unlock(&hw_mgr->ctx_data[ctx_id].ctx_mutex); ctx_data->in_use = false; mutex_unlock(&ctx_data->ctx_mutex); return 0; } Loading Loading @@ -280,7 +280,8 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data) hw_mgr->dev_hw_cfg_args[p_cfg_req->dev_type][0] = p_cfg_req; list_del_init(&p_cfg_req->list); } else { CAM_ERR(CAM_JPEG, "NOT dequeing, just return"); CAM_DBG(CAM_JPEG, "Not dequeing, just return"); mutex_unlock(&hw_mgr->hw_mgr_mutex); rc = -EFAULT; goto end; } Loading @@ -289,7 +290,7 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data) config_args = (struct cam_hw_config_args *)&p_cfg_req->hw_cfg_args; request_id = task_data->request_id; if (request_id != (uint64_t)config_args->priv) { CAM_WARN(CAM_JPEG, "not a recent req %d %d", CAM_DBG(CAM_JPEG, "not a recent req %lld %lld", request_id, (uint64_t)config_args->priv); } Loading Loading @@ -475,8 +476,8 @@ static int cam_jpeg_mgr_config_hw(void *hw_mgr_priv, void *config_hw_args) request_id = (uint64_t)config_args->priv; hw_update_entries = config_args->hw_update_entries; CAM_DBG(CAM_JPEG, "ctx_data = %pK req_id = %d %pK", ctx_data, request_id, config_args->priv); CAM_DBG(CAM_JPEG, "ctx_data = %pK req_id = %lld %lld", ctx_data, request_id, (uint64_t)config_args->priv); task = cam_req_mgr_workq_get_task(g_jpeg_hw_mgr.work_process_frame); if (!task) { CAM_ERR(CAM_JPEG, "no empty task"); Loading Loading @@ -631,13 +632,12 @@ static int cam_jpeg_mgr_prepare_hw_update(void *hw_mgr_priv, static int cam_jpeg_mgr_release_hw(void *hw_mgr_priv, void *release_hw_args) { int rc; int ctx_id = 0; struct cam_hw_release_args *release_hw = release_hw_args; struct cam_jpeg_hw_mgr *hw_mgr = hw_mgr_priv; struct cam_jpeg_hw_ctx_data *ctx_data = NULL; uint32_t dev_type; if (!release_hw || !hw_mgr) { if (!hw_mgr || !release_hw || !release_hw->ctxt_to_hw_map) { CAM_ERR(CAM_JPEG, "Invalid args"); return -EINVAL; } Loading Loading @@ -671,7 +671,7 @@ static int cam_jpeg_mgr_release_hw(void *hw_mgr_priv, void *release_hw_args) } mutex_unlock(&hw_mgr->hw_mgr_mutex); rc = cam_jpeg_mgr_release_ctx(hw_mgr, ctx_id); rc = cam_jpeg_mgr_release_ctx(hw_mgr, ctx_data); if (rc) { mutex_unlock(&hw_mgr->hw_mgr_mutex); return -EINVAL; Loading Loading @@ -838,7 +838,7 @@ static int cam_jpeg_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args) cam_cdm_release(hw_mgr->cdm_info[dev_type][0].cdm_handle); acq_cdm_hdl_failed: kfree(ctx_data->cdm_cmd); cam_jpeg_mgr_release_ctx(hw_mgr, ctx_id); cam_jpeg_mgr_release_ctx(hw_mgr, ctx_data); mutex_unlock(&hw_mgr->hw_mgr_mutex); return rc; Loading drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c +35 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ int cam_jpeg_dma_init_hw(void *device_priv, return -EINVAL; } mutex_lock(&core_info->core_mutex); if (++core_info->ref_count > 1) { mutex_unlock(&core_info->core_mutex); return 0; } cpas_vote.ahb_vote.type = CAM_VOTE_ABSOLUTE; cpas_vote.ahb_vote.vote.level = CAM_SVS_VOTE; cpas_vote.axi_vote.compressed_bw = JPEG_TURBO_VOTE; Loading @@ -64,15 +71,26 @@ int cam_jpeg_dma_init_hw(void *device_priv, rc = cam_cpas_start(core_info->cpas_handle, &cpas_vote.ahb_vote, &cpas_vote.axi_vote); if (rc) if (rc) { CAM_ERR(CAM_JPEG, "cpass start failed: %d", rc); goto cpas_failed; } rc = cam_jpeg_dma_enable_soc_resources(soc_info); if (rc) { CAM_ERR(CAM_JPEG, "soc enable is failed %d", rc); cam_cpas_stop(core_info->cpas_handle); goto soc_failed; } mutex_unlock(&core_info->core_mutex); return 0; soc_failed: cam_cpas_stop(core_info->cpas_handle); cpas_failed: --core_info->ref_count; mutex_unlock(&core_info->core_mutex); return rc; } Loading @@ -98,6 +116,19 @@ int cam_jpeg_dma_deinit_hw(void *device_priv, return -EINVAL; } mutex_lock(&core_info->core_mutex); if (--core_info->ref_count > 0) { mutex_unlock(&core_info->core_mutex); return 0; } if (core_info->ref_count < 0) { CAM_ERR(CAM_JPEG, "ref cnt %d", core_info->ref_count); core_info->ref_count = 0; mutex_unlock(&core_info->core_mutex); return -EFAULT; } rc = cam_jpeg_dma_disable_soc_resources(soc_info); if (rc) CAM_ERR(CAM_JPEG, "soc enable failed %d", rc); Loading @@ -106,6 +137,8 @@ int cam_jpeg_dma_deinit_hw(void *device_priv, if (rc) CAM_ERR(CAM_JPEG, "cpas stop failed: %d", rc); mutex_unlock(&core_info->core_mutex); return 0; } Loading drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.h +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ struct cam_jpeg_dma_device_core_info { struct cam_jpeg_dma_device_hw_info *jpeg_dma_hw_info; uint32_t cpas_handle; struct cam_jpeg_dma_set_irq_cb irq_cb; int32_t ref_count; struct mutex core_mutex; }; int cam_jpeg_dma_init_hw(void *device_priv, Loading drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_dev.c +5 −1 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ static int cam_jpeg_dma_remove(struct platform_device *pdev) if (rc) CAM_ERR(CAM_JPEG, " unreg failed to reg cpas %d", rc); mutex_destroy(&core_info->core_mutex); kfree(core_info); deinit_soc: Loading Loading @@ -165,13 +166,14 @@ static int cam_jpeg_dma_probe(struct platform_device *pdev) hw_info = (struct cam_jpeg_dma_device_hw_info *)match_dev->data; core_info->jpeg_dma_hw_info = hw_info; core_info->core_state = CAM_JPEG_DMA_CORE_NOT_READY; mutex_init(&core_info->core_mutex); rc = cam_jpeg_dma_init_soc_resources(&jpeg_dma_dev->soc_info, cam_jpeg_dma_irq, jpeg_dma_dev); if (rc) { CAM_ERR(CAM_JPEG, "%failed to init_soc %d", rc); goto error_match_dev; goto error_init_soc; } rc = cam_jpeg_dma_register_cpas(&jpeg_dma_dev->soc_info, Loading @@ -191,6 +193,8 @@ static int cam_jpeg_dma_probe(struct platform_device *pdev) error_reg_cpas: rc = cam_soc_util_release_platform_resource(&jpeg_dma_dev->soc_info); error_init_soc: mutex_destroy(&core_info->core_mutex); error_match_dev: kfree(jpeg_dma_dev->core_info); error_alloc_core: Loading drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_soc.c +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ int cam_jpeg_dma_disable_soc_resources(struct cam_hw_soc_info *soc_info) { int rc; rc = cam_soc_util_disable_platform_resource(soc_info, true, false); rc = cam_soc_util_disable_platform_resource(soc_info, true, true); if (rc) CAM_ERR(CAM_JPEG, "disable platform failed %d", rc); Loading Loading
drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c +17 −17 Original line number Diff line number Diff line Loading @@ -214,22 +214,22 @@ static int cam_jpeg_mgr_get_free_ctx(struct cam_jpeg_hw_mgr *hw_mgr) static int cam_jpeg_mgr_release_ctx( struct cam_jpeg_hw_mgr *hw_mgr, int ctx_id) struct cam_jpeg_hw_mgr *hw_mgr, struct cam_jpeg_hw_ctx_data *ctx_data) { if (ctx_id >= CAM_JPEG_CTX_MAX) { CAM_ERR(CAM_JPEG, "ctx_id is wrong: %d", ctx_id); if (!ctx_data) { CAM_ERR(CAM_JPEG, "invalid ctx_data %pK", ctx_data); return -EINVAL; } mutex_lock(&hw_mgr->ctx_data[ctx_id].ctx_mutex); if (!hw_mgr->ctx_data[ctx_id].in_use) { CAM_ERR(CAM_JPEG, "ctx is already in use: %d", ctx_id); mutex_unlock(&hw_mgr->ctx_data[ctx_id].ctx_mutex); mutex_lock(&ctx_data->ctx_mutex); if (!ctx_data->in_use) { CAM_ERR(CAM_JPEG, "ctx is already un-used: %pK", ctx_data); mutex_unlock(&ctx_data->ctx_mutex); return -EINVAL; } hw_mgr->ctx_data[ctx_id].in_use = 0; mutex_unlock(&hw_mgr->ctx_data[ctx_id].ctx_mutex); ctx_data->in_use = false; mutex_unlock(&ctx_data->ctx_mutex); return 0; } Loading Loading @@ -280,7 +280,8 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data) hw_mgr->dev_hw_cfg_args[p_cfg_req->dev_type][0] = p_cfg_req; list_del_init(&p_cfg_req->list); } else { CAM_ERR(CAM_JPEG, "NOT dequeing, just return"); CAM_DBG(CAM_JPEG, "Not dequeing, just return"); mutex_unlock(&hw_mgr->hw_mgr_mutex); rc = -EFAULT; goto end; } Loading @@ -289,7 +290,7 @@ static int cam_jpeg_mgr_process_cmd(void *priv, void *data) config_args = (struct cam_hw_config_args *)&p_cfg_req->hw_cfg_args; request_id = task_data->request_id; if (request_id != (uint64_t)config_args->priv) { CAM_WARN(CAM_JPEG, "not a recent req %d %d", CAM_DBG(CAM_JPEG, "not a recent req %lld %lld", request_id, (uint64_t)config_args->priv); } Loading Loading @@ -475,8 +476,8 @@ static int cam_jpeg_mgr_config_hw(void *hw_mgr_priv, void *config_hw_args) request_id = (uint64_t)config_args->priv; hw_update_entries = config_args->hw_update_entries; CAM_DBG(CAM_JPEG, "ctx_data = %pK req_id = %d %pK", ctx_data, request_id, config_args->priv); CAM_DBG(CAM_JPEG, "ctx_data = %pK req_id = %lld %lld", ctx_data, request_id, (uint64_t)config_args->priv); task = cam_req_mgr_workq_get_task(g_jpeg_hw_mgr.work_process_frame); if (!task) { CAM_ERR(CAM_JPEG, "no empty task"); Loading Loading @@ -631,13 +632,12 @@ static int cam_jpeg_mgr_prepare_hw_update(void *hw_mgr_priv, static int cam_jpeg_mgr_release_hw(void *hw_mgr_priv, void *release_hw_args) { int rc; int ctx_id = 0; struct cam_hw_release_args *release_hw = release_hw_args; struct cam_jpeg_hw_mgr *hw_mgr = hw_mgr_priv; struct cam_jpeg_hw_ctx_data *ctx_data = NULL; uint32_t dev_type; if (!release_hw || !hw_mgr) { if (!hw_mgr || !release_hw || !release_hw->ctxt_to_hw_map) { CAM_ERR(CAM_JPEG, "Invalid args"); return -EINVAL; } Loading Loading @@ -671,7 +671,7 @@ static int cam_jpeg_mgr_release_hw(void *hw_mgr_priv, void *release_hw_args) } mutex_unlock(&hw_mgr->hw_mgr_mutex); rc = cam_jpeg_mgr_release_ctx(hw_mgr, ctx_id); rc = cam_jpeg_mgr_release_ctx(hw_mgr, ctx_data); if (rc) { mutex_unlock(&hw_mgr->hw_mgr_mutex); return -EINVAL; Loading Loading @@ -838,7 +838,7 @@ static int cam_jpeg_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args) cam_cdm_release(hw_mgr->cdm_info[dev_type][0].cdm_handle); acq_cdm_hdl_failed: kfree(ctx_data->cdm_cmd); cam_jpeg_mgr_release_ctx(hw_mgr, ctx_id); cam_jpeg_mgr_release_ctx(hw_mgr, ctx_data); mutex_unlock(&hw_mgr->hw_mgr_mutex); return rc; Loading
drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c +35 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ int cam_jpeg_dma_init_hw(void *device_priv, return -EINVAL; } mutex_lock(&core_info->core_mutex); if (++core_info->ref_count > 1) { mutex_unlock(&core_info->core_mutex); return 0; } cpas_vote.ahb_vote.type = CAM_VOTE_ABSOLUTE; cpas_vote.ahb_vote.vote.level = CAM_SVS_VOTE; cpas_vote.axi_vote.compressed_bw = JPEG_TURBO_VOTE; Loading @@ -64,15 +71,26 @@ int cam_jpeg_dma_init_hw(void *device_priv, rc = cam_cpas_start(core_info->cpas_handle, &cpas_vote.ahb_vote, &cpas_vote.axi_vote); if (rc) if (rc) { CAM_ERR(CAM_JPEG, "cpass start failed: %d", rc); goto cpas_failed; } rc = cam_jpeg_dma_enable_soc_resources(soc_info); if (rc) { CAM_ERR(CAM_JPEG, "soc enable is failed %d", rc); cam_cpas_stop(core_info->cpas_handle); goto soc_failed; } mutex_unlock(&core_info->core_mutex); return 0; soc_failed: cam_cpas_stop(core_info->cpas_handle); cpas_failed: --core_info->ref_count; mutex_unlock(&core_info->core_mutex); return rc; } Loading @@ -98,6 +116,19 @@ int cam_jpeg_dma_deinit_hw(void *device_priv, return -EINVAL; } mutex_lock(&core_info->core_mutex); if (--core_info->ref_count > 0) { mutex_unlock(&core_info->core_mutex); return 0; } if (core_info->ref_count < 0) { CAM_ERR(CAM_JPEG, "ref cnt %d", core_info->ref_count); core_info->ref_count = 0; mutex_unlock(&core_info->core_mutex); return -EFAULT; } rc = cam_jpeg_dma_disable_soc_resources(soc_info); if (rc) CAM_ERR(CAM_JPEG, "soc enable failed %d", rc); Loading @@ -106,6 +137,8 @@ int cam_jpeg_dma_deinit_hw(void *device_priv, if (rc) CAM_ERR(CAM_JPEG, "cpas stop failed: %d", rc); mutex_unlock(&core_info->core_mutex); return 0; } Loading
drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.h +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ struct cam_jpeg_dma_device_core_info { struct cam_jpeg_dma_device_hw_info *jpeg_dma_hw_info; uint32_t cpas_handle; struct cam_jpeg_dma_set_irq_cb irq_cb; int32_t ref_count; struct mutex core_mutex; }; int cam_jpeg_dma_init_hw(void *device_priv, Loading
drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_dev.c +5 −1 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ static int cam_jpeg_dma_remove(struct platform_device *pdev) if (rc) CAM_ERR(CAM_JPEG, " unreg failed to reg cpas %d", rc); mutex_destroy(&core_info->core_mutex); kfree(core_info); deinit_soc: Loading Loading @@ -165,13 +166,14 @@ static int cam_jpeg_dma_probe(struct platform_device *pdev) hw_info = (struct cam_jpeg_dma_device_hw_info *)match_dev->data; core_info->jpeg_dma_hw_info = hw_info; core_info->core_state = CAM_JPEG_DMA_CORE_NOT_READY; mutex_init(&core_info->core_mutex); rc = cam_jpeg_dma_init_soc_resources(&jpeg_dma_dev->soc_info, cam_jpeg_dma_irq, jpeg_dma_dev); if (rc) { CAM_ERR(CAM_JPEG, "%failed to init_soc %d", rc); goto error_match_dev; goto error_init_soc; } rc = cam_jpeg_dma_register_cpas(&jpeg_dma_dev->soc_info, Loading @@ -191,6 +193,8 @@ static int cam_jpeg_dma_probe(struct platform_device *pdev) error_reg_cpas: rc = cam_soc_util_release_platform_resource(&jpeg_dma_dev->soc_info); error_init_soc: mutex_destroy(&core_info->core_mutex); error_match_dev: kfree(jpeg_dma_dev->core_info); error_alloc_core: Loading
drivers/media/platform/msm/camera/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_soc.c +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ int cam_jpeg_dma_disable_soc_resources(struct cam_hw_soc_info *soc_info) { int rc; rc = cam_soc_util_disable_platform_resource(soc_info, true, false); rc = cam_soc_util_disable_platform_resource(soc_info, true, true); if (rc) CAM_ERR(CAM_JPEG, "disable platform failed %d", rc); Loading