From f1bd9e7379598924b3d1f5ca62746737bd9b6927 Mon Sep 17 00:00:00 2001 From: Tejas Prajapati Date: Fri, 4 Sep 2020 12:47:50 +0530 Subject: [PATCH] msm: camera: ife: dump fill level registers on overflow Dump camnoc fill level registers for overflow and violations along with the SOF, EPOCH and EOF timestamps. CRs-Fixed: 2908055 Change-Id: I774140794eae6580f4332cd9cd39b8c65d7197a5 Signed-off-by: Tejas Prajapati --- drivers/cam_cpas/cam_cpas_intf.c | 20 +++ drivers/cam_cpas/cpas_top/cam_cpastop_hw.c | 121 ++++++++++++++++++ drivers/cam_cpas/cpas_top/cam_cpastop_hw.h | 30 +++++ drivers/cam_cpas/cpas_top/cpastop_v150_100.h | 8 +- drivers/cam_cpas/cpas_top/cpastop_v165_100.h | 6 + drivers/cam_cpas/cpas_top/cpastop_v170_110.h | 8 +- drivers/cam_cpas/cpas_top/cpastop_v170_200.h | 8 +- drivers/cam_cpas/cpas_top/cpastop_v175_100.h | 8 +- drivers/cam_cpas/cpas_top/cpastop_v175_101.h | 8 +- drivers/cam_cpas/cpas_top/cpastop_v175_120.h | 9 +- drivers/cam_cpas/cpas_top/cpastop_v175_130.h | 9 +- drivers/cam_cpas/cpas_top/cpastop_v480_100.h | 9 +- drivers/cam_cpas/include/cam_cpas_api.h | 33 ++++- .../vfe_hw/vfe_top/cam_vfe_camif_ver2.c | 53 ++++---- .../vfe_hw/vfe_top/cam_vfe_camif_ver3.c | 22 ++++ .../isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c | 5 + 16 files changed, 316 insertions(+), 41 deletions(-) diff --git a/drivers/cam_cpas/cam_cpas_intf.c b/drivers/cam_cpas/cam_cpas_intf.c index 7d007f4b3c29..f5bb5db85c29 100644 --- a/drivers/cam_cpas/cam_cpas_intf.c +++ b/drivers/cam_cpas/cam_cpas_intf.c @@ -18,6 +18,7 @@ #include "cam_cpas_hw_intf.h" #include "cam_cpas_soc.h" #include "camera_main.h" +#include "cam_cpas_api.h" #define CAM_CPAS_DEV_NAME "cam-cpas" #define CAM_CPAS_INTF_INITIALIZED() (g_cpas_intf && g_cpas_intf->probe_done) @@ -209,6 +210,25 @@ int cam_cpas_get_cpas_hw_version(uint32_t *hw_version) return 0; } +int cam_cpas_get_camnoc_fifo_fill_level_info( + uint32_t cpas_version, + uint32_t client_handle) +{ + int rc = 0; + + if (!CAM_CPAS_INTF_INITIALIZED()) { + CAM_ERR(CAM_CPAS, "cpas intf not initialized"); + return -ENODEV; + } + + rc = cam_cpas_hw_get_camnoc_fill_level_info(cpas_version, + client_handle); + if (rc) + CAM_ERR(CAM_CPAS, "Failed to dump fifo reg rc %d", rc); + + return rc; +} + int cam_cpas_get_hw_info(uint32_t *camera_family, struct cam_hw_version *camera_version, struct cam_hw_version *cpas_version, diff --git a/drivers/cam_cpas/cpas_top/cam_cpastop_hw.c b/drivers/cam_cpas/cpas_top/cam_cpastop_hw.c index bbcdbed8fc35..6447b3b40dc3 100644 --- a/drivers/cam_cpas/cpas_top/cam_cpastop_hw.c +++ b/drivers/cam_cpas/cpas_top/cam_cpastop_hw.c @@ -1006,6 +1006,127 @@ static int cam_cpastop_setup_qos_settings(struct cam_hw_info *cpas_hw, return rc; } +int cam_cpas_hw_get_camnoc_fill_level_info( + uint32_t cpas_version, + uint32_t client_handle) +{ + struct cam_camnoc_fifo_lvl_info *camnoc_reg_info; + uint32_t val; + + if (!camnoc_info->fill_lvl_register) + return -EFAULT; + + camnoc_reg_info = camnoc_info->fill_lvl_register; + + switch (cpas_version) { + case CAM_CPAS_TITAN_175_V120: + case CAM_CPAS_TITAN_175_V130: + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, + camnoc_reg_info->IFE0_nRDI_maxwr_offset, + true, &val); + CAM_INFO(CAM_CPAS, "IFE0_nRDI_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE0_nRDI_maxwr_offset, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, + camnoc_reg_info->IFE1_nRDI_maxwr_offset, + true, &val); + CAM_INFO(CAM_CPAS, "IFE1_nRDI_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE1_nRDI_maxwr_offset, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, + camnoc_reg_info->IFE0123_RDI_maxwr_offset, + true, &val); + CAM_INFO(CAM_CPAS, "IFE0_nRDI_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE0123_RDI_maxwr_offset, + val); + break; + case CAM_CPAS_TITAN_480_V100: + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->ife_linear, + true, &val); + CAM_INFO(CAM_CPAS, "ife_linear offset 0x%x val 0x%x", + camnoc_reg_info->ife_linear, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->ife_rdi_wr, + true, &val); + CAM_INFO(CAM_CPAS, "ife_rdi_wr offset 0x%x val 0x%x", + camnoc_reg_info->ife_rdi_wr, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->ife_ubwc_stats, + true, &val); + CAM_INFO(CAM_CPAS, "ife_ubwc_stats offset 0x%x val 0x%x", + camnoc_reg_info->ife_ubwc_stats, + val); + + break; + case CAM_CPAS_TITAN_170_V200: + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->IFE01_MAXWR_LOW, + true, &val); + CAM_INFO(CAM_ISP, "IFE01_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE01_MAXWR_LOW, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->IFE23_MAXWR_LOW, + true, &val); + CAM_INFO(CAM_ISP, "IFE23_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE23_MAXWR_LOW, + val); + + break; + case CAM_CPAS_TITAN_165_V100: + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->IFE0_MAXWR_LOW, + true, &val); + CAM_INFO(CAM_ISP, "IFE0_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE0_MAXWR_LOW, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->IFE1_MAXWR_LOW, + true, &val); + CAM_INFO(CAM_ISP, "IFE1_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE1_MAXWR_LOW, + val); + break; + case CAM_CPAS_TITAN_150_V100: + case CAM_CPAS_TITAN_170_V100: + case CAM_CPAS_TITAN_170_V110: + case CAM_CPAS_TITAN_170_V120: + case CAM_CPAS_TITAN_175_V100: + case CAM_CPAS_TITAN_175_V101: + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->IFE02_MAXWR_LOW, + true, &val); + CAM_INFO(CAM_ISP, "IFE02_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE02_MAXWR_LOW, + val); + + cam_cpas_reg_read(client_handle, + CAM_CPAS_REG_CAMNOC, camnoc_reg_info->IFE13_MAXWR_LOW, + true, &val); + CAM_INFO(CAM_ISP, "IFE13_MAXWR_LOW offset 0x%x val 0x%x", + camnoc_reg_info->IFE13_MAXWR_LOW, + val); + break; + default: + CAM_ERR(CAM_CPAS, "Camera version not supported %d", + cpas_version); + break; + } + return 0; +} + int cam_cpastop_get_internal_ops(struct cam_cpas_internal_ops *internal_ops) { if (!internal_ops) { diff --git a/drivers/cam_cpas/cpas_top/cam_cpastop_hw.h b/drivers/cam_cpas/cpas_top/cam_cpastop_hw.h index 3992e079ad18..ca4c3d0a8f1f 100644 --- a/drivers/cam_cpas/cpas_top/cam_cpastop_hw.h +++ b/drivers/cam_cpas/cpas_top/cam_cpastop_hw.h @@ -316,6 +316,34 @@ struct cam_camnoc_err_logger_info { uint32_t errlog3_high; }; +/** + * struct cam_camnoc_fifo_lvl_info : Struct for fifo fill level registers + * @IFE0_nRDI_maxwr_offset: Register offset for fill level for IFE0 + * @IFE1_nRDI_maxwr_offset: Register offset for fill level for IFE1 + * @IFE0123_RDI_maxwr_low_offset: Register offset for RDI + * @ife_linear: Register offset for ife linear + * @ife_rdi_wr: Register offset for rdi wr + * @ife_ubwc_stats: Register offset for ubwc stats + * @IFE02_MAXWR_LOW: Register offset for IFE02 + * @IFE13_MAXWR_LOW: Register offset for IFE13 + * @IFE01_MAXWR_LOW: Register offset for IFE01 + * @IFE23_MAXWR_LOW: Register offset for IFE23 + */ +struct cam_camnoc_fifo_lvl_info { + uint32_t IFE0_nRDI_maxwr_offset; + uint32_t IFE1_nRDI_maxwr_offset; + uint32_t IFE0123_RDI_maxwr_offset; + uint32_t ife_linear; + uint32_t ife_rdi_wr; + uint32_t ife_ubwc_stats; + uint32_t IFE02_MAXWR_LOW; + uint32_t IFE13_MAXWR_LOW; + uint32_t IFE01_MAXWR_LOW; + uint32_t IFE23_MAXWR_LOW; + uint32_t IFE0_MAXWR_LOW; + uint32_t IFE1_MAXWR_LOW; +}; + /** * struct cam_camnoc_info : Overall CAMNOC settings info * @@ -326,6 +354,7 @@ struct cam_camnoc_err_logger_info { * @irq_err_size: Array size of IRQ Error settings * @err_logger: Pointer to CAMNOC IRQ Error logger read registers * @errata_wa_list: HW Errata workaround info + * @fill_level_register: Fill level registers * */ struct cam_camnoc_info { @@ -336,6 +365,7 @@ struct cam_camnoc_info { int irq_err_size; struct cam_camnoc_err_logger_info *err_logger; struct cam_cpas_hw_errata_wa_list *errata_wa_list; + struct cam_camnoc_fifo_lvl_info *fill_lvl_register; }; /** diff --git a/drivers/cam_cpas/cpas_top/cpastop_v150_100.h b/drivers/cam_cpas/cpas_top/cpastop_v150_100.h index df9711e74379..edad15043dda 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v150_100.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v150_100.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V150_100_H_ @@ -515,6 +515,11 @@ static struct cam_cpas_hw_errata_wa_list cam150_cpas100_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam150_cpas100_camnoc_fifo_info = { + .IFE02_MAXWR_LOW = 0x420, + .IFE13_MAXWR_LOW = 0x820, +}; + static struct cam_camnoc_info cam150_cpas100_camnoc_info = { .specific = &cam_cpas_v150_100_camnoc_specific[0], .specific_size = sizeof(cam_cpas_v150_100_camnoc_specific) / @@ -525,6 +530,7 @@ static struct cam_camnoc_info cam150_cpas100_camnoc_info = { sizeof(cam_cpas_v150_100_irq_err[0]), .err_logger = &cam150_cpas100_err_logger_offsets, .errata_wa_list = &cam150_cpas100_errata_wa_list, + .fill_lvl_register = &cam150_cpas100_camnoc_fifo_info, }; #endif /* _CPASTOP_V150_100_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v165_100.h b/drivers/cam_cpas/cpas_top/cpastop_v165_100.h index 3e739d3c33a3..8e41284604f6 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v165_100.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v165_100.h @@ -591,6 +591,11 @@ static struct cam_cpas_hw_errata_wa_list cam165_cpas100_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam165_cpas100_camnoc_fifo_info = { + .IFE0_MAXWR_LOW = 0x3A20, + .IFE1_MAXWR_LOW = 0x5420, +}; + static struct cam_camnoc_info cam165_cpas100_camnoc_info = { .specific = &cam_cpas_v165_100_camnoc_specific[0], .specific_size = ARRAY_SIZE(cam_cpas_v165_100_camnoc_specific), @@ -599,6 +604,7 @@ static struct cam_camnoc_info cam165_cpas100_camnoc_info = { .irq_err_size = ARRAY_SIZE(cam_cpas_v165_100_irq_err), .err_logger = &cam165_cpas100_err_logger_offsets, .errata_wa_list = &cam165_cpas100_errata_wa_list, + .fill_lvl_register = &cam165_cpas100_camnoc_fifo_info, }; #endif /* _CPASTOP_V165_100_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v170_110.h b/drivers/cam_cpas/cpas_top/cpastop_v170_110.h index 788f571a3a13..fc986f598e33 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v170_110.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v170_110.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V170_110_H_ @@ -523,6 +523,11 @@ static struct cam_cpas_hw_errata_wa_list cam170_cpas110_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam170_cpas110_camnoc_fifo_info = { + .IFE02_MAXWR_LOW = 0x420, + .IFE13_MAXWR_LOW = 0x820, +}; + static struct cam_camnoc_info cam170_cpas110_camnoc_info = { .specific = &cam_cpas110_camnoc_specific[0], .specific_size = sizeof(cam_cpas110_camnoc_specific) / @@ -533,6 +538,7 @@ static struct cam_camnoc_info cam170_cpas110_camnoc_info = { sizeof(cam_cpas110_irq_err[0]), .err_logger = &cam170_cpas110_err_logger_offsets, .errata_wa_list = &cam170_cpas110_errata_wa_list, + .fill_lvl_register = &cam170_cpas110_camnoc_fifo_info, }; #endif /* _CPASTOP_V170_110_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v170_200.h b/drivers/cam_cpas/cpas_top/cpastop_v170_200.h index 98aabc984c87..3827e8dfff68 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v170_200.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v170_200.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V170_200_H_ @@ -525,6 +525,11 @@ static struct cam_cpas_hw_errata_wa_list cam170_cpas200_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam170_cpas200_camnoc_fifo_info = { + .IFE01_MAXWR_LOW = 0x2420, + .IFE23_MAXWR_LOW = 0x2620, +}; + static struct cam_camnoc_info cam170_cpas200_camnoc_info = { .specific = &cam_cpas_v170_200_camnoc_specific[0], .specific_size = ARRAY_SIZE(cam_cpas_v170_200_camnoc_specific), @@ -533,6 +538,7 @@ static struct cam_camnoc_info cam170_cpas200_camnoc_info = { .irq_err_size = ARRAY_SIZE(cam_cpas_v170_200_irq_err), .err_logger = &cam170_cpas200_err_logger_offsets, .errata_wa_list = &cam170_cpas200_errata_wa_list, + .fill_lvl_register = &cam170_cpas200_camnoc_fifo_info, }; #endif /* _CPASTOP_V170_200_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v175_100.h b/drivers/cam_cpas/cpas_top/cpastop_v175_100.h index aae26b5a9178..ab20db01cd18 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v175_100.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v175_100.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V175_100_H_ @@ -543,6 +543,11 @@ static struct cam_cpas_hw_errata_wa_list cam175_cpas100_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam175_cpas100_camnoc_fifo_info = { + .IFE02_MAXWR_LOW = 0x420, + .IFE13_MAXWR_LOW = 0x820, +}; + static struct cam_camnoc_info cam175_cpas100_camnoc_info = { .specific = &cam_cpas_v175_100_camnoc_specific[0], .specific_size = sizeof(cam_cpas_v175_100_camnoc_specific) / @@ -553,6 +558,7 @@ static struct cam_camnoc_info cam175_cpas100_camnoc_info = { sizeof(cam_cpas_v175_100_irq_err[0]), .err_logger = &cam175_cpas100_err_logger_offsets, .errata_wa_list = &cam175_cpas100_errata_wa_list, + .fill_lvl_register = &cam175_cpas100_camnoc_fifo_info, }; #endif /* _CPASTOP_V175_100_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v175_101.h b/drivers/cam_cpas/cpas_top/cpastop_v175_101.h index 7ec9bec36fd1..12ed226008e6 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v175_101.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v175_101.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V175_101_H_ @@ -543,6 +543,11 @@ static struct cam_cpas_hw_errata_wa_list cam175_cpas101_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam175_cpas101_camnoc_fifo_info = { + .IFE02_MAXWR_LOW = 0x420, + .IFE13_MAXWR_LOW = 0x820, +}; + static struct cam_camnoc_info cam175_cpas101_camnoc_info = { .specific = &cam_cpas_v175_101_camnoc_specific[0], .specific_size = sizeof(cam_cpas_v175_101_camnoc_specific) / @@ -553,6 +558,7 @@ static struct cam_camnoc_info cam175_cpas101_camnoc_info = { sizeof(cam_cpas_v175_101_irq_err[0]), .err_logger = &cam175_cpas101_err_logger_offsets, .errata_wa_list = &cam175_cpas101_errata_wa_list, + .fill_lvl_register = &cam175_cpas101_camnoc_fifo_info, }; #endif /* _CPASTOP_V175_101_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v175_120.h b/drivers/cam_cpas/cpas_top/cpastop_v175_120.h index 5844c38ae52c..83e5fb415472 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v175_120.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v175_120.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V175_120_H_ @@ -747,6 +747,12 @@ static struct cam_cpas_hw_errata_wa_list cam175_cpas120_errata_wa_list = { }, }; +static struct cam_camnoc_fifo_lvl_info cam175_cpas120_camnoc_fifo_info = { + .IFE0_nRDI_maxwr_offset = 0x3A20, + .IFE1_nRDI_maxwr_offset = 0x5420, + .IFE0123_RDI_maxwr_offset = 0x3620, +}; + static struct cam_camnoc_info cam175_cpas120_camnoc_info = { .specific = &cam_cpas_v175_120_camnoc_specific[0], .specific_size = ARRAY_SIZE(cam_cpas_v175_120_camnoc_specific), @@ -755,6 +761,7 @@ static struct cam_camnoc_info cam175_cpas120_camnoc_info = { .irq_err_size = ARRAY_SIZE(cam_cpas_v175_120_irq_err), .err_logger = &cam175_cpas120_err_logger_offsets, .errata_wa_list = &cam175_cpas120_errata_wa_list, + .fill_lvl_register = &cam175_cpas120_camnoc_fifo_info, }; #endif /* _CPASTOP_V175_120_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v175_130.h b/drivers/cam_cpas/cpas_top/cpastop_v175_130.h index 769e77fc3d6b..f7acca0f039f 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v175_130.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v175_130.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V175_130_H_ @@ -760,6 +760,12 @@ static struct cam_cpas_hw_errata_wa_list cam175_cpas130_errata_wa_list = { }, }; +static struct cam_camnoc_fifo_lvl_info cam175_cpas130_camnoc_fifo_info = { + .IFE0_nRDI_maxwr_offset = 0x3A20, + .IFE1_nRDI_maxwr_offset = 0x5420, + .IFE0123_RDI_maxwr_offset = 0x3620, +}; + static struct cam_camnoc_info cam175_cpas130_camnoc_info = { .specific = &cam_cpas_v175_130_camnoc_specific[0], .specific_size = ARRAY_SIZE(cam_cpas_v175_130_camnoc_specific), @@ -768,6 +774,7 @@ static struct cam_camnoc_info cam175_cpas130_camnoc_info = { .irq_err_size = ARRAY_SIZE(cam_cpas_v175_130_irq_err), .err_logger = &cam175_cpas130_err_logger_offsets, .errata_wa_list = &cam175_cpas130_errata_wa_list, + .fill_lvl_register = &cam175_cpas130_camnoc_fifo_info, }; #endif /* _CPASTOP_V175_130_H_ */ diff --git a/drivers/cam_cpas/cpas_top/cpastop_v480_100.h b/drivers/cam_cpas/cpas_top/cpastop_v480_100.h index 0d46e0ddcc20..49b1e8fb63a1 100644 --- a/drivers/cam_cpas/cpas_top/cpastop_v480_100.h +++ b/drivers/cam_cpas/cpas_top/cpastop_v480_100.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */ #ifndef _CPASTOP_V480_100_H_ @@ -698,6 +698,12 @@ static struct cam_cpas_hw_errata_wa_list cam480_cpas100_errata_wa_list = { }, }; +struct cam_camnoc_fifo_lvl_info cam480_cpas100_camnoc_fifo_info = { + .ife_linear = 0xA20, + .ife_rdi_wr = 0x1420, + .ife_ubwc_stats = 0x1A20, +}; + static struct cam_camnoc_info cam480_cpas100_camnoc_info = { .specific = &cam_cpas_v480_100_camnoc_specific[0], .specific_size = ARRAY_SIZE(cam_cpas_v480_100_camnoc_specific), @@ -706,6 +712,7 @@ static struct cam_camnoc_info cam480_cpas100_camnoc_info = { .irq_err_size = ARRAY_SIZE(cam_cpas_v480_100_irq_err), .err_logger = &cam480_cpas100_err_logger_offsets, .errata_wa_list = &cam480_cpas100_errata_wa_list, + .fill_lvl_register = &cam480_cpas100_camnoc_fifo_info, }; #endif /* _CPASTOP_V480_100_H_ */ diff --git a/drivers/cam_cpas/include/cam_cpas_api.h b/drivers/cam_cpas/include/cam_cpas_api.h index 1179f3999922..2b82d1f283e4 100644 --- a/drivers/cam_cpas/include/cam_cpas_api.h +++ b/drivers/cam_cpas/include/cam_cpas_api.h @@ -638,6 +638,21 @@ int cam_cpas_get_hw_info( int cam_cpas_get_cpas_hw_version( uint32_t *hw_version); +/** + * cam_cpas_get_camnoc_fifo_fill_level_info() + * + * @brief: API to get camera camnoc hw version + * + * @cpas_version: hw version + * @client_handle: cpas client handle + * + * @return 0 on success. + * + */ +int cam_cpas_get_camnoc_fifo_fill_level_info( + uint32_t cpas_version, + uint32_t client_handle); + /** * cam_cpas_is_feature_supported() * @@ -714,11 +729,23 @@ int cam_cpas_select_qos_settings(uint32_t selection_mask); * * @identifier_string: Identifier string passed by caller * @identifier_value: Identifier value passed by caller - * - * @return 0 on success. - * */ int cam_cpas_notify_event(const char *identifier_string, int32_t identifier_value); +/* + * cam_cpas_hw_get_camnoc_fill_level_info() + * + * @brief: API to get camnoc info + * + * @cpas_version: cpas hw version + * @client_handle: cpas client handle + * + * @return 0 on success. + * + */ +int cam_cpas_hw_get_camnoc_fill_level_info( + uint32_t cpas_version, + uint32_t client_handle); + #endif /* _CAM_CPAS_API_H_ */ diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c index 7c5b27ed08b0..6c2b701ded7f 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c @@ -523,7 +523,6 @@ static int cam_vfe_camif_reg_dump( struct cam_isp_resource_node *camif_res) { struct cam_vfe_mux_camif_data *camif_priv; - struct cam_vfe_soc_private *soc_private; uint32_t offset, val, wm_idx; if (!camif_res) { @@ -555,35 +554,6 @@ static int cam_vfe_camif_reg_dump( } } - soc_private = camif_priv->soc_info->soc_private; - if (soc_private->cpas_version == CAM_CPAS_TITAN_175_V120 || - soc_private->cpas_version == CAM_CPAS_TITAN_175_V130 || - soc_private->cpas_version == CAM_CPAS_TITAN_165_V100) { - cam_cpas_reg_read(soc_private->cpas_handle, - CAM_CPAS_REG_CAMNOC, 0x3A20, true, &val); - CAM_INFO(CAM_ISP, "IFE0_nRDI_MAXWR_LOW offset 0x3A20 val 0x%x", - val); - - cam_cpas_reg_read(soc_private->cpas_handle, - CAM_CPAS_REG_CAMNOC, 0x5420, true, &val); - CAM_INFO(CAM_ISP, "IFE1_nRDI_MAXWR_LOW offset 0x5420 val 0x%x", - val); - - cam_cpas_reg_read(soc_private->cpas_handle, - CAM_CPAS_REG_CAMNOC, 0x3620, true, &val); - CAM_INFO(CAM_ISP, - "IFE0123_RDI_WR_MAXWR_LOW offset 0x3620 val 0x%x", val); - - } else if (soc_private->cpas_version < CAM_CPAS_TITAN_175_V120) { - cam_cpas_reg_read(soc_private->cpas_handle, - CAM_CPAS_REG_CAMNOC, 0x420, true, &val); - CAM_INFO(CAM_ISP, "IFE02_MAXWR_LOW offset 0x420 val 0x%x", val); - - cam_cpas_reg_read(soc_private->cpas_handle, - CAM_CPAS_REG_CAMNOC, 0x820, true, &val); - CAM_INFO(CAM_ISP, "IFE13_MAXWR_LOW offset 0x820 val 0x%x", val); - } - return 0; } @@ -891,6 +861,15 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, camif_priv->event_cb(camif_priv->priv, CAM_ISP_HW_EVENT_ERROR, (void *)&evt_info); + CAM_INFO(CAM_ISP, + "SOF %lld:%lld EPOCH %lld:%lld EOF %lld:%lld", + camif_priv->sof_ts.tv_sec, + camif_priv->sof_ts.tv_usec, + camif_priv->epoch_ts.tv_sec, + camif_priv->epoch_ts.tv_usec, + camif_priv->eof_ts.tv_sec, + camif_priv->eof_ts.tv_usec); + CAM_INFO(CAM_ISP, "Violation status = %x", payload->irq_reg_val[2]); @@ -899,6 +878,9 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, CAM_INFO(CAM_ISP, "ife_clk_src:%lld", soc_private->ife_clk_src); + cam_cpas_get_camnoc_fifo_fill_level_info( + soc_private->cpas_version, + soc_private->cpas_handle); cam_cpas_log_votes(); if (camif_priv->camif_debug & CAMIF_DEBUG_ENABLE_REG_DUMP) @@ -908,6 +890,14 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, if (irq_status1 & camif_priv->reg_data->error_irq_mask1) { CAM_DBG(CAM_ISP, "Received ERROR"); + CAM_INFO(CAM_ISP, + "SOF %lld:%lld EPOCH %lld:%lld EOF %lld:%lld", + camif_priv->sof_ts.tv_sec, + camif_priv->sof_ts.tv_usec, + camif_priv->epoch_ts.tv_sec, + camif_priv->epoch_ts.tv_usec, + camif_priv->eof_ts.tv_sec, + camif_priv->eof_ts.tv_usec); ktime_get_boottime_ts64(&ts); CAM_INFO(CAM_ISP, "current monotonic time stamp seconds %lld:%lld", @@ -925,6 +915,9 @@ static int cam_vfe_camif_handle_irq_bottom_half(void *handler_priv, CAM_INFO(CAM_ISP, "ife_clk_src:%lld", soc_private->ife_clk_src); + cam_cpas_get_camnoc_fifo_fill_level_info( + soc_private->cpas_version, + soc_private->cpas_handle); cam_cpas_log_votes(); if (camif_priv->camif_debug & CAMIF_DEBUG_ENABLE_REG_DUMP) diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c index 72f108d9621a..9509561d5a26 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c @@ -1285,6 +1285,12 @@ static void cam_vfe_camif_ver3_print_status(uint32_t *status, print_state: soc_private = camif_priv->soc_info->soc_private; + cam_cpas_get_camnoc_fifo_fill_level_info( + soc_private->cpas_version, + soc_private->cpas_handle); + + cam_cpas_log_votes(); + cam_cpas_reg_read(soc_private->cpas_handle, CAM_CPAS_REG_CAMNOC, 0xA20, true, &val0); cam_cpas_reg_read(soc_private->cpas_handle, @@ -1492,6 +1498,14 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, & camif_priv->reg_data->error_irq_mask0) { CAM_ERR(CAM_ISP, "VFE:%d Overflow", evt_info.hw_idx); + CAM_INFO(CAM_ISP, + "SOF %lld:%lld EPOCH %lld:%lld EOF %lld:%lld", + camif_priv->sof_ts.tv_sec, + camif_priv->sof_ts.tv_usec, + camif_priv->epoch_ts.tv_sec, + camif_priv->epoch_ts.tv_usec, + camif_priv->eof_ts.tv_sec, + camif_priv->eof_ts.tv_usec); ktime_get_boottime_ts64(&ts); CAM_INFO(CAM_ISP, "current monotonic time stamp seconds %lld:%lld", @@ -1525,6 +1539,14 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, if (irq_status[CAM_IFE_IRQ_CAMIF_REG_STATUS2]) { CAM_ERR(CAM_ISP, "VFE:%d Violation", evt_info.hw_idx); + CAM_INFO(CAM_ISP, + "SOF %lld:%lld EPOCH %lld:%lld EOF %lld:%lld", + camif_priv->sof_ts.tv_sec, + camif_priv->sof_ts.tv_usec, + camif_priv->epoch_ts.tv_sec, + camif_priv->epoch_ts.tv_usec, + camif_priv->eof_ts.tv_sec, + camif_priv->eof_ts.tv_usec); ktime_get_boottime_ts64(&ts); CAM_INFO(CAM_ISP, "current monotonic time stamp seconds %lld:%lld", diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c index 1d8863c741e8..c1beec26e91d 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_rdi.c @@ -14,6 +14,7 @@ #include "cam_cdm_util.h" #include "cam_irq_controller.h" #include "cam_tasklet_util.h" +#include "cam_cpas_api.h" struct cam_vfe_mux_rdi_data { void __iomem *mem_base; @@ -568,6 +569,10 @@ static int cam_vfe_rdi_handle_irq_bottom_half(void *handler_priv, rdi_priv->event_cb(rdi_priv->priv, CAM_ISP_HW_EVENT_ERROR, (void *)&evt_info); + + cam_cpas_get_camnoc_fifo_fill_level_info( + soc_private->cpas_version, + soc_private->cpas_handle); cam_cpas_log_votes(); } end: