Revert "msm: camera: Add support for combo mode"
This reverts commit d6e734f867287b86df8f4f0c656b143fa03c9b68.
Change-Id: If0f9fc4a0da3d4184571d9d1db5f03ef26eb3191
Signed-off-by: Soundrapandian Jeyaprakash <jsoundra@codeaurora.org>
diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c
index 49976f2..bdd3e72 100644
--- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c
+++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c
@@ -70,10 +70,17 @@
return -EINVAL;
}
+ csiphy_dev->csiphy_info =
+ kzalloc(sizeof(struct cam_csiphy_info), GFP_KERNEL);
+ if (!csiphy_dev->csiphy_info)
+ return -ENOMEM;
+
rc = cam_mem_get_cpu_buf((int32_t) cfg_dev->packet_handle,
(uint64_t *)&generic_ptr, &len);
if (rc < 0) {
CAM_ERR(CAM_CSIPHY, "Failed to get packet Mem address: %d", rc);
+ kfree(csiphy_dev->csiphy_info);
+ csiphy_dev->csiphy_info = NULL;
return rc;
}
@@ -81,6 +88,8 @@
CAM_ERR(CAM_CSIPHY,
"offset is out of bounds: offset: %lld len: %zu",
cfg_dev->offset, len);
+ kfree(csiphy_dev->csiphy_info);
+ csiphy_dev->csiphy_info = NULL;
return -EINVAL;
}
@@ -95,6 +104,8 @@
if (rc < 0) {
CAM_ERR(CAM_CSIPHY,
"Failed to get cmd buf Mem address : %d", rc);
+ kfree(csiphy_dev->csiphy_info);
+ csiphy_dev->csiphy_info = NULL;
return rc;
}
@@ -102,18 +113,13 @@
cmd_buf += cmd_desc->offset / 4;
cam_cmd_csiphy_info = (struct cam_csiphy_info *)cmd_buf;
- csiphy_dev->csiphy_info.lane_cnt += cam_cmd_csiphy_info->lane_cnt;
- csiphy_dev->csiphy_info.lane_mask |= cam_cmd_csiphy_info->lane_mask;
- csiphy_dev->csiphy_info.csiphy_3phase =
+ csiphy_dev->csiphy_info->lane_cnt = cam_cmd_csiphy_info->lane_cnt;
+ csiphy_dev->csiphy_info->lane_mask = cam_cmd_csiphy_info->lane_mask;
+ csiphy_dev->csiphy_info->csiphy_3phase =
cam_cmd_csiphy_info->csiphy_3phase;
- csiphy_dev->csiphy_info.combo_mode |= cam_cmd_csiphy_info->combo_mode;
- if (cam_cmd_csiphy_info->combo_mode == 1)
- csiphy_dev->csiphy_info.settle_time_combo_sensor =
- cam_cmd_csiphy_info->settle_time;
- else
- csiphy_dev->csiphy_info.settle_time =
- cam_cmd_csiphy_info->settle_time;
- csiphy_dev->csiphy_info.data_rate = cam_cmd_csiphy_info->data_rate;
+ csiphy_dev->csiphy_info->combo_mode = cam_cmd_csiphy_info->combo_mode;
+ csiphy_dev->csiphy_info->settle_time = cam_cmd_csiphy_info->settle_time;
+ csiphy_dev->csiphy_info->data_rate = cam_cmd_csiphy_info->data_rate;
return rc;
}
@@ -199,8 +205,14 @@
void __iomem *csiphybase;
struct csiphy_reg_t (*reg_array)[MAX_SETTINGS_PER_LANE];
- lane_cnt = csiphy_dev->csiphy_info.lane_cnt;
- lane_mask = csiphy_dev->csiphy_info.lane_mask & 0x1f;
+ if (csiphy_dev->csiphy_info == NULL) {
+ CAM_ERR(CAM_CSIPHY, "csiphy_info is NULL, No/Fail CONFIG_DEV?");
+ return -EINVAL;
+ }
+
+ lane_cnt = csiphy_dev->csiphy_info->lane_cnt;
+ lane_mask = csiphy_dev->csiphy_info->lane_mask & 0x1f;
+ settle_cnt = (csiphy_dev->csiphy_info->settle_time / 200000000);
csiphybase = csiphy_dev->soc_info.reg_map[0].mem_base;
if (!csiphybase) {
@@ -219,8 +231,8 @@
mask <<= 1;
}
- if (!csiphy_dev->csiphy_info.csiphy_3phase) {
- if (csiphy_dev->csiphy_info.combo_mode == 1)
+ if (!csiphy_dev->csiphy_info->csiphy_3phase) {
+ if (csiphy_dev->csiphy_info->combo_mode == 1)
reg_array =
csiphy_dev->ctrl_reg->csiphy_2ph_combo_mode_reg;
else
@@ -230,7 +242,7 @@
cfg_size = csiphy_dev->ctrl_reg->csiphy_reg.
csiphy_2ph_config_array_size;
} else {
- if (csiphy_dev->csiphy_info.combo_mode == 1)
+ if (csiphy_dev->csiphy_info->combo_mode == 1)
reg_array =
csiphy_dev->ctrl_reg->csiphy_2ph_3ph_mode_reg;
else
@@ -271,12 +283,6 @@
continue;
}
- settle_cnt = (csiphy_dev->csiphy_info.settle_time / 200000000);
- if (csiphy_dev->csiphy_info.combo_mode == 1 &&
- (lane_pos >= 3))
- settle_cnt =
- (csiphy_dev->csiphy_info.
- settle_time_combo_sensor / 200000000);
for (i = 0; i < cfg_size; i++) {
switch (reg_array[lane_pos][i].csiphy_param_type) {
case CSIPHY_LANE_ENABLE:
@@ -347,14 +353,6 @@
csiphy_acq_params.combo_mode = 0;
- if (copy_from_user(&csiphy_acq_params,
- (void __user *)csiphy_acq_dev.info_handle,
- sizeof(csiphy_acq_params))) {
- CAM_ERR(CAM_CSIPHY,
- "Failed copying from User");
- goto release_mutex;
- }
-
if (csiphy_dev->acquire_count == 2) {
CAM_ERR(CAM_CSIPHY,
"CSIPHY device do not allow more than 2 acquires");
@@ -362,27 +360,6 @@
goto release_mutex;
}
- if ((csiphy_acq_params.combo_mode == 1) &&
- (csiphy_dev->is_acquired_dev_combo_mode == 1)) {
- CAM_ERR(CAM_CSIPHY,
- "Multiple Combo Acq are not allowed: cm: %d, acm: %d",
- csiphy_acq_params.combo_mode,
- csiphy_dev->is_acquired_dev_combo_mode);
- rc = -EINVAL;
- goto release_mutex;
- }
-
- if ((csiphy_acq_params.combo_mode != 1) &&
- (csiphy_dev->is_acquired_dev_combo_mode != 1) &&
- (csiphy_dev->acquire_count == 1)) {
- CAM_ERR(CAM_CSIPHY,
- "Multiple Acquires are not allowed cm: %d acm: %d",
- csiphy_acq_params.combo_mode,
- csiphy_dev->is_acquired_dev_combo_mode);
- rc = -EINVAL;
- goto release_mutex;
- }
-
bridge_params.ops = NULL;
bridge_params.session_hdl = csiphy_acq_dev.session_handle;
bridge_params.v4l2_sub_dev_flag = 0;
@@ -407,9 +384,7 @@
}
if (csiphy_acq_params.combo_mode == 1)
csiphy_dev->is_acquired_dev_combo_mode = 1;
-
csiphy_dev->acquire_count++;
- csiphy_dev->csiphy_state = CAM_CSIPHY_ACQUIRE;
}
break;
case CAM_QUERY_CAP: {
@@ -425,19 +400,6 @@
}
break;
case CAM_STOP_DEV: {
- if (csiphy_dev->csiphy_state !=
- CAM_CSIPHY_START) {
- CAM_ERR(CAM_CSIPHY, "Not in right state to stop : %d",
- csiphy_dev->csiphy_state);
- goto release_mutex;
- }
-
- if (--csiphy_dev->start_dev_count) {
- CAM_DBG(CAM_CSIPHY, "Stop Dev ref Cnt: %d",
- csiphy_dev->start_dev_count);
- goto release_mutex;
- }
-
rc = cam_csiphy_disable_hw(csiphy_dev);
if (rc < 0) {
CAM_ERR(CAM_CSIPHY, "Failed in csiphy release");
@@ -449,7 +411,6 @@
CAM_ERR(CAM_CSIPHY, "de-voting CPAS: %d", rc);
goto release_mutex;
}
- csiphy_dev->csiphy_state = CAM_CSIPHY_STOP;
}
break;
case CAM_RELEASE_DEV: {
@@ -480,11 +441,8 @@
csiphy_dev->bridge_intf.link_hdl[1] = -1;
csiphy_dev->bridge_intf.
session_hdl[1] = -1;
- csiphy_dev->is_acquired_dev_combo_mode = 0;
}
csiphy_dev->acquire_count--;
- if (csiphy_dev->acquire_count == 0)
- csiphy_dev->csiphy_state = CAM_CSIPHY_RELEASE;
}
break;
case CAM_CONFIG_DEV: {
@@ -506,11 +464,6 @@
struct cam_ahb_vote ahb_vote;
struct cam_axi_vote axi_vote;
- csiphy_dev->start_dev_count++;
-
- if (csiphy_dev->csiphy_state == CAM_CSIPHY_START)
- goto release_mutex;
-
ahb_vote.type = CAM_VOTE_ABSOLUTE;
ahb_vote.vote.level = CAM_SVS_VOTE;
axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
@@ -538,7 +491,6 @@
cam_cpas_stop(csiphy_dev->cpas_handle);
goto release_mutex;
}
- csiphy_dev->csiphy_state = CAM_CSIPHY_START;
}
break;
case CAM_SD_SHUTDOWN:
diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c
index a136fa7..6e74344 100644
--- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c
+++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.c
@@ -157,7 +157,6 @@
NULL;
new_csiphy_dev->acquire_count = 0;
- new_csiphy_dev->start_dev_count = 0;
new_csiphy_dev->is_acquired_dev_combo_mode = 0;
cpas_parms.cam_cpas_client_cb = NULL;
diff --git a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.h b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.h
index 35e96e4..8ed5ba4 100644
--- a/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.h
+++ b/drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_dev.h
@@ -67,13 +67,6 @@
#define CDBG(fmt, args...) pr_debug(fmt, ##args)
#endif
-enum cam_csiphy_state {
- CAM_CSIPHY_ACQUIRE,
- CAM_CSIPHY_RELEASE,
- CAM_CSIPHY_START,
- CAM_CSIPHY_STOP,
-};
-
/**
* struct csiphy_reg_parms_t
* @mipi_csiphy_glbl_irq_cmd_addr: CSIPhy irq addr
@@ -157,32 +150,6 @@
};
/**
- * cam_csiphy_param: Provides cmdbuffer structre
- * @lane_mask : Lane mask details
- * @lane_assign : Lane sensor will be using
- * @csiphy_3phase : Mentions DPHY or CPHY
- * @combo_mode : Info regarding combo_mode is enable / disable
- * @lane_cnt : Total number of lanes
- * @reserved
- * @3phase : Details whether 3Phase / 2Phase operation
- * @settle_time : Settling time in ms
- * @settle_time_combo_sensor : Settling time in ms
- * @data_rate : Data rate in mbps
- *
- */
-struct cam_csiphy_param {
- uint16_t lane_mask;
- uint16_t lane_assign;
- uint8_t csiphy_3phase;
- uint8_t combo_mode;
- uint8_t lane_cnt;
- uint8_t reserved;
- uint64_t settle_time;
- uint64_t settle_time_combo_sensor;
- uint64_t data_rate;
-};
-
-/**
* struct csiphy_device
* @pdev: Platform device
* @irq: Interrupt structure
@@ -204,7 +171,6 @@
* @ref_count: Reference count
* @clk_lane: Clock lane
* @acquire_count: Acquire device count
- * @start_dev_count: Start count
* @is_acquired_dev_combo_mode:
* Flag that mentions whether already acquired
* device is for combo mode
@@ -212,7 +178,7 @@
struct csiphy_device {
struct mutex mutex;
uint32_t hw_version;
- enum cam_csiphy_state csiphy_state;
+ uint32_t csiphy_state;
struct csiphy_ctrl_t *ctrl_reg;
uint32_t csiphy_max_clk;
struct msm_cam_clk_info csiphy_3p_clk_info[2];
@@ -224,11 +190,10 @@
uint8_t is_csiphy_3phase_hw;
uint8_t num_irq_registers;
struct cam_subdev v4l2_dev_str;
- struct cam_csiphy_param csiphy_info;
+ struct cam_csiphy_info *csiphy_info;
struct intf_params bridge_intf;
uint32_t clk_lane;
uint32_t acquire_count;
- uint32_t start_dev_count;
char device_name[20];
uint32_t is_acquired_dev_combo_mode;
struct cam_hw_soc_info soc_info;