summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c35
-rw-r--r--drivers/media/platform/msm/camera_v2/ispif/msm_ispif.h3
-rw-r--r--include/uapi/media/msmb_ispif.h4
3 files changed, 34 insertions, 8 deletions
diff --git a/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c b/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c
index caf6639f5151..24e3223a79d0 100644
--- a/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c
+++ b/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c
@@ -67,6 +67,10 @@ static int pix_overflow_error_count[VFE_MAX] = { 0 };
#define CDBG(fmt, args...)
#endif
+/* Backward interface compatibility for 3D THRESHOLD calculation */
+#define ISPIF_USE_DEFAULT_THRESHOLD (0)
+#define ISPIF_CALCULATE_THRESHOLD (1)
+
static int msm_ispif_clk_ahb_enable(struct ispif_device *ispif, int enable);
static int ispif_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
static long msm_ispif_subdev_ioctl_unlocked(struct v4l2_subdev *sd,
@@ -452,7 +456,7 @@ static int msm_ispif_reset_hw(struct ispif_device *ispif)
/* This is set when device is 8974 */
ispif->clk_idx = 1;
}
-
+ memset(ispif->stereo_configured, 0, sizeof(ispif->stereo_configured));
atomic_set(&ispif->reset_trig[VFE0], 1);
/* initiate reset of ISPIF */
msm_camera_io_w(ISPIF_RST_CMD_MASK,
@@ -1009,21 +1013,29 @@ static int msm_ispif_config(struct ispif_device *ispif,
}
static void msm_ispif_config_stereo(struct ispif_device *ispif,
- struct msm_ispif_param_data_ext *params) {
+ struct msm_ispif_param_data_ext *params, int use_line_width) {
int i;
enum msm_ispif_vfe_intf vfe_intf;
+ uint32_t stereo_3d_threshold = STEREO_DEFAULT_3D_THRESHOLD;
for (i = 0; i < params->num; i++) {
+ vfe_intf = params->entries[i].vfe_intf;
if (params->entries[i].intftype == PIX0 &&
- params->stereo_enable &&
- params->right_entries[i].csid < CSID_MAX) {
- vfe_intf = params->entries[i].vfe_intf;
+ params->stereo_enable &&
+ params->right_entries[i].csid < CSID_MAX &&
+ !ispif->stereo_configured[vfe_intf]) {
msm_camera_io_w_mb(0x3,
ispif->base + ISPIF_VFE_m_OUTPUT_SEL(vfe_intf));
- msm_camera_io_w_mb(STEREO_DEFAULT_3D_THRESHOLD,
+ if (use_line_width &&
+ (params->line_width[vfe_intf] > 0))
+ stereo_3d_threshold =
+ (params->line_width[vfe_intf] +
+ 2 * 6 - 1) / (2 * 6);
+ msm_camera_io_w_mb(stereo_3d_threshold,
ispif->base +
ISPIF_VFE_m_3D_THRESHOLD(vfe_intf));
+ ispif->stereo_configured[vfe_intf] = 1;
}
}
}
@@ -1132,6 +1144,8 @@ static int msm_ispif_stop_immediately(struct ispif_device *ispif,
msm_ispif_enable_intf_cids(ispif, params->entries[i].intftype,
cid_mask, params->entries[i].vfe_intf, 0);
if (params->stereo_enable) {
+ ispif->stereo_configured[
+ params->entries[i].vfe_intf] = 0;
cid_mask = msm_ispif_get_right_cids_mask_from_cfg(
&params->right_entries[i],
params->entries[i].num_cids);
@@ -1162,7 +1176,8 @@ static int msm_ispif_start_frame_boundary(struct ispif_device *ispif,
rc = -EINVAL;
return rc;
}
- msm_ispif_config_stereo(ispif, params);
+
+ msm_ispif_config_stereo(ispif, params, ISPIF_USE_DEFAULT_THRESHOLD);
msm_ispif_intf_cmd(ispif, ISPIF_INTF_CMD_ENABLE_FRAME_BOUNDARY, params);
return rc;
@@ -1392,6 +1407,8 @@ static int msm_ispif_stop_frame_boundary(struct ispif_device *ispif,
if (rc < 0)
goto end;
if (cid_right_mask) {
+ ispif->stereo_configured[
+ params->entries[i].vfe_intf] = 0;
intf_addr = ISPIF_VFE_m_PIX_INTF_n_STATUS(vfe_intf, 1);
rc = readl_poll_timeout(ispif->base + intf_addr,
stop_flag,
@@ -1807,6 +1824,10 @@ static long msm_ispif_dispatch_cmd(enum ispif_cfg_type_t cmd,
rc = msm_ispif_config2(ispif, params);
msm_ispif_io_dump_reg(ispif);
break;
+ case ISPIF_CFG_STEREO:
+ msm_ispif_config_stereo(ispif, params,
+ ISPIF_CALCULATE_THRESHOLD);
+ break;
default:
pr_err("%s: invalid cfg_type\n", __func__);
rc = -EINVAL;
diff --git a/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.h b/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.h
index 61e8f1dd7aff..3e6680c63ee5 100644
--- a/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.h
+++ b/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -77,5 +77,6 @@ struct ispif_device {
int ispif_vdd_count;
struct regulator *vfe_vdd[ISPIF_VFE_VDD_INFO_MAX];
int vfe_vdd_count;
+ int stereo_configured[VFE_MAX];
};
#endif
diff --git a/include/uapi/media/msmb_ispif.h b/include/uapi/media/msmb_ispif.h
index c3a6e006b2ff..d532037427cc 100644
--- a/include/uapi/media/msmb_ispif.h
+++ b/include/uapi/media/msmb_ispif.h
@@ -112,6 +112,7 @@ struct msm_ispif_param_data_ext {
struct msm_ispif_pack_cfg pack_cfg[CID_MAX];
struct msm_ispif_right_param_entry right_entries[MAX_PARAM_ENTRIES];
uint32_t stereo_enable;
+ uint16_t line_width[VFE_MAX];
};
struct msm_ispif_param_data {
@@ -143,6 +144,7 @@ enum ispif_cfg_type_t {
ISPIF_ENABLE_REG_DUMP,
ISPIF_SET_VFE_INFO,
ISPIF_CFG2,
+ ISPIF_CFG_STEREO,
};
struct ispif_cfg_data {
@@ -165,6 +167,8 @@ struct ispif_cfg_data_ext {
#define ISPIF_3D_SUPPORT 1
+#define ISPIF_LINE_WIDTH_SUPPORT 1
+
#define VIDIOC_MSM_ISPIF_CFG \
_IOWR('V', BASE_VIDIOC_PRIVATE, struct ispif_cfg_data)