msm: camera: csiphy: Add mipi flags to phy config

-Add mipi flags mask to phy cmd buffer.
-Enable skew calibration settings only if the
corresponding flag is set.

CRs-fixed: 2697576
Change-Id: I0353e57daf49ce15d7573b57dbaa9363dbc59635
Signed-off-by: Shravan Nevatia <snevatia@codeaurora.org>
This commit is contained in:
Shravan Nevatia
2020-05-26 04:20:39 +05:30
committed by Gerrit - the friendly Code Review server
parent 19ebf24ab1
commit a58f2a9d27
3 changed files with 19 additions and 1 deletions

View File

@@ -27,6 +27,9 @@
#define SEC_LANE_CP_REG_LEN 32
#define MAX_PHY_MSK_PER_REG 4
/* Mask to enable skew calibration registers */
#define SKEW_CAL_MASK 0x2
static int csiphy_dump;
module_param(csiphy_dump, int, 0644);
@@ -345,6 +348,8 @@ int32_t cam_cmd_buf_parser(struct csiphy_device *csiphy_dev,
cam_cmd_csiphy_info->data_rate;
csiphy_dev->csiphy_info[index].secure_mode =
cam_cmd_csiphy_info->secure_mode;
csiphy_dev->csiphy_info[index].mipi_flags =
cam_cmd_csiphy_info->mipi_flags;
lane_assign = csiphy_dev->csiphy_info[index].lane_assign;
lane_cnt = csiphy_dev->csiphy_info[index].lane_cnt;
@@ -596,6 +601,7 @@ int32_t cam_csiphy_config_dev(struct csiphy_device *csiphy_dev,
uint8_t lane_cnt;
int max_lanes = 0;
uint16_t settle_cnt = 0;
uint8_t skew_cal_enable = 0;
uint64_t intermediate_var;
uint8_t lane_pos = 0;
int index;
@@ -735,6 +741,8 @@ int32_t cam_csiphy_config_dev(struct csiphy_device *csiphy_dev,
intermediate_var = csiphy_dev->csiphy_info[index].settle_time;
do_div(intermediate_var, 200000000);
settle_cnt = intermediate_var;
skew_cal_enable =
csiphy_dev->csiphy_info[index].mipi_flags & SKEW_CAL_MASK;
for (lane_pos = 0; lane_pos < max_lanes; lane_pos++) {
CAM_DBG(CAM_CSIPHY, "lane_pos: %d is configuring", lane_pos);
@@ -760,6 +768,12 @@ int32_t cam_csiphy_config_dev(struct csiphy_device *csiphy_dev,
csiphybase +
reg_array[lane_pos][i].reg_addr);
break;
case CSIPHY_SKEW_CAL:
if (skew_cal_enable)
cam_io_w_mb(reg_array[lane_pos][i].reg_data,
csiphybase +
reg_array[lane_pos][i].reg_addr);
break;
default:
CAM_DBG(CAM_CSIPHY, "Do Nothing");
break;

View File

@@ -53,6 +53,7 @@
#define CSIPHY_DNP_PARAMS 4
#define CSIPHY_2PH_REGS 5
#define CSIPHY_3PH_REGS 6
#define CSIPHY_SKEW_CAL 7
#define CSIPHY_MAX_INSTANCES_PER_PHY 3
@@ -224,6 +225,7 @@ struct csiphy_ctrl_t {
* @settle_time : Settling time in ms
* @data_rate : Data rate in mbps
* @csiphy_3phase : To identify DPHY or CPHY
* @mipi_flags : MIPI phy flags
* @csiphy_cpas_cp_reg_mask : CP reg mask for phy instance
* @hdl_data : CSIPHY handle table
*/
@@ -235,6 +237,7 @@ struct cam_csiphy_param {
uint64_t settle_time;
uint64_t data_rate;
int csiphy_3phase;
uint16_t mipi_flags;
uint64_t csiphy_cpas_cp_reg_mask;
struct csiphy_hdl_tbl hdl_data;
};

View File

@@ -326,6 +326,7 @@ struct cam_cmd_unconditional_wait {
/**
* cam_csiphy_info : Provides cmdbuffer structre
* @lane_assign : Lane sensor will be using
* @mipi_flags : MIPI phy flags
* @lane_cnt : Total number of lanes
* @secure_mode : Secure mode flag to enable / disable
* @settle_time : Settling time in ms
@@ -335,7 +336,7 @@ struct cam_cmd_unconditional_wait {
struct cam_csiphy_info {
__u16 reserved;
__u16 lane_assign;
__u16 reserved1;
__u16 mipi_flags;
__u8 lane_cnt;
__u8 secure_mode;
__u64 settle_time;