diff --git a/drivers/cam_cdm/cam_cdm.h b/drivers/cam_cdm/cam_cdm.h index 6189ad9bdc..8d8c443af2 100644 --- a/drivers/cam_cdm/cam_cdm.h +++ b/drivers/cam_cdm/cam_cdm.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #ifndef _CAM_CDM_H_ @@ -132,14 +132,6 @@ CAM_CDM_IRQ_STATUS_ERROR_OVER_FLOW_MASK | \ CAM_CDM_IRQ_STATUS_ERROR_AHB_BUS_MASK) - -struct cam_cdm_pid_mid_data { - int cdm_pid; - int cdm_mid; - int ope_cdm_pid; - int ope_cdm_mid; -}; - /* Structure to store hw version info */ struct cam_version_reg { uint32_t hw_version; @@ -383,7 +375,6 @@ struct cam_cdm_common_regs { const struct cam_cdm_icl_regs *icl_reg; uint32_t spare; uint32_t priority_group_bit_offset; - struct cam_cdm_pid_mid_data *cdm_pid_mid_info; }; /** @@ -570,6 +561,8 @@ struct cam_cdm_private_dt_data { uint8_t priority_group; uint32_t fifo_depth[CAM_CDM_BL_FIFO_MAX]; uint32_t dt_num_supported_clients; + uint32_t pid; + uint32_t mid; const char *dt_cdm_client_name[CAM_PER_CDM_MAX_REGISTERED_CLIENTS]; }; diff --git a/drivers/cam_cdm/cam_cdm_hw_core.c b/drivers/cam_cdm/cam_cdm_hw_core.c index afd32c28d1..e4a05ed8da 100644 --- a/drivers/cam_cdm/cam_cdm_hw_core.c +++ b/drivers/cam_cdm/cam_cdm_hw_core.c @@ -737,6 +737,10 @@ bool cam_hw_cdm_bl_write( { struct cam_cdm *cdm_core = (struct cam_cdm *)cdm_hw->core_info; + CAM_DBG(CAM_CDM, "%s%d Base: 0x%x, Len: %u, Tag: %u, set_arb: %u, fifo_idx: %u", + cdm_hw->soc_info.label_name, cdm_hw->soc_info.index, + src, len, tag, set_arb, fifo_idx); + if (cam_cdm_write_hw_reg(cdm_hw, cdm_core->offsets->bl_fifo_reg[fifo_idx]->bl_fifo_base, src)) { @@ -1487,25 +1491,24 @@ static void cam_hw_cdm_iommu_fault_handler(struct cam_smmu_pf_info *pf_info) { struct cam_hw_info *cdm_hw = NULL; struct cam_cdm *core = NULL; - struct cam_cdm_pid_mid_data *pid_mid_info = NULL; + struct cam_cdm_private_dt_data *pvt_data; int i; + if (!pf_info) { + CAM_ERR(CAM_CDM, "pf_info is null"); + return; + } + if (pf_info->token) { cdm_hw = (struct cam_hw_info *)pf_info->token; core = (struct cam_cdm *)cdm_hw->core_info; - pid_mid_info = core->offsets->cmn_reg->cdm_pid_mid_info; + pvt_data = (struct cam_cdm_private_dt_data *) cdm_hw->soc_info.soc_private; CAM_ERR_RATE_LIMIT(CAM_CDM, "Page fault iova addr %pK\n", (void *)pf_info->iova); - if (pid_mid_info) { - /* - * If its CDM or OPE CDM then only handle the pf for CDM - * else return. - */ - if (((pf_info->pid == pid_mid_info->cdm_pid) && - (pf_info->mid == pid_mid_info->cdm_mid)) || - ((pf_info->pid == pid_mid_info->ope_cdm_pid) && - (pf_info->mid == pid_mid_info->ope_cdm_mid))) + /* Check if the PID and MID are valid, if not handle the pf */ + if ((pvt_data->pid >= 0) && (pvt_data->mid >= 0)) { + if (((pf_info->pid == pvt_data->pid) && (pf_info->mid == pvt_data->mid))) goto handle_cdm_pf; else return; diff --git a/drivers/cam_cdm/cam_cdm_hw_reg_2_1.h b/drivers/cam_cdm/cam_cdm_hw_reg_2_1.h index 2797c64dfc..f4dacbd3c5 100644 --- a/drivers/cam_cdm/cam_cdm_hw_reg_2_1.h +++ b/drivers/cam_cdm/cam_cdm_hw_reg_2_1.h @@ -1,17 +1,10 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ #include "cam_cdm.h" -struct cam_cdm_pid_mid_data cdm_hw_2_1_pid_mid_data = { - .cdm_pid = 2, - .cdm_mid = 0, - .ope_cdm_pid = 0, - .ope_cdm_mid = 2, -}; - struct cam_cdm_bl_pending_req_reg_params cdm_hw_2_1_bl_pending_req0 = { .rb_offset = 0x6c, .rb_mask = 0x1ff, @@ -233,7 +226,6 @@ static struct cam_cdm_common_regs cdm_hw_2_1_cmn_reg_offset = { .icl_reg = &cdm_2_1_icl, .spare = 0x3fc, .priority_group_bit_offset = 20, - .cdm_pid_mid_info = &cdm_hw_2_1_pid_mid_data, }; static struct cam_cdm_common_reg_data cdm_hw_2_1_cmn_reg_data = { diff --git a/drivers/cam_cdm/cam_cdm_soc.c b/drivers/cam_cdm/cam_cdm_soc.c index f2658448c3..7ecace508f 100644 --- a/drivers/cam_cdm/cam_cdm_soc.c +++ b/drivers/cam_cdm/cam_cdm_soc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include @@ -115,8 +115,15 @@ int cam_cdm_soc_load_dt_private(struct platform_device *pdev, } cdm_pvt_data->is_single_ctx_cdm = - of_property_read_bool(pdev->dev.of_node, - "single-context-cdm"); + of_property_read_bool(pdev->dev.of_node, "single-context-cdm"); + + rc = of_property_read_u32(pdev->dev.of_node, "cam_hw_pid", &cdm_pvt_data->pid); + if (rc) + cdm_pvt_data->pid = -1; + + rc = of_property_read_u32(pdev->dev.of_node, "cam-hw-mid", &cdm_pvt_data->mid); + if (rc) + cdm_pvt_data->mid = -1; rc = of_property_read_u8(pdev->dev.of_node, "cdm-priority-group", &cdm_pvt_data->priority_group);