mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
media: rockchip: isp: support unite mode for isp32
Change-Id: Iae10911ee0f199210c7913d3e99dd85ec4642f81 Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -626,7 +626,7 @@ static void restrict_rsz_resolution(struct rkisp_stream *stream,
|
||||
|
||||
max_rsz->width = ALIGN(DIV_ROUND_UP(input_win->width, div), 4);
|
||||
max_rsz->height = DIV_ROUND_UP(input_win->height, div);
|
||||
} else if (dev->hw_dev->is_unite) {
|
||||
} else if (dev->hw_dev->unite) {
|
||||
/* scale down only for unite mode */
|
||||
max_rsz->width = min_t(int, input_win->width, cfg->max_rsz_width);
|
||||
max_rsz->height = min_t(int, input_win->height, cfg->max_rsz_height);
|
||||
@@ -1140,7 +1140,8 @@ static int rkisp_set_wrap_line(struct rkisp_stream *stream, struct rkisp_wrap_in
|
||||
|
||||
if (dev->isp_ver != ISP_V32 ||
|
||||
dev->hw_dev->dev_link_num > 1 ||
|
||||
!stream->ops->set_wrap) {
|
||||
!stream->ops->set_wrap ||
|
||||
dev->hw_dev->unite) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"wrap only support for single sensor and mainpath\n");
|
||||
return -EINVAL;
|
||||
@@ -1465,7 +1466,7 @@ static struct v4l2_rect *rkisp_update_crop(struct rkisp_stream *stream,
|
||||
const struct v4l2_rect *in)
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = !!dev->hw_dev->unite;
|
||||
u32 align = is_unite ? 4 : 2;
|
||||
|
||||
/* Not crop for MP bayer raw data and dmatx path */
|
||||
@@ -1735,17 +1736,21 @@ int rkisp_register_stream_vdevs(struct rkisp_device *dev)
|
||||
st_cfg->max_rsz_height = CIF_ISP_INPUT_H_MAX_V21;
|
||||
ret = rkisp_register_stream_v21(dev);
|
||||
} else if (dev->isp_ver == ISP_V30) {
|
||||
st_cfg->max_rsz_width = dev->hw_dev->is_unite ?
|
||||
st_cfg->max_rsz_width = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V30_UNITE : CIF_ISP_INPUT_W_MAX_V30;
|
||||
st_cfg->max_rsz_height = dev->hw_dev->is_unite ?
|
||||
st_cfg->max_rsz_height = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V30_UNITE : CIF_ISP_INPUT_H_MAX_V30;
|
||||
ret = rkisp_register_stream_v30(dev);
|
||||
} else if (dev->isp_ver == ISP_V32) {
|
||||
st_cfg->max_rsz_width = CIF_ISP_INPUT_W_MAX_V32;
|
||||
st_cfg->max_rsz_height = CIF_ISP_INPUT_H_MAX_V32;
|
||||
st_cfg->max_rsz_width = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V32_UNITE : CIF_ISP_INPUT_W_MAX_V32;
|
||||
st_cfg->max_rsz_height = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V32_UNITE : CIF_ISP_INPUT_H_MAX_V32;
|
||||
st_cfg = &rkisp_sp_stream_config;
|
||||
st_cfg->max_rsz_width = CIF_ISP_INPUT_W_MAX_V32;
|
||||
st_cfg->max_rsz_height = CIF_ISP_INPUT_H_MAX_V32;
|
||||
st_cfg->max_rsz_width = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V32_UNITE : CIF_ISP_INPUT_W_MAX_V32;
|
||||
st_cfg->max_rsz_height = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V32_UNITE : CIF_ISP_INPUT_H_MAX_V32;
|
||||
ret = rkisp_register_stream_v32(dev);
|
||||
} else if (dev->isp_ver == ISP_V32_L) {
|
||||
st_cfg->max_rsz_width = CIF_ISP_INPUT_W_MAX_V32_L;
|
||||
|
||||
@@ -332,7 +332,7 @@ static int rkisp_stream_config_dcrop(struct rkisp_stream *stream, bool async)
|
||||
if (dcrop->width == input_win->width &&
|
||||
dcrop->height == input_win->height &&
|
||||
dcrop->left == 0 && dcrop->top == 0 &&
|
||||
!dev->hw_dev->is_unite) {
|
||||
!dev->hw_dev->unite) {
|
||||
rkisp_disable_dcrop(stream, async);
|
||||
v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev,
|
||||
"stream %d crop disabled\n", stream->id);
|
||||
@@ -472,7 +472,7 @@ static int mp_config_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
struct v4l2_pix_format_mplane *out_fmt = &stream->out_fmt;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = !!dev->hw_dev->unite;
|
||||
u32 val, mask;
|
||||
|
||||
/*
|
||||
@@ -480,26 +480,26 @@ static int mp_config_mi(struct rkisp_stream *stream)
|
||||
* memory plane formats, so calculate the size explicitly.
|
||||
*/
|
||||
val = out_fmt->plane_fmt[0].bytesperline * out_fmt->height;
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[2].sizeimage;
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_size_init, val, false);
|
||||
|
||||
val = is_unite ? out_fmt->width / 2 : out_fmt->width;
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_PIC_WIDTH, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_PIC_WIDTH, val, false);
|
||||
|
||||
val = out_fmt->height;
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_PIC_HEIGHT, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_PIC_HEIGHT, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[0].bytesperline;
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_LLENGTH, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_LLENGTH, val, false);
|
||||
|
||||
val = stream->out_isp_fmt.uv_swap ? ISP3X_MI_XTD_FORMAT_MP_UV_SWAP : 0;
|
||||
mask = ISP3X_MI_XTD_FORMAT_MP_UV_SWAP;
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false);
|
||||
|
||||
mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_MP_YUV_MODE;
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
@@ -511,13 +511,13 @@ static int mp_config_mi(struct rkisp_stream *stream)
|
||||
val |= ISP3X_SEPERATE_YUV_CFG;
|
||||
else
|
||||
val |= ISP3X_SEPERATE_YUV_CFG | ISP3X_MP_YUV_MODE;
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
|
||||
val = calc_burst_len(stream) | CIF_MI_CTRL_INIT_BASE_EN |
|
||||
CIF_MI_CTRL_INIT_OFFSET_EN | CIF_MI_MP_AUTOUPDATE_ENABLE |
|
||||
stream->out_isp_fmt.write_format;
|
||||
mask = GENMASK(19, 16) | MI_CTRL_MP_FMT_MASK;
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
@@ -558,7 +558,7 @@ static int sp_config_mi(struct rkisp_stream *stream)
|
||||
struct v4l2_pix_format_mplane *out_fmt = &stream->out_fmt;
|
||||
struct ispsd_out_fmt *input_isp_fmt =
|
||||
rkisp_get_ispsd_out_fmt(&dev->isp_sdev);
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = !!dev->hw_dev->unite;
|
||||
u32 sp_in_fmt, val, mask;
|
||||
|
||||
if (mbus_code_sp_in_fmt(input_isp_fmt->mbus_code,
|
||||
@@ -572,26 +572,26 @@ static int sp_config_mi(struct rkisp_stream *stream)
|
||||
* memory plane formats, so calculate the size explicitly.
|
||||
*/
|
||||
val = out_fmt->plane_fmt[0].bytesperline * out_fmt->height;
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[2].sizeimage;
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_size_init, val, false);
|
||||
|
||||
val = is_unite ? out_fmt->width / 2 : out_fmt->width;
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_PIC_WIDTH, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_PIC_WIDTH, val, false);
|
||||
|
||||
val = out_fmt->height;
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_PIC_HEIGHT, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_PIC_HEIGHT, val, false);
|
||||
|
||||
val = stream->u.sp.y_stride;
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_LLENGTH, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_LLENGTH, val, false);
|
||||
|
||||
val = stream->out_isp_fmt.uv_swap ? ISP3X_MI_XTD_FORMAT_SP_UV_SWAP : 0;
|
||||
mask = ISP3X_MI_XTD_FORMAT_SP_UV_SWAP;
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false);
|
||||
|
||||
mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_SP_YUV_MODE;
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
@@ -603,14 +603,14 @@ static int sp_config_mi(struct rkisp_stream *stream)
|
||||
val |= ISP3X_SEPERATE_YUV_CFG;
|
||||
else
|
||||
val |= ISP3X_SEPERATE_YUV_CFG | ISP3X_SP_YUV_MODE;
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
|
||||
val = calc_burst_len(stream) | CIF_MI_CTRL_INIT_BASE_EN |
|
||||
CIF_MI_CTRL_INIT_OFFSET_EN | stream->out_isp_fmt.write_format |
|
||||
sp_in_fmt | stream->out_isp_fmt.output_format |
|
||||
CIF_MI_SP_AUTOUPDATE_ENABLE;
|
||||
mask = GENMASK(19, 16) | MI_CTRL_SP_FMT_MASK;
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
@@ -625,12 +625,12 @@ static int fbc_config_mi(struct rkisp_stream *stream)
|
||||
u32 h = ALIGN(stream->out_fmt.height, 16);
|
||||
u32 w = ALIGN(stream->out_fmt.width, 16);
|
||||
u32 offs = ALIGN(w * h / 16, RK_MPP_ALIGN);
|
||||
bool is_unite = stream->ispdev->hw_dev->is_unite;
|
||||
bool is_unite = !!stream->ispdev->hw_dev->unite;
|
||||
|
||||
rkisp_write(stream->ispdev, ISP3X_MPFBC_HEAD_OFFSET, offs, false);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_VIR_WIDTH, w, false, is_unite);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_PAYL_WIDTH, w, false, is_unite);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_VIR_HEIGHT, h, false, is_unite);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_VIR_WIDTH, w, false);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_PAYL_WIDTH, w, false);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_VIR_HEIGHT, h, false);
|
||||
if (is_unite) {
|
||||
u32 left_w = (stream->out_fmt.width / 2) & ~0xf;
|
||||
|
||||
@@ -638,8 +638,7 @@ static int fbc_config_mi(struct rkisp_stream *stream)
|
||||
rkisp_next_write(stream->ispdev, ISP3X_MPFBC_HEAD_OFFSET, offs, false);
|
||||
}
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, 0,
|
||||
CIF_MI_CTRL_INIT_BASE_EN | CIF_MI_CTRL_INIT_OFFSET_EN,
|
||||
false, is_unite);
|
||||
CIF_MI_CTRL_INIT_BASE_EN | CIF_MI_CTRL_INIT_OFFSET_EN, false);
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
mi_frame_end(stream, FRAME_INIT);
|
||||
@@ -650,7 +649,7 @@ static int bp_config_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
struct v4l2_pix_format_mplane *out_fmt = &stream->out_fmt;
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = dev->hw_dev->unite;
|
||||
u32 val, mask;
|
||||
|
||||
/*
|
||||
@@ -658,19 +657,19 @@ static int bp_config_mi(struct rkisp_stream *stream)
|
||||
* memory plane formats, so calculate the size explicitly.
|
||||
*/
|
||||
val = out_fmt->plane_fmt[0].bytesperline * out_fmt->height;
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
val = is_unite ? out_fmt->width / 2 : out_fmt->width;
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_PIC_WIDTH, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_PIC_WIDTH, val, false);
|
||||
|
||||
val = out_fmt->height;
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_PIC_HEIGHT, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_PIC_HEIGHT, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[0].bytesperline;
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_LLENGTH, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_LLENGTH, val, false);
|
||||
|
||||
mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_BP_YUV_MODE;
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
@@ -680,9 +679,9 @@ static int bp_config_mi(struct rkisp_stream *stream)
|
||||
val |= ISP3X_SEPERATE_YUV_CFG;
|
||||
else
|
||||
val |= ISP3X_SEPERATE_YUV_CFG | ISP3X_BP_YUV_MODE;
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
val = CIF_MI_CTRL_INIT_BASE_EN | CIF_MI_CTRL_INIT_OFFSET_EN;
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, 0, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, 0, val, false);
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
mi_frame_end(stream, FRAME_INIT);
|
||||
@@ -697,8 +696,7 @@ static void mp_enable_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (isp_fmt->fmt_type == FMT_BAYER)
|
||||
val = CIF_MI_CTRL_RAW_ENABLE;
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val,
|
||||
false, stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
}
|
||||
|
||||
static void sp_enable_mi(struct rkisp_stream *stream)
|
||||
@@ -711,21 +709,18 @@ static void sp_enable_mi(struct rkisp_stream *stream)
|
||||
if (fmt->fmt_type == FMT_RGB &&
|
||||
dev->isp_sdev.quantization == V4L2_QUANTIZATION_FULL_RANGE)
|
||||
val |= mask;
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL,
|
||||
mask, val, false,
|
||||
stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
}
|
||||
|
||||
static void fbc_enable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
u32 val, mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_MPFBC_YUV_MASK |
|
||||
ISP3X_MPFBC_SPARSE_MODE;
|
||||
bool is_unite = stream->ispdev->hw_dev->is_unite;
|
||||
|
||||
/* config no effect immediately, read back is shadow, get config value from cache */
|
||||
val = rkisp_read_reg_cache(stream->ispdev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
val |= stream->out_isp_fmt.write_format | ISP3X_HEAD_OFFSET_EN | ISP3X_MPFBC_EN;
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_CTRL, val, false, is_unite);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MPFBC_CTRL, val, false);
|
||||
}
|
||||
|
||||
static void bp_enable_mi(struct rkisp_stream *stream)
|
||||
@@ -733,36 +728,31 @@ static void bp_enable_mi(struct rkisp_stream *stream)
|
||||
u32 val = stream->out_isp_fmt.write_format |
|
||||
ISP3X_BP_ENABLE | ISP3X_BP_AUTO_UPD;
|
||||
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MI_BP_WR_CTRL, val, false,
|
||||
stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MI_BP_WR_CTRL, val, false);
|
||||
}
|
||||
|
||||
static void mp_disable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
u32 mask = CIF_MI_CTRL_MP_ENABLE | CIF_MI_CTRL_RAW_ENABLE;
|
||||
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, false,
|
||||
stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, false);
|
||||
}
|
||||
|
||||
static void sp_disable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, CIF_MI_CTRL_SP_ENABLE,
|
||||
false, stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, CIF_MI_CTRL_SP_ENABLE, false);
|
||||
}
|
||||
|
||||
static void fbc_disable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
u32 mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_MPFBC_EN;
|
||||
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MPFBC_CTRL, mask,
|
||||
false, stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MPFBC_CTRL, mask, false);
|
||||
}
|
||||
|
||||
static void bp_disable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_BP_WR_CTRL, ISP3X_BP_ENABLE,
|
||||
false, stream->ispdev->hw_dev->is_unite);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_BP_WR_CTRL, ISP3X_BP_ENABLE, false);
|
||||
}
|
||||
|
||||
static void update_mi(struct rkisp_stream *stream)
|
||||
@@ -786,7 +776,7 @@ static void update_mi(struct rkisp_stream *stream)
|
||||
rkisp_write(dev, reg, val, false);
|
||||
}
|
||||
|
||||
if (dev->hw_dev->is_unite) {
|
||||
if (dev->hw_dev->unite) {
|
||||
u32 mult = stream->id != RKISP_STREAM_FBC ? 1 :
|
||||
(stream->out_isp_fmt.write_format ? 32 : 24);
|
||||
u32 div = stream->out_isp_fmt.fourcc == V4L2_PIX_FMT_UYVY ? 1 : 2;
|
||||
@@ -818,22 +808,22 @@ static void update_mi(struct rkisp_stream *stream)
|
||||
stream->dbg.frameloss++;
|
||||
val = dummy_buf->dma_addr;
|
||||
reg = stream->config->mi.y_base_ad_init;
|
||||
rkisp_unite_write(dev, reg, val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, reg, val, false);
|
||||
reg = stream->config->mi.cb_base_ad_init;
|
||||
rkisp_unite_write(dev, reg, val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, reg, val, false);
|
||||
reg = stream->config->mi.cr_base_ad_init;
|
||||
if (stream->id != RKISP_STREAM_FBC && stream->id != RKISP_STREAM_BP)
|
||||
rkisp_unite_write(dev, reg, val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, reg, val, false);
|
||||
}
|
||||
|
||||
if (stream->id != RKISP_STREAM_FBC) {
|
||||
reg = stream->config->mi.y_offs_cnt_init;
|
||||
rkisp_unite_write(dev, reg, 0, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, reg, 0, false);
|
||||
reg = stream->config->mi.cb_offs_cnt_init;
|
||||
rkisp_unite_write(dev, reg, 0, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, reg, 0, false);
|
||||
reg = stream->config->mi.cr_offs_cnt_init;
|
||||
if (stream->id != RKISP_STREAM_BP)
|
||||
rkisp_unite_write(dev, reg, 0, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, reg, 0, false);
|
||||
}
|
||||
|
||||
v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev,
|
||||
@@ -842,7 +832,7 @@ static void update_mi(struct rkisp_stream *stream)
|
||||
rkisp_read(dev, stream->config->mi.y_base_ad_init, false),
|
||||
rkisp_read(dev, stream->config->mi.cb_base_ad_init, false),
|
||||
rkisp_read(dev, stream->config->mi.y_base_ad_shd, true));
|
||||
if (dev->hw_dev->is_unite)
|
||||
if (dev->hw_dev->unite)
|
||||
v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev,
|
||||
"%s stream:%d Y:0x%x CB:0x%x | Y_SHD:0x%x, right\n",
|
||||
__func__, stream->id,
|
||||
@@ -897,11 +887,10 @@ static void stream_self_update(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
u32 val, mask = ISP3X_MPSELF_UPD | ISP3X_SPSELF_UPD | ISP3X_BPSELF_UPD;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
|
||||
if (stream->id == RKISP_STREAM_FBC) {
|
||||
val = ISP3X_MPFBC_FORCE_UPD;
|
||||
rkisp_unite_set_bits(dev, ISP3X_MPFBC_CTRL, 0, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MPFBC_CTRL, 0, val, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -919,7 +908,7 @@ static void stream_self_update(struct rkisp_stream *stream)
|
||||
return;
|
||||
}
|
||||
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL2, mask, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL2, mask, val, false);
|
||||
}
|
||||
|
||||
static int mi_frame_start(struct rkisp_stream *stream, u32 mis)
|
||||
@@ -1690,7 +1679,7 @@ void rkisp_mi_v30_isr(u32 mis_val, struct rkisp_device *dev)
|
||||
struct rkisp_stream *stream;
|
||||
unsigned int i;
|
||||
|
||||
if (dev->hw_dev->is_unite) {
|
||||
if (dev->hw_dev->unite) {
|
||||
u32 val = rkisp_read(dev, ISP3X_MI_RIS, true);
|
||||
|
||||
if (val) {
|
||||
|
||||
@@ -554,7 +554,8 @@ static int rkisp_stream_config_dcrop(struct rkisp_stream *stream, bool async)
|
||||
|
||||
if (dcrop->width == input_win->width &&
|
||||
dcrop->height == input_win->height &&
|
||||
dcrop->left == 0 && dcrop->top == 0) {
|
||||
dcrop->left == 0 && dcrop->top == 0 &&
|
||||
!dev->hw_dev->unite) {
|
||||
rkisp_disable_dcrop(stream, async);
|
||||
v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev,
|
||||
"stream %d crop disabled\n", stream->id);
|
||||
@@ -704,29 +705,29 @@ static int mp_config_mi(struct rkisp_stream *stream)
|
||||
/* in bytes for isp32 */
|
||||
if (dev->isp_ver == ISP_V32 &&
|
||||
stream->out_isp_fmt.write_format != MI_CTRL_MP_WRITE_YUVINT)
|
||||
rkisp_write(dev, ISP3X_MI_MP_WR_Y_LLENGTH, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_LLENGTH, val, false);
|
||||
val /= DIV_ROUND_UP(fmt->bpp[0], 8);
|
||||
/* in pixels for isp32 lite */
|
||||
if (dev->isp_ver == ISP_V32_L)
|
||||
rkisp_write(dev, ISP3X_MI_MP_WR_Y_LLENGTH, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MI_MP_WR_Y_LLENGTH, val, false);
|
||||
val *= height;
|
||||
rkisp_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
val = out_fmt->plane_fmt[0].bytesperline * height;
|
||||
rkisp_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
if (dev->cap_dev.wrap_line)
|
||||
val = out_fmt->plane_fmt[0].bytesperline * height / 2;
|
||||
rkisp_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[2].sizeimage;
|
||||
if (dev->cap_dev.wrap_line)
|
||||
val = out_fmt->plane_fmt[0].bytesperline * height / 2;
|
||||
rkisp_write(dev, stream->config->mi.cr_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_size_init, val, false);
|
||||
|
||||
val = stream->out_isp_fmt.uv_swap ? ISP3X_MI_XTD_FORMAT_MP_UV_SWAP : 0;
|
||||
mask = ISP3X_MI_XTD_FORMAT_MP_UV_SWAP;
|
||||
rkisp_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false);
|
||||
|
||||
mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_MP_YUV_MODE;
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
@@ -738,24 +739,24 @@ static int mp_config_mi(struct rkisp_stream *stream)
|
||||
val |= ISP3X_SEPERATE_YUV_CFG;
|
||||
else
|
||||
val |= ISP3X_SEPERATE_YUV_CFG | ISP3X_MP_YUV_MODE;
|
||||
rkisp_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
|
||||
val = stream->out_isp_fmt.output_format;
|
||||
rkisp_write(dev, ISP32_MI_MP_WR_CTRL, val, false);
|
||||
rkisp_unite_write(dev, ISP32_MI_MP_WR_CTRL, val, false);
|
||||
|
||||
val = calc_burst_len(stream) | CIF_MI_CTRL_INIT_BASE_EN |
|
||||
CIF_MI_CTRL_INIT_OFFSET_EN | CIF_MI_MP_AUTOUPDATE_ENABLE |
|
||||
stream->out_isp_fmt.write_format;
|
||||
mask = GENMASK(19, 16) | MI_CTRL_MP_FMT_MASK;
|
||||
rkisp_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
mi_frame_end(stream, FRAME_INIT);
|
||||
|
||||
rkisp_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
rkisp_write(dev, stream->config->mi.cr_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_offs_cnt_init, 0, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -805,21 +806,21 @@ static int sp_config_mi(struct rkisp_stream *stream)
|
||||
* memory plane formats, so calculate the size explicitly.
|
||||
*/
|
||||
val = stream->u.sp.y_stride;
|
||||
rkisp_write(dev, ISP3X_MI_SP_WR_Y_LLENGTH, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MI_SP_WR_Y_LLENGTH, val, false);
|
||||
val *= out_fmt->height;
|
||||
rkisp_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
val = out_fmt->plane_fmt[0].bytesperline * out_fmt->height;
|
||||
rkisp_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
rkisp_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[2].sizeimage;
|
||||
rkisp_write(dev, stream->config->mi.cr_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_size_init, val, false);
|
||||
|
||||
val = stream->out_isp_fmt.uv_swap ? ISP3X_MI_XTD_FORMAT_SP_UV_SWAP : 0;
|
||||
mask = ISP3X_MI_XTD_FORMAT_SP_UV_SWAP;
|
||||
rkisp_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_XTD_FORMAT_CTRL, mask, val, false);
|
||||
|
||||
mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_SP_YUV_MODE;
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
@@ -831,22 +832,22 @@ static int sp_config_mi(struct rkisp_stream *stream)
|
||||
val |= ISP3X_SEPERATE_YUV_CFG;
|
||||
else
|
||||
val |= ISP3X_SEPERATE_YUV_CFG | ISP3X_SP_YUV_MODE;
|
||||
rkisp_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
|
||||
val = calc_burst_len(stream) | CIF_MI_CTRL_INIT_BASE_EN |
|
||||
CIF_MI_CTRL_INIT_OFFSET_EN | stream->out_isp_fmt.write_format |
|
||||
sp_in_fmt | stream->out_isp_fmt.output_format |
|
||||
CIF_MI_SP_AUTOUPDATE_ENABLE;
|
||||
mask = GENMASK(19, 16) | MI_CTRL_SP_FMT_MASK;
|
||||
rkisp_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
mi_frame_end(stream, FRAME_INIT);
|
||||
|
||||
rkisp_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
rkisp_write(dev, stream->config->mi.cr_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cr_offs_cnt_init, 0, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -864,18 +865,18 @@ static int bp_config_mi(struct rkisp_stream *stream)
|
||||
val = out_fmt->plane_fmt[0].bytesperline;
|
||||
/* in bytes */
|
||||
if (stream->out_isp_fmt.write_format != ISP3X_BP_FORMAT_INT)
|
||||
rkisp_write(dev, ISP3X_MI_BP_WR_Y_LLENGTH, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_LLENGTH, val, false);
|
||||
val /= DIV_ROUND_UP(fmt->bpp[0], 8);
|
||||
/* in pixels */
|
||||
if (stream->out_isp_fmt.write_format == ISP3X_BP_FORMAT_INT)
|
||||
rkisp_write(dev, ISP3X_MI_BP_WR_Y_LLENGTH, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MI_BP_WR_Y_LLENGTH, val, false);
|
||||
val *= out_fmt->height;
|
||||
rkisp_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
val = out_fmt->plane_fmt[0].bytesperline * out_fmt->height;
|
||||
rkisp_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
rkisp_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
mask = ISP3X_MPFBC_FORCE_UPD | ISP3X_BP_YUV_MODE;
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_MPFBC_CTRL) & ~mask;
|
||||
@@ -885,15 +886,15 @@ static int bp_config_mi(struct rkisp_stream *stream)
|
||||
val |= ISP3X_SEPERATE_YUV_CFG;
|
||||
else
|
||||
val |= ISP3X_SEPERATE_YUV_CFG | ISP3X_BP_YUV_MODE;
|
||||
rkisp_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
rkisp_unite_write(dev, ISP3X_MPFBC_CTRL, val, false);
|
||||
val = CIF_MI_CTRL_INIT_BASE_EN | CIF_MI_CTRL_INIT_OFFSET_EN;
|
||||
rkisp_set_bits(dev, ISP3X_MI_WR_CTRL, 0, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, 0, val, false);
|
||||
mi_frame_end_int_enable(stream);
|
||||
/* set up first buffer */
|
||||
mi_frame_end(stream, FRAME_INIT);
|
||||
|
||||
rkisp_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -906,27 +907,27 @@ static int ds_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
val = out_fmt->plane_fmt[0].bytesperline;
|
||||
if (stream->out_isp_fmt.write_format != ISP3X_BP_FORMAT_INT)
|
||||
rkisp_write(dev, stream->config->mi.length, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.length, val, false);
|
||||
val /= DIV_ROUND_UP(fmt->bpp[0], 8);
|
||||
if (stream->out_isp_fmt.write_format == ISP3X_BP_FORMAT_INT)
|
||||
rkisp_write(dev, stream->config->mi.length, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.length, val, false);
|
||||
val *= out_fmt->height;
|
||||
rkisp_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_pic_size, val, false);
|
||||
val = out_fmt->plane_fmt[0].bytesperline * out_fmt->height;
|
||||
rkisp_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_size_init, val, false);
|
||||
|
||||
val = out_fmt->plane_fmt[1].sizeimage;
|
||||
rkisp_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_size_init, val, false);
|
||||
|
||||
val = CIF_MI_CTRL_INIT_BASE_EN | CIF_MI_CTRL_INIT_OFFSET_EN;
|
||||
rkisp_set_bits(dev, ISP3X_MI_WR_CTRL, 0, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, 0, val, false);
|
||||
|
||||
mi_frame_end_int_enable(stream);
|
||||
|
||||
mi_frame_end(stream, FRAME_INIT);
|
||||
|
||||
rkisp_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.y_offs_cnt_init, 0, false);
|
||||
rkisp_unite_write(dev, stream->config->mi.cb_offs_cnt_init, 0, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -940,7 +941,7 @@ static void mp_enable_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (isp_fmt->fmt_type == FMT_BAYER)
|
||||
val = CIF_MI_CTRL_RAW_ENABLE;
|
||||
rkisp_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
|
||||
/* enable bpds path output */
|
||||
if (t->streaming && !t->is_pause)
|
||||
@@ -957,7 +958,7 @@ static void sp_enable_mi(struct rkisp_stream *stream)
|
||||
if (fmt->fmt_type == FMT_RGB &&
|
||||
dev->isp_sdev.quantization == V4L2_QUANTIZATION_FULL_RANGE)
|
||||
val |= mask;
|
||||
rkisp_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
rkisp_unite_set_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, val, false);
|
||||
}
|
||||
|
||||
static void bp_enable_mi(struct rkisp_stream *stream)
|
||||
@@ -969,7 +970,7 @@ static void bp_enable_mi(struct rkisp_stream *stream)
|
||||
stream->out_isp_fmt.output_format |
|
||||
ISP3X_BP_ENABLE | ISP3X_BP_AUTO_UPD;
|
||||
|
||||
rkisp_write(stream->ispdev, ISP3X_MI_BP_WR_CTRL, val, false);
|
||||
rkisp_unite_write(stream->ispdev, ISP3X_MI_BP_WR_CTRL, val, false);
|
||||
|
||||
/* enable bpds path output */
|
||||
if (t->streaming && !t->is_pause)
|
||||
@@ -982,7 +983,7 @@ static void ds_enable_mi(struct rkisp_stream *stream)
|
||||
stream->out_isp_fmt.output_format |
|
||||
ISP32_DS_ENABLE | ISP32_DS_AUTO_UPD;
|
||||
|
||||
rkisp_write(stream->ispdev, stream->config->mi.ctrl, val, false);
|
||||
rkisp_unite_write(stream->ispdev, stream->config->mi.ctrl, val, false);
|
||||
}
|
||||
|
||||
static void mp_disable_mi(struct rkisp_stream *stream)
|
||||
@@ -991,8 +992,7 @@ static void mp_disable_mi(struct rkisp_stream *stream)
|
||||
struct rkisp_stream *t = &dev->cap_dev.stream[stream->conn_id];
|
||||
u32 mask = CIF_MI_CTRL_MP_ENABLE | CIF_MI_CTRL_RAW_ENABLE;
|
||||
|
||||
rkisp_set_bits(dev, 0x1814, 0, BIT(0), false);
|
||||
rkisp_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, false);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, mask, false);
|
||||
|
||||
/* disable mpds path output */
|
||||
if (!stream->is_pause && t->streaming)
|
||||
@@ -1001,7 +1001,7 @@ static void mp_disable_mi(struct rkisp_stream *stream)
|
||||
|
||||
static void sp_disable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
rkisp_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, CIF_MI_CTRL_SP_ENABLE, false);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_WR_CTRL, CIF_MI_CTRL_SP_ENABLE, false);
|
||||
}
|
||||
|
||||
static void bp_disable_mi(struct rkisp_stream *stream)
|
||||
@@ -1009,7 +1009,7 @@ static void bp_disable_mi(struct rkisp_stream *stream)
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
struct rkisp_stream *t = &dev->cap_dev.stream[stream->conn_id];
|
||||
|
||||
rkisp_clear_bits(stream->ispdev, ISP3X_MI_BP_WR_CTRL, ISP3X_BP_ENABLE, false);
|
||||
rkisp_unite_clear_bits(stream->ispdev, ISP3X_MI_BP_WR_CTRL, ISP3X_BP_ENABLE, false);
|
||||
|
||||
/* disable bpds path output */
|
||||
if (!stream->is_pause && t->streaming)
|
||||
@@ -1018,7 +1018,7 @@ static void bp_disable_mi(struct rkisp_stream *stream)
|
||||
|
||||
static void ds_disable_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
rkisp_clear_bits(stream->ispdev, stream->config->mi.ctrl, ISP32_DS_ENABLE, false);
|
||||
rkisp_unite_clear_bits(stream->ispdev, stream->config->mi.ctrl, ISP32_DS_ENABLE, false);
|
||||
}
|
||||
|
||||
static void update_mi(struct rkisp_stream *stream)
|
||||
@@ -1048,6 +1048,25 @@ static void update_mi(struct rkisp_stream *stream)
|
||||
rkisp_write(dev, reg, val, false);
|
||||
}
|
||||
|
||||
if (dev->hw_dev->unite) {
|
||||
reg = stream->config->mi.y_base_ad_init;
|
||||
val = stream->next_buf->buff_addr[RKISP_PLANE_Y];
|
||||
val += ((stream->out_fmt.width / 2) & ~0xf);
|
||||
rkisp_next_write(dev, reg, val, false);
|
||||
|
||||
reg = stream->config->mi.cb_base_ad_init;
|
||||
val = stream->next_buf->buff_addr[RKISP_PLANE_CB];
|
||||
val += ((stream->out_fmt.width / 2) & ~0xf);
|
||||
rkisp_next_write(dev, reg, val, false);
|
||||
|
||||
if (is_cr_cfg) {
|
||||
reg = stream->config->mi.cr_base_ad_init;
|
||||
val = stream->next_buf->buff_addr[RKISP_PLANE_CR];
|
||||
val += ((stream->out_fmt.width / 2) & ~0xf);
|
||||
rkisp_next_write(dev, reg, val, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (stream->is_pause) {
|
||||
/* single sensor mode with pingpong buffer:
|
||||
* if mi on, addr will auto update at frame end
|
||||
@@ -1141,9 +1160,9 @@ static int set_mirror_flip(struct rkisp_stream *stream)
|
||||
|
||||
stream->is_mf_upd = false;
|
||||
if (dev->cap_dev.is_mirror)
|
||||
rkisp_set_bits(dev, ISP3X_ISP_CTRL0, 0, ISP32_MIR_ENABLE, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_ISP_CTRL0, 0, ISP32_MIR_ENABLE, false);
|
||||
else
|
||||
rkisp_clear_bits(dev, ISP3X_ISP_CTRL0, ISP32_MIR_ENABLE, false);
|
||||
rkisp_unite_clear_bits(dev, ISP3X_ISP_CTRL0, ISP32_MIR_ENABLE, false);
|
||||
|
||||
switch (stream->id) {
|
||||
case RKISP_STREAM_SP:
|
||||
@@ -1169,9 +1188,9 @@ static int set_mirror_flip(struct rkisp_stream *stream)
|
||||
|
||||
tmp = rkisp_read_reg_cache(dev, ISP32_MI_WR_VFLIP_CTRL);
|
||||
if (stream->is_flip)
|
||||
rkisp_write(dev, ISP32_MI_WR_VFLIP_CTRL, tmp | val, false);
|
||||
rkisp_unite_write(dev, ISP32_MI_WR_VFLIP_CTRL, tmp | val, false);
|
||||
else
|
||||
rkisp_write(dev, ISP32_MI_WR_VFLIP_CTRL, tmp & ~val, false);
|
||||
rkisp_unite_write(dev, ISP32_MI_WR_VFLIP_CTRL, tmp & ~val, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2268,6 +2287,12 @@ void rkisp_mi_v32_isr(u32 mis_val, struct rkisp_device *dev)
|
||||
v4l2_dbg(3, rkisp_debug, &dev->v4l2_dev,
|
||||
"mi isr:0x%x\n", mis_val);
|
||||
|
||||
if (dev->hw_dev->unite == ISP_UNITE_ONE &&
|
||||
dev->unite_index == ISP_UNITE_LEFT) {
|
||||
rkisp_write(dev, ISP3X_MI_ICR, mis_val, true);
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (i = 0; i < RKISP_MAX_STREAM; ++i) {
|
||||
stream = &dev->cap_dev.stream[i];
|
||||
|
||||
@@ -2310,7 +2335,7 @@ void rkisp_mi_v32_isr(u32 mis_val, struct rkisp_device *dev)
|
||||
mi_frame_end(stream, FRAME_IRQ);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
if (mis_val & ISP3X_MI_MP_FRAME) {
|
||||
stream = &dev->cap_dev.stream[RKISP_STREAM_MP];
|
||||
if (!stream->streaming)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/slab.h>
|
||||
#include "dev.h"
|
||||
#include "hw.h"
|
||||
#include "isp_ispp.h"
|
||||
#include "regs.h"
|
||||
|
||||
@@ -36,6 +37,8 @@ void rkisp_next_write(struct rkisp_device *dev, u32 reg, u32 val, bool is_direct
|
||||
*flag = SW_REG_CACHE;
|
||||
if (dev->hw_dev->is_single || is_direct) {
|
||||
*flag = SW_REG_CACHE_SYNC;
|
||||
if (dev->hw_dev->unite == ISP_UNITE_ONE)
|
||||
return;
|
||||
writel(val, dev->hw_dev->base_next_addr + reg);
|
||||
}
|
||||
}
|
||||
@@ -166,13 +169,16 @@ void rkisp_update_regs(struct rkisp_device *dev, u32 start, u32 end)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hw->unite == ISP_UNITE_ONE && dev->unite_index == ISP_UNITE_RIGHT)
|
||||
val = dev->sw_base_addr + i + RKISP_ISP_SW_MAX_SIZE;
|
||||
|
||||
if (*flag == SW_REG_CACHE) {
|
||||
if ((i == ISP3X_MAIN_RESIZE_CTRL ||
|
||||
i == ISP32_BP_RESIZE_CTRL ||
|
||||
i == ISP3X_SELF_RESIZE_CTRL) && *val == 0)
|
||||
*val = CIF_RSZ_CTRL_CFG_UPD;
|
||||
writel(*val, base + i);
|
||||
if (hw->is_unite) {
|
||||
if (hw->unite == ISP_UNITE_TWO) {
|
||||
val = dev->sw_base_addr + i + RKISP_ISP_SW_MAX_SIZE;
|
||||
if ((i == ISP3X_MAIN_RESIZE_CTRL ||
|
||||
i == ISP32_BP_RESIZE_CTRL ||
|
||||
|
||||
@@ -184,32 +184,6 @@ u32 rkisp_next_read_reg_cache(struct rkisp_device *dev, u32 reg);
|
||||
void rkisp_next_set_reg_cache_bits(struct rkisp_device *dev, u32 reg, u32 mask, u32 val);
|
||||
void rkisp_next_clear_reg_cache_bits(struct rkisp_device *dev, u32 reg, u32 mask);
|
||||
|
||||
static inline void
|
||||
rkisp_unite_write(struct rkisp_device *dev, u32 reg, u32 val, bool is_direct, bool is_unite)
|
||||
{
|
||||
rkisp_write(dev, reg, val, is_direct);
|
||||
if (is_unite)
|
||||
rkisp_next_write(dev, reg, val, is_direct);
|
||||
}
|
||||
|
||||
static inline void
|
||||
rkisp_unite_set_bits(struct rkisp_device *dev, u32 reg, u32 mask,
|
||||
u32 val, bool is_direct, bool is_unite)
|
||||
{
|
||||
rkisp_set_bits(dev, reg, mask, val, is_direct);
|
||||
if (is_unite)
|
||||
rkisp_next_set_bits(dev, reg, mask, val, is_direct);
|
||||
}
|
||||
|
||||
static inline void
|
||||
rkisp_unite_clear_bits(struct rkisp_device *dev, u32 reg, u32 mask,
|
||||
bool is_direct, bool is_unite)
|
||||
{
|
||||
rkisp_clear_bits(dev, reg, mask, is_direct);
|
||||
if (is_unite)
|
||||
rkisp_next_clear_bits(dev, reg, mask, is_direct);
|
||||
}
|
||||
|
||||
void rkisp_update_regs(struct rkisp_device *dev, u32 start, u32 end);
|
||||
|
||||
int rkisp_alloc_buffer(struct rkisp_device *dev, struct rkisp_dummy_buffer *buf);
|
||||
|
||||
@@ -626,8 +626,7 @@ int rkisp_csi_config_patch(struct rkisp_device *dev)
|
||||
|
||||
if (!dev->hw_dev->is_mi_update)
|
||||
rkisp_unite_write(dev, CSI2RX_CTRL0,
|
||||
SW_IBUF_OP_MODE(dev->hdr.op_mode),
|
||||
true, dev->hw_dev->is_unite);
|
||||
SW_IBUF_OP_MODE(dev->hdr.op_mode), true);
|
||||
|
||||
/* hdr merge */
|
||||
switch (dev->hdr.op_mode) {
|
||||
@@ -651,25 +650,22 @@ int rkisp_csi_config_patch(struct rkisp_device *dev)
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
rkisp_unite_write(dev, ISP_HDRMGE_BASE, val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, ISP_HDRMGE_BASE, val, false);
|
||||
|
||||
val = RAW_RD_SIZE_ERR;
|
||||
if (!IS_HDR_RDBK(dev->hdr.op_mode))
|
||||
val |= ISP21_MIPI_DROP_FRM;
|
||||
rkisp_unite_set_bits(dev, CSI2RX_MASK_STAT, 0, val, true, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, CSI2RX_MASK_STAT, 0, val, true);
|
||||
}
|
||||
|
||||
if (IS_HDR_RDBK(dev->hdr.op_mode))
|
||||
rkisp_unite_set_bits(dev, CTRL_SWS_CFG, 0, SW_MPIP_DROP_FRM_DIS,
|
||||
true, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, CTRL_SWS_CFG, 0, SW_MPIP_DROP_FRM_DIS, true);
|
||||
|
||||
if (dev->isp_ver >= ISP_V30)
|
||||
rkisp_unite_set_bits(dev, CTRL_SWS_CFG, 0, ISP3X_SW_ACK_FRM_PRO_DIS,
|
||||
true, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, CTRL_SWS_CFG, 0, ISP3X_SW_ACK_FRM_PRO_DIS, true);
|
||||
/* line counter from isp out, default from mp out */
|
||||
if (dev->isp_ver == ISP_V32_L)
|
||||
rkisp_unite_set_bits(dev, CTRL_SWS_CFG, 0, ISP32L_ISP2ENC_CNT_MUX,
|
||||
true, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, CTRL_SWS_CFG, 0, ISP32L_ISP2ENC_CNT_MUX, true);
|
||||
dev->rdbk_cnt = -1;
|
||||
dev->rdbk_cnt_x1 = -1;
|
||||
dev->rdbk_cnt_x2 = -1;
|
||||
|
||||
@@ -239,6 +239,8 @@ static int __isp_pipeline_s_isp_clk(struct rkisp_pipeline *p)
|
||||
data_rate >>= 3;
|
||||
end:
|
||||
do_div(data_rate, 1000 * 1000);
|
||||
if (hw_dev->unite == ISP_UNITE_ONE)
|
||||
data_rate *= 4;
|
||||
|
||||
/* increase 25% margin */
|
||||
data_rate += data_rate >> 2;
|
||||
@@ -252,7 +254,7 @@ end:
|
||||
|
||||
/* set isp clock rate */
|
||||
rkisp_set_clk_rate(hw_dev->clks[0], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
|
||||
if (hw_dev->is_unite)
|
||||
if (hw_dev->unite == ISP_UNITE_TWO)
|
||||
rkisp_set_clk_rate(hw_dev->clks[5], hw_dev->clk_rate_tbl[i].clk_rate * 1000000UL);
|
||||
/* aclk equal to core clk */
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
@@ -842,7 +844,7 @@ static int rkisp_plat_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (isp_dev->hw_dev->is_unite)
|
||||
if (isp_dev->hw_dev->unite)
|
||||
mult = 2;
|
||||
isp_dev->sw_base_addr = devm_kzalloc(dev, RKISP_ISP_SW_MAX_SIZE * mult, GFP_KERNEL);
|
||||
if (!isp_dev->sw_base_addr)
|
||||
@@ -854,7 +856,7 @@ static int rkisp_plat_probe(struct platform_device *pdev)
|
||||
|
||||
snprintf(isp_dev->media_dev.model, sizeof(isp_dev->media_dev.model),
|
||||
"%s%d", DRIVER_NAME, isp_dev->dev_id);
|
||||
if (!isp_dev->hw_dev->is_unite)
|
||||
if (!isp_dev->hw_dev->unite)
|
||||
strscpy(isp_dev->name, dev_name(dev), sizeof(isp_dev->name));
|
||||
else
|
||||
snprintf(isp_dev->name, sizeof(isp_dev->name),
|
||||
@@ -980,6 +982,11 @@ static int __maybe_unused rkisp_runtime_resume(struct device *dev)
|
||||
|
||||
if (isp_dev->hw_dev->is_assigned_clk)
|
||||
rkisp_clk_dbg = true;
|
||||
|
||||
if (isp_dev->hw_dev->unite == ISP_UNITE_ONE &&
|
||||
!(isp_dev->isp_inp & INP_RAWRD2))
|
||||
rkisp_rdbk_auto = true;
|
||||
|
||||
isp_dev->cap_dev.wait_line = rkisp_wait_line;
|
||||
isp_dev->cap_dev.wrap_line = rkisp_wrap_line;
|
||||
isp_dev->is_rdbk_auto = rkisp_rdbk_auto;
|
||||
|
||||
@@ -103,6 +103,25 @@ enum rkisp_rdbk_filt {
|
||||
RDBK_F_MAX
|
||||
};
|
||||
|
||||
/* unite mode for isp to process high resolution
|
||||
* ISP_UNITE_TWO: image splits left and right to two isp hardware
|
||||
* ISP_UNITE_ONE: image splits left and right to single isp hardware
|
||||
*/
|
||||
enum {
|
||||
ISP_UNITE_NONE = 0,
|
||||
ISP_UNITE_TWO = 1,
|
||||
ISP_UNITE_ONE = 2,
|
||||
};
|
||||
|
||||
/* left and right index
|
||||
* ISP_UNITE_LEFT: left of image to isp process
|
||||
* ISP_UNITE_RIGHT: right of image to isp process
|
||||
*/
|
||||
enum {
|
||||
ISP_UNITE_LEFT = 0,
|
||||
ISP_UNITE_RIGHT = 1,
|
||||
};
|
||||
|
||||
/*
|
||||
* struct rkisp_pipeline - An ISP hardware pipeline
|
||||
*
|
||||
@@ -249,11 +268,40 @@ struct rkisp_device {
|
||||
bool is_pre_on;
|
||||
bool is_first_double;
|
||||
bool is_probe_end;
|
||||
bool is_frame_double;
|
||||
|
||||
struct rkisp_vicap_input vicap_in;
|
||||
|
||||
u8 multi_mode;
|
||||
u8 multi_index;
|
||||
u8 rawaf_irq_cnt;
|
||||
u8 unite_index;
|
||||
};
|
||||
|
||||
static inline void
|
||||
rkisp_unite_write(struct rkisp_device *dev, u32 reg, u32 val, bool is_direct)
|
||||
{
|
||||
rkisp_write(dev, reg, val, is_direct);
|
||||
if (dev->hw_dev->unite)
|
||||
rkisp_next_write(dev, reg, val, is_direct);
|
||||
}
|
||||
|
||||
static inline void
|
||||
rkisp_unite_set_bits(struct rkisp_device *dev, u32 reg, u32 mask,
|
||||
u32 val, bool is_direct)
|
||||
{
|
||||
rkisp_set_bits(dev, reg, mask, val, is_direct);
|
||||
if (dev->hw_dev->unite)
|
||||
rkisp_next_set_bits(dev, reg, mask, val, is_direct);
|
||||
}
|
||||
|
||||
static inline void
|
||||
rkisp_unite_clear_bits(struct rkisp_device *dev, u32 reg, u32 mask,
|
||||
bool is_direct)
|
||||
{
|
||||
rkisp_clear_bits(dev, reg, mask, is_direct);
|
||||
if (dev->hw_dev->unite)
|
||||
rkisp_next_clear_bits(dev, reg, mask, is_direct);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -318,7 +318,6 @@ static struct streams_ops rkisp_dmarx_streams_ops = {
|
||||
static int rawrd_config_mi(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
u32 val;
|
||||
|
||||
val = rkisp_read(dev, CSI2RX_DATA_IDS_1, true);
|
||||
@@ -348,8 +347,8 @@ static int rawrd_config_mi(struct rkisp_stream *stream)
|
||||
val |= CIF_CSI2_DT_RAW12;
|
||||
}
|
||||
rkisp_unite_write(dev, CSI2RX_RAW_RD_CTRL,
|
||||
stream->memory << 2, false, is_unite);
|
||||
rkisp_unite_write(dev, CSI2RX_DATA_IDS_1, val, false, is_unite);
|
||||
stream->memory << 2, false);
|
||||
rkisp_unite_write(dev, CSI2RX_DATA_IDS_1, val, false);
|
||||
rkisp_rawrd_set_pic_size(dev, stream->out_fmt.width,
|
||||
stream->out_fmt.height);
|
||||
mi_raw_length(stream);
|
||||
@@ -376,7 +375,7 @@ static void update_rawrd(struct rkisp_stream *stream)
|
||||
}
|
||||
val += stream->curr_buf->buff_addr[RKISP_PLANE_Y];
|
||||
rkisp_write(dev, stream->config->mi.y_base_ad_init, val, false);
|
||||
if (dev->hw_dev->is_unite) {
|
||||
if (dev->hw_dev->unite) {
|
||||
u32 offs = stream->out_fmt.width / 2 - RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
|
||||
if (stream->memory)
|
||||
@@ -464,13 +463,10 @@ static int dmarx_frame_end(struct rkisp_stream *stream)
|
||||
}
|
||||
dev->hdr.op_mode = dev->rd_mode;
|
||||
rkisp_unite_write(dev, CSI2RX_CTRL0,
|
||||
SW_IBUF_OP_MODE(dev->hdr.op_mode),
|
||||
true, dev->hw_dev->is_unite);
|
||||
SW_IBUF_OP_MODE(dev->hdr.op_mode), true);
|
||||
rkisp_unite_set_bits(dev, CSI2RX_MASK_STAT,
|
||||
0, ISP21_MIPI_DROP_FRM,
|
||||
true, dev->hw_dev->is_unite);
|
||||
rkisp_unite_clear_bits(dev, CIF_ISP_IMSC, CIF_ISP_FRAME_IN,
|
||||
true, dev->hw_dev->is_unite);
|
||||
0, ISP21_MIPI_DROP_FRM, true);
|
||||
rkisp_unite_clear_bits(dev, CIF_ISP_IMSC, CIF_ISP_FRAME_IN, true);
|
||||
dev_info(dev->dev,
|
||||
"switch online seq:%d mode:0x%x\n",
|
||||
rx_buf->sequence, dev->rd_mode);
|
||||
@@ -1135,7 +1131,7 @@ void rkisp_rawrd_set_pic_size(struct rkisp_device *dev,
|
||||
{
|
||||
struct rkisp_isp_subdev *sdev = &dev->isp_sdev;
|
||||
u8 mult = sdev->in_fmt.fmt_type == FMT_YUV ? 2 : 1;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = !!dev->hw_dev->unite;
|
||||
u32 w = !is_unite ? width : width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
|
||||
/* rx height should equal to isp height + offset for read back mode */
|
||||
@@ -1149,7 +1145,7 @@ void rkisp_rawrd_set_pic_size(struct rkisp_device *dev,
|
||||
height += RKMODULE_EXTEND_LINE;
|
||||
|
||||
w *= mult;
|
||||
rkisp_unite_write(dev, CSI2RX_RAW_RD_PIC_SIZE, height << 16 | w, false, is_unite);
|
||||
rkisp_unite_write(dev, CSI2RX_RAW_RD_PIC_SIZE, height << 16 | w, false);
|
||||
}
|
||||
|
||||
void rkisp_dmarx_get_frame(struct rkisp_device *dev, u32 *id,
|
||||
|
||||
@@ -132,7 +132,7 @@ static void default_sw_reg_flag(struct rkisp_device *dev)
|
||||
for (i = 0; i < size; i++) {
|
||||
flag = dev->sw_base_addr + reg[i] + RKISP_ISP_SW_REG_SIZE;
|
||||
*flag = SW_REG_CACHE;
|
||||
if (dev->hw_dev->is_unite) {
|
||||
if (dev->hw_dev->unite) {
|
||||
flag += RKISP_ISP_SW_MAX_SIZE / 4;
|
||||
*flag = SW_REG_CACHE;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ static irqreturn_t mipi_irq_hdl(int irq, void *ctx)
|
||||
struct device *dev = ctx;
|
||||
struct rkisp_hw_dev *hw_dev = dev_get_drvdata(dev);
|
||||
struct rkisp_device *isp = hw_dev->isp[hw_dev->mipi_dev_id];
|
||||
void __iomem *base = !hw_dev->is_unite ?
|
||||
void __iomem *base = hw_dev->unite != ISP_UNITE_TWO ?
|
||||
hw_dev->base_addr : hw_dev->base_next_addr;
|
||||
ktime_t t = 0;
|
||||
s64 us;
|
||||
@@ -201,7 +201,7 @@ static irqreturn_t mi_irq_hdl(int irq, void *ctx)
|
||||
struct device *dev = ctx;
|
||||
struct rkisp_hw_dev *hw_dev = dev_get_drvdata(dev);
|
||||
struct rkisp_device *isp = hw_dev->isp[hw_dev->cur_dev_id];
|
||||
void __iomem *base = !hw_dev->is_unite ?
|
||||
void __iomem *base = hw_dev->unite != ISP_UNITE_TWO ?
|
||||
hw_dev->base_addr : hw_dev->base_next_addr;
|
||||
u32 mis_val, tx_isr = MI_RAW0_WR_FRAME | MI_RAW1_WR_FRAME |
|
||||
MI_RAW2_WR_FRAME | MI_RAW3_WR_FRAME;
|
||||
@@ -237,7 +237,7 @@ static irqreturn_t isp_irq_hdl(int irq, void *ctx)
|
||||
struct device *dev = ctx;
|
||||
struct rkisp_hw_dev *hw_dev = dev_get_drvdata(dev);
|
||||
struct rkisp_device *isp = hw_dev->isp[hw_dev->cur_dev_id];
|
||||
void __iomem *base = !hw_dev->is_unite ?
|
||||
void __iomem *base = hw_dev->unite != ISP_UNITE_TWO ?
|
||||
hw_dev->base_addr : hw_dev->base_next_addr;
|
||||
unsigned int mis_val, mis_3a = 0;
|
||||
ktime_t t = 0;
|
||||
@@ -455,6 +455,9 @@ static const struct isp_clk_info rv1106_isp_clk_rate[] = {
|
||||
}, {
|
||||
.clk_rate = 350,
|
||||
.refer_data = 3072,
|
||||
}, {
|
||||
.clk_rate = 440,
|
||||
.refer_data = 3840,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -636,7 +639,7 @@ void rkisp_soft_reset(struct rkisp_hw_dev *dev, bool is_secure)
|
||||
/* record clk config and recover */
|
||||
iccl0 = readl(base + CIF_ICCL);
|
||||
clk_ctrl0 = readl(base + CTRL_VI_ISP_CLK_CTRL);
|
||||
if (dev->is_unite) {
|
||||
if (dev->unite == ISP_UNITE_TWO) {
|
||||
iccl1 = readl(dev->base_next_addr + CIF_ICCL);
|
||||
clk_ctrl1 = readl(dev->base_next_addr + CTRL_VI_ISP_CLK_CTRL);
|
||||
}
|
||||
@@ -646,7 +649,7 @@ void rkisp_soft_reset(struct rkisp_hw_dev *dev, bool is_secure)
|
||||
* isp soft reset first to protect isp reset.
|
||||
*/
|
||||
writel(0xffff, base + CIF_IRCL);
|
||||
if (dev->is_unite)
|
||||
if (dev->unite == ISP_UNITE_TWO)
|
||||
writel(0xffff, dev->base_next_addr + CIF_IRCL);
|
||||
udelay(10);
|
||||
}
|
||||
@@ -669,7 +672,7 @@ void rkisp_soft_reset(struct rkisp_hw_dev *dev, bool is_secure)
|
||||
writel(val, base + CIF_IRCL);
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
rv1106_sdmmc_put_lock();
|
||||
if (dev->is_unite)
|
||||
if (dev->unite == ISP_UNITE_TWO)
|
||||
writel(0xffff, dev->base_next_addr + CIF_IRCL);
|
||||
udelay(10);
|
||||
|
||||
@@ -681,7 +684,7 @@ void rkisp_soft_reset(struct rkisp_hw_dev *dev, bool is_secure)
|
||||
|
||||
writel(iccl0, base + CIF_ICCL);
|
||||
writel(clk_ctrl0, base + CTRL_VI_ISP_CLK_CTRL);
|
||||
if (dev->is_unite) {
|
||||
if (dev->unite == ISP_UNITE_TWO) {
|
||||
writel(iccl1, dev->base_next_addr + CIF_ICCL);
|
||||
writel(clk_ctrl1, dev->base_next_addr + CTRL_VI_ISP_CLK_CTRL);
|
||||
}
|
||||
@@ -722,7 +725,7 @@ static void isp_config_clk(struct rkisp_hw_dev *dev, int on)
|
||||
writel(val, dev->base_addr + CIF_ICCL);
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
rv1106_sdmmc_put_lock();
|
||||
if (dev->is_unite)
|
||||
if (dev->unite == ISP_UNITE_TWO)
|
||||
writel(val, dev->base_next_addr + CIF_ICCL);
|
||||
|
||||
if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) {
|
||||
@@ -752,7 +755,7 @@ static void isp_config_clk(struct rkisp_hw_dev *dev, int on)
|
||||
writel(val, dev->base_addr + CTRL_VI_ISP_CLK_CTRL);
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
rv1106_sdmmc_put_lock();
|
||||
if (dev->is_unite)
|
||||
if (dev->unite == ISP_UNITE_TWO)
|
||||
writel(val, dev->base_next_addr + CTRL_VI_ISP_CLK_CTRL);
|
||||
}
|
||||
}
|
||||
@@ -789,7 +792,7 @@ static int enable_sys_clk(struct rkisp_hw_dev *dev)
|
||||
if (!dev->is_assigned_clk) {
|
||||
rate = dev->clk_rate_tbl[0].clk_rate * 1000000UL;
|
||||
rkisp_set_clk_rate(dev->clks[0], rate);
|
||||
if (dev->is_unite)
|
||||
if (dev->unite == ISP_UNITE_TWO)
|
||||
rkisp_set_clk_rate(dev->clks[5], rate);
|
||||
}
|
||||
rkisp_soft_reset(dev, false);
|
||||
@@ -861,21 +864,11 @@ static int rkisp_hw_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
match_data = match->data;
|
||||
hw_dev->is_unite = match_data->unite;
|
||||
dev_set_drvdata(dev, hw_dev);
|
||||
hw_dev->dev = dev;
|
||||
hw_dev->is_thunderboot = IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP);
|
||||
dev_info(dev, "is_thunderboot: %d\n", hw_dev->is_thunderboot);
|
||||
memset(&hw_dev->max_in, 0, sizeof(hw_dev->max_in));
|
||||
if (!of_property_read_u32_array(node, "max-input", &hw_dev->max_in.w, 3)) {
|
||||
hw_dev->max_in.is_fix = true;
|
||||
if (hw_dev->is_unite) {
|
||||
hw_dev->max_in.w /= 2;
|
||||
hw_dev->max_in.w += RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
}
|
||||
}
|
||||
dev_info(dev, "max input:%dx%d@%dfps\n",
|
||||
hw_dev->max_in.w, hw_dev->max_in.h, hw_dev->max_in.fps);
|
||||
|
||||
hw_dev->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
|
||||
if (IS_ERR(hw_dev->grf))
|
||||
dev_warn(dev, "Missing rockchip,grf property\n");
|
||||
@@ -922,6 +915,27 @@ static int rkisp_hw_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
hw_dev->isp_ver = match_data->isp_ver;
|
||||
if (match_data->unite) {
|
||||
hw_dev->unite = ISP_UNITE_TWO;
|
||||
} else if (device_property_read_bool(dev, "rockchip,unite-en")) {
|
||||
hw_dev->unite = ISP_UNITE_ONE;
|
||||
hw_dev->base_next_addr = hw_dev->base_addr;
|
||||
} else {
|
||||
hw_dev->unite = ISP_UNITE_NONE;
|
||||
}
|
||||
|
||||
memset(&hw_dev->max_in, 0, sizeof(hw_dev->max_in));
|
||||
if (!of_property_read_u32_array(node, "max-input", &hw_dev->max_in.w, 3)) {
|
||||
hw_dev->max_in.is_fix = true;
|
||||
if (hw_dev->unite) {
|
||||
hw_dev->max_in.w /= 2;
|
||||
hw_dev->max_in.w += RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
}
|
||||
}
|
||||
dev_info(dev, "max input:%dx%d@%dfps\n",
|
||||
hw_dev->max_in.w, hw_dev->max_in.h, hw_dev->max_in.fps);
|
||||
|
||||
rkisp_monitor = device_property_read_bool(dev, "rockchip,restart-monitor-en");
|
||||
hw_dev->mipi_irq = -1;
|
||||
|
||||
@@ -967,10 +981,8 @@ static int rkisp_hw_probe(struct platform_device *pdev)
|
||||
hw_dev->dev_link_num = 0;
|
||||
hw_dev->cur_dev_id = 0;
|
||||
hw_dev->mipi_dev_id = 0;
|
||||
hw_dev->pre_dev_id = 0;
|
||||
hw_dev->pre_dev_id = -1;
|
||||
hw_dev->is_multi_overflow = false;
|
||||
hw_dev->isp_ver = match_data->isp_ver;
|
||||
hw_dev->is_unite = match_data->unite;
|
||||
mutex_init(&hw_dev->dev_lock);
|
||||
spin_lock_init(&hw_dev->rdbk_lock);
|
||||
atomic_set(&hw_dev->refcnt, 0);
|
||||
@@ -1020,7 +1032,7 @@ static void rkisp_hw_shutdown(struct platform_device *pdev)
|
||||
hw_dev->is_shutdown = true;
|
||||
if (pm_runtime_active(&pdev->dev)) {
|
||||
writel(0xffff, hw_dev->base_addr + CIF_IRCL);
|
||||
if (hw_dev->is_unite)
|
||||
if (hw_dev->unite == ISP_UNITE_TWO)
|
||||
writel(0xffff, hw_dev->base_next_addr + CIF_IRCL);
|
||||
}
|
||||
dev_info(&pdev->dev, "%s\n", __func__);
|
||||
@@ -1060,7 +1072,7 @@ void rkisp_hw_enum_isp_size(struct rkisp_hw_dev *hw_dev)
|
||||
hw_dev->is_single = false;
|
||||
w = isp->isp_sdev.in_crop.width;
|
||||
h = isp->isp_sdev.in_crop.height;
|
||||
if (hw_dev->is_unite)
|
||||
if (hw_dev->unite)
|
||||
w = w / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
hw_dev->isp_size[i].w = w;
|
||||
hw_dev->isp_size[i].h = h;
|
||||
@@ -1072,6 +1084,8 @@ void rkisp_hw_enum_isp_size(struct rkisp_hw_dev *hw_dev)
|
||||
hw_dev->max_in.h = h;
|
||||
}
|
||||
}
|
||||
if (hw_dev->unite == ISP_UNITE_ONE)
|
||||
hw_dev->is_single = false;
|
||||
for (i = 0; i < hw_dev->dev_num; i++) {
|
||||
isp = hw_dev->isp[i];
|
||||
if (!isp || (isp && !isp->is_hw_link))
|
||||
@@ -1085,7 +1099,7 @@ static int __maybe_unused rkisp_runtime_resume(struct device *dev)
|
||||
struct rkisp_hw_dev *hw_dev = dev_get_drvdata(dev);
|
||||
void __iomem *base = hw_dev->base_addr;
|
||||
struct rkisp_device *isp;
|
||||
int mult = hw_dev->is_unite ? 2 : 1;
|
||||
int mult = hw_dev->unite ? 2 : 1;
|
||||
int ret, i;
|
||||
void *buf;
|
||||
|
||||
@@ -1101,7 +1115,7 @@ static int __maybe_unused rkisp_runtime_resume(struct device *dev)
|
||||
buf = isp->sw_base_addr;
|
||||
memset(buf, 0, RKISP_ISP_SW_MAX_SIZE * mult);
|
||||
memcpy_fromio(buf, base, RKISP_ISP_SW_REG_SIZE);
|
||||
if (hw_dev->is_unite) {
|
||||
if (hw_dev->unite) {
|
||||
buf += RKISP_ISP_SW_MAX_SIZE;
|
||||
base = hw_dev->base_next_addr;
|
||||
memcpy_fromio(buf, base, RKISP_ISP_SW_REG_SIZE);
|
||||
|
||||
@@ -89,6 +89,7 @@ struct rkisp_hw_dev {
|
||||
struct rkisp_monitor monitor;
|
||||
u64 iq_feature;
|
||||
int buf_init_cnt;
|
||||
u32 unite;
|
||||
bool is_feature_on;
|
||||
bool is_dma_contig;
|
||||
bool is_dma_sg_ops;
|
||||
@@ -99,7 +100,6 @@ struct rkisp_hw_dev {
|
||||
bool is_thunderboot;
|
||||
bool is_buf_init;
|
||||
bool is_shutdown;
|
||||
bool is_unite;
|
||||
bool is_multi_overflow;
|
||||
bool is_runing;
|
||||
bool is_frm_buf;
|
||||
|
||||
@@ -146,11 +146,12 @@ static void rkisp_params_vb2_buf_queue(struct vb2_buffer *vb)
|
||||
struct rkisp_buffer *params_buf = to_rkisp_buffer(vbuf);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv;
|
||||
struct rkisp_device *dev = params_vdev->dev;
|
||||
void *first_param;
|
||||
unsigned long flags;
|
||||
unsigned int cur_frame_id = -1;
|
||||
|
||||
cur_frame_id = atomic_read(¶ms_vdev->dev->isp_sdev.frm_sync_seq) - 1;
|
||||
cur_frame_id = atomic_read(&dev->isp_sdev.frm_sync_seq) - 1;
|
||||
if (params_vdev->first_params) {
|
||||
first_param = vb2_plane_vaddr(vb, 0);
|
||||
params_vdev->ops->save_first_param(params_vdev, first_param);
|
||||
@@ -159,16 +160,22 @@ static void rkisp_params_vb2_buf_queue(struct vb2_buffer *vb)
|
||||
vb2_buffer_done(¶ms_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
params_vdev->first_params = false;
|
||||
wake_up(¶ms_vdev->dev->sync_onoff);
|
||||
if (params_vdev->dev->is_first_double) {
|
||||
dev_info(params_vdev->dev->dev, "first params for fast\n");
|
||||
params_vdev->dev->is_first_double = false;
|
||||
rkisp_trigger_read_back(params_vdev->dev, false, false, false);
|
||||
if (dev->is_first_double) {
|
||||
dev_info(dev->dev, "first params for fast\n");
|
||||
dev->is_first_double = false;
|
||||
dev->sw_rd_cnt = 0;
|
||||
if (dev->hw_dev->unite == ISP_UNITE_ONE) {
|
||||
dev->unite_index = ISP_UNITE_LEFT;
|
||||
dev->sw_rd_cnt += dev->hw_dev->is_multi_overflow ? 3 : 1;
|
||||
}
|
||||
params_vdev->rdbk_times = dev->sw_rd_cnt + 1;
|
||||
rkisp_trigger_read_back(dev, false, false, false);
|
||||
}
|
||||
dev_info(params_vdev->dev->dev, "first params buf queue\n");
|
||||
dev_info(dev->dev, "first params buf queue\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params_vdev->dev->procfs.mode &
|
||||
if (dev->procfs.mode &
|
||||
(RKISP_PROCFS_FIL_AIQ | RKISP_PROCFS_FIL_SW)) {
|
||||
vb2_buffer_done(¶ms_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
return;
|
||||
@@ -208,9 +215,7 @@ static void rkisp_params_vb2_stop_streaming(struct vb2_queue *vq)
|
||||
break;
|
||||
}
|
||||
|
||||
if (buf)
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
buf = NULL;
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
if (params_vdev->cur_buf) {
|
||||
@@ -406,8 +411,7 @@ void rkisp_params_first_cfg(struct rkisp_isp_params_vdev *params_vdev,
|
||||
stream->out_isp_fmt.fmt_type == FMT_RGB)
|
||||
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask,
|
||||
quantization == V4L2_QUANTIZATION_FULL_RANGE ?
|
||||
mask : 0,
|
||||
false, dev->hw_dev->is_unite);
|
||||
mask : 0, false);
|
||||
dev->isp_sdev.quantization = quantization;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,169 +29,171 @@
|
||||
struct rkisp_isp_params_vdev;
|
||||
struct rkisp_isp_params_ops_v32 {
|
||||
void (*dpcc_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_dpcc_cfg *arg);
|
||||
const struct isp2x_dpcc_cfg *arg, u32 id);
|
||||
void (*dpcc_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*bls_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_bls_cfg *arg);
|
||||
const struct isp32_bls_cfg *arg, u32 id);
|
||||
void (*bls_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*sdg_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_sdg_cfg *arg);
|
||||
const struct isp2x_sdg_cfg *arg, u32 id);
|
||||
void (*sdg_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*lsc_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp3x_lsc_cfg *arg);
|
||||
const struct isp3x_lsc_cfg *arg, u32 id);
|
||||
void (*lsc_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*awbgain_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_awb_gain_cfg *arg);
|
||||
const struct isp32_awb_gain_cfg *arg, u32 id);
|
||||
void (*awbgain_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*debayer_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_debayer_cfg *arg);
|
||||
const struct isp32_debayer_cfg *arg, u32 id);
|
||||
void (*debayer_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*ccm_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_ccm_cfg *arg);
|
||||
const struct isp32_ccm_cfg *arg, u32 id);
|
||||
void (*ccm_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*goc_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp3x_gammaout_cfg *arg);
|
||||
const struct isp3x_gammaout_cfg *arg, u32 id);
|
||||
void (*goc_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*cproc_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_cproc_cfg *arg);
|
||||
const struct isp2x_cproc_cfg *arg, u32 id);
|
||||
void (*cproc_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*ie_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_ie_cfg *arg);
|
||||
const struct isp2x_ie_cfg *arg, u32 id);
|
||||
void (*ie_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawaf_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_rawaf_meas_cfg *arg);
|
||||
const struct isp32_rawaf_meas_cfg *arg, u32 id);
|
||||
void (*rawaf_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawae0_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawaelite_meas_cfg *arg);
|
||||
const struct isp2x_rawaelite_meas_cfg *arg, u32 id);
|
||||
void (*rawae0_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawae1_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawaebig_meas_cfg *arg);
|
||||
const struct isp2x_rawaebig_meas_cfg *arg, u32 id);
|
||||
void (*rawae1_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawae2_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawaebig_meas_cfg *arg);
|
||||
const struct isp2x_rawaebig_meas_cfg *arg, u32 id);
|
||||
void (*rawae2_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawae3_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawaebig_meas_cfg *arg);
|
||||
const struct isp2x_rawaebig_meas_cfg *arg, u32 id);
|
||||
void (*rawae3_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawawb_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_rawawb_meas_cfg *arg);
|
||||
const struct isp32_rawawb_meas_cfg *arg, u32 id);
|
||||
void (*rawawb_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawhst0_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawhistlite_cfg *arg);
|
||||
const struct isp2x_rawhistlite_cfg *arg, u32 id);
|
||||
void (*rawhst0_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawhst1_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawhistbig_cfg *arg);
|
||||
const struct isp2x_rawhistbig_cfg *arg, u32 id);
|
||||
void (*rawhst1_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawhst2_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawhistbig_cfg *arg);
|
||||
const struct isp2x_rawhistbig_cfg *arg, u32 id);
|
||||
void (*rawhst2_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*rawhst3_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_rawhistbig_cfg *arg);
|
||||
const struct isp2x_rawhistbig_cfg *arg, u32 id);
|
||||
void (*rawhst3_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*hdrdrc_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_drc_cfg *arg,
|
||||
enum rkisp_params_type type);
|
||||
enum rkisp_params_type type, u32 id);
|
||||
void (*hdrdrc_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*hdrmge_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_hdrmge_cfg *arg,
|
||||
enum rkisp_params_type type);
|
||||
enum rkisp_params_type type, u32 id);
|
||||
void (*hdrmge_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*gic_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp21_gic_cfg *arg);
|
||||
const struct isp21_gic_cfg *arg, u32 id);
|
||||
void (*gic_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*dhaz_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_dhaz_cfg *arg);
|
||||
const struct isp32_dhaz_cfg *arg, u32 id);
|
||||
void (*dhaz_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*isp3dlut_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp2x_3dlut_cfg *arg);
|
||||
const struct isp2x_3dlut_cfg *arg, u32 id);
|
||||
void (*isp3dlut_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*ldch_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_ldch_cfg *arg);
|
||||
const struct isp32_ldch_cfg *arg, u32 id);
|
||||
void (*ldch_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*ynr_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_ynr_cfg *arg);
|
||||
const struct isp32_ynr_cfg *arg, u32 id);
|
||||
void (*ynr_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*cnr_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_cnr_cfg *arg);
|
||||
const struct isp32_cnr_cfg *arg, u32 id);
|
||||
void (*cnr_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*sharp_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_sharp_cfg *arg);
|
||||
const struct isp32_sharp_cfg *arg, u32 id);
|
||||
void (*sharp_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*baynr_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_baynr_cfg *arg);
|
||||
const struct isp32_baynr_cfg *arg, u32 id);
|
||||
void (*baynr_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*bay3d_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_bay3d_cfg *arg);
|
||||
const struct isp32_bay3d_cfg *arg, u32 id);
|
||||
void (*bay3d_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*gain_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp3x_gain_cfg *arg);
|
||||
const struct isp3x_gain_cfg *arg, u32 id);
|
||||
void (*gain_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*cac_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_cac_cfg *arg);
|
||||
const struct isp32_cac_cfg *arg, u32 id);
|
||||
void (*cac_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
void (*csm_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp21_csm_cfg *arg);
|
||||
const struct isp21_csm_cfg *arg, u32 id);
|
||||
void (*cgc_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp21_cgc_cfg *arg);
|
||||
const struct isp21_cgc_cfg *arg, u32 id);
|
||||
void (*vsm_config)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
const struct isp32_vsm_cfg *arg);
|
||||
const struct isp32_vsm_cfg *arg, u32 id);
|
||||
void (*vsm_enable)(struct rkisp_isp_params_vdev *params_vdev,
|
||||
bool en);
|
||||
bool en, u32 id);
|
||||
};
|
||||
|
||||
struct rkisp_isp_params_val_v32 {
|
||||
struct tasklet_struct lsc_tasklet;
|
||||
|
||||
struct rkisp_dummy_buffer buf_3dlut[ISP32_3DLUT_BUF_NUM];
|
||||
u32 buf_3dlut_idx;
|
||||
struct rkisp_dummy_buffer buf_3dlut[ISP3_UNITE_MAX][ISP32_3DLUT_BUF_NUM];
|
||||
u32 buf_3dlut_idx[ISP3_UNITE_MAX];
|
||||
|
||||
struct rkisp_dummy_buffer buf_ldch[ISP3_UNITE_MAX][ISP3X_MESH_BUF_NUM];
|
||||
u32 buf_ldch_idx[ISP3_UNITE_MAX];
|
||||
|
||||
struct rkisp_dummy_buffer buf_cac[ISP3_UNITE_MAX][ISP3X_MESH_BUF_NUM];
|
||||
u32 buf_cac_idx[ISP3_UNITE_MAX];
|
||||
|
||||
struct rkisp_dummy_buffer buf_lsclut[ISP32_LSC_LUT_BUF_NUM];
|
||||
u32 buf_lsclut_idx;
|
||||
|
||||
struct rkisp_dummy_buffer buf_ldch[ISP3X_MESH_BUF_NUM];
|
||||
u32 buf_ldch_idx;
|
||||
|
||||
struct rkisp_dummy_buffer buf_cac[ISP3X_MESH_BUF_NUM];
|
||||
u32 buf_cac_idx;
|
||||
|
||||
struct rkisp_dummy_buffer buf_info[RKISP_INFO2DDR_BUF_MAX];
|
||||
u32 buf_info_owner;
|
||||
u32 buf_info_cnt;
|
||||
int buf_info_idx;
|
||||
|
||||
u32 bay3d_ds_size;
|
||||
u32 bay3d_iir_size;
|
||||
u32 bay3d_cur_size;
|
||||
u32 bay3d_cur_wsize;
|
||||
u32 bay3d_cur_wrap_line;
|
||||
|
||||
@@ -591,7 +591,7 @@ isp_lsc_cfg_sram_task(unsigned long data)
|
||||
struct isp3x_isp_params_cfg *params = params_vdev->isp3x_params;
|
||||
|
||||
isp_lsc_matrix_cfg_sram(params_vdev, ¶ms->others.lsc_cfg, true, 0);
|
||||
if (params_vdev->dev->hw_dev->is_unite) {
|
||||
if (params_vdev->dev->hw_dev->unite) {
|
||||
params++;
|
||||
isp_lsc_matrix_cfg_sram(params_vdev, ¶ms->others.lsc_cfg, true, 1);
|
||||
}
|
||||
@@ -1223,7 +1223,7 @@ isp_rawaelite_config(struct rkisp_isp_params_vdev *params_vdev,
|
||||
|
||||
block_hsize = arg->win.h_size / ae_wnd_num[wnd_num_idx];
|
||||
value = block_hsize * ae_wnd_num[wnd_num_idx] + arg->win.h_offs;
|
||||
if (ispdev->hw_dev->is_unite)
|
||||
if (ispdev->hw_dev->unite)
|
||||
width = width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
if (value + 1 > width)
|
||||
block_hsize -= 1;
|
||||
@@ -1310,7 +1310,7 @@ isp_rawaebig_config(struct rkisp_isp_params_vdev *params_vdev,
|
||||
|
||||
block_hsize = arg->win.h_size / ae_wnd_num[wnd_num_idx];
|
||||
value = block_hsize * ae_wnd_num[wnd_num_idx] + arg->win.h_offs;
|
||||
if (ispdev->hw_dev->is_unite)
|
||||
if (ispdev->hw_dev->unite)
|
||||
width = width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
if (value + 1 > width)
|
||||
block_hsize -= 1;
|
||||
@@ -2887,7 +2887,7 @@ isp_dhaz_config(struct rkisp_isp_params_vdev *params_vdev,
|
||||
value = ISP_PACK_2SHORT(arg->sigma_lut[i * 2], 0);
|
||||
isp3_param_write(params_vdev, value, ISP3X_DHAZ_GAIN_LUT0 + i * 4, id);
|
||||
|
||||
if (dev->hw_dev->is_unite &&
|
||||
if (dev->hw_dev->unite &&
|
||||
dev->hw_dev->is_single &&
|
||||
ctrl & ISP3X_DHAZ_ENMUX)
|
||||
ctrl |= ISP3X_SELF_FORCE_UPD;
|
||||
@@ -4105,7 +4105,7 @@ void rkisp_params_cfgsram_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
isp_rawhstbig_cfg_sram(params_vdev, ¶ms->meas.rawhist2, 2, true, 0);
|
||||
isp_rawhstbig_cfg_sram(params_vdev, ¶ms->meas.rawhist3, 0, true, 0);
|
||||
isp_rawawb_cfg_sram(params_vdev, ¶ms->meas.rawawb, true, 0);
|
||||
if (params_vdev->dev->hw_dev->is_unite) {
|
||||
if (params_vdev->dev->hw_dev->unite) {
|
||||
params++;
|
||||
isp_lsc_matrix_cfg_sram(params_vdev, ¶ms->others.lsc_cfg, true, 1);
|
||||
isp_rawhstbig_cfg_sram(params_vdev, ¶ms->meas.rawhist1, 1, true, 1);
|
||||
@@ -4129,7 +4129,7 @@ rkisp_alloc_internal_buf(struct rkisp_isp_params_vdev *params_vdev,
|
||||
module_en_update = new_params->module_en_update;
|
||||
module_ens = new_params->module_ens;
|
||||
|
||||
for (id = 0; id <= ispdev->hw_dev->is_unite; id++) {
|
||||
for (id = 0; id <= !!ispdev->hw_dev->unite; id++) {
|
||||
priv_val->buf_3dlut_idx[id] = 0;
|
||||
for (i = 0; i < ISP3X_3DLUT_BUF_NUM; i++) {
|
||||
priv_val->buf_3dlut[id][i].is_need_vaddr = true;
|
||||
@@ -4146,10 +4146,10 @@ rkisp_alloc_internal_buf(struct rkisp_isp_params_vdev *params_vdev,
|
||||
(module_ens & ISP3X_MODULE_BAY3D)) {
|
||||
w = ALIGN(isp_sdev->in_crop.width, 16);
|
||||
h = ALIGN(isp_sdev->in_crop.height, 16);
|
||||
if (ispdev->hw_dev->is_unite)
|
||||
if (ispdev->hw_dev->unite)
|
||||
w = ALIGN(isp_sdev->in_crop.width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL, 16);
|
||||
|
||||
for (id = 0; id <= ispdev->hw_dev->is_unite; id++) {
|
||||
for (id = 0; id <= !!ispdev->hw_dev->unite; id++) {
|
||||
size = ALIGN((w + w / 8) * h * 2, 16);
|
||||
|
||||
priv_val->buf_3dnr_iir[id].size = size;
|
||||
@@ -4185,7 +4185,7 @@ err_3dnr:
|
||||
rkisp_free_buffer(ispdev, &priv_val->buf_3dnr_cur[id]);
|
||||
rkisp_free_buffer(ispdev, &priv_val->buf_3dnr_ds[id]);
|
||||
}
|
||||
id = ispdev->hw_dev->is_unite ? 1 : 0;
|
||||
id = ispdev->hw_dev->unite ? 1 : 0;
|
||||
i = ISP3X_3DLUT_BUF_NUM;
|
||||
err_3dlut:
|
||||
for (; id >= 0; id--) {
|
||||
@@ -4240,7 +4240,7 @@ multi_overflow:
|
||||
continue;
|
||||
dev_warn(dev, "isp%d %dx%d over four vir isp max:%dx1536\n",
|
||||
i, hw->isp_size[i].w, hw->isp_size[i].h,
|
||||
hw->is_unite ? (2560 - RKMOUDLE_UNITE_EXTEND_PIXEL) * 2 : 2560);
|
||||
hw->unite ? (2560 - RKMOUDLE_UNITE_EXTEND_PIXEL) * 2 : 2560);
|
||||
hw->is_multi_overflow = true;
|
||||
goto multi_overflow;
|
||||
}
|
||||
@@ -4282,7 +4282,7 @@ multi_overflow:
|
||||
(hw->isp_size[idx1[0]].size > ISP3X_VIR2_MAX_SIZE)) {
|
||||
dev_warn(dev, "isp%d %dx%d over three vir isp max:%dx1536\n",
|
||||
idx1[0], hw->isp_size[idx1[0]].w, hw->isp_size[idx1[0]].h,
|
||||
hw->is_unite ? (2560 - RKMOUDLE_UNITE_EXTEND_PIXEL) * 2 : 2560);
|
||||
hw->unite ? (2560 - RKMOUDLE_UNITE_EXTEND_PIXEL) * 2 : 2560);
|
||||
hw->is_multi_overflow = true;
|
||||
goto multi_overflow;
|
||||
} else {
|
||||
@@ -4341,7 +4341,7 @@ multi_overflow:
|
||||
hw->isp_size[idx1[k - 1]].size > (ISP3X_VIR4_MAX_SIZE + ISP3X_VIR2_MAX_SIZE)) {
|
||||
dev_warn(dev, "isp%d %dx%d over two vir isp max:%dx2160\n",
|
||||
idx1[k - 1], hw->isp_size[idx1[k - 1]].w, hw->isp_size[idx1[k - 1]].h,
|
||||
hw->is_unite ? (3840 - RKMOUDLE_UNITE_EXTEND_PIXEL) * 2 : 3840);
|
||||
hw->unite ? (3840 - RKMOUDLE_UNITE_EXTEND_PIXEL) * 2 : 3840);
|
||||
hw->is_multi_overflow = true;
|
||||
goto multi_overflow;
|
||||
} else {
|
||||
@@ -4363,7 +4363,7 @@ multi_overflow:
|
||||
ispdev->multi_mode = 0;
|
||||
ispdev->multi_index = 0;
|
||||
width = crop->width;
|
||||
if (hw->is_unite)
|
||||
if (hw->unite)
|
||||
width = width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
height = crop->height;
|
||||
size = width * height;
|
||||
@@ -4400,7 +4400,7 @@ rkisp_params_first_cfg_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
priv_val->lsc_en = 0;
|
||||
priv_val->mge_en = 0;
|
||||
priv_val->lut3d_en = 0;
|
||||
if (hw->is_unite) {
|
||||
if (hw->unite) {
|
||||
if (dev->is_bigmode)
|
||||
rkisp_next_set_bits(params_vdev->dev, ISP3X_ISP_CTRL1, 0,
|
||||
ISP3X_BIGMODE_MANUAL | ISP3X_BIGMODE_FORCE_EN, false);
|
||||
@@ -4431,7 +4431,7 @@ static void rkisp_save_first_param_v3x(struct rkisp_isp_params_vdev *params_vdev
|
||||
|
||||
static void rkisp_clear_first_param_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
{
|
||||
u32 mult = params_vdev->dev->hw_dev->is_unite ? ISP3_UNITE_MAX : 1;
|
||||
u32 mult = params_vdev->dev->hw_dev->unite ? ISP3_UNITE_MAX : 1;
|
||||
u32 size = sizeof(struct isp3x_isp_params_cfg) * mult;
|
||||
|
||||
memset(params_vdev->isp3x_params, 0, size);
|
||||
@@ -4530,7 +4530,7 @@ static void
|
||||
rkisp_get_param_size_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
unsigned int sizes[])
|
||||
{
|
||||
u32 mult = params_vdev->dev->hw_dev->is_unite ? ISP3_UNITE_MAX : 1;
|
||||
u32 mult = params_vdev->dev->hw_dev->unite ? ISP3_UNITE_MAX : 1;
|
||||
|
||||
sizes[0] = sizeof(struct isp3x_isp_params_cfg) * mult;
|
||||
}
|
||||
@@ -4575,7 +4575,7 @@ rkisp_params_set_meshbuf_size_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
{
|
||||
struct rkisp_meshbuf_size *meshsize = size;
|
||||
|
||||
if (!params_vdev->dev->hw_dev->is_unite)
|
||||
if (!params_vdev->dev->hw_dev->unite)
|
||||
meshsize->unite_isp_id = 0;
|
||||
rkisp_deinit_mesh_buf(params_vdev, meshsize->module_id, meshsize->unite_isp_id);
|
||||
return rkisp_init_mesh_buf(params_vdev, meshsize);
|
||||
@@ -4587,7 +4587,7 @@ rkisp_params_free_meshbuf_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
{
|
||||
int id;
|
||||
|
||||
for (id = 0; id <= params_vdev->dev->hw_dev->is_unite; id++)
|
||||
for (id = 0; id <= !!params_vdev->dev->hw_dev->unite; id++)
|
||||
rkisp_deinit_mesh_buf(params_vdev, module_id, id);
|
||||
}
|
||||
|
||||
@@ -4600,7 +4600,7 @@ rkisp_params_stream_stop_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
|
||||
priv_val = (struct rkisp_isp_params_val_v3x *)params_vdev->priv_val;
|
||||
tasklet_disable(&priv_val->lsc_tasklet);
|
||||
for (id = 0; id <= ispdev->hw_dev->is_unite; id++) {
|
||||
for (id = 0; id <= !!ispdev->hw_dev->unite; id++) {
|
||||
rkisp_free_buffer(ispdev, &priv_val->buf_3dnr_iir[id]);
|
||||
rkisp_free_buffer(ispdev, &priv_val->buf_3dnr_cur[id]);
|
||||
rkisp_free_buffer(ispdev, &priv_val->buf_3dnr_ds[id]);
|
||||
@@ -4616,7 +4616,7 @@ rkisp_params_fop_release_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
{
|
||||
int id;
|
||||
|
||||
for (id = 0; id <= params_vdev->dev->hw_dev->is_unite; id++) {
|
||||
for (id = 0; id <= !!params_vdev->dev->hw_dev->unite; id++) {
|
||||
rkisp_deinit_mesh_buf(params_vdev, ISP3X_MODULE_LDCH, id);
|
||||
rkisp_deinit_mesh_buf(params_vdev, ISP3X_MODULE_CAC, id);
|
||||
}
|
||||
@@ -4631,7 +4631,7 @@ rkisp_params_disable_isp_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
|
||||
__isp_isr_other_en(params_vdev, params_vdev->isp3x_params, RKISP_PARAMS_ALL, 0);
|
||||
__isp_isr_meas_en(params_vdev, params_vdev->isp3x_params, RKISP_PARAMS_ALL, 0);
|
||||
if (params_vdev->dev->hw_dev->is_unite) {
|
||||
if (params_vdev->dev->hw_dev->unite) {
|
||||
__isp_isr_other_en(params_vdev, params_vdev->isp3x_params, RKISP_PARAMS_ALL, 1);
|
||||
__isp_isr_meas_en(params_vdev, params_vdev->isp3x_params, RKISP_PARAMS_ALL, 1);
|
||||
}
|
||||
@@ -4704,7 +4704,7 @@ rkisp_params_cfg_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
__isp_isr_other_en(params_vdev, new_params, type, 0);
|
||||
__isp_isr_meas_en(params_vdev, new_params, type, 0);
|
||||
new_params->module_cfg_update = 0;
|
||||
if (hw_dev->is_unite) {
|
||||
if (hw_dev->unite) {
|
||||
struct isp3x_isp_params_cfg *params = new_params + 1;
|
||||
|
||||
__isp_isr_meas_config(params_vdev, params, type, 1);
|
||||
@@ -4717,7 +4717,7 @@ rkisp_params_cfg_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
if (new_params->module_cfg_update &
|
||||
(ISP3X_MODULE_LDCH | ISP3X_MODULE_CAC)) {
|
||||
module_data_abandon(params_vdev, new_params, 0);
|
||||
if (hw_dev->is_unite)
|
||||
if (hw_dev->unite)
|
||||
module_data_abandon(params_vdev, new_params, 1);
|
||||
}
|
||||
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
@@ -4735,7 +4735,7 @@ rkisp_params_cfg_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
goto unlock;
|
||||
|
||||
new_params = (struct isp3x_isp_params_cfg *)(cur_buf->vaddr[0]);
|
||||
if (hw_dev->is_unite) {
|
||||
if (hw_dev->unite) {
|
||||
__isp_isr_meas_config(params_vdev, new_params + 1, type, 1);
|
||||
__isp_isr_other_config(params_vdev, new_params + 1, type, 1);
|
||||
__isp_isr_other_en(params_vdev, new_params + 1, type, 1);
|
||||
@@ -4748,7 +4748,7 @@ rkisp_params_cfg_v3x(struct rkisp_isp_params_vdev *params_vdev,
|
||||
|
||||
if (type != RKISP_PARAMS_IMD) {
|
||||
new_params->module_cfg_update = 0;
|
||||
if (hw_dev->is_unite)
|
||||
if (hw_dev->unite)
|
||||
(new_params++)->module_cfg_update = 0;
|
||||
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
cur_buf = NULL;
|
||||
@@ -4782,7 +4782,7 @@ rkisp_params_clear_fstflg(struct rkisp_isp_params_vdev *params_vdev)
|
||||
if (value & ISP3X_RAW3D_FST_FRAME)
|
||||
rkisp_clear_bits(params_vdev->dev, ISP3X_ISP_CTRL1,
|
||||
ISP3X_RAW3D_FST_FRAME, false);
|
||||
if (hw_dev->is_unite) {
|
||||
if (hw_dev->unite) {
|
||||
value = rkisp_next_read(dev, ISP3X_ISP_CTRL1, false);
|
||||
if (value & ISP3X_YNR_FST_FRAME)
|
||||
rkisp_next_clear_bits(params_vdev->dev, ISP3X_ISP_CTRL1,
|
||||
@@ -4857,7 +4857,7 @@ int rkisp_init_params_vdev_v3x(struct rkisp_isp_params_vdev *params_vdev)
|
||||
return -ENOMEM;
|
||||
|
||||
size = sizeof(struct isp3x_isp_params_cfg);
|
||||
if (ispdev->hw_dev->is_unite)
|
||||
if (ispdev->hw_dev->unite)
|
||||
size *= 2;
|
||||
params_vdev->isp3x_params = vmalloc(size);
|
||||
if (!params_vdev->isp3x_params) {
|
||||
|
||||
@@ -428,6 +428,8 @@ rkisp_stats_update_buf(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
struct rkisp_device *dev = stats_vdev->dev;
|
||||
struct rkisp_buffer *buf;
|
||||
unsigned long flags;
|
||||
u32 size = stats_vdev->vdev_fmt.fmt.meta.buffersize;
|
||||
u32 val = 0;
|
||||
|
||||
spin_lock_irqsave(&stats_vdev->rd_lock, flags);
|
||||
if (!stats_vdev->nxt_buf && !list_empty(&stats_vdev->stat)) {
|
||||
@@ -439,18 +441,23 @@ rkisp_stats_update_buf(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
spin_unlock_irqrestore(&stats_vdev->rd_lock, flags);
|
||||
|
||||
if (stats_vdev->nxt_buf) {
|
||||
rkisp_write(dev, ISP3X_MI_3A_WR_BASE, stats_vdev->nxt_buf->buff_addr[0], false);
|
||||
val = stats_vdev->nxt_buf->buff_addr[0];
|
||||
v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev,
|
||||
"%s BASE:0x%x SHD:0x%x\n",
|
||||
__func__, stats_vdev->nxt_buf->buff_addr[0],
|
||||
__func__, val,
|
||||
isp3_stats_read(stats_vdev, ISP3X_MI_3A_WR_BASE));
|
||||
if (!dev->hw_dev->is_single) {
|
||||
stats_vdev->cur_buf = stats_vdev->nxt_buf;
|
||||
stats_vdev->nxt_buf = NULL;
|
||||
}
|
||||
} else if (stats_vdev->stats_buf[0].mem_priv) {
|
||||
rkisp_write(dev, ISP3X_MI_3A_WR_BASE,
|
||||
stats_vdev->stats_buf[0].dma_addr, false);
|
||||
val = stats_vdev->stats_buf[0].dma_addr;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
rkisp_write(dev, ISP3X_MI_3A_WR_BASE, val, false);
|
||||
if (dev->hw_dev->unite)
|
||||
rkisp_next_write(dev, ISP3X_MI_3A_WR_BASE, val + size / 2, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,14 +540,15 @@ static void
|
||||
rkisp_stats_send_meas(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
struct rkisp_isp_readout_work *meas_work)
|
||||
{
|
||||
unsigned int cur_frame_id = -1;
|
||||
struct rkisp_device *dev = stats_vdev->dev;
|
||||
struct rkisp_hw_dev *hw = dev->hw_dev;
|
||||
struct rkisp_isp_params_vdev *params_vdev = &dev->params_vdev;
|
||||
struct rkisp_buffer *cur_buf = stats_vdev->cur_buf;
|
||||
struct rkisp32_isp_stat_buffer *cur_stat_buf = NULL;
|
||||
struct rkisp_stats_ops_v32 *ops =
|
||||
(struct rkisp_stats_ops_v32 *)stats_vdev->priv_ops;
|
||||
struct rkisp_isp_params_vdev *params_vdev = &stats_vdev->dev->params_vdev;
|
||||
u32 size = sizeof(struct rkisp32_isp_stat_buffer);
|
||||
int ret = 0;
|
||||
u32 size = stats_vdev->vdev_fmt.fmt.meta.buffersize;
|
||||
u32 cur_frame_id = meas_work->frame_id;
|
||||
bool is_dummy = false;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -548,97 +556,107 @@ rkisp_stats_send_meas(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
if (!cur_buf && stats_vdev->stats_buf[0].mem_priv) {
|
||||
rkisp_finish_buffer(stats_vdev->dev, &stats_vdev->stats_buf[0]);
|
||||
cur_stat_buf = stats_vdev->stats_buf[0].vaddr;
|
||||
cur_stat_buf->frame_id = -1;
|
||||
cur_stat_buf->frame_id = cur_frame_id;
|
||||
cur_stat_buf->params_id = params_vdev->cur_frame_id;
|
||||
is_dummy = true;
|
||||
} else if (cur_buf) {
|
||||
cur_stat_buf = cur_buf->vaddr[0];
|
||||
cur_stat_buf->frame_id = cur_frame_id;
|
||||
cur_stat_buf->params_id = params_vdev->cur_frame_id;
|
||||
}
|
||||
/* config buf for next frame */
|
||||
stats_vdev->cur_buf = NULL;
|
||||
if (stats_vdev->nxt_buf) {
|
||||
stats_vdev->cur_buf = stats_vdev->nxt_buf;
|
||||
stats_vdev->nxt_buf = NULL;
|
||||
}
|
||||
rkisp_stats_update_buf(stats_vdev);
|
||||
|
||||
cur_frame_id = meas_work->frame_id;
|
||||
/* buffer done when frame of right handle */
|
||||
if (hw->unite == ISP_UNITE_ONE) {
|
||||
if (dev->unite_index == ISP_UNITE_LEFT) {
|
||||
cur_buf = NULL;
|
||||
is_dummy = false;
|
||||
} else if (cur_stat_buf) {
|
||||
cur_stat_buf = (void *)cur_stat_buf + size / 2;
|
||||
cur_stat_buf->frame_id = cur_frame_id;
|
||||
cur_stat_buf->params_id = params_vdev->cur_frame_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (hw->unite != ISP_UNITE_ONE || dev->unite_index == ISP_UNITE_RIGHT) {
|
||||
/* config buf for next frame */
|
||||
stats_vdev->cur_buf = NULL;
|
||||
if (stats_vdev->nxt_buf) {
|
||||
stats_vdev->cur_buf = stats_vdev->nxt_buf;
|
||||
stats_vdev->nxt_buf = NULL;
|
||||
}
|
||||
rkisp_stats_update_buf(stats_vdev);
|
||||
}
|
||||
} else {
|
||||
cur_buf = NULL;
|
||||
}
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAWB)
|
||||
ret |= ops->get_rawawb_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawawb_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAF ||
|
||||
stats_vdev->af_meas_done_next)
|
||||
ret |= ops->get_rawaf_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawaf_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_BIG ||
|
||||
stats_vdev->ae_meas_done_next)
|
||||
ret |= ops->get_rawae3_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawae3_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_BIG)
|
||||
ret |= ops->get_rawhst3_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawhst3_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH0)
|
||||
ret |= ops->get_rawae0_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawae0_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH1)
|
||||
ret |= ops->get_rawae1_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawae1_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH2)
|
||||
ret |= ops->get_rawae2_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawae2_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH0)
|
||||
ret |= ops->get_rawhst0_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawhst0_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH1)
|
||||
ret |= ops->get_rawhst1_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawhst1_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH2)
|
||||
ret |= ops->get_rawhst2_meas(stats_vdev, cur_stat_buf);
|
||||
ops->get_rawhst2_meas(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp_ris & ISP3X_FRAME) {
|
||||
ret |= ops->get_bls_stats(stats_vdev, cur_stat_buf);
|
||||
ret |= ops->get_dhaz_stats(stats_vdev, cur_stat_buf);
|
||||
ret |= ops->get_vsm_stats(stats_vdev, cur_stat_buf);
|
||||
ops->get_bls_stats(stats_vdev, cur_stat_buf);
|
||||
ops->get_dhaz_stats(stats_vdev, cur_stat_buf);
|
||||
ops->get_vsm_stats(stats_vdev, cur_stat_buf);
|
||||
}
|
||||
|
||||
if (ret || (cur_stat_buf && !cur_stat_buf->meas_type)) {
|
||||
if (is_dummy) {
|
||||
spin_lock_irqsave(&stats_vdev->rd_lock, flags);
|
||||
if (!list_empty(&stats_vdev->stat)) {
|
||||
cur_buf = list_first_entry(&stats_vdev->stat, struct rkisp_buffer, queue);
|
||||
list_del(&cur_buf->queue);
|
||||
}
|
||||
spin_unlock_irqrestore(&stats_vdev->rd_lock, flags);
|
||||
if (cur_buf) {
|
||||
spin_lock_irqsave(&stats_vdev->rd_lock, flags);
|
||||
list_add_tail(&cur_buf->queue, &stats_vdev->stat);
|
||||
spin_unlock_irqrestore(&stats_vdev->rd_lock, flags);
|
||||
}
|
||||
} else {
|
||||
if (is_dummy) {
|
||||
spin_lock_irqsave(&stats_vdev->rd_lock, flags);
|
||||
if (!list_empty(&stats_vdev->stat)) {
|
||||
cur_buf = list_first_entry(&stats_vdev->stat, struct rkisp_buffer, queue);
|
||||
list_del(&cur_buf->queue);
|
||||
} else {
|
||||
cur_stat_buf->frame_id = cur_frame_id;
|
||||
cur_stat_buf->params_id = params_vdev->cur_frame_id;
|
||||
}
|
||||
spin_unlock_irqrestore(&stats_vdev->rd_lock, flags);
|
||||
if (cur_buf) {
|
||||
memcpy(cur_buf->vaddr[0], cur_stat_buf, size);
|
||||
cur_stat_buf = cur_buf->vaddr[0];
|
||||
}
|
||||
}
|
||||
if (cur_buf && cur_stat_buf) {
|
||||
cur_stat_buf->frame_id = cur_frame_id;
|
||||
cur_stat_buf->params_id = params_vdev->cur_frame_id;
|
||||
cur_stat_buf->params.info2ddr.buf_fd = -1;
|
||||
cur_stat_buf->params.info2ddr.owner = 0;
|
||||
rkisp_stats_info2ddr(stats_vdev, cur_stat_buf);
|
||||
|
||||
vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size);
|
||||
cur_buf->vb.sequence = cur_frame_id;
|
||||
cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp;
|
||||
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
memcpy(cur_buf->vaddr[0], stats_vdev->stats_buf[0].vaddr, size);
|
||||
cur_stat_buf = cur_buf->vaddr[0];
|
||||
}
|
||||
}
|
||||
if (cur_buf && cur_stat_buf) {
|
||||
cur_stat_buf->frame_id = cur_frame_id;
|
||||
cur_stat_buf->params_id = params_vdev->cur_frame_id;
|
||||
cur_stat_buf->params.info2ddr.buf_fd = -1;
|
||||
cur_stat_buf->params.info2ddr.owner = 0;
|
||||
rkisp_stats_info2ddr(stats_vdev, cur_stat_buf);
|
||||
|
||||
vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size);
|
||||
cur_buf->vb.sequence = cur_frame_id;
|
||||
cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp;
|
||||
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
v4l2_dbg(4, rkisp_debug, &dev->v4l2_dev,
|
||||
"%s id:%d seq:%d params_id:%d ris:0x%x buf:%p meas_type:0x%x\n",
|
||||
__func__, dev->unite_index,
|
||||
cur_frame_id, params_vdev->cur_frame_id, meas_work->isp3a_ris,
|
||||
cur_buf, !cur_stat_buf ? 0 : cur_stat_buf->meas_type);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -890,12 +908,12 @@ static void
|
||||
rkisp_stats_send_meas_lite(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
struct rkisp_isp_readout_work *meas_work)
|
||||
{
|
||||
struct rkisp_isp_params_vdev *params_vdev = &stats_vdev->dev->params_vdev;
|
||||
struct rkisp_device *dev = stats_vdev->dev;
|
||||
struct rkisp_isp_params_vdev *params_vdev = &dev->params_vdev;
|
||||
unsigned int cur_frame_id = meas_work->frame_id;
|
||||
struct rkisp_buffer *cur_buf = NULL;
|
||||
struct rkisp32_lite_stat_buffer *cur_stat_buf = NULL;
|
||||
u32 size = sizeof(struct rkisp32_lite_stat_buffer);
|
||||
int ret = 0;
|
||||
|
||||
spin_lock(&stats_vdev->rd_lock);
|
||||
if (!list_empty(&stats_vdev->stat)) {
|
||||
@@ -913,45 +931,42 @@ rkisp_stats_send_meas_lite(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
}
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAWB)
|
||||
ret |= rkisp_stats_get_rawawb_meas_lite(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_rawawb_meas_lite(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAF ||
|
||||
stats_vdev->af_meas_done_next)
|
||||
ret |= rkisp_stats_get_rawaf_meas_lite(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_rawaf_meas_lite(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_BIG ||
|
||||
stats_vdev->ae_meas_done_next)
|
||||
ret |= rkisp_stats_get_rawae3_meas_lite(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_rawae3_meas_lite(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_BIG)
|
||||
ret |= rkisp_stats_get_rawhst3_meas_lite(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_rawhst3_meas_lite(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH0)
|
||||
ret |= rkisp_stats_get_rawaelite_meas_lite(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_rawaelite_meas_lite(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH0)
|
||||
ret |= rkisp_stats_get_rawhstlite_meas_lite(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_rawhstlite_meas_lite(stats_vdev, cur_stat_buf);
|
||||
|
||||
if (meas_work->isp_ris & ISP3X_FRAME) {
|
||||
ret |= rkisp_stats_get_bls_stats(stats_vdev, cur_stat_buf);
|
||||
ret |= rkisp_stats_get_dhaz_stats(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_bls_stats(stats_vdev, cur_stat_buf);
|
||||
rkisp_stats_get_dhaz_stats(stats_vdev, cur_stat_buf);
|
||||
}
|
||||
|
||||
if (cur_buf) {
|
||||
if (ret || !cur_stat_buf->meas_type) {
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&stats_vdev->rd_lock, flags);
|
||||
list_add_tail(&cur_buf->queue, &stats_vdev->stat);
|
||||
spin_unlock_irqrestore(&stats_vdev->rd_lock, flags);
|
||||
} else {
|
||||
rkisp_stats_info2ddr(stats_vdev, cur_stat_buf);
|
||||
vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size);
|
||||
cur_buf->vb.sequence = cur_frame_id;
|
||||
cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp;
|
||||
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
rkisp_stats_info2ddr(stats_vdev, cur_stat_buf);
|
||||
vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size);
|
||||
cur_buf->vb.sequence = cur_frame_id;
|
||||
cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp;
|
||||
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
||||
}
|
||||
v4l2_dbg(4, rkisp_debug, &dev->v4l2_dev,
|
||||
"%s seq:%d params_id:%d ris:0x%x buf:%p meas_type:0x%x\n",
|
||||
__func__,
|
||||
cur_frame_id, params_vdev->cur_frame_id, meas_work->isp_ris,
|
||||
cur_buf, !cur_stat_buf ? 0 : cur_stat_buf->meas_type);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1048,6 +1063,7 @@ void rkisp_stats_first_ddr_config_v32(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
{
|
||||
struct rkisp_device *dev = stats_vdev->dev;
|
||||
u32 size = stats_vdev->vdev_fmt.fmt.meta.buffersize;
|
||||
u32 div = dev->hw_dev->unite ? 2 : 1;
|
||||
|
||||
if (dev->isp_sdev.in_fmt.fmt_type == FMT_YUV)
|
||||
return;
|
||||
@@ -1059,8 +1075,8 @@ void rkisp_stats_first_ddr_config_v32(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
else
|
||||
memset(stats_vdev->stats_buf[0].vaddr, 0, size);
|
||||
rkisp_stats_update_buf(stats_vdev);
|
||||
rkisp_write(dev, ISP3X_MI_DBR_WR_SIZE, size, false);
|
||||
rkisp_set_bits(dev, ISP3X_SWS_CFG, 0, ISP3X_3A_DDR_WRITE_EN, false);
|
||||
rkisp_unite_write(dev, ISP3X_MI_DBR_WR_SIZE, size / div, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_SWS_CFG, 0, ISP3X_3A_DDR_WRITE_EN, false);
|
||||
if (stats_vdev->nxt_buf) {
|
||||
stats_vdev->cur_buf = stats_vdev->nxt_buf;
|
||||
stats_vdev->nxt_buf = NULL;
|
||||
@@ -1080,6 +1096,7 @@ void rkisp_stats_next_ddr_config_v32(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
|
||||
void rkisp_init_stats_vdev_v32(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
{
|
||||
int mult = stats_vdev->dev->hw_dev->unite ? 2 : 1;
|
||||
u32 size;
|
||||
|
||||
stats_vdev->vdev_fmt.fmt.meta.dataformat =
|
||||
@@ -1087,13 +1104,13 @@ void rkisp_init_stats_vdev_v32(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
if (stats_vdev->dev->isp_ver == ISP_V32) {
|
||||
stats_vdev->priv_ops = &stats_ddr_ops_v32;
|
||||
stats_vdev->rd_stats_from_ddr = true;
|
||||
size = sizeof(struct rkisp32_isp_stat_buffer);
|
||||
size = ALIGN(sizeof(struct rkisp32_isp_stat_buffer), 16);
|
||||
} else {
|
||||
stats_vdev->priv_ops = NULL;
|
||||
stats_vdev->rd_stats_from_ddr = false;
|
||||
size = sizeof(struct rkisp32_lite_stat_buffer);
|
||||
}
|
||||
stats_vdev->vdev_fmt.fmt.meta.buffersize = size;
|
||||
stats_vdev->vdev_fmt.fmt.meta.buffersize = size * mult;
|
||||
stats_vdev->ops = &rkisp_isp_stats_ops_tbl;
|
||||
}
|
||||
|
||||
|
||||
@@ -1038,7 +1038,7 @@ rkisp_stats_send_meas_v3x(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
ret |= ops->get_dhaz_stats(stats_vdev, cur_stat_buf, 0);
|
||||
}
|
||||
|
||||
if (stats_vdev->dev->hw_dev->is_unite) {
|
||||
if (stats_vdev->dev->hw_dev->unite) {
|
||||
size *= 2;
|
||||
if (cur_buf) {
|
||||
cur_stat_buf++;
|
||||
@@ -1086,7 +1086,7 @@ rkisp_stats_isr_v3x(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
{
|
||||
struct rkisp_device *dev = stats_vdev->dev;
|
||||
struct rkisp_hw_dev *hw = dev->hw_dev;
|
||||
void __iomem *base = !hw->is_unite ?
|
||||
void __iomem *base = hw->unite != ISP_UNITE_TWO ?
|
||||
hw->base_addr : hw->base_next_addr;
|
||||
struct rkisp_isp_readout_work work;
|
||||
u32 iq_isr_mask = ISP3X_SIAWB_DONE | ISP3X_SIAF_FIN |
|
||||
@@ -1138,7 +1138,7 @@ rkisp_stats_isr_v3x(struct rkisp_isp_stats_vdev *stats_vdev,
|
||||
|
||||
rkisp_write(dev, ISP3X_MI_3A_WR_BASE,
|
||||
stats_vdev->stats_buf[wr_buf_idx].dma_addr, false);
|
||||
if (dev->hw_dev->is_unite)
|
||||
if (dev->hw_dev->unite)
|
||||
rkisp_next_write(dev, ISP3X_MI_3A_WR_BASE,
|
||||
stats_vdev->stats_buf[wr_buf_idx].dma_addr +
|
||||
ISP3X_RD_STATS_BUF_SIZE, false);
|
||||
@@ -1178,7 +1178,7 @@ static struct rkisp_isp_stats_ops rkisp_isp_stats_ops_tbl = {
|
||||
void rkisp_stats_first_ddr_config_v3x(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
{
|
||||
struct rkisp_device *dev = stats_vdev->dev;
|
||||
int i, mult = dev->hw_dev->is_unite ? 2 : 1;
|
||||
int i, mult = dev->hw_dev->unite ? 2 : 1;
|
||||
|
||||
if (dev->isp_sdev.in_fmt.fmt_type == FMT_YUV)
|
||||
return;
|
||||
@@ -1199,14 +1199,12 @@ void rkisp_stats_first_ddr_config_v3x(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
stats_vdev->wr_buf_idx = 0;
|
||||
|
||||
rkisp_unite_write(dev, ISP3X_MI_DBR_WR_SIZE,
|
||||
ISP3X_RD_STATS_BUF_SIZE,
|
||||
false, dev->hw_dev->is_unite);
|
||||
ISP3X_RD_STATS_BUF_SIZE, false);
|
||||
rkisp_unite_set_bits(dev, ISP3X_SWS_CFG, 0,
|
||||
ISP3X_3A_DDR_WRITE_EN, false,
|
||||
dev->hw_dev->is_unite);
|
||||
ISP3X_3A_DDR_WRITE_EN, false);
|
||||
rkisp_write(dev, ISP3X_MI_3A_WR_BASE,
|
||||
stats_vdev->stats_buf[0].dma_addr, false);
|
||||
if (dev->hw_dev->is_unite)
|
||||
if (dev->hw_dev->unite)
|
||||
rkisp_next_write(dev, ISP3X_MI_3A_WR_BASE,
|
||||
stats_vdev->stats_buf[0].dma_addr +
|
||||
ISP3X_RD_STATS_BUF_SIZE, false);
|
||||
@@ -1220,7 +1218,7 @@ err:
|
||||
|
||||
void rkisp_init_stats_vdev_v3x(struct rkisp_isp_stats_vdev *stats_vdev)
|
||||
{
|
||||
int mult = stats_vdev->dev->hw_dev->is_unite ? 2 : 1;
|
||||
int mult = stats_vdev->dev->hw_dev->unite ? 2 : 1;
|
||||
|
||||
stats_vdev->vdev_fmt.fmt.meta.dataformat =
|
||||
V4L2_META_FMT_RK_ISP1_STAT_3A;
|
||||
|
||||
@@ -933,7 +933,7 @@ static int isp_show(struct seq_file *p, void *v)
|
||||
break;
|
||||
case ISP_V30:
|
||||
if (IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_ISP_VERSION_V30)) {
|
||||
if (dev->hw_dev->is_unite)
|
||||
if (dev->hw_dev->unite)
|
||||
isp30_unite_show(dev, p);
|
||||
else
|
||||
isp30_show(dev, p);
|
||||
@@ -963,7 +963,7 @@ static int isp_show(struct seq_file *p, void *v)
|
||||
msecs_to_jiffies(1000));
|
||||
seq_printf(p, "****************HW REG*Ret:%d**************\n", ret);
|
||||
for (i = 0; i < ISP3X_RAWAWB_RAM_DATA_BASE; i += 16) {
|
||||
if (!dev->hw_dev->is_unite) {
|
||||
if (dev->hw_dev->unite != ISP_UNITE_TWO) {
|
||||
seq_printf(p, "%04x: %08x %08x %08x %08x\n", i,
|
||||
rkisp_read(dev, i, true),
|
||||
rkisp_read(dev, i + 4, true),
|
||||
|
||||
@@ -45,8 +45,7 @@ void rkisp_disable_dcrop(struct rkisp_stream *stream, bool async)
|
||||
|
||||
if (async && dev->hw_dev->is_single)
|
||||
val = CIF_DUAL_CROP_GEN_CFG_UPD;
|
||||
rkisp_unite_set_bits(dev, stream->config->dual_crop.ctrl,
|
||||
mask, val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, stream->config->dual_crop.ctrl, mask, val, false);
|
||||
}
|
||||
|
||||
void rkisp_config_dcrop(struct rkisp_stream *stream,
|
||||
@@ -54,7 +53,7 @@ void rkisp_config_dcrop(struct rkisp_stream *stream,
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
u32 val = stream->config->dual_crop.yuvmode_mask;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = !!dev->hw_dev->unite;
|
||||
struct v4l2_rect tmp = *rect;
|
||||
u32 reg;
|
||||
|
||||
@@ -69,9 +68,9 @@ void rkisp_config_dcrop(struct rkisp_stream *stream,
|
||||
rkisp_write(dev, reg, tmp.width, false);
|
||||
|
||||
reg = stream->config->dual_crop.v_offset;
|
||||
rkisp_unite_write(dev, reg, tmp.top, false, is_unite);
|
||||
rkisp_unite_write(dev, reg, tmp.top, false);
|
||||
reg = stream->config->dual_crop.v_size;
|
||||
rkisp_unite_write(dev, reg, tmp.height, false, is_unite);
|
||||
rkisp_unite_write(dev, reg, tmp.height, false);
|
||||
|
||||
if (async && dev->hw_dev->is_single)
|
||||
val |= CIF_DUAL_CROP_GEN_CFG_UPD;
|
||||
@@ -149,8 +148,7 @@ static void update_rsz_shadow(struct rkisp_stream *stream, bool async)
|
||||
|
||||
if (async && dev->hw_dev->is_single)
|
||||
val = CIF_RSZ_CTRL_CFG_UPD_AUTO;
|
||||
rkisp_unite_set_bits(dev, stream->config->rsz.ctrl, 0,
|
||||
val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, stream->config->rsz.ctrl, 0, val, false);
|
||||
}
|
||||
|
||||
static void set_scale(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
@@ -220,17 +218,8 @@ static void set_scale(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
rkisp_write(dev, scale_vc_addr, scale_vc, false);
|
||||
}
|
||||
|
||||
if (dev->hw_dev->is_unite) {
|
||||
u32 hy_size_reg = stream->id == RKISP_STREAM_MP ?
|
||||
ISP3X_MAIN_RESIZE_HY_SIZE : ISP3X_SELF_RESIZE_HY_SIZE;
|
||||
u32 hc_size_reg = stream->id == RKISP_STREAM_MP ?
|
||||
ISP3X_MAIN_RESIZE_HC_SIZE : ISP3X_SELF_RESIZE_HC_SIZE;
|
||||
u32 hy_offs_mi_reg = stream->id == RKISP_STREAM_MP ?
|
||||
ISP3X_MAIN_RESIZE_HY_OFFS_MI : ISP3X_SELF_RESIZE_HY_OFFS_MI;
|
||||
u32 hc_offs_mi_reg = stream->id == RKISP_STREAM_MP ?
|
||||
ISP3X_MAIN_RESIZE_HC_OFFS_MI : ISP3X_SELF_RESIZE_HC_OFFS_MI;
|
||||
u32 in_crop_offs_reg = stream->id == RKISP_STREAM_MP ?
|
||||
ISP3X_MAIN_RESIZE_IN_CROP_OFFSET : ISP3X_SELF_RESIZE_IN_CROP_OFFSET;
|
||||
if (dev->hw_dev->unite) {
|
||||
u32 hy_size_reg, hc_size_reg, hy_offs_mi_reg, hc_offs_mi_reg, in_crop_offs_reg;
|
||||
u32 isp_in_w = in_y->width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
u32 scl_w = out_y->width / 2;
|
||||
u32 left_y = scale_hy == 1 ? scl_w : DIV_ROUND_UP(scl_w * 65536, scale_hy);
|
||||
@@ -249,6 +238,34 @@ static void set_scale(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
u32 right_scl_in_y;
|
||||
u32 right_scl_in_c;
|
||||
|
||||
switch (stream->id) {
|
||||
case RKISP_STREAM_MP:
|
||||
hy_size_reg = ISP3X_MAIN_RESIZE_HY_SIZE;
|
||||
hc_size_reg = ISP3X_MAIN_RESIZE_HC_SIZE;
|
||||
hy_offs_mi_reg = ISP3X_MAIN_RESIZE_HY_OFFS_MI;
|
||||
hc_offs_mi_reg = ISP3X_MAIN_RESIZE_HC_OFFS_MI;
|
||||
in_crop_offs_reg = ISP3X_MAIN_RESIZE_IN_CROP_OFFSET;
|
||||
break;
|
||||
case RKISP_STREAM_SP:
|
||||
hy_size_reg = ISP3X_SELF_RESIZE_HY_SIZE;
|
||||
hc_size_reg = ISP3X_SELF_RESIZE_HC_SIZE;
|
||||
hy_offs_mi_reg = ISP3X_SELF_RESIZE_HY_OFFS_MI;
|
||||
hc_offs_mi_reg = ISP3X_SELF_RESIZE_HC_OFFS_MI;
|
||||
in_crop_offs_reg = ISP3X_SELF_RESIZE_IN_CROP_OFFSET;
|
||||
break;
|
||||
case RKISP_STREAM_BP:
|
||||
hy_size_reg = ISP32_BP_RESIZE_HY_SIZE;
|
||||
hc_size_reg = ISP32_BP_RESIZE_HC_SIZE;
|
||||
hy_offs_mi_reg = ISP32_BP_RESIZE_HY_OFFS_MI;
|
||||
hc_offs_mi_reg = ISP32_BP_RESIZE_HC_OFFS_MI;
|
||||
in_crop_offs_reg = ISP32_BP_RESIZE_IN_CROP_OFFSET;
|
||||
break;
|
||||
default:
|
||||
v4l2_warn(&dev->v4l2_dev, "%s no support unite for stream:%d\n",
|
||||
__func__, stream->id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (right_crop_y < RKMOUDLE_UNITE_EXTEND_PIXEL) {
|
||||
u32 reg;
|
||||
|
||||
@@ -362,7 +379,6 @@ void rkisp_config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
int i = 0;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
|
||||
if (dev->isp_ver == ISP_V32_L && stream->id == RKISP_STREAM_SP) {
|
||||
set_bilinear_scale(stream, in_y, in_c, out_y, out_c, async);
|
||||
@@ -377,8 +393,8 @@ void rkisp_config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
|
||||
/* Linear interpolation */
|
||||
for (i = 0; i < 64; i++) {
|
||||
rkisp_unite_write(dev, stream->config->rsz.scale_lut_addr, i, true, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->rsz.scale_lut, i, true, is_unite);
|
||||
rkisp_unite_write(dev, stream->config->rsz.scale_lut_addr, i, true);
|
||||
rkisp_unite_write(dev, stream->config->rsz.scale_lut, i, true);
|
||||
}
|
||||
|
||||
set_scale(stream, in_y, in_c, out_y, out_c);
|
||||
@@ -388,9 +404,7 @@ void rkisp_config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
|
||||
void rkisp_disable_rsz(struct rkisp_stream *stream, bool async)
|
||||
{
|
||||
bool is_unite = stream->ispdev->hw_dev->is_unite;
|
||||
|
||||
rkisp_unite_write(stream->ispdev, stream->config->rsz.ctrl, 0, false, is_unite);
|
||||
rkisp_unite_write(stream->ispdev, stream->config->rsz.ctrl, 0, false);
|
||||
if (stream->ispdev->isp_ver == ISP_V32_L && stream->id == RKISP_STREAM_SP)
|
||||
return;
|
||||
update_rsz_shadow(stream, async);
|
||||
|
||||
@@ -1753,7 +1753,7 @@ static inline void mi_set_cr_offset(struct rkisp_stream *stream, int val)
|
||||
static inline void mi_frame_end_int_enable(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_hw_dev *hw = stream->ispdev->hw_dev;
|
||||
void __iomem *base = !hw->is_unite ?
|
||||
void __iomem *base = hw->unite != ISP_UNITE_TWO ?
|
||||
hw->base_addr : hw->base_next_addr;
|
||||
void __iomem *addr = base + CIF_MI_IMSC;
|
||||
|
||||
@@ -1763,7 +1763,7 @@ static inline void mi_frame_end_int_enable(struct rkisp_stream *stream)
|
||||
static inline void mi_frame_end_int_disable(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_hw_dev *hw = stream->ispdev->hw_dev;
|
||||
void __iomem *base = !hw->is_unite ?
|
||||
void __iomem *base = hw->unite != ISP_UNITE_TWO ?
|
||||
hw->base_addr : hw->base_next_addr;
|
||||
void __iomem *addr = base + CIF_MI_IMSC;
|
||||
|
||||
@@ -1773,7 +1773,7 @@ static inline void mi_frame_end_int_disable(struct rkisp_stream *stream)
|
||||
static inline void mi_frame_end_int_clear(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_hw_dev *hw = stream->ispdev->hw_dev;
|
||||
void __iomem *base = !hw->is_unite ?
|
||||
void __iomem *base = hw->unite != ISP_UNITE_TWO ?
|
||||
hw->base_addr : hw->base_next_addr;
|
||||
void __iomem *addr = base + CIF_MI_ICR;
|
||||
|
||||
@@ -1783,7 +1783,6 @@ static inline void mi_frame_end_int_clear(struct rkisp_stream *stream)
|
||||
static inline void stream_data_path(struct rkisp_stream *stream)
|
||||
{
|
||||
struct rkisp_device *dev = stream->ispdev;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
u32 dpcl = 0;
|
||||
|
||||
if (stream->id == RKISP_STREAM_MP)
|
||||
@@ -1792,7 +1791,7 @@ static inline void stream_data_path(struct rkisp_stream *stream)
|
||||
dpcl |= CIF_VI_DPCL_CHAN_MODE_SP;
|
||||
|
||||
if (dpcl)
|
||||
rkisp_unite_set_bits(dev, CIF_VI_DPCL, 0, dpcl, true, is_unite);
|
||||
rkisp_unite_set_bits(dev, CIF_VI_DPCL, 0, dpcl, true);
|
||||
}
|
||||
|
||||
static inline void mp_set_uv_swap(void __iomem *base)
|
||||
@@ -1914,16 +1913,15 @@ static inline void sp_mi_ctrl_autoupdate_en(void __iomem *base)
|
||||
static inline void force_cfg_update(struct rkisp_device *dev)
|
||||
{
|
||||
u32 val = CIF_MI_CTRL_INIT_OFFSET_EN | CIF_MI_CTRL_INIT_BASE_EN;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
|
||||
if (dev->isp_ver == ISP_V21) {
|
||||
val |= rkisp_read_reg_cache(dev, CIF_MI_CTRL);
|
||||
rkisp_write(dev, CIF_MI_CTRL, val, true);
|
||||
}
|
||||
dev->hw_dev->is_mi_update = true;
|
||||
rkisp_unite_set_bits(dev, CIF_MI_CTRL, 0, val, false, is_unite);
|
||||
rkisp_unite_set_bits(dev, CIF_MI_CTRL, 0, val, false);
|
||||
val = CIF_MI_INIT_SOFT_UPD;
|
||||
rkisp_unite_write(dev, CIF_MI_INIT, val, true, is_unite);
|
||||
rkisp_unite_write(dev, CIF_MI_INIT, val, true);
|
||||
}
|
||||
|
||||
static inline void dmatx0_ctrl(void __iomem *base, u32 val)
|
||||
|
||||
@@ -2700,7 +2700,7 @@ static inline void mi_raw_length(struct rkisp_stream *stream)
|
||||
stream->out_fmt.plane_fmt[0].bytesperline, is_direct);
|
||||
if (stream->ispdev->isp_ver == ISP_V21 || stream->ispdev->isp_ver == ISP_V30)
|
||||
rkisp_set_bits(stream->ispdev, MI_RD_CTRL2, 0, BIT(30), false);
|
||||
if (stream->ispdev->hw_dev->is_unite) {
|
||||
if (stream->ispdev->hw_dev->unite) {
|
||||
rkisp_next_write(stream->ispdev, stream->config->mi.length,
|
||||
stream->out_fmt.plane_fmt[0].bytesperline, is_direct);
|
||||
rkisp_next_set_bits(stream->ispdev, MI_RD_CTRL2, 0, BIT(30), false);
|
||||
|
||||
@@ -343,6 +343,15 @@
|
||||
#define ISP32_BP_RESIZE_PHASE_HC_SHD (ISP32_BP_RESIZE_BASE + 0x0004c)
|
||||
#define ISP32_BP_RESIZE_PHASE_VY_SHD (ISP32_BP_RESIZE_BASE + 0x00050)
|
||||
#define ISP32_BP_RESIZE_PHASE_VC_SHD (ISP32_BP_RESIZE_BASE + 0x00054)
|
||||
#define ISP32_BP_RESIZE_HY_SIZE (ISP32_BP_RESIZE_BASE + 0x00058)
|
||||
#define ISP32_BP_RESIZE_HC_SIZE (ISP32_BP_RESIZE_BASE + 0x0005c)
|
||||
#define ISP32_BP_RESIZE_HY_OFFS_MI (ISP32_BP_RESIZE_BASE + 0x00060)
|
||||
#define ISP32_BP_RESIZE_HC_OFFS_MI (ISP32_BP_RESIZE_BASE + 0x00064)
|
||||
#define ISP32_BP_RESIZE_HY_SIZE_SHD (ISP32_BP_RESIZE_BASE + 0x00068)
|
||||
#define ISP32_BP_RESIZE_HC_SIZE_SHD (ISP32_BP_RESIZE_BASE + 0x0006c)
|
||||
#define ISP32_BP_RESIZE_HY_OFFS_MI_SHD (ISP32_BP_RESIZE_BASE + 0x00070)
|
||||
#define ISP32_BP_RESIZE_HC_OFFS_MI_SHD (ISP32_BP_RESIZE_BASE + 0x00074)
|
||||
#define ISP32_BP_RESIZE_IN_CROP_OFFSET (ISP32_BP_RESIZE_BASE + 0x00078)
|
||||
|
||||
#define ISP3X_SELF_RESIZE_BASE 0x00001000
|
||||
#define ISP3X_SELF_RESIZE_CTRL (ISP3X_SELF_RESIZE_BASE + 0x00000)
|
||||
|
||||
@@ -213,17 +213,16 @@ int rkisp_align_sensor_resolution(struct rkisp_device *dev,
|
||||
max_h = CIF_ISP_INPUT_H_MAX_V21;
|
||||
break;
|
||||
case ISP_V30:
|
||||
if (dev->hw_dev->is_unite) {
|
||||
max_w = CIF_ISP_INPUT_W_MAX_V30_UNITE;
|
||||
max_h = CIF_ISP_INPUT_H_MAX_V30_UNITE;
|
||||
} else {
|
||||
max_w = CIF_ISP_INPUT_W_MAX_V30;
|
||||
max_h = CIF_ISP_INPUT_H_MAX_V30;
|
||||
}
|
||||
max_w = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V30_UNITE : CIF_ISP_INPUT_W_MAX_V30;
|
||||
max_h = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V30_UNITE : CIF_ISP_INPUT_H_MAX_V30;
|
||||
break;
|
||||
case ISP_V32:
|
||||
max_w = CIF_ISP_INPUT_W_MAX_V32;
|
||||
max_h = CIF_ISP_INPUT_H_MAX_V32;
|
||||
max_w = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V32_UNITE : CIF_ISP_INPUT_W_MAX_V32;
|
||||
max_h = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V32_UNITE : CIF_ISP_INPUT_H_MAX_V32;
|
||||
break;
|
||||
case ISP_V32_L:
|
||||
max_w = CIF_ISP_INPUT_W_MAX_V32_L;
|
||||
@@ -530,7 +529,7 @@ static void rkisp_dvfs(struct rkisp_device *dev)
|
||||
|
||||
/* set isp clock rate */
|
||||
rkisp_set_clk_rate(hw->clks[0], hw->clk_rate_tbl[i].clk_rate * 1000000UL);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
rkisp_set_clk_rate(hw->clks[5], hw->clk_rate_tbl[i].clk_rate * 1000000UL);
|
||||
/* aclk equal to core clk */
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
@@ -563,7 +562,7 @@ static void rkisp_multi_overflow_hdl(struct rkisp_device *dev, bool on)
|
||||
writel(0, hw->base_addr + ISP3X_MPFBC_CTRL);
|
||||
writel(0, hw->base_addr + ISP3X_MI_BP_WR_CTRL);
|
||||
writel(0xc, hw->base_addr + ISP3X_SWS_CFG);
|
||||
if (hw->is_unite) {
|
||||
if (hw->unite == ISP_UNITE_TWO) {
|
||||
writel(0, hw->base_next_addr + ISP3X_MI_WR_CTRL);
|
||||
writel(0, hw->base_next_addr + ISP3X_MPFBC_CTRL);
|
||||
writel(0, hw->base_next_addr + ISP3X_MI_BP_WR_CTRL);
|
||||
@@ -575,7 +574,7 @@ static void rkisp_multi_overflow_hdl(struct rkisp_device *dev, bool on)
|
||||
writel(0, hw->base_addr + ISP32_MI_MPDS_WR_CTRL);
|
||||
}
|
||||
}
|
||||
rkisp_unite_write(dev, ISP3X_MI_WR_INIT, CIF_MI_INIT_SOFT_UPD, true, hw->is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_WR_INIT, CIF_MI_INIT_SOFT_UPD, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -595,7 +594,8 @@ void rkisp_trigger_read_back(struct rkisp_device *dev, u8 dma2frm, u32 mode, boo
|
||||
hw->cur_dev_id = dev->dev_id;
|
||||
rkisp_dmarx_get_frame(dev, &cur_frame_id, NULL, NULL, true);
|
||||
|
||||
if (hw->is_multi_overflow && is_try)
|
||||
/* isp process the same frame */
|
||||
if (is_try)
|
||||
goto run_next;
|
||||
|
||||
val = 0;
|
||||
@@ -625,13 +625,12 @@ void rkisp_trigger_read_back(struct rkisp_device *dev, u8 dma2frm, u32 mode, boo
|
||||
}
|
||||
|
||||
if (rd_mode != dev->rd_mode) {
|
||||
rkisp_unite_set_bits(dev, ISP_HDRMGE_BASE, ISP_HDRMGE_MODE_MASK,
|
||||
val, false, hw->is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP_HDRMGE_BASE, ISP_HDRMGE_MODE_MASK, val, false);
|
||||
dev->skip_frame = 2;
|
||||
is_upd = true;
|
||||
}
|
||||
|
||||
if (dev->isp_ver == ISP_V20 && dev->dmarx_dev.trigger == T_MANUAL && !is_try) {
|
||||
if (dev->isp_ver == ISP_V20 && dev->dmarx_dev.trigger == T_MANUAL) {
|
||||
if (dev->rd_mode != rd_mode && dev->br_dev.en) {
|
||||
tmp = dev->isp_sdev.in_crop.height;
|
||||
val = rkisp_read(dev, CIF_DUAL_CROP_CTRL, false);
|
||||
@@ -652,12 +651,15 @@ void rkisp_trigger_read_back(struct rkisp_device *dev, u8 dma2frm, u32 mode, boo
|
||||
}
|
||||
dev->rd_mode = rd_mode;
|
||||
|
||||
rkisp_params_first_cfg(&dev->params_vdev, &dev->isp_sdev.in_fmt,
|
||||
dev->isp_sdev.quantization);
|
||||
rkisp_params_cfg(params_vdev, cur_frame_id);
|
||||
rkisp_config_cmsk(dev);
|
||||
rkisp_stream_frame_start(dev, 0);
|
||||
if (!hw->is_single && !is_try) {
|
||||
if (hw->unite != ISP_UNITE_ONE || dev->unite_index == ISP_UNITE_LEFT) {
|
||||
rkisp_params_first_cfg(&dev->params_vdev, &dev->isp_sdev.in_fmt,
|
||||
dev->isp_sdev.quantization);
|
||||
rkisp_params_cfg(params_vdev, cur_frame_id);
|
||||
rkisp_config_cmsk(dev);
|
||||
rkisp_stream_frame_start(dev, 0);
|
||||
}
|
||||
|
||||
if (!hw->is_single) {
|
||||
/* multi sensor need to reset isp resize mode if scale up */
|
||||
val = 0;
|
||||
if (rkisp_read(dev, ISP3X_MAIN_RESIZE_CTRL, true) & 0xf0)
|
||||
@@ -693,7 +695,7 @@ void rkisp_trigger_read_back(struct rkisp_device *dev, u8 dma2frm, u32 mode, boo
|
||||
} else {
|
||||
if (dev->isp_ver == ISP_V32_L)
|
||||
rkisp_write(dev, ISP32_SELF_SCALE_UPDATE, ISP32_SCALE_FORCE_UPD, true);
|
||||
rkisp_unite_write(dev, ISP3X_MI_WR_INIT, CIF_MI_INIT_SOFT_UPD, true, hw->is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_MI_WR_INIT, CIF_MI_INIT_SOFT_UPD, true);
|
||||
}
|
||||
/* sensor mode & index */
|
||||
if (dev->isp_ver >= ISP_V21) {
|
||||
@@ -704,7 +706,7 @@ void rkisp_trigger_read_back(struct rkisp_device *dev, u8 dma2frm, u32 mode, boo
|
||||
else
|
||||
val |= ISP21_SENSOR_MODE(dev->multi_mode);
|
||||
writel(val, hw->base_addr + ISP_ACQ_H_OFFS);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP_ACQ_H_OFFS);
|
||||
v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev,
|
||||
"sensor mode:%d index:%d | 0x%x\n",
|
||||
@@ -724,49 +726,15 @@ void rkisp_trigger_read_back(struct rkisp_device *dev, u8 dma2frm, u32 mode, boo
|
||||
else
|
||||
dev->rdbk_cnt_x1++;
|
||||
dev->rdbk_cnt++;
|
||||
|
||||
rkisp_params_cfgsram(params_vdev);
|
||||
params_vdev->rdbk_times = dma2frm + 1;
|
||||
if (dev->isp_ver == ISP_V20)
|
||||
params_vdev->rdbk_times = dma2frm + 1;
|
||||
|
||||
run_next:
|
||||
if (hw->is_multi_overflow && !dev->is_first_double) {
|
||||
stats_vdev->rdbk_drop = false;
|
||||
if (dev->sw_rd_cnt) {
|
||||
/* the frame first running to off mi to save bandwidth */
|
||||
rkisp_multi_overflow_hdl(dev, false);
|
||||
|
||||
/* FST_FRAME no to read sram thumb */
|
||||
val = ISP3X_YNR_FST_FRAME | ISP3X_DHAZ_FST_FRAME;
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
val |= ISP32_SHP_FST_FRAME;
|
||||
else
|
||||
val |= ISP3X_CNR_FST_FRAME;
|
||||
rkisp_unite_set_bits(dev, ISP3X_ISP_CTRL1, 0, val, false, hw->is_unite);
|
||||
/* ADRC low iir thumb weight for first sensor switch */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_DRC_IIRWG_GAIN);
|
||||
val &= ~ISP3X_DRC_IIR_WEIGHT_MASK;
|
||||
writel(val, hw->base_addr + ISP3X_DRC_IIRWG_GAIN);
|
||||
/* ADRC iir5x5 and cur3x3 weight */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_DRC_EXPLRATIO);
|
||||
val &= ~ISP3X_DRC_WEIPRE_FRAME_MASK;
|
||||
writel(val, hw->base_addr + ISP3X_DRC_EXPLRATIO);
|
||||
/* YNR_THUMB_MIX_CUR_EN for thumb read addr to 0 */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_YNR_GLOBAL_CTRL);
|
||||
val |= ISP3X_YNR_THUMB_MIX_CUR_EN;
|
||||
writel(val, hw->base_addr + ISP3X_YNR_GLOBAL_CTRL);
|
||||
if (dev->isp_ver == ISP_V21 || dev->isp_ver == ISP_V30) {
|
||||
/* CNR_THUMB_MIX_CUR_EN for thumb read addr to 0 */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_CNR_CTRL);
|
||||
val |= ISP3X_CNR_THUMB_MIX_CUR_EN;
|
||||
writel(val, hw->base_addr + ISP3X_CNR_CTRL);
|
||||
if (hw->is_unite)
|
||||
writel(val, hw->base_next_addr + ISP3X_CNR_CTRL);
|
||||
}
|
||||
|
||||
params_vdev->rdbk_times += dev->sw_rd_cnt;
|
||||
stats_vdev->rdbk_drop = true;
|
||||
is_upd = true;
|
||||
} else if (is_try) {
|
||||
rkisp_params_cfgsram(params_vdev);
|
||||
stats_vdev->rdbk_drop = false;
|
||||
if (dev->is_frame_double) {
|
||||
is_upd = true;
|
||||
if (is_try) {
|
||||
/* the frame second running to on mi */
|
||||
rkisp_multi_overflow_hdl(dev, true);
|
||||
rkisp_update_regs(dev, ISP_LDCH_BASE, ISP_LDCH_BASE);
|
||||
@@ -776,13 +744,53 @@ run_next:
|
||||
val |= ISP32_SHP_FST_FRAME;
|
||||
else
|
||||
val |= ISP3X_CNR_FST_FRAME;
|
||||
rkisp_unite_clear_bits(dev, ISP3X_ISP_CTRL1, val, false, hw->is_unite);
|
||||
rkisp_unite_clear_bits(dev, ISP3X_ISP_CTRL1, val, false);
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_DRC_IIRWG_GAIN);
|
||||
writel(val, hw->base_addr + ISP3X_DRC_IIRWG_GAIN);
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP3X_DRC_IIRWG_GAIN);
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_DRC_EXPLRATIO);
|
||||
writel(val, hw->base_addr + ISP3X_DRC_EXPLRATIO);
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP3X_DRC_EXPLRATIO);
|
||||
} else {
|
||||
/* the frame first running to off mi to save bandwidth */
|
||||
rkisp_multi_overflow_hdl(dev, false);
|
||||
|
||||
is_upd = true;
|
||||
/* FST_FRAME no to read sram thumb */
|
||||
val = ISP3X_YNR_FST_FRAME | ISP3X_DHAZ_FST_FRAME;
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
val |= ISP32_SHP_FST_FRAME;
|
||||
else
|
||||
val |= ISP3X_CNR_FST_FRAME;
|
||||
rkisp_unite_set_bits(dev, ISP3X_ISP_CTRL1, 0, val, false);
|
||||
/* ADRC low iir thumb weight for first sensor switch */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_DRC_IIRWG_GAIN);
|
||||
val &= ~ISP3X_DRC_IIR_WEIGHT_MASK;
|
||||
writel(val, hw->base_addr + ISP3X_DRC_IIRWG_GAIN);
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP3X_DRC_IIRWG_GAIN);
|
||||
/* ADRC iir5x5 and cur3x3 weight */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_DRC_EXPLRATIO);
|
||||
val &= ~ISP3X_DRC_WEIPRE_FRAME_MASK;
|
||||
writel(val, hw->base_addr + ISP3X_DRC_EXPLRATIO);
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP3X_DRC_EXPLRATIO);
|
||||
/* YNR_THUMB_MIX_CUR_EN for thumb read addr to 0 */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_YNR_GLOBAL_CTRL);
|
||||
val |= ISP3X_YNR_THUMB_MIX_CUR_EN;
|
||||
writel(val, hw->base_addr + ISP3X_YNR_GLOBAL_CTRL);
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP3X_YNR_GLOBAL_CTRL);
|
||||
if (dev->isp_ver == ISP_V21 || dev->isp_ver == ISP_V30) {
|
||||
/* CNR_THUMB_MIX_CUR_EN for thumb read addr to 0 */
|
||||
val = rkisp_read_reg_cache(dev, ISP3X_CNR_CTRL);
|
||||
val |= ISP3X_CNR_THUMB_MIX_CUR_EN;
|
||||
writel(val, hw->base_addr + ISP3X_CNR_CTRL);
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP3X_CNR_CTRL);
|
||||
}
|
||||
stats_vdev->rdbk_drop = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,13 +799,13 @@ run_next:
|
||||
*/
|
||||
if (hw->is_single && is_upd &&
|
||||
rkisp_read_reg_cache(dev, ISP_3DLUT_UPDATE) & 0x1) {
|
||||
rkisp_unite_write(dev, ISP_3DLUT_UPDATE, 0, true, hw->is_unite);
|
||||
rkisp_unite_write(dev, ISP_3DLUT_UPDATE, 0, true);
|
||||
is_3dlut_upd = true;
|
||||
}
|
||||
if (is_upd) {
|
||||
val = rkisp_read(dev, ISP_CTRL, false);
|
||||
val |= CIF_ISP_CTRL_ISP_CFG_UPD;
|
||||
rkisp_unite_write(dev, ISP_CTRL, val, true, hw->is_unite);
|
||||
rkisp_unite_write(dev, ISP_CTRL, val, true);
|
||||
/* bayer pat after ISP_CFG_UPD for multi sensor to read lsc r/g/b table */
|
||||
rkisp_update_regs(dev, ISP3X_ISP_CTRL1, ISP3X_ISP_CTRL1);
|
||||
/* fix ldch multi sensor case:
|
||||
@@ -810,12 +818,12 @@ run_next:
|
||||
udelay(50);
|
||||
val &= ~(BIT(0) | BIT(31));
|
||||
writel(val, hw->base_addr + ISP_LDCH_BASE);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(val, hw->base_next_addr + ISP_LDCH_BASE);
|
||||
}
|
||||
}
|
||||
if (is_3dlut_upd)
|
||||
rkisp_unite_write(dev, ISP_3DLUT_UPDATE, 1, true, hw->is_unite);
|
||||
rkisp_unite_write(dev, ISP_3DLUT_UPDATE, 1, true);
|
||||
|
||||
/* if output stream enable, wait it end */
|
||||
val = rkisp_read(dev, CIF_MI_CTRL_SHD, true);
|
||||
@@ -849,10 +857,10 @@ run_next:
|
||||
if (dev->isp_ver > ISP_V20)
|
||||
dma2frm = dev->sw_rd_cnt;
|
||||
v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev,
|
||||
"readback frame:%d time:%d 0x%x\n",
|
||||
cur_frame_id, dma2frm + 1, val);
|
||||
"readback frame:%d time:%d 0x%x try:%d\n",
|
||||
cur_frame_id, dma2frm + 1, val, is_try);
|
||||
if (!hw->is_shutdown)
|
||||
rkisp_unite_write(dev, CSI2RX_CTRL0, val, true, hw->is_unite);
|
||||
rkisp_unite_write(dev, CSI2RX_CTRL0, val, true);
|
||||
}
|
||||
|
||||
static void rkisp_fast_switch_rx_buf(struct rkisp_device *dev, bool is_current)
|
||||
@@ -906,6 +914,12 @@ static void rkisp_rdbk_trigger_handle(struct rkisp_device *dev, u32 cmd)
|
||||
isp = dev;
|
||||
is_try = true;
|
||||
times = 0;
|
||||
if (hw->unite == ISP_UNITE_ONE) {
|
||||
if (dev->sw_rd_cnt < 2)
|
||||
isp->unite_index = ISP_UNITE_RIGHT;
|
||||
if (!hw->is_multi_overflow || (dev->sw_rd_cnt & 0x1))
|
||||
is_try = false;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
hw->is_idle = true;
|
||||
@@ -955,17 +969,40 @@ static void rkisp_rdbk_trigger_handle(struct rkisp_device *dev, u32 cmd)
|
||||
times = t.times;
|
||||
hw->cur_dev_id = id;
|
||||
hw->is_idle = false;
|
||||
/* this frame will read count by isp */
|
||||
isp->sw_rd_cnt = 0;
|
||||
if (hw->is_multi_overflow && (hw->pre_dev_id != id)) {
|
||||
/* frame double for multi camera resolution out of hardware limit
|
||||
* first for HW save this camera information, and second to output image
|
||||
*/
|
||||
isp->is_frame_double = false;
|
||||
if (hw->is_multi_overflow &&
|
||||
(hw->unite == ISP_UNITE_ONE ||
|
||||
(hw->pre_dev_id != -1 && hw->pre_dev_id != id))) {
|
||||
isp->is_frame_double = true;
|
||||
isp->sw_rd_cnt = 1;
|
||||
times = 0;
|
||||
}
|
||||
/* resolution out of hardware limit
|
||||
* frame is vertically divided into left and right
|
||||
*/
|
||||
isp->unite_index = ISP_UNITE_LEFT;
|
||||
if (hw->unite == ISP_UNITE_ONE) {
|
||||
isp->sw_rd_cnt *= 2;
|
||||
isp->sw_rd_cnt += 1;
|
||||
}
|
||||
/* first frame handle twice for thunderboot
|
||||
* first output stats to AIQ and wait new params to run second
|
||||
*/
|
||||
if (isp->is_pre_on && t.frame_id == 0) {
|
||||
isp->is_first_double = true;
|
||||
isp->skip_frame = 1;
|
||||
isp->sw_rd_cnt = 0;
|
||||
if (hw->unite != ISP_UNITE_ONE) {
|
||||
isp->sw_rd_cnt = 0;
|
||||
isp->is_frame_double = false;
|
||||
}
|
||||
rkisp_fast_switch_rx_buf(isp, false);
|
||||
}
|
||||
isp->params_vdev.rdbk_times = isp->sw_rd_cnt + 1;
|
||||
}
|
||||
end:
|
||||
spin_unlock_irqrestore(&hw->rdbk_lock, lock_flags);
|
||||
@@ -1023,12 +1060,6 @@ void rkisp_check_idle(struct rkisp_device *dev, u32 irq)
|
||||
{
|
||||
u32 val = 0;
|
||||
|
||||
if (dev->hw_dev->is_multi_overflow &&
|
||||
dev->sw_rd_cnt &&
|
||||
irq & ISP_FRAME_END &&
|
||||
!dev->is_first_double)
|
||||
goto end;
|
||||
|
||||
dev->irq_ends |= (irq & dev->irq_ends_mask);
|
||||
v4l2_dbg(3, rkisp_debug, &dev->v4l2_dev,
|
||||
"%s irq:0x%x ends:0x%x mask:0x%x\n",
|
||||
@@ -1043,6 +1074,9 @@ void rkisp_check_idle(struct rkisp_device *dev, u32 irq)
|
||||
!IS_HDR_RDBK(dev->rd_mode))
|
||||
return;
|
||||
|
||||
if (dev->sw_rd_cnt)
|
||||
goto end;
|
||||
|
||||
if (dev->is_first_double) {
|
||||
rkisp_fast_switch_rx_buf(dev, true);
|
||||
dev->skip_frame = 0;
|
||||
@@ -1109,26 +1143,25 @@ static void rkisp_config_ism(struct rkisp_device *dev)
|
||||
{
|
||||
struct v4l2_rect *out_crop = &dev->isp_sdev.out_crop;
|
||||
u32 width = out_crop->width, mult = 1;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
u32 unite = dev->hw_dev->unite;
|
||||
|
||||
/* isp2.0 no ism */
|
||||
if (dev->isp_ver == ISP_V20 || dev->isp_ver == ISP_V21 ||
|
||||
dev->isp_ver == ISP_V32_L)
|
||||
return;
|
||||
|
||||
if (is_unite)
|
||||
if (unite)
|
||||
width = width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_RECENTER, 0, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_MAX_DX, 0, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_MAX_DY, 0, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_DISPLACE, 0, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_H_OFFS, out_crop->left, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_V_OFFS, out_crop->top, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_H_SIZE, width, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_RECENTER, 0, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_MAX_DX, 0, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_MAX_DY, 0, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_DISPLACE, 0, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_H_OFFS, out_crop->left, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_V_OFFS, out_crop->top, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_H_SIZE, width, false);
|
||||
if (dev->cap_dev.stream[RKISP_STREAM_SP].interlaced)
|
||||
mult = 2;
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_V_SIZE, out_crop->height / mult,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IS_V_SIZE, out_crop->height / mult, false);
|
||||
|
||||
if (dev->isp_ver == ISP_V30 || dev->isp_ver == ISP_V32)
|
||||
return;
|
||||
@@ -1430,20 +1463,18 @@ static void rkisp_config_color_space(struct rkisp_device *dev)
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
rkisp_unite_write(dev, CIF_ISP_CC_COEFF_0 + i * 4,
|
||||
*(coeff + i), false, dev->hw_dev->is_unite);
|
||||
*(coeff + i), false);
|
||||
|
||||
val = rkisp_read_reg_cache(dev, CIF_ISP_CTRL);
|
||||
|
||||
if (dev->isp_sdev.quantization == V4L2_QUANTIZATION_FULL_RANGE)
|
||||
rkisp_unite_write(dev, CIF_ISP_CTRL, val |
|
||||
CIF_ISP_CTRL_ISP_CSM_Y_FULL_ENA |
|
||||
CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA,
|
||||
false, dev->hw_dev->is_unite);
|
||||
CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA, false);
|
||||
else
|
||||
rkisp_unite_write(dev, CIF_ISP_CTRL, val &
|
||||
~(CIF_ISP_CTRL_ISP_CSM_Y_FULL_ENA |
|
||||
CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA),
|
||||
false, dev->hw_dev->is_unite);
|
||||
CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA), false);
|
||||
}
|
||||
|
||||
static void rkisp_config_cmsk_single(struct rkisp_device *dev,
|
||||
@@ -1642,7 +1673,7 @@ static void rkisp_config_cmsk(struct rkisp_device *dev)
|
||||
cfg = dev->cmsk_cfg;
|
||||
spin_unlock_irqrestore(&dev->cmsk_lock, lock_flags);
|
||||
|
||||
if (!dev->hw_dev->is_unite)
|
||||
if (!dev->hw_dev->unite)
|
||||
rkisp_config_cmsk_single(dev, &cfg);
|
||||
else
|
||||
rkisp_config_cmsk_dual(dev, &cfg);
|
||||
@@ -1657,7 +1688,7 @@ static int rkisp_config_isp(struct rkisp_device *dev)
|
||||
struct ispsd_out_fmt *out_fmt;
|
||||
struct v4l2_rect *in_crop;
|
||||
struct rkisp_sensor_info *sensor;
|
||||
bool is_unite = dev->hw_dev->is_unite;
|
||||
bool is_unite = !!dev->hw_dev->unite;
|
||||
u32 isp_ctrl = 0;
|
||||
u32 irq_mask = 0;
|
||||
u32 signal = 0;
|
||||
@@ -1687,22 +1718,20 @@ static int rkisp_config_isp(struct rkisp_device *dev)
|
||||
in_fmt->mbus_code == MEDIA_BUS_FMT_Y10_1X10 ||
|
||||
in_fmt->mbus_code == MEDIA_BUS_FMT_Y12_1X12) {
|
||||
if (dev->isp_ver >= ISP_V20)
|
||||
rkisp_unite_write(dev, ISP_DEBAYER_CONTROL,
|
||||
0, false, is_unite);
|
||||
rkisp_unite_write(dev, ISP_DEBAYER_CONTROL, 0, false);
|
||||
else
|
||||
rkisp_write(dev, CIF_ISP_DEMOSAIC,
|
||||
CIF_ISP_DEMOSAIC_BYPASS |
|
||||
CIF_ISP_DEMOSAIC_TH(0xc), false);
|
||||
CIF_ISP_DEMOSAIC_BYPASS |
|
||||
CIF_ISP_DEMOSAIC_TH(0xc), false);
|
||||
} else {
|
||||
if (dev->isp_ver >= ISP_V20)
|
||||
rkisp_unite_write(dev, ISP_DEBAYER_CONTROL,
|
||||
SW_DEBAYER_EN |
|
||||
SW_DEBAYER_FILTER_G_EN |
|
||||
SW_DEBAYER_FILTER_C_EN,
|
||||
false, is_unite);
|
||||
SW_DEBAYER_FILTER_C_EN, false);
|
||||
else
|
||||
rkisp_write(dev, CIF_ISP_DEMOSAIC,
|
||||
CIF_ISP_DEMOSAIC_TH(0xc), false);
|
||||
CIF_ISP_DEMOSAIC_TH(0xc), false);
|
||||
}
|
||||
|
||||
if (sensor && sensor->mbus.type == V4L2_MBUS_BT656)
|
||||
@@ -1755,38 +1784,31 @@ static int rkisp_config_isp(struct rkisp_device *dev)
|
||||
if (rkisp_read_reg_cache(dev, CIF_ISP_CTRL) & ISP32_MIR_ENABLE)
|
||||
isp_ctrl |= ISP32_MIR_ENABLE;
|
||||
|
||||
rkisp_unite_write(dev, CIF_ISP_CTRL, isp_ctrl, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_CTRL, isp_ctrl, false);
|
||||
acq_prop |= signal | in_fmt->yuv_seq |
|
||||
CIF_ISP_ACQ_PROP_BAYER_PAT(in_fmt->bayer_pat) |
|
||||
CIF_ISP_ACQ_PROP_FIELD_SEL_ALL;
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_PROP, acq_prop, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_NR_FRAMES, 0, true, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_PROP, acq_prop, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_NR_FRAMES, 0, true);
|
||||
|
||||
if (is_unite)
|
||||
width = width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
/* Acquisition Size */
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_H_OFFS, acq_mult * in_crop->left,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_V_OFFS, in_crop->top,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_H_SIZE, acq_mult * width,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_H_OFFS, acq_mult * in_crop->left, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_V_OFFS, in_crop->top, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_H_SIZE, acq_mult * width, false);
|
||||
|
||||
/* ISP Out Area differ with ACQ is only FIFO, so don't crop in this */
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_H_OFFS, 0, true, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_V_OFFS, 0, true, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_H_SIZE, width, false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_H_OFFS, 0, true);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_V_OFFS, 0, true);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_H_SIZE, width, false);
|
||||
|
||||
if (dev->cap_dev.stream[RKISP_STREAM_SP].interlaced) {
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_V_SIZE, in_crop->height / 2,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_V_SIZE, in_crop->height / 2,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_V_SIZE, in_crop->height / 2, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_V_SIZE, in_crop->height / 2, false);
|
||||
} else {
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_V_SIZE, in_crop->height + extend_line,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_V_SIZE, in_crop->height + extend_line,
|
||||
false, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_ACQ_V_SIZE, in_crop->height + extend_line, false);
|
||||
rkisp_unite_write(dev, CIF_ISP_OUT_V_SIZE, in_crop->height + extend_line, false);
|
||||
}
|
||||
|
||||
/* interrupt mask */
|
||||
@@ -1795,7 +1817,7 @@ static int rkisp_config_isp(struct rkisp_device *dev)
|
||||
irq_mask |= ISP2X_LSC_LUT_ERR;
|
||||
if (dev->is_pre_on)
|
||||
irq_mask |= CIF_ISP_FRAME_IN;
|
||||
rkisp_unite_write(dev, CIF_ISP_IMSC, irq_mask, true, is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_IMSC, irq_mask, true);
|
||||
|
||||
if ((dev->isp_ver == ISP_V20 ||
|
||||
dev->isp_ver == ISP_V21) &&
|
||||
@@ -1950,8 +1972,7 @@ static int rkisp_config_path(struct rkisp_device *dev)
|
||||
if (dev->isp_ver == ISP_V32)
|
||||
dpcl |= BIT(0);
|
||||
|
||||
rkisp_unite_set_bits(dev, CIF_VI_DPCL, 0, dpcl, true,
|
||||
dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, CIF_VI_DPCL, 0, dpcl, true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2048,9 +2069,9 @@ static int rkisp_isp_stop(struct rkisp_device *dev)
|
||||
|
||||
v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev,
|
||||
"%s refcnt:%d\n", __func__,
|
||||
atomic_read(&dev->hw_dev->refcnt));
|
||||
atomic_read(&hw->refcnt));
|
||||
|
||||
if (atomic_read(&dev->hw_dev->refcnt) > 1)
|
||||
if (atomic_read(&hw->refcnt) > 1)
|
||||
goto end;
|
||||
/*
|
||||
* ISP(mi) stop in mi frame end -> Stop ISP(mipi) ->
|
||||
@@ -2106,7 +2127,7 @@ static int rkisp_isp_stop(struct rkisp_device *dev)
|
||||
|
||||
val = readl(base + CIF_ISP_CTRL);
|
||||
writel(val | CIF_ISP_CTRL_ISP_CFG_UPD, base + CIF_ISP_CTRL);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
rkisp_next_write(dev, CIF_ISP_CTRL,
|
||||
val | CIF_ISP_CTRL_ISP_CFG_UPD, true);
|
||||
|
||||
@@ -2123,11 +2144,11 @@ static int rkisp_isp_stop(struct rkisp_device *dev)
|
||||
safe_rate = hw->clk_rate_tbl[0].clk_rate * 1000000UL;
|
||||
if (old_rate > safe_rate) {
|
||||
rkisp_set_clk_rate(hw->clks[0], safe_rate);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
rkisp_set_clk_rate(hw->clks[5], safe_rate);
|
||||
udelay(100);
|
||||
}
|
||||
rkisp_soft_reset(dev->hw_dev, false);
|
||||
rkisp_soft_reset(hw, false);
|
||||
}
|
||||
|
||||
if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) {
|
||||
@@ -2138,14 +2159,15 @@ static int rkisp_isp_stop(struct rkisp_device *dev)
|
||||
writel(0, base + CIF_ISP_CSI0_MASK3);
|
||||
} else if (dev->isp_ver >= ISP_V20) {
|
||||
writel(0, base + CSI2RX_CSI2_RESETN);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
rkisp_next_write(dev, CSI2RX_CSI2_RESETN, 0, true);
|
||||
}
|
||||
|
||||
hw->is_dvfs = false;
|
||||
hw->is_runing = false;
|
||||
dev->hw_dev->is_idle = true;
|
||||
dev->hw_dev->is_mi_update = false;
|
||||
hw->is_idle = true;
|
||||
hw->is_mi_update = false;
|
||||
hw->pre_dev_id = -1;
|
||||
end:
|
||||
dev->irq_ends_mask = 0;
|
||||
dev->hdr.op_mode = 0;
|
||||
@@ -2196,12 +2218,9 @@ static int rkisp_isp_start(struct rkisp_device *dev)
|
||||
val = dev->isp_sdev.out_crop.height / 15;
|
||||
val = dev->cap_dev.wait_line / val;
|
||||
val = ISP3X_RAWAF_INELINE0(val) | ISP3X_RAWAF_INTLINE0_EN;
|
||||
rkisp_unite_write(dev, ISP3X_RAWAF_INT_LINE,
|
||||
val, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_set_bits(dev, ISP_ISP3A_IMSC, 0,
|
||||
ISP2X_3A_RAWAF, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_clear_bits(dev, CIF_ISP_IMSC,
|
||||
ISP2X_LSC_LUT_ERR, false, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, ISP3X_RAWAF_INT_LINE, val, false);
|
||||
rkisp_unite_set_bits(dev, ISP_ISP3A_IMSC, 0, ISP2X_3A_RAWAF, false);
|
||||
rkisp_unite_clear_bits(dev, CIF_ISP_IMSC, ISP2X_LSC_LUT_ERR, false);
|
||||
dev->rawaf_irq_cnt = 0;
|
||||
}
|
||||
}
|
||||
@@ -2229,7 +2248,7 @@ static int rkisp_isp_start(struct rkisp_device *dev)
|
||||
val |= NOC_HURRY_PRIORITY(2) | NOC_HURRY_W_MODE(2) | NOC_HURRY_R_MODE(1);
|
||||
if (atomic_read(&dev->hw_dev->refcnt) > 1)
|
||||
is_direct = false;
|
||||
rkisp_unite_write(dev, CIF_ISP_CTRL, val, is_direct, dev->hw_dev->is_unite);
|
||||
rkisp_unite_write(dev, CIF_ISP_CTRL, val, is_direct);
|
||||
rkisp_clear_reg_cache_bits(dev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_CFG_UPD);
|
||||
|
||||
dev->isp_err_cnt = 0;
|
||||
@@ -2709,14 +2728,16 @@ static int rkisp_isp_sd_get_selection(struct v4l2_subdev *sd,
|
||||
max_h = CIF_ISP_INPUT_H_MAX_V21;
|
||||
break;
|
||||
case ISP_V30:
|
||||
max_w = dev->hw_dev->is_unite ?
|
||||
max_w = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V30_UNITE : CIF_ISP_INPUT_W_MAX_V30;
|
||||
max_h = dev->hw_dev->is_unite ?
|
||||
max_h = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V30_UNITE : CIF_ISP_INPUT_H_MAX_V30;
|
||||
break;
|
||||
case ISP_V32:
|
||||
max_w = CIF_ISP_INPUT_W_MAX_V32;
|
||||
max_h = CIF_ISP_INPUT_H_MAX_V32;
|
||||
max_w = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_W_MAX_V32_UNITE : CIF_ISP_INPUT_W_MAX_V32;
|
||||
max_h = dev->hw_dev->unite ?
|
||||
CIF_ISP_INPUT_H_MAX_V32_UNITE : CIF_ISP_INPUT_H_MAX_V32;
|
||||
break;
|
||||
case ISP_V32_L:
|
||||
max_w = CIF_ISP_INPUT_W_MAX_V32_L;
|
||||
@@ -2978,7 +2999,7 @@ static void rkisp_rx_qbuf_online(struct rkisp_stream *stream,
|
||||
u32 val = pool->buf.buff_addr[RKISP_PLANE_Y];
|
||||
|
||||
rkisp_write(dev, stream->config->mi.y_base_ad_init, val, false);
|
||||
if (dev->hw_dev->is_unite) {
|
||||
if (dev->hw_dev->unite == ISP_UNITE_TWO) {
|
||||
u32 offs = stream->out_fmt.width / 2 - RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
|
||||
if (stream->memory)
|
||||
@@ -3454,7 +3475,7 @@ static int rkisp_get_info(struct rkisp_device *dev, struct rkisp_isp_info *info)
|
||||
if (dev->is_bigmode)
|
||||
mode |= RKISP_ISP_BIGMODE;
|
||||
info->mode = mode;
|
||||
if (dev->hw_dev->is_unite)
|
||||
if (dev->hw_dev->unite)
|
||||
info->act_width = in_crop->width / 2 + RKMOUDLE_UNITE_EXTEND_PIXEL;
|
||||
else
|
||||
info->act_width = in_crop->width;
|
||||
@@ -3741,7 +3762,7 @@ static void rkisp_isp_sd_init_default_fmt(struct rkisp_isp_subdev *isp_sd)
|
||||
struct ispsd_in_fmt *in_fmt = &isp_sd->in_fmt;
|
||||
struct ispsd_out_fmt *out_fmt = &isp_sd->out_fmt;
|
||||
|
||||
*in_fmt = rkisp_isp_input_formats[0];
|
||||
*in_fmt = rkisp_isp_input_formats[8];
|
||||
in_frm->width = RKISP_DEFAULT_WIDTH;
|
||||
in_frm->height = RKISP_DEFAULT_HEIGHT;
|
||||
in_frm->code = in_fmt->mbus_code;
|
||||
@@ -4068,7 +4089,7 @@ void rkisp_isp_isr(unsigned int isp_mis,
|
||||
struct rkisp_device *dev)
|
||||
{
|
||||
struct rkisp_hw_dev *hw = dev->hw_dev;
|
||||
void __iomem *base = !hw->is_unite ?
|
||||
void __iomem *base = hw->unite != ISP_UNITE_TWO ?
|
||||
hw->base_addr : hw->base_next_addr;
|
||||
unsigned int isp_mis_tmp = 0;
|
||||
unsigned int isp_err = 0;
|
||||
@@ -4089,7 +4110,7 @@ void rkisp_isp_isr(unsigned int isp_mis,
|
||||
if (isp3a_mis & ISP2X_3A_RAWAE_BIG && dev->params_vdev.rdbk_times > 0)
|
||||
writel(BIT(31), base + RAWAE_BIG1_BASE + RAWAE_BIG_CTRL);
|
||||
|
||||
if (hw->is_unite) {
|
||||
if (hw->unite == ISP_UNITE_TWO) {
|
||||
u32 val = rkisp_read(dev, ISP3X_ISP_RIS, true);
|
||||
|
||||
if (val) {
|
||||
@@ -4125,7 +4146,7 @@ void rkisp_isp_isr(unsigned int isp_mis,
|
||||
*/
|
||||
if (!dev->hw_dev->is_single) {
|
||||
writel(0, hw->base_addr + ISP_3DLUT_UPDATE);
|
||||
if (hw->is_unite)
|
||||
if (hw->unite == ISP_UNITE_TWO)
|
||||
writel(0, hw->base_next_addr + ISP_3DLUT_UPDATE);
|
||||
}
|
||||
rkisp_stats_rdbk_enable(&dev->stats_vdev, true);
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
#define CIF_ISP_INPUT_H_MAX_V30_UNITE 6144
|
||||
#define CIF_ISP_INPUT_W_MAX_V32 3072
|
||||
#define CIF_ISP_INPUT_H_MAX_V32 1728
|
||||
#define CIF_ISP_INPUT_W_MAX_V32_UNITE 3840
|
||||
#define CIF_ISP_INPUT_H_MAX_V32_UNITE 2160
|
||||
#define CIF_ISP_INPUT_W_MAX_V32_L 4224
|
||||
#define CIF_ISP_INPUT_H_MAX_V32_L 3136
|
||||
#define CIF_ISP_INPUT_W_MIN 272
|
||||
|
||||
Reference in New Issue
Block a user