From bc32fa9ef8ba4c3a18673b9ef9c60d2dce1fd416 Mon Sep 17 00:00:00 2001 From: Shravya Samala Date: Thu, 8 Apr 2021 17:07:47 +0530 Subject: [PATCH 1/6] msm: camera: smmu: Disable SMMU stall on page fault Changes are made to disable stall on pagefault for all the driver contexts inorder to support for smmu stall on page fault. CRs-Fixed: 2936320 Change-Id: Id3d16b4d980349044de1bc1d1bf4bfad5aee79f4 Signed-off-by: Shravya Samala --- drivers/cam_smmu/cam_smmu_api.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/cam_smmu/cam_smmu_api.c b/drivers/cam_smmu/cam_smmu_api.c index 14734c75a15d..05b3700bddfb 100644 --- a/drivers/cam_smmu/cam_smmu_api.c +++ b/drivers/cam_smmu/cam_smmu_api.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. */ #include @@ -133,6 +133,7 @@ struct cam_context_bank_info { bool is_fw_allocated; bool is_secheap_allocated; bool is_qdss_allocated; + bool stall_disable; struct scratch_mapping scratch_map; struct gen_pool *shared_mem_pool; @@ -3641,6 +3642,8 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, struct device *dev) { int rc = 0; + int32_t stall_disable = 1; + int32_t hupcf = 1; if (!cb || !dev) { CAM_ERR(CAM_SMMU, "Error: invalid input params"); @@ -3708,6 +3711,24 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, cb->discard_iova_len); cb->state = CAM_SMMU_ATTACH; + + if (cb->stall_disable) { + if (iommu_domain_set_attr(cb->domain, + DOMAIN_ATTR_FAULT_MODEL_NO_STALL, + &stall_disable) < 0) { + CAM_ERR(CAM_SMMU, + "Error: failed to set cb stall disable for node: %s", + cb->name[0]); + } + + if (iommu_domain_set_attr(cb->domain, + DOMAIN_ATTR_FAULT_MODEL_HUPCF, + &hupcf) < 0) { + CAM_ERR(CAM_SMMU, + "Error: failed to set attribute HUPCF for node: %s", + cb->name[0]); + } + } } else { CAM_ERR(CAM_SMMU, "Context bank does not have IO region"); rc = -ENODEV; @@ -4046,6 +4067,9 @@ static int cam_populate_smmu_context_banks(struct device *dev, cb->num_shared_hdl = of_property_count_strings(dev->of_node, "cam-smmu-label"); + cb->stall_disable = + of_property_read_bool(dev->of_node, "stall-disable"); + if (cb->num_shared_hdl > CAM_SMMU_SHARED_HDL_MAX) { CAM_ERR(CAM_CDM, "Invalid count of client names count=%d", From 6c3073f63a272705628a0cbc349e6098e1ec2d9d Mon Sep 17 00:00:00 2001 From: Depeng Shao Date: Tue, 15 Jun 2021 10:48:38 +0800 Subject: [PATCH 2/6] msm: camera: isp: Fix the assignment of bubble_detected Fix the assignment of bubble_detected. CRs-Fixed: 2948932 Change-Id: Ie9a289f732d12a0238e643e81c8a5bbdcaca059a Signed-off-by: Depeng Shao --- drivers/cam_isp/cam_isp_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index 00af70d8a093..ea569d0521bc 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -866,7 +866,6 @@ static int __cam_isp_ctx_handle_buf_done_for_req_list( req_isp->cdm_reset_before_apply = false; req_isp->num_acked = 0; req_isp->num_deferred_acks = 0; - req_isp->bubble_detected = false; /* * Only update the process_bubble and bubble_frame_cnt * when bubble is detected on this req, in case the other @@ -875,6 +874,7 @@ static int __cam_isp_ctx_handle_buf_done_for_req_list( if (req_isp->bubble_detected) { atomic_set(&ctx_isp->process_bubble, 0); ctx_isp->bubble_frame_cnt = 0; + req_isp->bubble_detected = false; } CAM_DBG(CAM_REQ, From 5bf8f7b7ae49965d42c453a445a8696c5e466027 Mon Sep 17 00:00:00 2001 From: Anil Kumar Kanakanti Date: Mon, 14 Jun 2021 22:49:14 +0530 Subject: [PATCH 3/6] msm: camera: flash: Init default flash type to PMIC flash Initialize default flash type to PMIC flash. CRs-Fixed: 2969985 Change-Id: Id563435f78b7412362bd1f6a1db53cbdfc3664cc Signed-off-by: Anil Kumar Kanakanti --- drivers/cam_sensor_module/cam_flash/cam_flash_soc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cam_sensor_module/cam_flash/cam_flash_soc.c b/drivers/cam_sensor_module/cam_flash/cam_flash_soc.c index 9af39e9560fb..9ec28e953f8b 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_soc.c +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_soc.c @@ -7,6 +7,7 @@ #include #include "cam_flash_soc.h" #include "cam_res_mgr_api.h" +#include void cam_flash_put_source_node_data(struct cam_flash_ctrl *fctrl) { @@ -77,6 +78,7 @@ static int32_t cam_get_source_node_info( if (rc) { CAM_ERR(CAM_FLASH, "flash-type read failed rc=%d", rc); + soc_private->flash_type = CAM_FLASH_TYPE_PMIC; // default to PMIC flash } switch_src_node = of_parse_phandle(of_node, "switch-source", 0); From e1261386ea9c5a220093aa1e47108e012471edf1 Mon Sep 17 00:00:00 2001 From: Wyes Karny Date: Tue, 22 Jun 2021 12:18:26 +0530 Subject: [PATCH 4/6] msm: camera: common: Fix for wrong ab ib value send to ICC While passing ab and ib value to interconnect for conversion from BPS to ICC units wrong kernel macro is used. Therefore use correct macro to get the proper ICC units. In the same way, update the correct flash on active time (use div_u64 instead of do_div). CRs-Fixed: 2971025 Change-Id: I4cd0de06bd081ea95cdc76eb74887c4d5815241a Signed-off-by: Wyes Karny --- drivers/cam_sensor_module/cam_flash/cam_flash_core.c | 4 ++-- drivers/cam_utils/cam_soc_icc.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/cam_sensor_module/cam_flash/cam_flash_core.c b/drivers/cam_sensor_module/cam_flash/cam_flash_core.c index 8fe5b78243f3..0dbc38b0280b 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_core.c +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_core.c @@ -10,7 +10,7 @@ #include "cam_res_mgr_api.h" #include "cam_common_util.h" #include "cam_packet_util.h" -#include +#include static uint default_on_timer = 2; module_param(default_on_timer, uint, 0644); @@ -1559,7 +1559,7 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg) add_req.trigger_eof = true; /* Active time for the preflash */ flash_data->flash_active_time_ms = - do_div(flash_operation_info->time_on_duration_ns, 1000000); + div_u64(flash_operation_info->time_on_duration_ns, 1000000); CAM_DBG(CAM_FLASH, "PRECISE FLASH: active_time: %llu", flash_data->flash_active_time_ms); diff --git a/drivers/cam_utils/cam_soc_icc.c b/drivers/cam_utils/cam_soc_icc.c index 757254777740..c6b405b509c5 100644 --- a/drivers/cam_utils/cam_soc_icc.c +++ b/drivers/cam_utils/cam_soc_icc.c @@ -5,7 +5,7 @@ #include #include "cam_soc_bus.h" -#include +#include /** * struct cam_soc_bus_client_data : Bus client data * @@ -37,8 +37,8 @@ int cam_soc_bus_client_update_request(void *client, unsigned int idx) CAM_DBG(CAM_PERF, "Bus client=[%s] index[%d] ab[%llu] ib[%llu]", bus_client->common_data->name, idx, ab, ib); - rc = icc_set_bw(bus_client_data->icc_data, do_div(ab, 1000), - do_div(ib, 1000)); + rc = icc_set_bw(bus_client_data->icc_data, div_u64(ab, 1000), + div_u64(ib, 1000)); if (rc) { CAM_ERR(CAM_UTIL, "Update request failed, client[%s], idx: %d", @@ -60,8 +60,8 @@ int cam_soc_bus_client_update_bw(void *client, uint64_t ab, uint64_t ib) CAM_DBG(CAM_PERF, "Bus client=[%s] :ab[%llu] ib[%llu]", bus_client->common_data->name, ab, ib); - rc = icc_set_bw(bus_client_data->icc_data, do_div(ab, 1000), - do_div(ib, 1000)); + rc = icc_set_bw(bus_client_data->icc_data, div_u64(ab, 1000), + div_u64(ib, 1000)); if (rc) { CAM_ERR(CAM_UTIL, "Update request failed, client[%s]", bus_client->common_data->name); From 8940d2ec7362b363d2e87d1d0c54e479165a7666 Mon Sep 17 00:00:00 2001 From: Anil Kumar Kanakanti Date: Tue, 22 Jun 2021 14:17:41 +0530 Subject: [PATCH 5/6] msm: camera: csiphy: Update CSIPHY settings as per HPG CSIPHY settings updated based on latest HPG settings. CRs-Fixed: 2974853 Change-Id: I3cb3d25bddf707ee9d57a145e0506487b12e487e Signed-off-by: Anil Kumar Kanakanti --- .../include/cam_csiphy_1_2_1_hwreg.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_1_hwreg.h b/drivers/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_1_hwreg.h index 813d978eb536..3881b21bfab8 100644 --- a/drivers/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_1_hwreg.h +++ b/drivers/cam_sensor_module/cam_csiphy/include/cam_csiphy_1_2_1_hwreg.h @@ -71,7 +71,7 @@ csiphy_reg_t csiphy_2ph_v1_2_1_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0000, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x000c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0014, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0028, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0024, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -93,7 +93,7 @@ csiphy_reg_t csiphy_2ph_v1_2_1_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x070c, 0xA5, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0714, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0724, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -115,7 +115,7 @@ csiphy_reg_t csiphy_2ph_v1_2_1_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0200, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x020c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0214, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0228, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0224, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -137,7 +137,7 @@ csiphy_reg_t csiphy_2ph_v1_2_1_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0400, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x040c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0414, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0428, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0424, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -159,7 +159,7 @@ csiphy_reg_t csiphy_2ph_v1_2_1_reg[MAX_LANES][MAX_SETTINGS_PER_LANE] = { {0x0600, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x060c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0614, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0628, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0624, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, @@ -185,7 +185,7 @@ struct csiphy_reg_t {0x0000, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x000c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0014, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0028, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0024, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DNP_PARAMS}, @@ -207,7 +207,7 @@ struct csiphy_reg_t {0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x070c, 0xA5, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0714, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0724, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DNP_PARAMS}, @@ -229,7 +229,7 @@ struct csiphy_reg_t {0x0200, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x020c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0214, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0228, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0224, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DNP_PARAMS}, @@ -251,7 +251,7 @@ struct csiphy_reg_t {0x0400, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x040C, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0414, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0428, 0x0A, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0424, 0x00, 0x00, CSIPHY_DNP_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DNP_PARAMS}, @@ -273,7 +273,7 @@ struct csiphy_reg_t {0x0600, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x060C, 0xA5, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0638, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, - {0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0614, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0628, 0x0E, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0624, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, {0x0800, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, From 146310b60e7e63029e020859f8e113f5eb25229b Mon Sep 17 00:00:00 2001 From: Hongwei Ren Date: Fri, 25 Jun 2021 11:00:54 +0530 Subject: [PATCH 6/6] msm: camera: core: Make Bengal camera module dynamic This change is to make Bengal camera module dynamic. CRs-Fixed: 2977410 Change-Id: I447fa17c907c5e1993dbf86ae1347e4e15de6b30 Signed-off-by: Hongwei Ren --- config/bengalcamera.conf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/bengalcamera.conf b/config/bengalcamera.conf index 38e163af7ebd..7d85536d439c 100644 --- a/config/bengalcamera.conf +++ b/config/bengalcamera.conf @@ -1,8 +1,12 @@ # 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. -export CONFIG_SPECTRA_CAMERA=y +$(info "BENGAL SPECTRA_CAMERA IS MODULAR") +export CONFIG_SPECTRA_CAMERA=m + +ifneq (,$(filter $(CONFIG_SPECTRA_CAMERA), y m)) export CONFIG_SPECTRA_TFE=y export CONFIG_SPECTRA_ISP=y export CONFIG_SPECTRA_SENSOR=y export CONFIG_SPECTRA_OPE=y +endif \ No newline at end of file