msm: camera: isp: Rearrange the rt-wrapper-base property
Rearrange the rt-wrapper property in order to not request for the ioremap for the rt-wrapper region unnecessarily and also to make the code more general for upcoming targets. CRs-Fixed: 3060818 Change-Id: I45da335c1e1c372229388350612f659720326066 Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
b73505f037
commit
132e366145
@@ -682,6 +682,7 @@ int cam_ife_csid_get_base(struct cam_hw_soc_info *soc_info,
|
|||||||
struct cam_cdm_utils_ops *cdm_util_ops = NULL;
|
struct cam_cdm_utils_ops *cdm_util_ops = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
uint32_t mem_base = 0;
|
uint32_t mem_base = 0;
|
||||||
|
struct cam_csid_soc_private *soc_private;
|
||||||
|
|
||||||
|
|
||||||
if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
|
if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
|
||||||
@@ -689,11 +690,17 @@ int cam_ife_csid_get_base(struct cam_hw_soc_info *soc_info,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cdm_args || !cdm_args->res) {
|
if (!cdm_args || !cdm_args->res || !soc_info) {
|
||||||
CAM_ERR(CAM_ISP, "Error, Invalid args");
|
CAM_ERR(CAM_ISP, "Error, Invalid args");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
soc_private = soc_info->soc_private;
|
||||||
|
if (!soc_private) {
|
||||||
|
CAM_ERR(CAM_ISP, "soc_private is null");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
cdm_util_ops =
|
cdm_util_ops =
|
||||||
(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
|
(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
|
||||||
|
|
||||||
@@ -711,14 +718,19 @@ int cam_ife_csid_get_base(struct cam_hw_soc_info *soc_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mem_base = CAM_SOC_GET_REG_MAP_CAM_BASE(soc_info, base_id);
|
mem_base = CAM_SOC_GET_REG_MAP_CAM_BASE(soc_info, base_id);
|
||||||
if (cdm_args->cdm_id == CAM_CDM_RT)
|
if (cdm_args->cdm_id == CAM_CDM_RT) {
|
||||||
mem_base -= CAM_SOC_GET_REG_MAP_CAM_BASE(soc_info, RT_BASE_IDX);
|
if (!soc_private->rt_wrapper_base) {
|
||||||
|
CAM_ERR(CAM_ISP, "rt_wrapper_base_addr is null");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_base -= soc_private->rt_wrapper_base;
|
||||||
|
}
|
||||||
|
|
||||||
CAM_DBG(CAM_ISP, "core %d mem_base 0x%x, cdm_id:%u",
|
CAM_DBG(CAM_ISP, "core %d mem_base 0x%x, cdm_id:%u",
|
||||||
soc_info->index, mem_base, cdm_args->cdm_id);
|
soc_info->index, mem_base, cdm_args->cdm_id);
|
||||||
|
|
||||||
cdm_util_ops->cdm_write_changebase(
|
cdm_util_ops->cdm_write_changebase(cdm_args->cmd.cmd_buf_addr, mem_base);
|
||||||
cdm_args->cmd.cmd_buf_addr, mem_base);
|
|
||||||
cdm_args->cmd.used_bytes = (size * 4);
|
cdm_args->cmd.used_bytes = (size * 4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -37,6 +37,14 @@ static int cam_ife_csid_get_dt_properties(struct cam_hw_soc_info *soc_info)
|
|||||||
soc_private->is_ife_csid_lite = true;
|
soc_private->is_ife_csid_lite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = of_property_read_u32(of_node, "rt-wrapper-base", &soc_private->rt_wrapper_base);
|
||||||
|
if (rc) {
|
||||||
|
soc_private->rt_wrapper_base = 0;
|
||||||
|
CAM_DBG(CAM_ISP, "rc: %d Error reading rt_wrapper_base for core_idx: %u",
|
||||||
|
rc, soc_info->index);
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,12 +16,14 @@
|
|||||||
* @cpas_handle: Handle returned on registering with CPAS driver.
|
* @cpas_handle: Handle returned on registering with CPAS driver.
|
||||||
* This handle is used for all further interface
|
* This handle is used for all further interface
|
||||||
* with CPAS.
|
* with CPAS.
|
||||||
|
* @rt_wrapper_base: Base address of the RT-Wrapper if the hw is in rt-wrapper
|
||||||
* @is_ife_csid_lite: Flag to indicate Whether a full csid or a Lite csid
|
* @is_ife_csid_lite: Flag to indicate Whether a full csid or a Lite csid
|
||||||
* @max_width_enabled: Flag to enable max width restriction
|
* @max_width_enabled: Flag to enable max width restriction
|
||||||
* @max_width: Maxinum allowed width
|
* @max_width: Maxinum allowed width
|
||||||
*/
|
*/
|
||||||
struct cam_csid_soc_private {
|
struct cam_csid_soc_private {
|
||||||
uint32_t cpas_handle;
|
uint32_t cpas_handle;
|
||||||
|
uint32_t rt_wrapper_base;
|
||||||
bool is_ife_csid_lite;
|
bool is_ife_csid_lite;
|
||||||
bool max_width_enabled;
|
bool max_width_enabled;
|
||||||
uint32_t max_width;
|
uint32_t max_width;
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
#include "cam_cpas_api.h"
|
#include "cam_cpas_api.h"
|
||||||
|
|
||||||
#define SFE_CORE_BASE_IDX 0
|
#define SFE_CORE_BASE_IDX 0
|
||||||
#define SFE_RT_CDM_BASE_IDX 1
|
|
||||||
#define CAM_SFE_HW_NUM_MAX 2
|
#define CAM_SFE_HW_NUM_MAX 2
|
||||||
|
|
||||||
enum cam_sfe_core_id {
|
enum cam_sfe_core_id {
|
||||||
|
@@ -21,6 +21,15 @@ static int cam_sfe_get_dt_properties(struct cam_hw_soc_info *soc_info)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = of_property_read_u32(pdev->dev.of_node, "rt-wrapper-base",
|
||||||
|
&soc_private->rt_wrapper_base);
|
||||||
|
if (rc) {
|
||||||
|
soc_private->rt_wrapper_base = 0;
|
||||||
|
CAM_DBG(CAM_ISP, "rc: %d Error reading rt_wrapper_base for core_idx: %u",
|
||||||
|
rc, soc_info->index);
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
soc_private->num_pid = 0;
|
soc_private->num_pid = 0;
|
||||||
num_pid = of_property_count_u32_elems(pdev->dev.of_node, "cam_hw_pid");
|
num_pid = of_property_count_u32_elems(pdev->dev.of_node, "cam_hw_pid");
|
||||||
CAM_DBG(CAM_SFE, "sfe:%d pid count %d", soc_info->index, num_pid);
|
CAM_DBG(CAM_SFE, "sfe:%d pid count %d", soc_info->index, num_pid);
|
||||||
|
@@ -18,12 +18,14 @@
|
|||||||
* This handle is used for all further interface
|
* This handle is used for all further interface
|
||||||
* with CPAS.
|
* with CPAS.
|
||||||
* @cpas_version: CPAS version
|
* @cpas_version: CPAS version
|
||||||
|
* @* @rt_wrapper_base: Base address of the RT-Wrapper if the hw is in rt-wrapper
|
||||||
* @num_pid: Number of pids of sfe
|
* @num_pid: Number of pids of sfe
|
||||||
* @pid: SFE pid values list
|
* @pid: SFE pid values list
|
||||||
*/
|
*/
|
||||||
struct cam_sfe_soc_private {
|
struct cam_sfe_soc_private {
|
||||||
uint32_t cpas_handle;
|
uint32_t cpas_handle;
|
||||||
uint32_t cpas_version;
|
uint32_t cpas_version;
|
||||||
|
uint32_t rt_wrapper_base;
|
||||||
uint32_t num_pid;
|
uint32_t num_pid;
|
||||||
uint32_t pid[CAM_ISP_HW_MAX_PID_VAL];
|
uint32_t pid[CAM_ISP_HW_MAX_PID_VAL];
|
||||||
};
|
};
|
||||||
|
@@ -637,6 +637,7 @@ static int cam_sfe_top_get_base(
|
|||||||
uint32_t mem_base = 0;
|
uint32_t mem_base = 0;
|
||||||
struct cam_isp_hw_get_cmd_update *cdm_args = cmd_args;
|
struct cam_isp_hw_get_cmd_update *cdm_args = cmd_args;
|
||||||
struct cam_cdm_utils_ops *cdm_util_ops = NULL;
|
struct cam_cdm_utils_ops *cdm_util_ops = NULL;
|
||||||
|
struct cam_sfe_soc_private *soc_private;
|
||||||
|
|
||||||
if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
|
if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
|
||||||
CAM_ERR(CAM_SFE, "Invalid cmd size");
|
CAM_ERR(CAM_SFE, "Invalid cmd size");
|
||||||
@@ -649,6 +650,12 @@ static int cam_sfe_top_get_base(
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
soc_private = top_priv->common_data.soc_info->soc_private;
|
||||||
|
if (!soc_private) {
|
||||||
|
CAM_ERR(CAM_ISP, "soc_private is null");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
cdm_util_ops =
|
cdm_util_ops =
|
||||||
(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
|
(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
|
||||||
|
|
||||||
@@ -668,17 +675,19 @@ static int cam_sfe_top_get_base(
|
|||||||
top_priv->common_data.soc_info,
|
top_priv->common_data.soc_info,
|
||||||
SFE_CORE_BASE_IDX);
|
SFE_CORE_BASE_IDX);
|
||||||
|
|
||||||
if (cdm_args->cdm_id == CAM_CDM_RT)
|
if (cdm_args->cdm_id == CAM_CDM_RT) {
|
||||||
mem_base -= CAM_SOC_GET_REG_MAP_CAM_BASE(
|
if (!soc_private->rt_wrapper_base) {
|
||||||
top_priv->common_data.soc_info,
|
CAM_ERR(CAM_ISP, "rt_wrapper_base_addr is null");
|
||||||
SFE_RT_CDM_BASE_IDX);
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
mem_base -= soc_private->rt_wrapper_base;
|
||||||
|
}
|
||||||
|
|
||||||
CAM_DBG(CAM_SFE, "core %d mem_base 0x%x, CDM Id: %d",
|
CAM_DBG(CAM_SFE, "core %d mem_base 0x%x, CDM Id: %d",
|
||||||
top_priv->common_data.soc_info->index, mem_base,
|
top_priv->common_data.soc_info->index, mem_base,
|
||||||
cdm_args->cdm_id);
|
cdm_args->cdm_id);
|
||||||
|
|
||||||
cdm_util_ops->cdm_write_changebase(
|
cdm_util_ops->cdm_write_changebase(cdm_args->cmd.cmd_buf_addr, mem_base);
|
||||||
cdm_args->cmd.cmd_buf_addr, mem_base);
|
|
||||||
cdm_args->cmd.used_bytes = (size * 4);
|
cdm_args->cmd.used_bytes = (size * 4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -51,6 +51,14 @@ static int cam_vfe_get_dt_properties(struct cam_hw_soc_info *soc_info)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = of_property_read_u32(of_node, "rt-wrapper-base", &vfe_soc_private->rt_wrapper_base);
|
||||||
|
if (rc) {
|
||||||
|
vfe_soc_private->rt_wrapper_base = 0;
|
||||||
|
CAM_DBG(CAM_ISP, "rc: %d Error reading rt_wrapper_base for core_idx: %u",
|
||||||
|
rc, soc_info->index);
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
vfe_soc_private->is_ife_lite = false;
|
vfe_soc_private->is_ife_lite = false;
|
||||||
if (strnstr(soc_info->compatible, "lite",
|
if (strnstr(soc_info->compatible, "lite",
|
||||||
strlen(soc_info->compatible)) != NULL) {
|
strlen(soc_info->compatible)) != NULL) {
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
* This handle is used for all further interface
|
* This handle is used for all further interface
|
||||||
* with CPAS.
|
* with CPAS.
|
||||||
* @cpas_version: Has cpas version read from Hardware
|
* @cpas_version: Has cpas version read from Hardware
|
||||||
|
* @rt_wrapper_base: Base address of the RT-Wrapper if the hw is in rt-wrapper
|
||||||
* @dsp_clk_index: DSP clk index in optional clocks
|
* @dsp_clk_index: DSP clk index in optional clocks
|
||||||
* @ubwc_static_ctrl: UBWC static control configuration
|
* @ubwc_static_ctrl: UBWC static control configuration
|
||||||
* @is_ife_lite: Flag to indicate full vs lite IFE
|
* @is_ife_lite: Flag to indicate full vs lite IFE
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
struct cam_vfe_soc_private {
|
struct cam_vfe_soc_private {
|
||||||
uint32_t cpas_handle;
|
uint32_t cpas_handle;
|
||||||
uint32_t cpas_version;
|
uint32_t cpas_version;
|
||||||
|
uint32_t rt_wrapper_base;
|
||||||
int32_t dsp_clk_index;
|
int32_t dsp_clk_index;
|
||||||
uint32_t ubwc_static_ctrl[UBWC_STATIC_CONFIG_MAX];
|
uint32_t ubwc_static_ctrl[UBWC_STATIC_CONFIG_MAX];
|
||||||
bool is_ife_lite;
|
bool is_ife_lite;
|
||||||
|
@@ -182,6 +182,7 @@ static int cam_vfe_top_ver4_mux_get_base(struct cam_vfe_top_ver4_priv *top_priv,
|
|||||||
uint32_t mem_base = 0;
|
uint32_t mem_base = 0;
|
||||||
struct cam_isp_hw_get_cmd_update *cdm_args = cmd_args;
|
struct cam_isp_hw_get_cmd_update *cdm_args = cmd_args;
|
||||||
struct cam_cdm_utils_ops *cdm_util_ops = NULL;
|
struct cam_cdm_utils_ops *cdm_util_ops = NULL;
|
||||||
|
struct cam_vfe_soc_private *soc_private;
|
||||||
|
|
||||||
if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
|
if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
|
||||||
CAM_ERR(CAM_ISP, "Error, Invalid cmd size");
|
CAM_ERR(CAM_ISP, "Error, Invalid cmd size");
|
||||||
@@ -194,6 +195,12 @@ static int cam_vfe_top_ver4_mux_get_base(struct cam_vfe_top_ver4_priv *top_priv,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
soc_private = top_priv->top_common.soc_info->soc_private;
|
||||||
|
if (!soc_private) {
|
||||||
|
CAM_ERR(CAM_ISP, "soc_private is null");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
cdm_util_ops =
|
cdm_util_ops =
|
||||||
(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
|
(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
|
||||||
|
|
||||||
@@ -212,16 +219,20 @@ static int cam_vfe_top_ver4_mux_get_base(struct cam_vfe_top_ver4_priv *top_priv,
|
|||||||
|
|
||||||
mem_base = CAM_SOC_GET_REG_MAP_CAM_BASE(
|
mem_base = CAM_SOC_GET_REG_MAP_CAM_BASE(
|
||||||
top_priv->top_common.soc_info, VFE_CORE_BASE_IDX);
|
top_priv->top_common.soc_info, VFE_CORE_BASE_IDX);
|
||||||
if (cdm_args->cdm_id == CAM_CDM_RT)
|
if (cdm_args->cdm_id == CAM_CDM_RT) {
|
||||||
mem_base -= CAM_SOC_GET_REG_MAP_CAM_BASE(
|
if (!soc_private->rt_wrapper_base) {
|
||||||
top_priv->top_common.soc_info, RT_BASE_IDX);
|
CAM_ERR(CAM_ISP, "rt_wrapper_base_addr is null");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_base -= soc_private->rt_wrapper_base;
|
||||||
|
}
|
||||||
|
|
||||||
CAM_DBG(CAM_ISP, "core %d mem_base 0x%x, cdm_id: %u",
|
CAM_DBG(CAM_ISP, "core %d mem_base 0x%x, cdm_id: %u",
|
||||||
top_priv->top_common.soc_info->index, mem_base,
|
top_priv->top_common.soc_info->index, mem_base,
|
||||||
cdm_args->cdm_id);
|
cdm_args->cdm_id);
|
||||||
|
|
||||||
cdm_util_ops->cdm_write_changebase(
|
cdm_util_ops->cdm_write_changebase(cdm_args->cmd.cmd_buf_addr, mem_base);
|
||||||
cdm_args->cmd.cmd_buf_addr, mem_base);
|
|
||||||
cdm_args->cmd.used_bytes = (size * 4);
|
cdm_args->cmd.used_bytes = (size * 4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user