Loading drivers/cam_cpas/cam_cpas_hw.c +73 −0 Original line number Diff line number Diff line Loading @@ -955,6 +955,70 @@ static int cam_cpas_util_apply_client_axi_vote( return rc; } static int cam_cpas_util_apply_default_axi_vote( struct cam_hw_info *cpas_hw, bool enable) { struct cam_cpas *cpas_core = (struct cam_cpas *) cpas_hw->core_info; struct cam_cpas_axi_port *axi_port = NULL; uint64_t mnoc_ab_bw = 0, mnoc_ib_bw = 0; uint64_t camnoc_ab_bw = 0, camnoc_ib_bw = 0; int rc = 0, i = 0; mutex_lock(&cpas_core->tree_lock); for (i = 0; i < cpas_core->num_axi_ports; i++) { if (!cpas_core->axi_port[i].ab_bw || !cpas_core->axi_port[i].ib_bw) axi_port = &cpas_core->axi_port[i]; else continue; if (enable) mnoc_ib_bw = CAM_CPAS_DEFAULT_AXI_BW; else mnoc_ib_bw = 0; CAM_DBG(CAM_CPAS, "Port=[%s] :ab[%llu] ib[%llu]", axi_port->axi_port_name, mnoc_ab_bw, mnoc_ib_bw); rc = cam_cpas_util_vote_bus_client_bw(&axi_port->bus_client, mnoc_ab_bw, mnoc_ib_bw, false); if (rc) { CAM_ERR(CAM_CPAS, "Failed in mnoc vote ab[%llu] ib[%llu] rc=%d", mnoc_ab_bw, mnoc_ib_bw, rc); goto unlock_tree; } } for (i = 0; i < cpas_core->num_camnoc_axi_ports; i++) { if (!cpas_core->camnoc_axi_port[i].ab_bw || !cpas_core->camnoc_axi_port[i].ib_bw) axi_port = &cpas_core->camnoc_axi_port[i]; else continue; if (enable) camnoc_ib_bw = CAM_CPAS_DEFAULT_AXI_BW; else camnoc_ib_bw = 0; CAM_DBG(CAM_CPAS, "Port=[%s] :ab[%llu] ib[%llu]", axi_port->axi_port_name, camnoc_ab_bw, camnoc_ib_bw); rc = cam_cpas_util_vote_bus_client_bw(&axi_port->bus_client, camnoc_ab_bw, camnoc_ib_bw, false); if (rc) { CAM_ERR(CAM_CPAS, "Failed in camnoc vote ab[%llu] ib[%llu] rc=%d", camnoc_ab_bw, camnoc_ib_bw, rc); goto unlock_tree; } } unlock_tree: mutex_unlock(&cpas_core->tree_lock); return rc; } static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw, uint32_t client_handle, struct cam_axi_vote *client_axi_vote) { Loading Loading @@ -1334,6 +1398,10 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args, goto remove_ahb_vote; if (cpas_core->streamon_clients == 0) { rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, true); if (rc) goto remove_ahb_vote; atomic_set(&cpas_core->irq_count, 1); rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info, applied_level); Loading Loading @@ -1513,6 +1581,11 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args, rc = cam_cpas_util_apply_client_axi_vote(cpas_hw, cpas_client, &axi_vote); if (rc) goto done; if (cpas_core->streamon_clients == 0) rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, false); done: mutex_unlock(&cpas_core->client_mutex[client_indx]); mutex_unlock(&cpas_hw->hw_mutex); Loading drivers/cam_cpas/cpas_top/cpastop_v170_200.h +3 −3 Original line number Diff line number Diff line Loading @@ -253,7 +253,7 @@ static struct cam_camnoc_specific .access_type = CAM_REG_TYPE_READ_WRITE, .masked_value = 0, .offset = 0x2430, /* SPECIFIC_IFE01_PRIORITYLUT_LOW */ .value = 0x66665643, .value = 0x66665433, }, .priority_lut_high = { .enable = true, Loading Loading @@ -301,7 +301,7 @@ static struct cam_camnoc_specific .access_type = CAM_REG_TYPE_READ_WRITE, .masked_value = 0, .offset = 0x2630, /* SPECIFIC_IFE23_PRIORITYLUT_LOW */ .value = 0x66665643, .value = 0x66665433, }, .priority_lut_high = { .enable = true, Loading Loading @@ -366,7 +366,7 @@ static struct cam_camnoc_specific /* SPECIFIC_IBL_RD_URGENCY_LOW_READ_MASK */ .mask = 0x7, /* SPECIFIC_IBL_RD_URGENCY_LOW_READ_SHIFT */ .shift = 0x4, .shift = 0, .value = 3, }, .danger_lut = { Loading drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +91 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ (CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON + 1) #define CAM_ISP_GENERIC_BLOB_TYPE_MAX \ (CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 + 1) (CAM_ISP_GENERIC_BLOB_TYPE_CSID_QCFA_CONFIG + 1) static uint32_t blob_type_hw_cmd_map[CAM_ISP_GENERIC_BLOB_TYPE_MAX] = { CAM_ISP_HW_CMD_GET_HFR_UPDATE, Loading Loading @@ -5119,6 +5119,76 @@ static int cam_isp_blob_clock_update( return rc; } static int cam_isp_blob_sensor_config( uint32_t blob_type, struct cam_isp_generic_blob_info *blob_info, struct cam_isp_sensor_config *dim_config, struct cam_hw_prepare_update_args *prepare) { struct cam_ife_hw_mgr_ctx *ctx = NULL; struct cam_ife_hw_mgr_res *hw_mgr_res; struct cam_hw_intf *hw_intf; struct cam_ife_sensor_dimension_update_args update_args; int rc = -EINVAL, found = 0; uint32_t i, j; struct cam_isp_sensor_dimension *path_config; ctx = prepare->ctxt_to_hw_map; list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) { for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) { if (!hw_mgr_res->hw_res[i]) continue; found = 1; hw_intf = hw_mgr_res->hw_res[i]->hw_intf; if (hw_intf && hw_intf->hw_ops.process_cmd) { path_config = &(dim_config->ipp_path); update_args.ipp_path.width = path_config->width; update_args.ipp_path.height = path_config->height; update_args.ipp_path.measure_enabled = path_config->measure_enabled; path_config = &(dim_config->ppp_path); update_args.ppp_path.width = path_config->width; update_args.ppp_path.height = path_config->height; update_args.ppp_path.measure_enabled = path_config->measure_enabled; for (j = 0; j < CAM_IFE_RDI_NUM_MAX; j++) { path_config = &(dim_config->rdi_path[j]); update_args.rdi_path[j].width = path_config->width; update_args.rdi_path[j].height = path_config->height; update_args.rdi_path[j].measure_enabled = path_config->measure_enabled; } rc = hw_intf->hw_ops.process_cmd( hw_intf->hw_priv, CAM_IFE_CSID_SET_SENSOR_DIMENSION_CFG, &update_args, sizeof( struct cam_ife_sensor_dimension_update_args) ); if (rc) { CAM_ERR(CAM_ISP, "Dimension Update failed"); break; } } else CAM_ERR(CAM_ISP, "hw_intf is NULL"); } if (found) break; } return rc; } static int cam_isp_blob_vfe_out_update( uint32_t blob_type, struct cam_isp_generic_blob_info *blob_info, Loading Loading @@ -5739,6 +5809,26 @@ static int cam_isp_packet_generic_blob_handler(void *user_data, CAM_ERR(CAM_ISP, "CSID Config failed rc: %d", rc); } break; case CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG: { struct cam_isp_sensor_config *csid_dim_config; if (blob_size < sizeof(struct cam_isp_sensor_config)) { CAM_ERR(CAM_ISP, "Invalid blob size %zu expected %zu", blob_size, sizeof(struct cam_isp_sensor_config)); return -EINVAL; } csid_dim_config = (struct cam_isp_sensor_config *)blob_data; rc = cam_isp_blob_sensor_config(blob_type, blob_info, csid_dim_config, prepare); if (rc) CAM_ERR(CAM_ISP, "Sensor Dimension Update Failed rc: %d", rc); } break; default: CAM_WARN(CAM_ISP, "Invalid blob type %d", blob_type); break; Loading drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c +2 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #include <linux/slab.h> Loading Loading @@ -515,8 +515,8 @@ int cam_irq_controller_unsubscribe_irq(void *irq_controller, } } priority = evt_handler->priority; if (found) { priority = evt_handler->priority; for (i = 0; i < controller->num_registers; i++) { irq_register = &controller->irq_register_arr[i]; irq_register->top_half_enable_mask[priority] &= Loading drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid170.h +5 −1 Original line number Diff line number Diff line /* 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 _CAM_IFE_CSID_170_H_ Loading Loading @@ -286,6 +286,10 @@ static struct cam_ife_csid_common_reg_offset .ppp_irq_mask_all = 0x0, .measure_en_hbi_vbi_cnt_mask = 0xC, .format_measure_en_val = 1, .format_measure_height_mask_val = 0xFFFF, .format_measure_height_shift_val = 0x10, .format_measure_width_mask_val = 0xFFFF, .format_measure_width_shift_val = 0x0, }; static struct cam_ife_csid_reg_offset cam_ife_csid_170_reg_offset = { Loading Loading
drivers/cam_cpas/cam_cpas_hw.c +73 −0 Original line number Diff line number Diff line Loading @@ -955,6 +955,70 @@ static int cam_cpas_util_apply_client_axi_vote( return rc; } static int cam_cpas_util_apply_default_axi_vote( struct cam_hw_info *cpas_hw, bool enable) { struct cam_cpas *cpas_core = (struct cam_cpas *) cpas_hw->core_info; struct cam_cpas_axi_port *axi_port = NULL; uint64_t mnoc_ab_bw = 0, mnoc_ib_bw = 0; uint64_t camnoc_ab_bw = 0, camnoc_ib_bw = 0; int rc = 0, i = 0; mutex_lock(&cpas_core->tree_lock); for (i = 0; i < cpas_core->num_axi_ports; i++) { if (!cpas_core->axi_port[i].ab_bw || !cpas_core->axi_port[i].ib_bw) axi_port = &cpas_core->axi_port[i]; else continue; if (enable) mnoc_ib_bw = CAM_CPAS_DEFAULT_AXI_BW; else mnoc_ib_bw = 0; CAM_DBG(CAM_CPAS, "Port=[%s] :ab[%llu] ib[%llu]", axi_port->axi_port_name, mnoc_ab_bw, mnoc_ib_bw); rc = cam_cpas_util_vote_bus_client_bw(&axi_port->bus_client, mnoc_ab_bw, mnoc_ib_bw, false); if (rc) { CAM_ERR(CAM_CPAS, "Failed in mnoc vote ab[%llu] ib[%llu] rc=%d", mnoc_ab_bw, mnoc_ib_bw, rc); goto unlock_tree; } } for (i = 0; i < cpas_core->num_camnoc_axi_ports; i++) { if (!cpas_core->camnoc_axi_port[i].ab_bw || !cpas_core->camnoc_axi_port[i].ib_bw) axi_port = &cpas_core->camnoc_axi_port[i]; else continue; if (enable) camnoc_ib_bw = CAM_CPAS_DEFAULT_AXI_BW; else camnoc_ib_bw = 0; CAM_DBG(CAM_CPAS, "Port=[%s] :ab[%llu] ib[%llu]", axi_port->axi_port_name, camnoc_ab_bw, camnoc_ib_bw); rc = cam_cpas_util_vote_bus_client_bw(&axi_port->bus_client, camnoc_ab_bw, camnoc_ib_bw, false); if (rc) { CAM_ERR(CAM_CPAS, "Failed in camnoc vote ab[%llu] ib[%llu] rc=%d", camnoc_ab_bw, camnoc_ib_bw, rc); goto unlock_tree; } } unlock_tree: mutex_unlock(&cpas_core->tree_lock); return rc; } static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw, uint32_t client_handle, struct cam_axi_vote *client_axi_vote) { Loading Loading @@ -1334,6 +1398,10 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args, goto remove_ahb_vote; if (cpas_core->streamon_clients == 0) { rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, true); if (rc) goto remove_ahb_vote; atomic_set(&cpas_core->irq_count, 1); rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info, applied_level); Loading Loading @@ -1513,6 +1581,11 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args, rc = cam_cpas_util_apply_client_axi_vote(cpas_hw, cpas_client, &axi_vote); if (rc) goto done; if (cpas_core->streamon_clients == 0) rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, false); done: mutex_unlock(&cpas_core->client_mutex[client_indx]); mutex_unlock(&cpas_hw->hw_mutex); Loading
drivers/cam_cpas/cpas_top/cpastop_v170_200.h +3 −3 Original line number Diff line number Diff line Loading @@ -253,7 +253,7 @@ static struct cam_camnoc_specific .access_type = CAM_REG_TYPE_READ_WRITE, .masked_value = 0, .offset = 0x2430, /* SPECIFIC_IFE01_PRIORITYLUT_LOW */ .value = 0x66665643, .value = 0x66665433, }, .priority_lut_high = { .enable = true, Loading Loading @@ -301,7 +301,7 @@ static struct cam_camnoc_specific .access_type = CAM_REG_TYPE_READ_WRITE, .masked_value = 0, .offset = 0x2630, /* SPECIFIC_IFE23_PRIORITYLUT_LOW */ .value = 0x66665643, .value = 0x66665433, }, .priority_lut_high = { .enable = true, Loading Loading @@ -366,7 +366,7 @@ static struct cam_camnoc_specific /* SPECIFIC_IBL_RD_URGENCY_LOW_READ_MASK */ .mask = 0x7, /* SPECIFIC_IBL_RD_URGENCY_LOW_READ_SHIFT */ .shift = 0x4, .shift = 0, .value = 3, }, .danger_lut = { Loading
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +91 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ (CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON + 1) #define CAM_ISP_GENERIC_BLOB_TYPE_MAX \ (CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 + 1) (CAM_ISP_GENERIC_BLOB_TYPE_CSID_QCFA_CONFIG + 1) static uint32_t blob_type_hw_cmd_map[CAM_ISP_GENERIC_BLOB_TYPE_MAX] = { CAM_ISP_HW_CMD_GET_HFR_UPDATE, Loading Loading @@ -5119,6 +5119,76 @@ static int cam_isp_blob_clock_update( return rc; } static int cam_isp_blob_sensor_config( uint32_t blob_type, struct cam_isp_generic_blob_info *blob_info, struct cam_isp_sensor_config *dim_config, struct cam_hw_prepare_update_args *prepare) { struct cam_ife_hw_mgr_ctx *ctx = NULL; struct cam_ife_hw_mgr_res *hw_mgr_res; struct cam_hw_intf *hw_intf; struct cam_ife_sensor_dimension_update_args update_args; int rc = -EINVAL, found = 0; uint32_t i, j; struct cam_isp_sensor_dimension *path_config; ctx = prepare->ctxt_to_hw_map; list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) { for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) { if (!hw_mgr_res->hw_res[i]) continue; found = 1; hw_intf = hw_mgr_res->hw_res[i]->hw_intf; if (hw_intf && hw_intf->hw_ops.process_cmd) { path_config = &(dim_config->ipp_path); update_args.ipp_path.width = path_config->width; update_args.ipp_path.height = path_config->height; update_args.ipp_path.measure_enabled = path_config->measure_enabled; path_config = &(dim_config->ppp_path); update_args.ppp_path.width = path_config->width; update_args.ppp_path.height = path_config->height; update_args.ppp_path.measure_enabled = path_config->measure_enabled; for (j = 0; j < CAM_IFE_RDI_NUM_MAX; j++) { path_config = &(dim_config->rdi_path[j]); update_args.rdi_path[j].width = path_config->width; update_args.rdi_path[j].height = path_config->height; update_args.rdi_path[j].measure_enabled = path_config->measure_enabled; } rc = hw_intf->hw_ops.process_cmd( hw_intf->hw_priv, CAM_IFE_CSID_SET_SENSOR_DIMENSION_CFG, &update_args, sizeof( struct cam_ife_sensor_dimension_update_args) ); if (rc) { CAM_ERR(CAM_ISP, "Dimension Update failed"); break; } } else CAM_ERR(CAM_ISP, "hw_intf is NULL"); } if (found) break; } return rc; } static int cam_isp_blob_vfe_out_update( uint32_t blob_type, struct cam_isp_generic_blob_info *blob_info, Loading Loading @@ -5739,6 +5809,26 @@ static int cam_isp_packet_generic_blob_handler(void *user_data, CAM_ERR(CAM_ISP, "CSID Config failed rc: %d", rc); } break; case CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG: { struct cam_isp_sensor_config *csid_dim_config; if (blob_size < sizeof(struct cam_isp_sensor_config)) { CAM_ERR(CAM_ISP, "Invalid blob size %zu expected %zu", blob_size, sizeof(struct cam_isp_sensor_config)); return -EINVAL; } csid_dim_config = (struct cam_isp_sensor_config *)blob_data; rc = cam_isp_blob_sensor_config(blob_type, blob_info, csid_dim_config, prepare); if (rc) CAM_ERR(CAM_ISP, "Sensor Dimension Update Failed rc: %d", rc); } break; default: CAM_WARN(CAM_ISP, "Invalid blob type %d", blob_type); break; Loading
drivers/cam_isp/isp_hw_mgr/hw_utils/irq_controller/cam_irq_controller.c +2 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #include <linux/slab.h> Loading Loading @@ -515,8 +515,8 @@ int cam_irq_controller_unsubscribe_irq(void *irq_controller, } } priority = evt_handler->priority; if (found) { priority = evt_handler->priority; for (i = 0; i < controller->num_registers; i++) { irq_register = &controller->irq_register_arr[i]; irq_register->top_half_enable_mask[priority] &= Loading
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid170.h +5 −1 Original line number Diff line number Diff line /* 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 _CAM_IFE_CSID_170_H_ Loading Loading @@ -286,6 +286,10 @@ static struct cam_ife_csid_common_reg_offset .ppp_irq_mask_all = 0x0, .measure_en_hbi_vbi_cnt_mask = 0xC, .format_measure_en_val = 1, .format_measure_height_mask_val = 0xFFFF, .format_measure_height_shift_val = 0x10, .format_measure_width_mask_val = 0xFFFF, .format_measure_width_shift_val = 0x0, }; static struct cam_ife_csid_reg_offset cam_ife_csid_170_reg_offset = { Loading