diff --git a/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c b/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c index 4225a33e4f72..5d72d910ad37 100644 --- a/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c +++ b/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -142,12 +143,18 @@ static int cam_jpeg_process_next_hw_update(void *priv, void *data, CAM_TRACE(CAM_JPEG, "Start JPEG ENC Req %llu", config_args->request_id); - /* configure jpeg hw and camnoc misr */ - rc = hw_mgr->devices[dev_type][0]->hw_ops.process_cmd( - hw_mgr->devices[dev_type][0]->hw_priv, - CAM_JPEG_CMD_CONFIG_HW_MISR, - &g_jpeg_hw_mgr.camnoc_misr_test, - sizeof(g_jpeg_hw_mgr.camnoc_misr_test)); + if (g_jpeg_hw_mgr.camnoc_misr_test) { + /* configure jpeg hw and camnoc misr */ + rc = hw_mgr->devices[dev_type][0]->hw_ops.process_cmd( + hw_mgr->devices[dev_type][0]->hw_priv, + CAM_JPEG_CMD_CONFIG_HW_MISR, + &g_jpeg_hw_mgr.camnoc_misr_test, + sizeof(g_jpeg_hw_mgr.camnoc_misr_test)); + if (rc) { + CAM_ERR(CAM_JPEG, "Failed to apply the configs %d", rc); + goto end_error; + } + } rc = hw_mgr->devices[dev_type][0]->hw_ops.start( hw_mgr->devices[dev_type][0]->hw_priv, NULL, 0); @@ -214,16 +221,18 @@ static int cam_jpeg_mgr_process_irq(void *priv, void *data) CAM_DBG(CAM_JPEG, "hw entry processed %d Encoded size :%d", p_cfg_req->num_hw_entry_processed, task_data->result_size); - misr_args.req_id = p_cfg_req->req_id; - misr_args.enable_bug = g_jpeg_hw_mgr.bug_on_misr; - CAM_DBG(CAM_JPEG, "req %lld bug is enabled for MISR :%d", - misr_args.req_id, misr_args.enable_bug); + if (g_jpeg_hw_mgr.camnoc_misr_test) { + misr_args.req_id = p_cfg_req->req_id; + misr_args.enable_bug = g_jpeg_hw_mgr.bug_on_misr; + CAM_DBG(CAM_JPEG, "req %lld bug is enabled for MISR :%d", + misr_args.req_id, misr_args.enable_bug); - /* dump jpeg hw and camnoc misr */ - rc = hw_mgr->devices[dev_type][0]->hw_ops.process_cmd( - hw_mgr->devices[dev_type][0]->hw_priv, - CAM_JPEG_CMD_DUMP_HW_MISR_VAL, &misr_args, - sizeof(struct cam_jpeg_misr_dump_args)); + /* dump jpeg hw and camnoc misr */ + rc = hw_mgr->devices[dev_type][0]->hw_ops.process_cmd( + hw_mgr->devices[dev_type][0]->hw_priv, + CAM_JPEG_CMD_DUMP_HW_MISR_VAL, &misr_args, + sizeof(struct cam_jpeg_misr_dump_args)); + } if ((task_data->result_size > 0) && (p_cfg_req->num_hw_entry_processed < diff --git a/drivers/cam_jpeg/jpeg_hw/include/cam_jpeg_hw_intf.h b/drivers/cam_jpeg/jpeg_hw/include/cam_jpeg_hw_intf.h index 9bb20da715ab..e0176146940d 100644 --- a/drivers/cam_jpeg/jpeg_hw/include/cam_jpeg_hw_intf.h +++ b/drivers/cam_jpeg/jpeg_hw/include/cam_jpeg_hw_intf.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -21,8 +22,8 @@ #define CAM_JPEG_CAMNOC_MISR_VAL_ROW 2 #define CAM_JPEG_CAMNOC_MISR_VAL_COL 4 #define CAM_JPEG_ENC_MISR_VAL_NUM 3 -#define CAM_JPEG_MISR_ID_LOW_RD 0 -#define CAM_JPEG_MISR_ID_LOW_WR 1 +#define CAM_JPEG_MISR_ID_LOW_RD 1 +#define CAM_JPEG_MISR_ID_LOW_WR 2 enum cam_jpeg_hw_type { CAM_JPEG_DEV_ENC, diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_165_hw_info_ver_4_2_0.h b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_165_hw_info_ver_4_2_0.h index 81e146938265..c87de869de72 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_165_hw_info_ver_4_2_0.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_165_hw_info_ver_4_2_0.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ @@ -70,6 +71,7 @@ static struct cam_jpeg_dma_device_hw_info cam_jpeg_dma_165_hw_info = { .camnoc_misr_sigdata = 4, .master_we_sel = 2, .misr_rd_word_sel = 4, + .camnoc_misr_support = 1, }; #endif /* CAM_JPEG_DMA_165_HW_INFO_VER_4_2_0_H */ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_580_hw_info_ver_4_2_0.h b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_580_hw_info_ver_4_2_0.h index b4f4ce10325d..86bb1f8735e2 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_580_hw_info_ver_4_2_0.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_580_hw_info_ver_4_2_0.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ @@ -70,6 +71,7 @@ static struct cam_jpeg_dma_device_hw_info cam_jpeg_dma_580_hw_info = { .camnoc_misr_sigdata = 4, .master_we_sel = 2, .misr_rd_word_sel = 4, + .camnoc_misr_support = 1, }; #endif /* CAM_JPEG_DMA_580_HW_INFO_VER_4_2_0_H */ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_hw_info_ver_4_2_0.h b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_hw_info_ver_4_2_0.h index d4c62f381851..ce44f6b97f79 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_hw_info_ver_4_2_0.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/cam_jpeg_dma_hw_info_ver_4_2_0.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2020, The Linux Foundation. All rights reserved. */ @@ -40,7 +41,8 @@ static struct cam_jpeg_dma_device_hw_info cam_jpeg_dma_hw_info = { .resetdone = CAM_JPEGDMA_HW_MASK_COMP_RESET_ACK, .iserror = 0x0, .stopdone = CAM_JPEGDMA_HW_IRQ_STATUS_AXI_HALT, - } + }, + .camnoc_misr_support = 0, }; #endif /* CAM_JPEG_DMA_HW_INFO_VER_4_2_0_H */ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c index 081a52dca755..d94462f8c4e8 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -684,15 +685,22 @@ int cam_jpeg_dma_process_cmd(void *device_priv, uint32_t cmd_type, break; case CAM_JPEG_CMD_CONFIG_HW_MISR: { - rc = cam_jpeg_dma_config_cmanoc_hw_misr(hw_info, soc_info, cmd_args); + if (hw_info->camnoc_misr_support) + rc = cam_jpeg_dma_config_cmanoc_hw_misr(hw_info, soc_info, cmd_args); + else + CAM_DBG(CAM_JPEG, "camnoc misr is not supported"); break; } case CAM_JPEG_CMD_DUMP_HW_MISR_VAL: { - rc = cam_jpeg_dma_dump_hw_misr_val(hw_info, soc_info, cmd_args); - if (rc) - break; - rc = cam_jpeg_dma_dump_camnoc_misr_val(hw_info, soc_info, cmd_args); + if (hw_info->camnoc_misr_support) { + rc = cam_jpeg_dma_dump_hw_misr_val(hw_info, soc_info, cmd_args); + if (rc) + break; + rc = cam_jpeg_dma_dump_camnoc_misr_val(hw_info, soc_info, cmd_args); + } else { + CAM_DBG(CAM_JPEG, "camnoc misr is not supported"); + } break; } default: diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.h b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.h index c8c398072306..54d19e504cc1 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_dma_hw/jpeg_dma_core.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -75,6 +76,7 @@ struct cam_jpeg_dma_device_hw_info { uint32_t camnoc_misr_sigdata; uint32_t master_we_sel; uint32_t misr_rd_word_sel; + uint32_t camnoc_misr_support; int32_t prev_dma_wr_misr_val[CAM_JPEG_CAMNOC_MISR_VAL_ROW][ CAM_JPEG_CAMNOC_MISR_VAL_COL]; int32_t prev_dma_rd_misr_val[CAM_JPEG_CAMNOC_MISR_VAL_ROW][ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_165_hw_info_ver_4_2_0.h b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_165_hw_info_ver_4_2_0.h index af434b2928bd..ac194dc6b2f6 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_165_hw_info_ver_4_2_0.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_165_hw_info_ver_4_2_0.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ @@ -97,6 +98,7 @@ static struct cam_jpeg_enc_device_hw_info cam_jpeg_enc_165_hw_info = { .max_misr = 3, .max_misr_rd = 4, .camnoc_misr_sigdata = 4, + .camnoc_misr_support = 1, }; #endif /* CAM_JPEG_ENC_165_HW_INFO_TITAN170_H */ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_580_hw_info_ver_4_2_0.h b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_580_hw_info_ver_4_2_0.h index 647bdb514957..ad810c6cb615 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_580_hw_info_ver_4_2_0.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_580_hw_info_ver_4_2_0.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ @@ -97,6 +98,7 @@ static struct cam_jpeg_enc_device_hw_info cam_jpeg_enc_580_hw_info = { .max_misr = 3, .max_misr_rd = 4, .camnoc_misr_sigdata = 4, + .camnoc_misr_support = 1, }; #endif /* CAM_JPEG_ENC_580_HW_INFO_TITAN170_H */ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_hw_info_ver_4_2_0.h b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_hw_info_ver_4_2_0.h index b75998bc586c..15cd1517e0cb 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_hw_info_ver_4_2_0.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/cam_jpeg_enc_hw_info_ver_4_2_0.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ @@ -70,7 +71,8 @@ static struct cam_jpeg_enc_device_hw_info cam_jpeg_enc_hw_info = { .reg_dump = { .start_offset = 0x0, .end_offset = 0x33C, - } + }, + .camnoc_misr_support = 0, }; #endif /* CAM_JPEG_ENC_HW_INFO_TITAN170_H */ diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.c b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.c index a767bb2bc75b..0e39a8a42791 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.c +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 20222 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -775,15 +776,22 @@ int cam_jpeg_enc_process_cmd(void *device_priv, uint32_t cmd_type, break; case CAM_JPEG_CMD_CONFIG_HW_MISR: { - rc = cam_jpeg_enc_config_cmanoc_hw_misr(hw_info, soc_info, cmd_args); + if (hw_info->camnoc_misr_support) + rc = cam_jpeg_enc_config_cmanoc_hw_misr(hw_info, soc_info, cmd_args); + else + CAM_DBG(CAM_JPEG, "camnoc misr is not supported"); break; } case CAM_JPEG_CMD_DUMP_HW_MISR_VAL: { - rc = cam_jpeg_enc_dump_hw_misr_val(hw_info, soc_info, cmd_args); - if (rc) - break; - rc = cam_jpeg_enc_dump_camnoc_misr_val(hw_info, soc_info, cmd_args); + if (hw_info->camnoc_misr_support) { + rc = cam_jpeg_enc_dump_hw_misr_val(hw_info, soc_info, cmd_args); + if (rc) + break; + rc = cam_jpeg_enc_dump_camnoc_misr_val(hw_info, soc_info, cmd_args); + } else { + CAM_DBG(CAM_JPEG, "camnoc misr is not supported"); + } break; } default: diff --git a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.h b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.h index af52512ac43c..763cec566e50 100644 --- a/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.h +++ b/drivers/cam_jpeg/jpeg_hw/jpeg_enc_hw/jpeg_enc_core.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ @@ -77,6 +78,7 @@ struct cam_jpeg_enc_device_hw_info { uint32_t max_misr; uint32_t max_misr_rd; uint32_t camnoc_misr_sigdata; + uint32_t camnoc_misr_support; int32_t prev_camnoc_misr_val[ CAM_JPEG_CAMNOC_MISR_VAL_ROW][CAM_JPEG_CAMNOC_MISR_VAL_COL]; int32_t prev_enc_misr_val[CAM_JPEG_ENC_MISR_VAL_NUM][