diff --git a/drivers/media/platform/msm/cvp/cvp_core_hfi.c b/drivers/media/platform/msm/cvp/cvp_core_hfi.c index 742b1a388266..d6fae2f105dc 100644 --- a/drivers/media/platform/msm/cvp/cvp_core_hfi.c +++ b/drivers/media/platform/msm/cvp/cvp_core_hfi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include diff --git a/drivers/media/platform/msm/cvp/cvp_hfi.c b/drivers/media/platform/msm/cvp/cvp_hfi.c index 92ceaf65d2f3..569cae3d7be4 100644 --- a/drivers/media/platform/msm/cvp/cvp_hfi.c +++ b/drivers/media/platform/msm/cvp/cvp_hfi.c @@ -1131,6 +1131,26 @@ static inline int __boot_firmware(struct iris_hfi_device *device) return rc; } +static int iris_hfi_resume(void *dev) +{ + int rc = 0; + struct iris_hfi_device *device = (struct iris_hfi_device *) dev; + + if (!device) { + dprintk(CVP_ERR, "%s invalid device\n", __func__); + return -EINVAL; + } + + dprintk(CVP_DBG, "Resuming Iris\n"); + + mutex_lock(&device->lock); + rc = __resume(device); + mutex_unlock(&device->lock); + + return rc; +} + + static int iris_hfi_suspend(void *dev) { int rc = 0; @@ -1231,7 +1251,6 @@ static int __set_clocks(struct iris_hfi_device *device, u32 freq) return rc; } - trace_msm_cvp_perf_clock_scale(cl->name, freq); dprintk(CVP_DBG, "Scaling clock %s to %u\n", cl->name, freq); } @@ -4213,7 +4232,6 @@ static int __load_fw(struct iris_hfi_device *device) dprintk(CVP_ERR, "Failed to initialize packetization\n"); goto fail_init_pkt; } - trace_msm_v4l2_cvp_fw_load_start("msm_cvp cvp fw load start"); rc = __iris_power_on(device); if (rc) { @@ -4243,7 +4261,6 @@ static int __load_fw(struct iris_hfi_device *device) goto fail_protect_mem; } } - trace_msm_v4l2_cvp_fw_load_end("msm_cvp cvp fw load end"); return rc; fail_protect_mem: if (device->resources.fw.cookie) @@ -4255,7 +4272,6 @@ fail_iris_power_on: fail_init_pkt: __deinit_resources(device); fail_init_res: - trace_msm_v4l2_cvp_fw_load_end("msm_cvp cvp fw load end"); return rc; } @@ -4577,6 +4593,7 @@ static void iris_init_hfi_callbacks(struct cvp_hfi_device *hdev) hdev->get_fw_info = iris_hfi_get_fw_info; hdev->get_core_capabilities = iris_hfi_get_core_capabilities; hdev->suspend = iris_hfi_suspend; + hdev->resume = iris_hfi_resume; hdev->flush_debug_queue = iris_hfi_flush_debug_queue; hdev->noc_error_info = iris_hfi_noc_error_info; hdev->validate_session = iris_hfi_validate_session; diff --git a/drivers/media/platform/msm/cvp/cvp_hfi_api.h b/drivers/media/platform/msm/cvp/cvp_hfi_api.h index 166fb082933b..a2fe140d7af8 100644 --- a/drivers/media/platform/msm/cvp/cvp_hfi_api.h +++ b/drivers/media/platform/msm/cvp/cvp_hfi_api.h @@ -406,6 +406,7 @@ struct cvp_hfi_device { int (*session_clean)(void *sess); int (*get_core_capabilities)(void *dev); int (*suspend)(void *dev); + int (*resume)(void *dev); int (*flush_debug_queue)(void *dev); int (*noc_error_info)(void *dev); int (*validate_session)(void *sess, const char *func); diff --git a/drivers/media/platform/msm/cvp/cvp_hfi_io.h b/drivers/media/platform/msm/cvp/cvp_hfi_io.h index bdd44c0ee8ad..fa8933f9cf3d 100644 --- a/drivers/media/platform/msm/cvp/cvp_hfi_io.h +++ b/drivers/media/platform/msm/cvp/cvp_hfi_io.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __CVP_HFI_IO_H__ diff --git a/drivers/media/platform/msm/cvp/cvp_private.h b/drivers/media/platform/msm/cvp/cvp_private.h index b5056738af96..e6b84e9d14b5 100644 --- a/drivers/media/platform/msm/cvp/cvp_private.h +++ b/drivers/media/platform/msm/cvp/cvp_private.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _MSM_V4L2_PRIVATE_H_ diff --git a/drivers/media/platform/msm/cvp/hfi_packetization.h b/drivers/media/platform/msm/cvp/hfi_packetization.h index 6d72c04c5ad5..dcadde46f319 100644 --- a/drivers/media/platform/msm/cvp/hfi_packetization.h +++ b/drivers/media/platform/msm/cvp/hfi_packetization.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __HFI_PACKETIZATION__ #define __HFI_PACKETIZATION__ diff --git a/drivers/media/platform/msm/cvp/msm_cvp.h b/drivers/media/platform/msm/cvp/msm_cvp.h index 8b95b8ad66ee..0e19ad8e9f87 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp.h +++ b/drivers/media/platform/msm/cvp/msm_cvp.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _MSM_CVP_H_ diff --git a/drivers/media/platform/msm/cvp/msm_cvp_clocks.c b/drivers/media/platform/msm/cvp/msm_cvp_clocks.c index 4a6c83368a63..43300c82dfae 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_clocks.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_clocks.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include "msm_cvp_common.h" diff --git a/drivers/media/platform/msm/cvp/msm_cvp_clocks.h b/drivers/media/platform/msm/cvp/msm_cvp_clocks.h index 1fef84d3bd42..401f89d4724c 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_clocks.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_clocks.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ diff --git a/drivers/media/platform/msm/cvp/msm_cvp_common.c b/drivers/media/platform/msm/cvp/msm_cvp_common.c index 12201bccbac1..2f4e6fe96824 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_common.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_common.c @@ -1301,9 +1301,6 @@ int msm_cvp_comm_try_state(struct msm_cvp_inst *inst, int state) "Failed to move from state: %d to %d\n", inst->state, state); msm_cvp_comm_kill_session(inst); - } else { - trace_msm_cvp_common_state_change((void *)inst, - inst->state, state); } return rc; } diff --git a/drivers/media/platform/msm/cvp/msm_cvp_common.h b/drivers/media/platform/msm/cvp/msm_cvp_common.h index 99dd3fdc90ae..4ac19fdd4b52 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_common.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_common.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ diff --git a/drivers/media/platform/msm/cvp/msm_cvp_core.c b/drivers/media/platform/msm/cvp/msm_cvp_core.c index 0baec9f617ee..f372946edfb5 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_core.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_core.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include diff --git a/drivers/media/platform/msm/cvp/msm_cvp_core.h b/drivers/media/platform/msm/cvp/msm_cvp_core.h index bdd1bd881ca4..1ea31691a39c 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_core.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_core.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _MSM_CVP_CORE_H_ diff --git a/drivers/media/platform/msm/cvp/msm_cvp_debug.c b/drivers/media/platform/msm/cvp/msm_cvp_debug.c index d3d463f0c7f7..1803dd47f815 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_debug.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_debug.c @@ -3,12 +3,14 @@ * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ -#define CREATE_TRACE_POINTS -#define MAX_SSR_STRING_LEN 10 +#include #include "msm_cvp_debug.h" #include "msm_cvp_common.h" #include "cvp_core_hfi.h" +#include "cvp_hfi_api.h" +#define CREATE_TRACE_POINTS +#define MAX_SSR_STRING_LEN 10 int msm_cvp_debug = CVP_ERR | CVP_WARN | CVP_FW | CVP_DBG; EXPORT_SYMBOL(msm_cvp_debug); @@ -160,6 +162,70 @@ static const struct file_operations ssr_fops = { .write = trigger_ssr_write, }; +static int cvp_power_get(void *data, u64 *val) +{ + struct cvp_hfi_device *hfi_ops; + struct msm_cvp_core *core; + struct iris_hfi_device *hfi_device; + + core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list); + if (!core) + return 0; + hfi_ops = core->device; + if (!hfi_ops) + return 0; + + hfi_device = hfi_ops->hfi_device_data; + if (!hfi_device) + return 0; + + *val = hfi_device->power_enabled; + return 0; +} + +#define MIN_PC_INTERVAL 1000 +#define MAX_PC_INTERVAL 1000000 + +static int cvp_power_set(void *data, u64 val) +{ + struct cvp_hfi_device *hfi_ops; + struct msm_cvp_core *core; + struct iris_hfi_device *hfi_device; + int rc = 0; + + core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list); + if (!core) + return -EINVAL; + + hfi_ops = core->device; + if (!hfi_ops) + return -EINVAL; + + hfi_device = hfi_ops->hfi_device_data; + if (!hfi_device) + return -EINVAL; + + if (val >= MAX_PC_INTERVAL) { + hfi_device->res->sw_power_collapsible = 0; + } else if (val > MIN_PC_INTERVAL) { + hfi_device->res->sw_power_collapsible = 1; + hfi_device->res->msm_cvp_pwr_collapse_delay = + (unsigned int)val; + } + + if (core->state == CVP_CORE_UNINIT) + return -EINVAL; + + if (val > 0) { + rc = call_hfi_op(hfi_ops, resume, hfi_ops->hfi_device_data); + if (rc) + dprintk(CVP_ERR, "debugfs fail to power on cvp\n"); + } + return rc; +} + +DEFINE_DEBUGFS_ATTRIBUTE(cvp_pwr_fops, cvp_power_get, cvp_power_set, "%llu\n"); + struct dentry *msm_cvp_debugfs_init_drv(void) { bool ok = false; @@ -200,6 +266,8 @@ struct dentry *msm_cvp_debugfs_init_drv(void) if (!ok) goto failed_create_dir; + debugfs_create_file("cvp_power", 0644, dir, NULL, &cvp_pwr_fops); + return dir; failed_create_dir: diff --git a/drivers/media/platform/msm/cvp/msm_cvp_debug.h b/drivers/media/platform/msm/cvp/msm_cvp_debug.h index a7e348063e51..5285b4095955 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_debug.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_debug.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __MSM_CVP_DEBUG__ diff --git a/drivers/media/platform/msm/cvp/msm_cvp_ioctl.c b/drivers/media/platform/msm/cvp/msm_cvp_ioctl.c index d52a0689ac41..12e839cd7162 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_ioctl.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_ioctl.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include "cvp_private.h" diff --git a/drivers/media/platform/msm/cvp/msm_cvp_platform.c b/drivers/media/platform/msm/cvp/msm_cvp_platform.c index 0da95acb8214..f27cc0c60789 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_platform.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_platform.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include diff --git a/drivers/media/platform/msm/cvp/msm_cvp_res_parse.c b/drivers/media/platform/msm/cvp/msm_cvp_res_parse.c index de8ead0cc437..4e86ca5d2d43 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_res_parse.c +++ b/drivers/media/platform/msm/cvp/msm_cvp_res_parse.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include diff --git a/drivers/media/platform/msm/cvp/msm_cvp_res_parse.h b/drivers/media/platform/msm/cvp/msm_cvp_res_parse.h index 9404bb8a7b67..814ee94e814e 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_res_parse.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_res_parse.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __MSM_CVP_RES_PARSE_H__ diff --git a/drivers/media/platform/msm/cvp/msm_cvp_resources.h b/drivers/media/platform/msm/cvp/msm_cvp_resources.h index 27aaa97310ab..ad1bcdb98d65 100644 --- a/drivers/media/platform/msm/cvp/msm_cvp_resources.h +++ b/drivers/media/platform/msm/cvp/msm_cvp_resources.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __MSM_CVP_RESOURCES_H__ diff --git a/drivers/media/platform/msm/cvp/msm_smem.c b/drivers/media/platform/msm/cvp/msm_smem.c index 63fe372da4b8..ef1d5a453170 100644 --- a/drivers/media/platform/msm/cvp/msm_smem.c +++ b/drivers/media/platform/msm/cvp/msm_smem.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include @@ -86,10 +86,6 @@ static int msm_dma_get_device_address(struct dma_buf *dbuf, u32 align, goto mem_map_table_failed; } - /* debug trace's need to be updated later */ - trace_msm_cvp_smem_buffer_iommu_op_start("MAP", 0, 0, - align, *iova, *buffer_size); - if (table->sgl) { *iova = table->sgl->dma_address; *buffer_size = table->sgl->dma_length; @@ -106,8 +102,6 @@ static int msm_dma_get_device_address(struct dma_buf *dbuf, u32 align, mapping_info->buf = dbuf; mapping_info->cb_info = (void *)cb; - trace_msm_cvp_smem_buffer_iommu_op_end("MAP", 0, 0, - align, *iova, *buffer_size); } else { dprintk(CVP_DBG, "iommu not present, use phys mem addr\n"); } @@ -140,11 +134,9 @@ static int msm_dma_put_device_address(u32 flags, return -EINVAL; } - trace_msm_cvp_smem_buffer_iommu_op_start("UNMAP", 0, 0, 0, 0, 0); dma_buf_unmap_attachment(mapping_info->attach, mapping_info->table, DMA_BIDIRECTIONAL); dma_buf_detach(mapping_info->buf, mapping_info->attach); - trace_msm_cvp_smem_buffer_iommu_op_end("UNMAP", 0, 0, 0, 0, 0); mapping_info->dev = NULL; mapping_info->domain = NULL; @@ -346,8 +338,6 @@ static int alloc_dma_mem(size_t size, u32 align, u32 flags, int map_kernel, heap_mask = ION_HEAP(ION_SECURE_HEAP_ID); } - trace_msm_cvp_smem_buffer_dma_op_start("ALLOC", (u32)ion_flags, - heap_mask, size, align, flags, map_kernel); dbuf = ion_alloc(size, heap_mask, ion_flags); if (IS_ERR_OR_NULL(dbuf)) { dprintk(CVP_ERR, @@ -356,8 +346,6 @@ static int alloc_dma_mem(size_t size, u32 align, u32 flags, int map_kernel, rc = -ENOMEM; goto fail_shared_mem_alloc; } - trace_msm_cvp_smem_buffer_dma_op_end("ALLOC", (u32)ion_flags, - heap_mask, size, align, flags, map_kernel); mem->flags = flags; mem->buffer_type = ion_flags; @@ -425,14 +413,8 @@ static int free_dma_mem(struct msm_cvp_smem *mem) } if (mem->dma_buf) { - trace_msm_cvp_smem_buffer_dma_op_start("FREE", - (u32)mem->buffer_type, -1, mem->size, -1, - mem->flags, -1); dma_buf_put(mem->dma_buf); mem->dma_buf = NULL; - trace_msm_cvp_smem_buffer_dma_op_end( - "FREE", (u32)mem->buffer_type, - -1, mem->size, -1, mem->flags, -1); } return 0;