diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index b1a972cedf4f..4403aa93039d 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -138,7 +138,7 @@ source "drivers/media/platform/xilinx/Kconfig" source "drivers/media/platform/rcar-vin/Kconfig" source "drivers/media/platform/atmel/Kconfig" source "drivers/media/platform/rockchip/cif/Kconfig" -source "drivers/media/platform/rockchip/isp1/Kconfig" +source "drivers/media/platform/rockchip/isp/Kconfig" config VIDEO_TI_CAL tristate "TI CAL (Camera Adaptation Layer) driver" diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index ce94f5e8a1d3..79b8858caf8f 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -68,7 +68,7 @@ obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1/ obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip/rga/ obj-$(CONFIG_VIDEO_ROCKCHIP_CIF) += rockchip/cif/ -obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rockchip/isp1/ +obj-$(CONFIG_VIDEO_ROCKCHIP_ISP) += rockchip/isp/ obj-y += omap/ diff --git a/drivers/media/platform/rockchip/isp/Kconfig b/drivers/media/platform/rockchip/isp/Kconfig new file mode 100644 index 000000000000..76be506d91b2 --- /dev/null +++ b/drivers/media/platform/rockchip/isp/Kconfig @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0 +config VIDEO_ROCKCHIP_ISP + tristate "Rockchip Image Signal Processing Unit driver" + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on ARCH_ROCKCHIP || COMPILE_TEST + select VIDEOBUF2_DMA_CONTIG + select VIDEOBUF2_VMALLOC + select V4L2_FWNODE + select PHY_ROCKCHIP_MIPI_RX + default n + help + Support for ISP1 on the rockchip SoC. + +config VIDEO_ROCKCHIP_ISP1 + tristate "Rockchip Image Signal Processing V1 Unit driver (DEPRECATED)" + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on ARCH_ROCKCHIP || COMPILE_TEST + select VIDEO_ROCKCHIP_ISP + default n + help + Support for ISP1 on the rockchip SoC. + + This config option is here only for backward compatibility. + Use VIDEO_ROCKCHIP_ISP instead. diff --git a/drivers/media/platform/rockchip/isp1/Makefile b/drivers/media/platform/rockchip/isp/Makefile similarity index 58% rename from drivers/media/platform/rockchip/isp1/Makefile rename to drivers/media/platform/rockchip/isp/Makefile index 788e3d97978a..d919446b9ada 100644 --- a/drivers/media/platform/rockchip/isp1/Makefile +++ b/drivers/media/platform/rockchip/isp/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += video_rkisp1.o +obj-$(CONFIG_VIDEO_ROCKCHIP_ISP) += video_rkisp.o -video_rkisp1-objs += rkisp1.o \ +video_rkisp-objs += rkisp.o \ dev.o \ regs.o \ isp_stats.o \ diff --git a/drivers/media/platform/rockchip/isp1/capture.c b/drivers/media/platform/rockchip/isp/capture.c similarity index 82% rename from drivers/media/platform/rockchip/isp1/capture.c rename to drivers/media/platform/rockchip/isp/capture.c index 3fc56166356f..e986ff47072b 100644 --- a/drivers/media/platform/rockchip/isp1/capture.c +++ b/drivers/media/platform/rockchip/isp/capture.c @@ -45,7 +45,7 @@ /* * NOTE: - * 1. There are two capture video devices in rkisp1, selfpath and mainpath + * 1. There are two capture video devices in rkisp, selfpath and mainpath * 2. Two capture device have separated memory-interface/crop/scale units. * 3. Besides describing stream hardware, this file also contain entries * for pipeline operations. @@ -533,7 +533,7 @@ static const struct capture_fmt raw_fmts[] = { }, }; -static struct stream_config rkisp1_mp_stream_config = { +static struct stream_config rkisp_mp_stream_config = { .fmts = mp_fmts, .fmt_size = ARRAY_SIZE(mp_fmts), /* constraints */ @@ -588,7 +588,7 @@ static struct stream_config rkisp1_mp_stream_config = { }, }; -static struct stream_config rkisp1_sp_stream_config = { +static struct stream_config rkisp_sp_stream_config = { .fmts = sp_fmts, .fmt_size = ARRAY_SIZE(sp_fmts), /* constraints */ @@ -643,13 +643,13 @@ static struct stream_config rkisp1_sp_stream_config = { }, }; -static struct stream_config rkisp1_raw_stream_config = { +static struct stream_config rkisp_raw_stream_config = { .fmts = raw_fmts, .fmt_size = ARRAY_SIZE(raw_fmts), }; static const -struct capture_fmt *find_fmt(struct rkisp1_stream *stream, const u32 pixelfmt) +struct capture_fmt *find_fmt(struct rkisp_stream *stream, const u32 pixelfmt) { const struct capture_fmt *fmt; int i; @@ -663,27 +663,27 @@ struct capture_fmt *find_fmt(struct rkisp1_stream *stream, const u32 pixelfmt) } /* configure dual-crop unit */ -static int rkisp1_config_dcrop(struct rkisp1_stream *stream, bool async) +static int rkisp_config_dcrop(struct rkisp_stream *stream, bool async) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_rect *dcrop = &stream->dcrop; struct v4l2_rect *input_win; /* dual-crop unit get data from isp */ - input_win = rkisp1_get_isp_sd_win(&dev->isp_sdev); + input_win = rkisp_get_isp_sd_win(&dev->isp_sdev); if (dcrop->width == input_win->width && dcrop->height == input_win->height && dcrop->left == 0 && dcrop->top == 0) { disable_dcrop(stream, async); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "stream %d crop disabled\n", stream->id); return 0; } config_dcrop(stream, dcrop, async); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "stream %d crop: %dx%d -> %dx%d\n", stream->id, input_win->width, input_win->height, dcrop->width, dcrop->height); @@ -692,13 +692,13 @@ static int rkisp1_config_dcrop(struct rkisp1_stream *stream, bool async) } /* configure scale unit */ -static int rkisp1_config_rsz(struct rkisp1_stream *stream, bool async) +static int rkisp_config_rsz(struct rkisp_stream *stream, bool async) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_pix_format_mplane output_fmt = stream->out_fmt; struct capture_fmt *output_isp_fmt = &stream->out_isp_fmt; struct ispsd_out_fmt *input_isp_fmt = - rkisp1_get_ispsd_out_fmt(&dev->isp_sdev); + rkisp_get_ispsd_out_fmt(&dev->isp_sdev); struct v4l2_rect in_y, in_c, out_y, out_c; u32 xsubs_in = 1, ysubs_in = 1; u32 xsubs_out = 1, ysubs_out = 1; @@ -733,18 +733,18 @@ static int rkisp1_config_rsz(struct rkisp1_stream *stream, bool async) goto disable; /* set RSZ input and output */ - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "stream %d rsz/scale: %dx%d -> %dx%d\n", stream->id, stream->dcrop.width, stream->dcrop.height, output_fmt.width, output_fmt.height); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "chroma scaling %dx%d -> %dx%d\n", in_c.width, in_c.height, out_c.width, out_c.height); /* calculate and set scale */ config_rsz(stream, &in_y, &in_c, &out_y, &out_c, async); - if (rkisp1_debug) + if (rkisp_debug) dump_rsz_regs(stream); return 0; @@ -761,9 +761,9 @@ disable: * memory base addresses should be with respect * to the burst alignment restriction for AXI. */ -static u32 calc_burst_len(struct rkisp1_stream *stream) +static u32 calc_burst_len(struct rkisp_stream *stream) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; u32 y_size = stream->out_fmt.plane_fmt[0].bytesperline * stream->out_fmt.height; u32 cb_size = stream->out_fmt.plane_fmt[1].sizeimage; @@ -803,7 +803,7 @@ static u32 calc_burst_len(struct rkisp1_stream *stream) (cr_offs == 0) ? bus * 4 : bus * 16); stream->burst = burst; - for (i = 0; i < RKISP1_MAX_STREAM; i++) + for (i = 0; i < RKISP_MAX_STREAM; i++) if (burst > dev->stream[i].burst) burst = dev->stream[i].burst; @@ -832,7 +832,7 @@ static u32 calc_burst_len(struct rkisp1_stream *stream) * configure memory interface for mainpath * This should only be called when stream-on */ -static int mp_config_mi(struct rkisp1_stream *stream) +static int mp_config_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; @@ -859,13 +859,13 @@ static int mp_config_mi(struct rkisp1_stream *stream) * configure memory interface for selfpath * This should only be called when stream-on */ -static int sp_config_mi(struct rkisp1_stream *stream) +static int sp_config_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct capture_fmt *output_isp_fmt = &stream->out_isp_fmt; struct ispsd_out_fmt *input_isp_fmt = - rkisp1_get_ispsd_out_fmt(&dev->isp_sdev); + rkisp_get_ispsd_out_fmt(&dev->isp_sdev); u32 sp_in_fmt; if (mbus_code_sp_in_fmt(input_isp_fmt->mbus_code, @@ -911,36 +911,36 @@ static int sp_config_mi(struct rkisp1_stream *stream) * configure memory interface for rawpath * This should only be called when stream-on */ -static int raw_config_mi(struct rkisp1_stream *stream) +static int raw_config_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_mbus_framefmt *in_frm; u32 in_size; if (!dev->active_sensor || (dev->active_sensor && dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) { - if (stream->id == RKISP1_STREAM_RAW) + if (stream->id == RKISP_STREAM_RAW) v4l2_err(&dev->v4l2_dev, "only mipi sensor support raw path\n"); return -EINVAL; } - if (dev->stream[RKISP1_STREAM_RAW].streaming) + if (dev->stream[RKISP_STREAM_RAW].streaming) return 0; in_frm = &dev->active_sensor->fmt.format; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, - "stream:%d input %dx%d\n", - stream->id, in_frm->width, in_frm->height); + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, + "stream:%d input %dx%d\n", + stream->id, in_frm->width, in_frm->height); /* raw output size equal to sensor input size */ - if (stream->id == RKISP1_STREAM_RAW) { + if (stream->id == RKISP_STREAM_RAW) { in_size = stream->out_fmt.plane_fmt[0].sizeimage; } else { - struct rkisp1_stream *raw = &dev->stream[RKISP1_STREAM_RAW]; + struct rkisp_stream *raw = &dev->stream[RKISP_STREAM_RAW]; in_size = raw->out_fmt.plane_fmt[0].sizeimage; } @@ -958,13 +958,13 @@ static int raw_config_mi(struct rkisp1_stream *stream) /* dummy buf for raw first address shadow */ mi_raw0_set_addr(base, stream->dummy_buf.dma_addr); mi_ctrl2(base, CIF_MI_CTRL2_MIPI_RAW0_AUTO_UPDATE); - if (stream->id == RKISP1_STREAM_RAW) + if (stream->id == RKISP_STREAM_RAW) stream->u.raw.pre_stop = false; return 0; } -static void mp_enable_mi(struct rkisp1_stream *stream) +static void mp_enable_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; struct capture_fmt *isp_fmt = &stream->out_isp_fmt; @@ -976,63 +976,63 @@ static void mp_enable_mi(struct rkisp1_stream *stream) mi_ctrl_mpyuv_enable(base); } -static void sp_enable_mi(struct rkisp1_stream *stream) +static void sp_enable_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; mi_ctrl_spyuv_enable(base); } -static void raw_enable_mi(struct rkisp1_stream *stream) +static void raw_enable_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; mi_mipi_raw0_enable(base); } -static void mp_disable_mi(struct rkisp1_stream *stream) +static void mp_disable_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; mi_ctrl_mp_disable(base); } -static void sp_disable_mi(struct rkisp1_stream *stream) +static void sp_disable_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; mi_ctrl_spyuv_disable(base); } -static void update_dmatx0(struct rkisp1_stream *stream) +static void update_dmatx0(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; - struct rkisp1_dummy_buffer *dummy_buf = &stream->dummy_buf; + struct rkisp_dummy_buffer *dummy_buf = &stream->dummy_buf; if (stream->next_buf) mi_raw0_set_addr(base, - stream->next_buf->buff_addr[RKISP1_PLANE_Y]); + stream->next_buf->buff_addr[RKISP_PLANE_Y]); else mi_raw0_set_addr(base, dummy_buf->dma_addr); } /* Update buffer info to memory interface, it's called in interrupt */ -static void update_mi(struct rkisp1_stream *stream) +static void update_mi(struct rkisp_stream *stream) { - struct rkisp1_dummy_buffer *dummy_buf = &stream->dummy_buf; + struct rkisp_dummy_buffer *dummy_buf = &stream->dummy_buf; /* The dummy space allocated by dma_alloc_coherent is used, we can * throw data to it if there is no available buffer. */ if (stream->next_buf) { mi_set_y_addr(stream, - stream->next_buf->buff_addr[RKISP1_PLANE_Y]); + stream->next_buf->buff_addr[RKISP_PLANE_Y]); mi_set_cb_addr(stream, - stream->next_buf->buff_addr[RKISP1_PLANE_CB]); + stream->next_buf->buff_addr[RKISP_PLANE_CB]); mi_set_cr_addr(stream, - stream->next_buf->buff_addr[RKISP1_PLANE_CR]); + stream->next_buf->buff_addr[RKISP_PLANE_CR]); } else { - v4l2_dbg(1, rkisp1_debug, &stream->ispdev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &stream->ispdev->v4l2_dev, "stream %d: to dummy buf\n", stream->id); mi_set_y_addr(stream, dummy_buf->dma_addr); mi_set_cb_addr(stream, dummy_buf->dma_addr); @@ -1044,7 +1044,7 @@ static void update_mi(struct rkisp1_stream *stream) mi_set_cr_offset(stream, 0); } -static void mp_stop_mi(struct rkisp1_stream *stream) +static void mp_stop_mi(struct rkisp_stream *stream) { if (!stream->streaming) return; @@ -1052,7 +1052,7 @@ static void mp_stop_mi(struct rkisp1_stream *stream) stream->ops->disable_mi(stream); } -static void sp_stop_mi(struct rkisp1_stream *stream) +static void sp_stop_mi(struct rkisp_stream *stream) { if (!stream->streaming) return; @@ -1060,7 +1060,7 @@ static void sp_stop_mi(struct rkisp1_stream *stream) stream->ops->disable_mi(stream); } -static void raw_stop_mi(struct rkisp1_stream *stream) +static void raw_stop_mi(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; @@ -1069,7 +1069,7 @@ static void raw_stop_mi(struct rkisp1_stream *stream) mi_mipi_raw0_disable(base); } -static struct streams_ops rkisp1_mp_streams_ops = { +static struct streams_ops rkisp_mp_streams_ops = { .config_mi = mp_config_mi, .enable_mi = mp_enable_mi, .disable_mi = mp_disable_mi, @@ -1079,7 +1079,7 @@ static struct streams_ops rkisp1_mp_streams_ops = { .update_mi = update_mi, }; -static struct streams_ops rkisp1_sp_streams_ops = { +static struct streams_ops rkisp_sp_streams_ops = { .config_mi = sp_config_mi, .enable_mi = sp_enable_mi, .disable_mi = sp_disable_mi, @@ -1089,7 +1089,7 @@ static struct streams_ops rkisp1_sp_streams_ops = { .update_mi = update_mi, }; -static struct streams_ops rkisp1_raw_streams_ops = { +static struct streams_ops rkisp_raw_streams_ops = { .config_mi = raw_config_mi, .enable_mi = raw_enable_mi, .stop_mi = raw_stop_mi, @@ -1101,10 +1101,10 @@ static struct streams_ops rkisp1_raw_streams_ops = { * is processing and we should set up buffer for next-next frame, * otherwise it will overflow. */ -static int mi_frame_end(struct rkisp1_stream *stream) +static int mi_frame_end(struct rkisp_stream *stream) { - struct rkisp1_device *isp_dev = stream->ispdev; - struct rkisp1_isp_subdev *isp_sd = &isp_dev->isp_sdev; + struct rkisp_device *isp_dev = stream->ispdev; + struct rkisp_isp_subdev *isp_sd = &isp_dev->isp_sdev; struct capture_fmt *isp_fmt = &stream->out_isp_fmt; bool interlaced = stream->interlaced; unsigned long lock_flags = 0; @@ -1146,7 +1146,7 @@ static int mi_frame_end(struct rkisp1_stream *stream) if (!list_empty(&stream->buf_queue)) { stream->next_buf = list_first_entry(&stream->buf_queue, - struct rkisp1_buffer, + struct rkisp_buffer, queue); list_del(&stream->next_buf->queue); } @@ -1155,11 +1155,11 @@ static int mi_frame_end(struct rkisp1_stream *stream) stream->u.sp.field == RKISP_FIELD_EVEN) { /* Interlaced: event field next buffer address */ if (stream->next_buf) { - stream->next_buf->buff_addr[RKISP1_PLANE_Y] += + stream->next_buf->buff_addr[RKISP_PLANE_Y] += stream->u.sp.vir_offs; - stream->next_buf->buff_addr[RKISP1_PLANE_CB] += + stream->next_buf->buff_addr[RKISP_PLANE_CB] += stream->u.sp.vir_offs; - stream->next_buf->buff_addr[RKISP1_PLANE_CR] += + stream->next_buf->buff_addr[RKISP_PLANE_CR] += stream->u.sp.vir_offs; } stream->curr_buf = stream->next_buf; @@ -1179,9 +1179,9 @@ static int mi_frame_end(struct rkisp1_stream *stream) * Set flags and wait, it should stop in interrupt. * If it didn't, stop it by force. */ -static void rkisp1_stream_stop(struct rkisp1_stream *stream) +static void rkisp_stream_stop(struct rkisp_stream *stream) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; int ret = 0; @@ -1202,7 +1202,7 @@ static void rkisp1_stream_stop(struct rkisp1_stream *stream) stream->streaming = false; } - if (stream->id != RKISP1_STREAM_RAW) { + if (stream->id != RKISP_STREAM_RAW) { disable_dcrop(stream, true); disable_rsz(stream, true); } @@ -1219,14 +1219,14 @@ static void rkisp1_stream_stop(struct rkisp1_stream *stream) * Usually, each sub-module updates its shadow register after * processing the last pixel of a frame. */ -static int rkisp1_start(struct rkisp1_stream *stream) +static int rkisp_start(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; bool other_streaming = false; int i, ret; - for (i = 0; i < RKISP1_MAX_STREAM; i++) { + for (i = 0; i < RKISP_MAX_STREAM; i++) { if (i != stream->id && dev->stream[i].streaming) { other_streaming = true; @@ -1238,13 +1238,13 @@ static int rkisp1_start(struct rkisp1_stream *stream) * config raw in first stream (sp/mp), and enable when raw stream open. */ if (!other_streaming && - stream->id == RKISP1_STREAM_RAW) { + stream->id == RKISP_STREAM_RAW) { v4l2_err(&dev->v4l2_dev, "stream raw only support to open after stream mp/sp"); return -EINVAL; } -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) #else if (dev->isp_ver == ISP_V12 || @@ -1259,7 +1259,7 @@ static int rkisp1_start(struct rkisp1_stream *stream) return ret; /* for mp/sp Set up an buffer for the next frame */ - if (stream->id != RKISP1_STREAM_RAW) + if (stream->id != RKISP_STREAM_RAW) mi_frame_end(stream); stream->ops->enable_mi(stream); /* It's safe to config ACTIVE and SHADOW regs for the @@ -1280,14 +1280,14 @@ static int rkisp1_start(struct rkisp1_stream *stream) return 0; } -static int rkisp1_queue_setup(struct vb2_queue *queue, +static int rkisp_queue_setup(struct vb2_queue *queue, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], struct device *alloc_ctxs[]) { - struct rkisp1_stream *stream = queue->drv_priv; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = queue->drv_priv; + struct rkisp_device *dev = stream->ispdev; const struct v4l2_pix_format_mplane *pixm = NULL; const struct capture_fmt *isp_fmt = NULL; u32 i; @@ -1303,22 +1303,22 @@ static int rkisp1_queue_setup(struct vb2_queue *queue, sizes[i] = plane_fmt->sizeimage; } - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, "%s count %d, size %d\n", + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "%s count %d, size %d\n", v4l2_type_names[queue->type], *num_buffers, sizes[0]); return 0; } /* - * The vb2_buffer are stored in rkisp1_buffer, in order to unify + * The vb2_buffer are stored in rkisp_buffer, in order to unify * mplane buffer and none-mplane buffer. */ -static void rkisp1_buf_queue(struct vb2_buffer *vb) +static void rkisp_buf_queue(struct vb2_buffer *vb) { struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct rkisp1_buffer *ispbuf = to_rkisp1_buffer(vbuf); + struct rkisp_buffer *ispbuf = to_rkisp_buffer(vbuf); struct vb2_queue *queue = vb->vb2_queue; - struct rkisp1_stream *stream = queue->drv_priv; + struct rkisp_stream *stream = queue->drv_priv; unsigned long lock_flags = 0; struct v4l2_pix_format_mplane *pixm = &stream->out_fmt; struct capture_fmt *isp_fmt = &stream->out_isp_fmt; @@ -1327,14 +1327,14 @@ static void rkisp1_buf_queue(struct vb2_buffer *vb) memset(ispbuf->buff_addr, 0, sizeof(ispbuf->buff_addr)); for (i = 0; i < isp_fmt->mplanes; i++) { ispbuf->buff_addr[i] = vb2_dma_contig_plane_dma_addr(vb, i); - if (stream->id == RKISP1_STREAM_RAW) { + if (stream->id == RKISP_STREAM_RAW) { /* for check dmatx to ddr complete */ u32 sizeimage = pixm->plane_fmt[0].sizeimage; u32 *buf = vb2_plane_vaddr(vb, 0); if (buf) { - *buf = RKISP1_DMATX_CHECK; - *(buf + sizeimage / 4 - 1) = RKISP1_DMATX_CHECK; + *buf = RKISP_DMATX_CHECK; + *(buf + sizeimage / 4 - 1) = RKISP_DMATX_CHECK; } } } @@ -1360,7 +1360,7 @@ static void rkisp1_buf_queue(struct vb2_buffer *vb) if (stream->streaming && !stream->next_buf && !stream->interlaced && - stream->id != RKISP1_STREAM_RAW && + stream->id != RKISP_STREAM_RAW && atomic_read(&stream->ispdev->isp_sdev.frm_sync_seq) == 0) { stream->next_buf = ispbuf; stream->ops->update_mi(stream); @@ -1370,10 +1370,10 @@ static void rkisp1_buf_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); } -static int rkisp1_create_dummy_buf(struct rkisp1_stream *stream) +static int rkisp_create_dummy_buf(struct rkisp_stream *stream) { - struct rkisp1_dummy_buffer *dummy_buf = &stream->dummy_buf; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_dummy_buffer *dummy_buf = &stream->dummy_buf; + struct rkisp_device *dev = stream->ispdev; /* get a maximum size */ dummy_buf->size = max3(stream->out_fmt.plane_fmt[0].bytesperline * @@ -1385,7 +1385,7 @@ static int rkisp1_create_dummy_buf(struct rkisp1_stream *stream) (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13)) { u32 in_size; - struct rkisp1_stream *raw = &dev->stream[RKISP1_STREAM_RAW]; + struct rkisp_stream *raw = &dev->stream[RKISP_STREAM_RAW]; in_size = raw->out_fmt.plane_fmt[0].sizeimage; dummy_buf->size = max(dummy_buf->size, in_size); @@ -1403,26 +1403,26 @@ static int rkisp1_create_dummy_buf(struct rkisp1_stream *stream) return 0; } -static void rkisp1_destroy_dummy_buf(struct rkisp1_stream *stream) +static void rkisp_destroy_dummy_buf(struct rkisp_stream *stream) { - struct rkisp1_dummy_buffer *dummy_buf = &stream->dummy_buf; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_dummy_buffer *dummy_buf = &stream->dummy_buf; + struct rkisp_device *dev = stream->ispdev; dma_free_coherent(dev->dev, dummy_buf->size, dummy_buf->vaddr, dummy_buf->dma_addr); } -static void rkisp1_stop_streaming(struct vb2_queue *queue) +static void rkisp_stop_streaming(struct vb2_queue *queue) { - struct rkisp1_stream *stream = queue->drv_priv; - struct rkisp1_vdev_node *node = &stream->vnode; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = queue->drv_priv; + struct rkisp_vdev_node *node = &stream->vnode; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; - struct rkisp1_buffer *buf; + struct rkisp_buffer *buf; unsigned long lock_flags = 0; int ret; - rkisp1_stream_stop(stream); + rkisp_stream_stop(stream); /* call to the other devices */ media_pipeline_stop(&node->vdev.entity); ret = dev->pipe.set_stream(&dev->pipe, false); @@ -1444,7 +1444,7 @@ static void rkisp1_stop_streaming(struct vb2_queue *queue) } while (!list_empty(&stream->buf_queue)) { buf = list_first_entry(&stream->buf_queue, - struct rkisp1_buffer, queue); + struct rkisp_buffer, queue); list_del(&buf->queue); vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); } @@ -1453,25 +1453,25 @@ static void rkisp1_stop_streaming(struct vb2_queue *queue) ret = dev->pipe.close(&dev->pipe); if (ret < 0) v4l2_err(v4l2_dev, "pipeline close failed error:%d\n", ret); - rkisp1_destroy_dummy_buf(stream); + rkisp_destroy_dummy_buf(stream); } -static int rkisp1_stream_start(struct rkisp1_stream *stream) +static int rkisp_stream_start(struct rkisp_stream *stream) { struct v4l2_device *v4l2_dev = &stream->ispdev->v4l2_dev; - struct rkisp1_device *dev = stream->ispdev; - struct rkisp1_stream *other = &dev->stream[stream->id ^ 1]; + struct rkisp_device *dev = stream->ispdev; + struct rkisp_stream *other = &dev->stream[stream->id ^ 1]; bool async = false; int ret; /* STREAM RAW don't have rsz and dcrop */ - if (stream->id == RKISP1_STREAM_RAW) + if (stream->id == RKISP_STREAM_RAW) goto end; if (other->streaming) async = true; - ret = rkisp1_config_rsz(stream, async); + ret = rkisp_config_rsz(stream, async); if (ret < 0) { v4l2_err(v4l2_dev, "config rsz failed with error %d\n", ret); return ret; @@ -1481,22 +1481,22 @@ static int rkisp1_stream_start(struct rkisp1_stream *stream) * can't be async now, otherwise the latter started stream fails to * produce mi interrupt. */ - ret = rkisp1_config_dcrop(stream, false); + ret = rkisp_config_dcrop(stream, false); if (ret < 0) { v4l2_err(v4l2_dev, "config dcrop failed with error %d\n", ret); return ret; } end: - return rkisp1_start(stream); + return rkisp_start(stream); } static int -rkisp1_start_streaming(struct vb2_queue *queue, unsigned int count) +rkisp_start_streaming(struct vb2_queue *queue, unsigned int count) { - struct rkisp1_stream *stream = queue->drv_priv; - struct rkisp1_vdev_node *node = &stream->vnode; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = queue->drv_priv; + struct rkisp_vdev_node *node = &stream->vnode; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; int ret; unsigned int i; @@ -1506,7 +1506,7 @@ rkisp1_start_streaming(struct vb2_queue *queue, unsigned int count) if (dev->isp_inp != INP_DMARX_ISP) { /* Always update sensor info in case media topology changed */ - ret = rkisp1_update_sensor_info(dev); + ret = rkisp_update_sensor_info(dev); if (ret < 0) { v4l2_err(v4l2_dev, "update sensor info failed %d\n", @@ -1518,7 +1518,7 @@ rkisp1_start_streaming(struct vb2_queue *queue, unsigned int count) if (dev->active_sensor && dev->active_sensor->fmt.format.field == V4L2_FIELD_INTERLACED) { - if (stream->id != RKISP1_STREAM_SP) { + if (stream->id != RKISP_STREAM_SP) { v4l2_err(v4l2_dev, "only selfpath support interlaced\n"); ret = -EINVAL; @@ -1529,7 +1529,7 @@ rkisp1_start_streaming(struct vb2_queue *queue, unsigned int count) stream->u.sp.field_rec = RKISP_FIELD_INVAL; } - ret = rkisp1_create_dummy_buf(stream); + ret = rkisp_create_dummy_buf(stream); if (ret < 0) goto buffer_done; @@ -1541,7 +1541,7 @@ rkisp1_start_streaming(struct vb2_queue *queue, unsigned int count) } /* configure stream hardware to start */ - ret = rkisp1_stream_start(stream); + ret = rkisp_stream_start(stream); if (ret < 0) { v4l2_err(v4l2_dev, "start streaming failed\n"); goto close_pipe; @@ -1563,11 +1563,11 @@ rkisp1_start_streaming(struct vb2_queue *queue, unsigned int count) pipe_stream_off: dev->pipe.set_stream(&dev->pipe, false); stop_stream: - rkisp1_stream_stop(stream); + rkisp_stream_stop(stream); close_pipe: dev->pipe.close(&dev->pipe); destroy_dummy_buf: - rkisp1_destroy_dummy_buf(stream); + rkisp_destroy_dummy_buf(stream); buffer_done: for (i = 0; i < queue->num_buffers; ++i) { struct vb2_buffer *vb; @@ -1580,29 +1580,29 @@ buffer_done: return ret; } -static struct vb2_ops rkisp1_vb2_ops = { - .queue_setup = rkisp1_queue_setup, - .buf_queue = rkisp1_buf_queue, +static struct vb2_ops rkisp_vb2_ops = { + .queue_setup = rkisp_queue_setup, + .buf_queue = rkisp_buf_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, - .stop_streaming = rkisp1_stop_streaming, - .start_streaming = rkisp1_start_streaming, + .stop_streaming = rkisp_stop_streaming, + .start_streaming = rkisp_start_streaming, }; static int rkisp_init_vb2_queue(struct vb2_queue *q, - struct rkisp1_stream *stream, + struct rkisp_stream *stream, enum v4l2_buf_type buf_type) { - struct rkisp1_vdev_node *node; + struct rkisp_vdev_node *node; node = queue_to_node(q); q->type = buf_type; q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; q->drv_priv = stream; - q->ops = &rkisp1_vb2_ops; + q->ops = &rkisp_vb2_ops; q->mem_ops = &vb2_dma_contig_memops; - q->buf_struct_size = sizeof(struct rkisp1_buffer); + q->buf_struct_size = sizeof(struct rkisp_buffer); q->min_buffers_needed = CIF_ISP_REQ_BUFS_MIN; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = &stream->ispdev->apilock; @@ -1617,24 +1617,24 @@ static int rkisp_init_vb2_queue(struct vb2_queue *q, * recommended to use ISP scale-up function to get output size * that exceeds sensor max resolution. */ -static void restrict_rsz_resolution(struct rkisp1_device *dev, +static void restrict_rsz_resolution(struct rkisp_device *dev, const struct stream_config *config, struct v4l2_rect *max_rsz) { struct v4l2_rect *input_win; - input_win = rkisp1_get_isp_sd_win(&dev->isp_sdev); + input_win = rkisp_get_isp_sd_win(&dev->isp_sdev); max_rsz->width = min_t(int, input_win->width, config->max_rsz_width); max_rsz->height = min_t(int, input_win->height, config->max_rsz_height); } -static int rkisp1_set_fmt(struct rkisp1_stream *stream, +static int rkisp_set_fmt(struct rkisp_stream *stream, struct v4l2_pix_format_mplane *pixm, bool try) { const struct capture_fmt *fmt; const struct stream_config *config = stream->config; - struct rkisp1_stream *other_stream; + struct rkisp_stream *other_stream; unsigned int imagsize = 0; unsigned int planes; u32 xsubs = 1, ysubs = 1; @@ -1651,7 +1651,7 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, return -EINVAL; } - if (stream->id != RKISP1_STREAM_RAW) { + if (stream->id != RKISP_STREAM_RAW) { struct v4l2_rect max_rsz; other_stream = @@ -1664,7 +1664,7 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, config->min_rsz_height, max_rsz.height); } else { other_stream = - &stream->ispdev->stream[RKISP1_STREAM_MP]; + &stream->ispdev->stream[RKISP_STREAM_MP]; } pixm->num_planes = fmt->mplanes; pixm->field = V4L2_FIELD_NONE; @@ -1697,7 +1697,7 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, bytesperline = width * DIV_ROUND_UP(fmt->bpp[i], 8); /* stride is only available for sp stream and y plane */ - if (stream->id != RKISP1_STREAM_SP || i != 0 || + if (stream->id != RKISP_STREAM_SP || i != 0 || plane_fmt->bytesperline < bytesperline) plane_fmt->bytesperline = bytesperline; @@ -1717,15 +1717,15 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, stream->out_isp_fmt = *fmt; stream->out_fmt = *pixm; - if (stream->id == RKISP1_STREAM_SP) { + if (stream->id == RKISP_STREAM_SP) { stream->u.sp.y_stride = pixm->plane_fmt[0].bytesperline / DIV_ROUND_UP(fmt->bpp[0], 8); - } else if (stream->id == RKISP1_STREAM_MP) { + } else if (stream->id == RKISP_STREAM_MP) { stream->u.mp.raw_enable = (fmt->fmt_type == FMT_BAYER); } - v4l2_dbg(1, rkisp1_debug, &stream->ispdev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &stream->ispdev->v4l2_dev, "%s: stream: %d req(%d, %d) out(%d, %d)\n", __func__, stream->id, pixm->width, pixm->height, stream->out_fmt.width, stream->out_fmt.height); @@ -1734,10 +1734,10 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, return 0; } -int rkisp1_fh_open(struct file *filp) +int rkisp_fh_open(struct file *filp) { - struct rkisp1_stream *stream = video_drvdata(filp); - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = video_drvdata(filp); + struct rkisp_device *dev = stream->ispdev; int ret; ret = v4l2_fh_open(filp); @@ -1751,10 +1751,10 @@ int rkisp1_fh_open(struct file *filp) return ret; } -int rkisp1_fop_release(struct file *file) +int rkisp_fop_release(struct file *file) { - struct rkisp1_stream *stream = video_drvdata(file); - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = video_drvdata(file); + struct rkisp_device *dev = stream->ispdev; int ret; ret = vb2_fop_release(file); @@ -1768,17 +1768,17 @@ int rkisp1_fop_release(struct file *file) return ret; } -void rkisp1_set_stream_def_fmt(struct rkisp1_device *dev, u32 id, +void rkisp_set_stream_def_fmt(struct rkisp_device *dev, u32 id, u32 width, u32 height, u32 pixelformat) { - struct rkisp1_stream *stream = &dev->stream[id]; + struct rkisp_stream *stream = &dev->stream[id]; struct v4l2_pix_format_mplane pixm; memset(&pixm, 0, sizeof(pixm)); pixm.pixelformat = pixelformat; pixm.width = width; pixm.height = height; - rkisp1_set_fmt(stream, &pixm, false); + rkisp_set_fmt(stream, &pixm, false); stream->dcrop.left = 0; stream->dcrop.top = 0; @@ -1787,9 +1787,9 @@ void rkisp1_set_stream_def_fmt(struct rkisp1_device *dev, u32 id, } /************************* v4l2_file_operations***************************/ -void rkisp1_stream_init(struct rkisp1_device *dev, u32 id) +void rkisp_stream_init(struct rkisp_device *dev, u32 id) { - struct rkisp1_stream *stream = &dev->stream[id]; + struct rkisp_stream *stream = &dev->stream[id]; memset(stream, 0, sizeof(*stream)); stream->id = id; @@ -1798,15 +1798,15 @@ void rkisp1_stream_init(struct rkisp1_device *dev, u32 id) INIT_LIST_HEAD(&stream->buf_queue); init_waitqueue_head(&stream->done); spin_lock_init(&stream->vbq_lock); - if (stream->id == RKISP1_STREAM_SP) { - stream->ops = &rkisp1_sp_streams_ops; - stream->config = &rkisp1_sp_stream_config; - } else if (stream->id == RKISP1_STREAM_RAW) { - stream->ops = &rkisp1_raw_streams_ops; - stream->config = &rkisp1_raw_stream_config; + if (stream->id == RKISP_STREAM_SP) { + stream->ops = &rkisp_sp_streams_ops; + stream->config = &rkisp_sp_stream_config; + } else if (stream->id == RKISP_STREAM_RAW) { + stream->ops = &rkisp_raw_streams_ops; + stream->config = &rkisp_raw_stream_config; } else { - stream->ops = &rkisp1_mp_streams_ops; - stream->config = &rkisp1_mp_stream_config; + stream->ops = &rkisp_mp_streams_ops; + stream->config = &rkisp_mp_stream_config; } stream->streaming = false; @@ -1817,9 +1817,9 @@ void rkisp1_stream_init(struct rkisp1_device *dev, u32 id) CIF_MI_CTRL_BURST_LEN_CHROM_16; } -static const struct v4l2_file_operations rkisp1_fops = { - .open = rkisp1_fh_open, - .release = rkisp1_fop_release, +static const struct v4l2_file_operations rkisp_fops = { + .open = rkisp_fh_open, + .release = rkisp_fop_release, .unlocked_ioctl = video_ioctl2, .poll = vb2_fop_poll, .mmap = vb2_fop_mmap, @@ -1829,7 +1829,7 @@ static const struct v4l2_file_operations rkisp1_fops = { * mp and sp v4l2_ioctl_ops */ -static int rkisp1_enum_input(struct file *file, void *priv, +static int rkisp_enum_input(struct file *file, void *priv, struct v4l2_input *input) { if (input->index > 0) @@ -1841,18 +1841,18 @@ static int rkisp1_enum_input(struct file *file, void *priv, return 0; } -static int rkisp1_try_fmt_vid_cap_mplane(struct file *file, void *fh, +static int rkisp_try_fmt_vid_cap_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); - return rkisp1_set_fmt(stream, &f->fmt.pix_mp, true); + return rkisp_set_fmt(stream, &f->fmt.pix_mp, true); } static int rkisp_enum_framesizes(struct file *file, void *prov, struct v4l2_frmsizeenum *fsize) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); const struct stream_config *config = stream->config; struct v4l2_frmsize_stepwise *s = &fsize->stepwise; struct v4l2_frmsize_discrete *d = &fsize->discrete; @@ -1867,7 +1867,7 @@ static int rkisp_enum_framesizes(struct file *file, void *prov, restrict_rsz_resolution(stream->ispdev, config, &max_rsz); - input_isp_fmt = rkisp1_get_ispsd_out_fmt(&stream->ispdev->isp_sdev); + input_isp_fmt = rkisp_get_ispsd_out_fmt(&stream->ispdev->isp_sdev); if (input_isp_fmt->fmt_type == FMT_BAYER) { fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; d->width = max_rsz.width; @@ -1888,9 +1888,9 @@ static int rkisp_enum_framesizes(struct file *file, void *prov, static int rkisp_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *fival) { - const struct rkisp1_stream *stream = video_drvdata(file); - struct rkisp1_device *dev = stream->ispdev; - struct rkisp1_sensor_info *sensor = dev->active_sensor; + const struct rkisp_stream *stream = video_drvdata(file); + struct rkisp_device *dev = stream->ispdev; + struct rkisp_sensor_info *sensor = dev->active_sensor; struct v4l2_subdev_frame_interval fi; int ret; @@ -1923,10 +1923,10 @@ static int rkisp_enum_frameintervals(struct file *file, void *fh, return 0; } -static int rkisp1_enum_fmt_vid_cap_mplane(struct file *file, void *priv, +static int rkisp_enum_fmt_vid_cap_mplane(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); const struct capture_fmt *fmt = NULL; if (f->index >= stream->config->fmt_size) @@ -1938,41 +1938,41 @@ static int rkisp1_enum_fmt_vid_cap_mplane(struct file *file, void *priv, return 0; } -static int rkisp1_s_fmt_vid_cap_mplane(struct file *file, +static int rkisp_s_fmt_vid_cap_mplane(struct file *file, void *priv, struct v4l2_format *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); struct video_device *vdev = &stream->vnode.vdev; - struct rkisp1_vdev_node *node = vdev_to_node(vdev); - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_vdev_node *node = vdev_to_node(vdev); + struct rkisp_device *dev = stream->ispdev; if (vb2_is_busy(&node->buf_queue)) { v4l2_err(&dev->v4l2_dev, "%s queue busy\n", __func__); return -EBUSY; } - return rkisp1_set_fmt(stream, &f->fmt.pix_mp, false); + return rkisp_set_fmt(stream, &f->fmt.pix_mp, false); } -static int rkisp1_g_fmt_vid_cap_mplane(struct file *file, void *fh, +static int rkisp_g_fmt_vid_cap_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); f->fmt.pix_mp = stream->out_fmt; return 0; } -static int rkisp1_g_selection(struct file *file, void *prv, +static int rkisp_g_selection(struct file *file, void *prv, struct v4l2_selection *sel) { - struct rkisp1_stream *stream = video_drvdata(file); - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = video_drvdata(file); + struct rkisp_device *dev = stream->ispdev; struct v4l2_rect *dcrop = &stream->dcrop; struct v4l2_rect *input_win; - input_win = rkisp1_get_isp_sd_win(&dev->isp_sdev); + input_win = rkisp_get_isp_sd_win(&dev->isp_sdev); switch (sel->target) { case V4L2_SEL_TGT_CROP_BOUNDS: @@ -1991,14 +1991,14 @@ static int rkisp1_g_selection(struct file *file, void *prv, return 0; } -static struct v4l2_rect *rkisp1_update_crop(struct rkisp1_stream *stream, +static struct v4l2_rect *rkisp_update_crop(struct rkisp_stream *stream, struct v4l2_rect *sel, const struct v4l2_rect *in) { /* Not crop for MP bayer raw data and RAW path */ - if ((stream->id == RKISP1_STREAM_MP && - stream->out_isp_fmt.fmt_type == FMT_BAYER) || - stream->id == RKISP1_STREAM_RAW) { + if ((stream->id == RKISP_STREAM_MP && + stream->out_isp_fmt.fmt_type == FMT_BAYER) || + stream->id == RKISP_STREAM_RAW) { sel->left = 0; sel->top = 0; sel->width = in->width; @@ -2019,13 +2019,13 @@ static struct v4l2_rect *rkisp1_update_crop(struct rkisp1_stream *stream, return sel; } -static int rkisp1_s_selection(struct file *file, void *prv, +static int rkisp_s_selection(struct file *file, void *prv, struct v4l2_selection *sel) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); struct video_device *vdev = &stream->vnode.vdev; - struct rkisp1_vdev_node *node = vdev_to_node(vdev); - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_vdev_node *node = vdev_to_node(vdev); + struct rkisp_device *dev = stream->ispdev; struct v4l2_rect *dcrop = &stream->dcrop; const struct v4l2_rect *input_win; @@ -2034,7 +2034,7 @@ static int rkisp1_s_selection(struct file *file, void *prv, return -EBUSY; } - input_win = rkisp1_get_isp_sd_win(&dev->isp_sdev); + input_win = rkisp_get_isp_sd_win(&dev->isp_sdev); if (sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; @@ -2042,18 +2042,18 @@ static int rkisp1_s_selection(struct file *file, void *prv, if (sel->flags != 0) return -EINVAL; - *dcrop = *rkisp1_update_crop(stream, &sel->r, input_win); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + *dcrop = *rkisp_update_crop(stream, &sel->r, input_win); + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "stream %d crop(%d,%d)/%dx%d\n", stream->id, dcrop->left, dcrop->top, dcrop->width, dcrop->height); return 0; } -static int rkisp1_querycap(struct file *file, void *priv, +static int rkisp_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); struct device *dev = stream->ispdev->dev; struct video_device *vdev = video_devdata(file); @@ -2067,7 +2067,7 @@ static int rkisp1_querycap(struct file *file, void *priv, return 0; } -static const struct v4l2_ioctl_ops rkisp1_v4l2_ioctl_ops = { +static const struct v4l2_ioctl_ops rkisp_v4l2_ioctl_ops = { .vidioc_reqbufs = vb2_ioctl_reqbufs, .vidioc_querybuf = vb2_ioctl_querybuf, .vidioc_create_bufs = vb2_ioctl_create_bufs, @@ -2077,65 +2077,65 @@ static const struct v4l2_ioctl_ops rkisp1_v4l2_ioctl_ops = { .vidioc_prepare_buf = vb2_ioctl_prepare_buf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_enum_input = rkisp1_enum_input, - .vidioc_try_fmt_vid_cap_mplane = rkisp1_try_fmt_vid_cap_mplane, - .vidioc_enum_fmt_vid_cap_mplane = rkisp1_enum_fmt_vid_cap_mplane, - .vidioc_s_fmt_vid_cap_mplane = rkisp1_s_fmt_vid_cap_mplane, - .vidioc_g_fmt_vid_cap_mplane = rkisp1_g_fmt_vid_cap_mplane, - .vidioc_s_selection = rkisp1_s_selection, - .vidioc_g_selection = rkisp1_g_selection, - .vidioc_querycap = rkisp1_querycap, + .vidioc_enum_input = rkisp_enum_input, + .vidioc_try_fmt_vid_cap_mplane = rkisp_try_fmt_vid_cap_mplane, + .vidioc_enum_fmt_vid_cap_mplane = rkisp_enum_fmt_vid_cap_mplane, + .vidioc_s_fmt_vid_cap_mplane = rkisp_s_fmt_vid_cap_mplane, + .vidioc_g_fmt_vid_cap_mplane = rkisp_g_fmt_vid_cap_mplane, + .vidioc_s_selection = rkisp_s_selection, + .vidioc_g_selection = rkisp_g_selection, + .vidioc_querycap = rkisp_querycap, .vidioc_enum_frameintervals = rkisp_enum_frameintervals, .vidioc_enum_framesizes = rkisp_enum_framesizes, }; -static void rkisp1_unregister_stream_vdev(struct rkisp1_stream *stream) +static void rkisp_unregister_stream_vdev(struct rkisp_stream *stream) { media_entity_cleanup(&stream->vnode.vdev.entity); video_unregister_device(&stream->vnode.vdev); } -void rkisp1_unregister_stream_vdevs(struct rkisp1_device *dev) +void rkisp_unregister_stream_vdevs(struct rkisp_device *dev) { - struct rkisp1_stream *mp_stream = &dev->stream[RKISP1_STREAM_MP]; - struct rkisp1_stream *sp_stream = &dev->stream[RKISP1_STREAM_SP]; - struct rkisp1_stream *raw_stream = &dev->stream[RKISP1_STREAM_RAW]; + struct rkisp_stream *mp_stream = &dev->stream[RKISP_STREAM_MP]; + struct rkisp_stream *sp_stream = &dev->stream[RKISP_STREAM_SP]; + struct rkisp_stream *raw_stream = &dev->stream[RKISP_STREAM_RAW]; - rkisp1_unregister_stream_vdev(mp_stream); + rkisp_unregister_stream_vdev(mp_stream); if (dev->isp_ver != ISP_V10_1) - rkisp1_unregister_stream_vdev(sp_stream); + rkisp_unregister_stream_vdev(sp_stream); -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) #else if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) #endif - rkisp1_unregister_stream_vdev(raw_stream); + rkisp_unregister_stream_vdev(raw_stream); } -static int rkisp1_register_stream_vdev(struct rkisp1_stream *stream) +static int rkisp_register_stream_vdev(struct rkisp_stream *stream) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; struct video_device *vdev = &stream->vnode.vdev; - struct rkisp1_vdev_node *node; + struct rkisp_vdev_node *node; int ret = 0; char *vdev_name; switch (stream->id) { - case RKISP1_STREAM_SP: + case RKISP_STREAM_SP: vdev_name = SP_VDEV_NAME; if (dev->isp_ver == ISP_V10_1) return 0; break; - case RKISP1_STREAM_MP: + case RKISP_STREAM_MP: vdev_name = MP_VDEV_NAME; break; - case RKISP1_STREAM_RAW: + case RKISP_STREAM_RAW: vdev_name = RAW_VDEV_NAME; -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver != ISP_V13) #else if (dev->isp_ver != ISP_V12 && @@ -2150,9 +2150,9 @@ static int rkisp1_register_stream_vdev(struct rkisp1_stream *stream) strlcpy(vdev->name, vdev_name, sizeof(vdev->name)); node = vdev_to_node(vdev); - vdev->ioctl_ops = &rkisp1_v4l2_ioctl_ops; + vdev->ioctl_ops = &rkisp_v4l2_ioctl_ops; vdev->release = video_device_release_empty; - vdev->fops = &rkisp1_fops; + vdev->fops = &rkisp_fops; vdev->minor = -1; vdev->v4l2_dev = v4l2_dev; vdev->lock = &dev->apilock; @@ -2183,15 +2183,15 @@ unreg: return ret; } -int rkisp1_register_stream_vdevs(struct rkisp1_device *dev) +int rkisp_register_stream_vdevs(struct rkisp_device *dev) { - struct rkisp1_stream *stream; + struct rkisp_stream *stream; int i, j, ret; - for (i = 0; i < RKISP1_MAX_STREAM; i++) { + for (i = 0; i < RKISP_MAX_STREAM; i++) { stream = &dev->stream[i]; stream->ispdev = dev; - ret = rkisp1_register_stream_vdev(stream); + ret = rkisp_register_stream_vdev(stream); if (ret < 0) goto err; } @@ -2200,7 +2200,7 @@ int rkisp1_register_stream_vdevs(struct rkisp1_device *dev) err: for (j = 0; j < i; j++) { stream = &dev->stream[j]; - rkisp1_unregister_stream_vdev(stream); + rkisp_unregister_stream_vdev(stream); } return ret; @@ -2208,15 +2208,15 @@ err: /**************** Interrupter Handler ****************/ -void rkisp1_mi_isr(u32 mis_val, struct rkisp1_device *dev) +void rkisp_mi_isr(u32 mis_val, struct rkisp_device *dev) { unsigned int i; if (mis_val & CIF_MI_DMA_READY) - rkisp1_dmarx_isr(mis_val, dev); + rkisp_dmarx_isr(mis_val, dev); for (i = 0; i < ARRAY_SIZE(dev->stream); ++i) { - struct rkisp1_stream *stream = &dev->stream[i]; + struct rkisp_stream *stream = &dev->stream[i]; if (!(mis_val & CIF_MI_FRAME(stream))) continue; @@ -2243,9 +2243,9 @@ void rkisp1_mi_isr(u32 mis_val, struct rkisp1_device *dev) } } -void rkisp1_mipi_dmatx0_end(u32 status, struct rkisp1_device *dev) +void rkisp_mipi_dmatx0_end(u32 status, struct rkisp_device *dev) { - struct rkisp1_stream *stream = &dev->stream[RKISP1_STREAM_RAW]; + struct rkisp_stream *stream = &dev->stream[RKISP_STREAM_RAW]; u32 *buf, end, timeout = 100; if (!(status & 0x1) || !stream->streaming) @@ -2259,9 +2259,9 @@ void rkisp1_mipi_dmatx0_end(u32 status, struct rkisp1_device *dev) */ if (!stream->u.raw.pre_stop) { int i; - struct rkisp1_stream *other = NULL; + struct rkisp_stream *other = NULL; - for (i = 0; i < RKISP1_MAX_STREAM; i++) { + for (i = 0; i < RKISP_MAX_STREAM; i++) { if (i != stream->id && dev->stream[i].streaming) { other = &dev->stream[i]; @@ -2293,7 +2293,7 @@ void rkisp1_mipi_dmatx0_end(u32 status, struct rkisp1_device *dev) if (!buf) goto out; end = *(buf + sizeimage / 4 - 1); - while (end == RKISP1_DMATX_CHECK) { + while (end == RKISP_DMATX_CHECK) { udelay(1); end = *(buf + sizeimage / 4 - 1); if (timeout-- == 0) { diff --git a/drivers/media/platform/rockchip/isp1/capture.h b/drivers/media/platform/rockchip/isp/capture.h similarity index 73% rename from drivers/media/platform/rockchip/isp1/capture.h rename to drivers/media/platform/rockchip/isp/capture.h index 8613618352e9..e9562f590e4e 100644 --- a/drivers/media/platform/rockchip/isp1/capture.h +++ b/drivers/media/platform/rockchip/isp/capture.h @@ -32,12 +32,12 @@ * SOFTWARE. */ -#ifndef _RKISP1_PATH_VIDEO_H -#define _RKISP1_PATH_VIDEO_H +#ifndef _RKISP_PATH_VIDEO_H +#define _RKISP_PATH_VIDEO_H #include "common.h" -struct rkisp1_stream; +struct rkisp_stream; /* * @fourcc: pixel format @@ -64,35 +64,35 @@ struct capture_fmt { u8 bpp[VIDEO_MAX_PLANES]; }; -enum rkisp1_sp_inp { - RKISP1_SP_INP_ISP, - RKISP1_SP_INP_DMA_SP, - RKISP1_SP_INP_MAX +enum rkisp_sp_inp { + RKISP_SP_INP_ISP, + RKISP_SP_INP_DMA_SP, + RKISP_SP_INP_MAX }; -enum rkisp1_field { +enum rkisp_field { RKISP_FIELD_ODD, RKISP_FIELD_EVEN, RKISP_FIELD_INVAL, }; -struct rkisp1_stream_sp { +struct rkisp_stream_sp { int y_stride; int vir_offs; - enum rkisp1_sp_inp input_sel; - enum rkisp1_field field; - enum rkisp1_field field_rec; + enum rkisp_sp_inp input_sel; + enum rkisp_field field; + enum rkisp_field field_rec; }; -struct rkisp1_stream_mp { +struct rkisp_stream_mp { bool raw_enable; }; -struct rkisp1_stream_raw { +struct rkisp_stream_raw { u8 pre_stop; }; -struct rkisp1_stream_dmarx { +struct rkisp_stream_dmarx { int y_stride; }; @@ -154,17 +154,17 @@ struct stream_config { /* Different reg ops between selfpath and mainpath */ struct streams_ops { - int (*config_mi)(struct rkisp1_stream *stream); - void (*stop_mi)(struct rkisp1_stream *stream); - void (*enable_mi)(struct rkisp1_stream *stream); - void (*disable_mi)(struct rkisp1_stream *stream); + int (*config_mi)(struct rkisp_stream *stream); + void (*stop_mi)(struct rkisp_stream *stream); + void (*enable_mi)(struct rkisp_stream *stream); + void (*disable_mi)(struct rkisp_stream *stream); void (*set_data_path)(void __iomem *base); bool (*is_stream_stopped)(void __iomem *base); - void (*update_mi)(struct rkisp1_stream *stream); + void (*update_mi)(struct rkisp_stream *stream); }; /* - * struct rkisp1_stream - ISP capture video device + * struct rkisp_stream - ISP capture video device * * @out_isp_fmt: output isp format * @out_fmt: output buffer size @@ -174,15 +174,15 @@ struct streams_ops { * @buf_queue: queued buffer list * @dummy_buf: dummy space to store dropped data * - * rkisp1 use shadowsock registers, so it need two buffer at a time + * rkisp use shadowsock registers, so it need two buffer at a time * @curr_buf: the buffer used for current frame * @next_buf: the buffer used for next frame */ -struct rkisp1_stream { +struct rkisp_stream { unsigned id:2; unsigned interlaced:1; - struct rkisp1_device *ispdev; - struct rkisp1_vdev_node vnode; + struct rkisp_device *ispdev; + struct rkisp_vdev_node vnode; struct capture_fmt out_isp_fmt; struct v4l2_pix_format_mplane out_fmt; struct v4l2_rect dcrop; @@ -190,30 +190,30 @@ struct rkisp1_stream { struct stream_config *config; spinlock_t vbq_lock; struct list_head buf_queue; - struct rkisp1_dummy_buffer dummy_buf; - struct rkisp1_buffer *curr_buf; - struct rkisp1_buffer *next_buf; + struct rkisp_dummy_buffer dummy_buf; + struct rkisp_buffer *curr_buf; + struct rkisp_buffer *next_buf; bool streaming; bool stopping; bool frame_end; wait_queue_head_t done; unsigned int burst; union { - struct rkisp1_stream_sp sp; - struct rkisp1_stream_mp mp; - struct rkisp1_stream_raw raw; - struct rkisp1_stream_dmarx dmarx; + struct rkisp_stream_sp sp; + struct rkisp_stream_mp mp; + struct rkisp_stream_raw raw; + struct rkisp_stream_dmarx dmarx; } u; }; -void rkisp1_unregister_stream_vdevs(struct rkisp1_device *dev); -int rkisp1_register_stream_vdevs(struct rkisp1_device *dev); -void rkisp1_mi_isr(u32 mis_val, struct rkisp1_device *dev); -void rkisp1_stream_init(struct rkisp1_device *dev, u32 id); -void rkisp1_set_stream_def_fmt(struct rkisp1_device *dev, u32 id, +void rkisp_unregister_stream_vdevs(struct rkisp_device *dev); +int rkisp_register_stream_vdevs(struct rkisp_device *dev); +void rkisp_mi_isr(u32 mis_val, struct rkisp_device *dev); +void rkisp_stream_init(struct rkisp_device *dev, u32 id); +void rkisp_set_stream_def_fmt(struct rkisp_device *dev, u32 id, u32 width, u32 height, u32 pixelformat); -void rkisp1_mipi_dmatx0_end(u32 status, struct rkisp1_device *dev); +void rkisp_mipi_dmatx0_end(u32 status, struct rkisp_device *dev); int fcc_xysubs(u32 fcc, u32 *xsubs, u32 *ysubs); -int rkisp1_fh_open(struct file *filp); -int rkisp1_fop_release(struct file *file); -#endif /* _RKISP1_PATH_VIDEO_H */ +int rkisp_fh_open(struct file *filp); +int rkisp_fop_release(struct file *file); +#endif /* _RKISP_PATH_VIDEO_H */ diff --git a/drivers/media/platform/rockchip/isp1/common.h b/drivers/media/platform/rockchip/isp/common.h similarity index 65% rename from drivers/media/platform/rockchip/isp1/common.h rename to drivers/media/platform/rockchip/isp/common.h index f20a0829c96c..8e784635ec6f 100644 --- a/drivers/media/platform/rockchip/isp1/common.h +++ b/drivers/media/platform/rockchip/isp/common.h @@ -32,8 +32,8 @@ * SOFTWARE. */ -#ifndef _RKISP1_COMMON_H -#define _RKISP1_COMMON_H +#ifndef _RKISP_COMMON_H +#define _RKISP_COMMON_H #include #include @@ -44,38 +44,38 @@ #include #include -#define RKISP1_DEFAULT_WIDTH 800 -#define RKISP1_DEFAULT_HEIGHT 600 +#define RKISP_DEFAULT_WIDTH 800 +#define RKISP_DEFAULT_HEIGHT 600 -#define RKISP1_MAX_STREAM 3 -#define RKISP1_STREAM_MP 0 -#define RKISP1_STREAM_SP 1 -#define RKISP1_STREAM_RAW 2 +#define RKISP_MAX_STREAM 3 +#define RKISP_STREAM_MP 0 +#define RKISP_STREAM_SP 1 +#define RKISP_STREAM_RAW 2 -#define RKISP1_PLANE_Y 0 -#define RKISP1_PLANE_CB 1 -#define RKISP1_PLANE_CR 2 +#define RKISP_PLANE_Y 0 +#define RKISP_PLANE_CB 1 +#define RKISP_PLANE_CR 2 -#define RKISP1_EMDDATA_FIFO_MAX 4 -#define RKISP1_DMATX_CHECK 0xA5A5A5A5 -#define RKISP1_RK3326_USE_OLDMIPI 0 +#define RKISP_EMDDATA_FIFO_MAX 4 +#define RKISP_DMATX_CHECK 0xA5A5A5A5 +#define RKISP_RK3326_USE_OLDMIPI 0 -enum rkisp1_sd_type { - RKISP1_SD_SENSOR, - RKISP1_SD_PHY_CSI, - RKISP1_SD_VCM, - RKISP1_SD_FLASH, - RKISP1_SD_MAX, +enum rkisp_sd_type { + RKISP_SD_SENSOR, + RKISP_SD_PHY_CSI, + RKISP_SD_VCM, + RKISP_SD_FLASH, + RKISP_SD_MAX, }; /* One structure per video node */ -struct rkisp1_vdev_node { +struct rkisp_vdev_node { struct vb2_queue buf_queue; struct video_device vdev; struct media_pad pad; }; -enum rkisp1_fmt_pix_type { +enum rkisp_fmt_pix_type { FMT_YUV, FMT_RGB, FMT_BAYER, @@ -83,14 +83,14 @@ enum rkisp1_fmt_pix_type { FMT_MAX }; -enum rkisp1_fmt_raw_pat_type { +enum rkisp_fmt_raw_pat_type { RAW_RGGB = 0, RAW_GRBG, RAW_GBRG, RAW_BGGR, }; -struct rkisp1_buffer { +struct rkisp_buffer { struct vb2_v4l2_buffer vb; struct list_head queue; union { @@ -99,35 +99,35 @@ struct rkisp1_buffer { }; }; -struct rkisp1_dummy_buffer { +struct rkisp_dummy_buffer { void *vaddr; dma_addr_t dma_addr; u32 size; }; -extern int rkisp1_debug; +extern int rkisp_debug; static inline -struct rkisp1_vdev_node *vdev_to_node(struct video_device *vdev) +struct rkisp_vdev_node *vdev_to_node(struct video_device *vdev) { - return container_of(vdev, struct rkisp1_vdev_node, vdev); + return container_of(vdev, struct rkisp_vdev_node, vdev); } -static inline struct rkisp1_vdev_node *queue_to_node(struct vb2_queue *q) +static inline struct rkisp_vdev_node *queue_to_node(struct vb2_queue *q) { - return container_of(q, struct rkisp1_vdev_node, buf_queue); + return container_of(q, struct rkisp_vdev_node, buf_queue); } -static inline struct rkisp1_buffer *to_rkisp1_buffer(struct vb2_v4l2_buffer *vb) +static inline struct rkisp_buffer *to_rkisp_buffer(struct vb2_v4l2_buffer *vb) { - return container_of(vb, struct rkisp1_buffer, vb); + return container_of(vb, struct rkisp_buffer, vb); } static inline struct vb2_queue *to_vb2_queue(struct file *file) { - struct rkisp1_vdev_node *vnode = video_drvdata(file); + struct rkisp_vdev_node *vnode = video_drvdata(file); return &vnode->buf_queue; } -#endif /* _RKISP1_COMMON_H */ +#endif /* _RKISP_COMMON_H */ diff --git a/drivers/media/platform/rockchip/isp1/dev.c b/drivers/media/platform/rockchip/isp/dev.c similarity index 72% rename from drivers/media/platform/rockchip/isp1/dev.c rename to drivers/media/platform/rockchip/isp/dev.c index a865baaea6f7..4a8e7abd8610 100644 --- a/drivers/media/platform/rockchip/isp1/dev.c +++ b/drivers/media/platform/rockchip/isp/dev.c @@ -48,7 +48,7 @@ #include #include #include "regs.h" -#include "rkisp1.h" +#include "rkisp.h" #include "common.h" #include "version.h" @@ -62,30 +62,30 @@ struct isp_irqs_data { struct isp_match_data { const char * const *clks; int num_clks; - enum rkisp1_isp_ver isp_ver; + enum rkisp_isp_ver isp_ver; const unsigned int *clk_rate_tbl; int num_clk_rate_tbl; struct isp_irqs_data *irqs; int num_irqs; }; -int rkisp1_debug; -module_param_named(debug, rkisp1_debug, int, 0644); +int rkisp_debug; +module_param_named(debug, rkisp_debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level (0-1)"); -static char rkisp1_version[RKISP_VERNO_LEN]; -module_param_string(version, rkisp1_version, RKISP_VERNO_LEN, 0444); +static char rkisp_version[RKISP_VERNO_LEN]; +module_param_string(version, rkisp_version, RKISP_VERNO_LEN, 0444); MODULE_PARM_DESC(version, "version number"); -static DEFINE_MUTEX(rkisp1_dev_mutex); -static LIST_HEAD(rkisp1_device_list); +static DEFINE_MUTEX(rkisp_dev_mutex); +static LIST_HEAD(rkisp_device_list); /**************************** pipeline operations *****************************/ -static int __isp_pipeline_prepare(struct rkisp1_pipeline *p, +static int __isp_pipeline_prepare(struct rkisp_pipeline *p, struct media_entity *me) { - struct rkisp1_device *dev = container_of(p, struct rkisp1_device, pipe); + struct rkisp_device *dev = container_of(p, struct rkisp_device, pipe); struct v4l2_subdev *sd; int i; @@ -127,9 +127,9 @@ static int __isp_pipeline_prepare(struct rkisp1_pipeline *p, return 0; } -static int __isp_pipeline_s_isp_clk(struct rkisp1_pipeline *p) +static int __isp_pipeline_s_isp_clk(struct rkisp_pipeline *p) { - struct rkisp1_device *dev = container_of(p, struct rkisp1_device, pipe); + struct rkisp_device *dev = container_of(p, struct rkisp_device, pipe); struct v4l2_subdev *sd; struct v4l2_ctrl *ctrl; u64 data_rate; @@ -177,13 +177,13 @@ static int __isp_pipeline_s_isp_clk(struct rkisp1_pipeline *p) /* set isp clock rate */ clk_set_rate(dev->clks[0], dev->clk_rate_tbl[i] * 1000000UL); - v4l2_dbg(1, rkisp1_debug, sd, "set isp clk = %luHz\n", + v4l2_dbg(1, rkisp_debug, sd, "set isp clk = %luHz\n", clk_get_rate(dev->clks[0])); return 0; } -static int rkisp1_pipeline_open(struct rkisp1_pipeline *p, +static int rkisp_pipeline_open(struct rkisp_pipeline *p, struct media_entity *me, bool prepare) { @@ -208,7 +208,7 @@ static int rkisp1_pipeline_open(struct rkisp1_pipeline *p, return 0; } -static int rkisp1_pipeline_close(struct rkisp1_pipeline *p) +static int rkisp_pipeline_close(struct rkisp_pipeline *p) { atomic_dec(&p->power_cnt); @@ -219,9 +219,9 @@ static int rkisp1_pipeline_close(struct rkisp1_pipeline *p) * stream-on order: isp_subdev, mipi dphy, sensor * stream-off order: mipi dphy, sensor, isp_subdev */ -static int rkisp1_pipeline_set_stream(struct rkisp1_pipeline *p, bool on) +static int rkisp_pipeline_set_stream(struct rkisp_pipeline *p, bool on) { - struct rkisp1_device *dev = container_of(p, struct rkisp1_device, pipe); + struct rkisp_device *dev = container_of(p, struct rkisp_device, pipe); int i, ret; if ((on && atomic_inc_return(&p->stream_cnt) > 1) || @@ -262,7 +262,7 @@ err_stream_off: /***************************** media controller *******************************/ /* See http://opensource.rock-chips.com/wiki_Rockchip-isp1 for Topology */ -static int rkisp1_create_links(struct rkisp1_device *dev) +static int rkisp_create_links(struct rkisp_device *dev) { struct media_entity *source, *sink; unsigned int flags, s, pad; @@ -270,7 +270,7 @@ static int rkisp1_create_links(struct rkisp1_device *dev) /* sensor links(or mipi-phy) */ for (s = 0; s < dev->num_sensors; ++s) { - struct rkisp1_sensor_info *sensor = &dev->sensors[s]; + struct rkisp_sensor_info *sensor = &dev->sensors[s]; for (pad = 0; pad < sensor->sd->entity.num_pads; pad++) if (sensor->sd->entity.pads[pad].flags & @@ -288,7 +288,7 @@ static int rkisp1_create_links(struct rkisp1_device *dev) ret = media_create_pad_link( &sensor->sd->entity, pad, &dev->isp_sdev.sd.entity, - RKISP1_ISP_PAD_SINK, + RKISP_ISP_PAD_SINK, s ? 0 : MEDIA_LNK_FL_ENABLED); if (ret) { dev_err(dev->dev, @@ -303,7 +303,7 @@ static int rkisp1_create_links(struct rkisp1_device *dev) sink = &dev->isp_sdev.sd.entity; flags = MEDIA_LNK_FL_ENABLED; ret = media_create_pad_link(source, 0, sink, - RKISP1_ISP_PAD_SINK_PARAMS, flags); + RKISP_ISP_PAD_SINK_PARAMS, flags); if (ret < 0) return ret; @@ -311,9 +311,9 @@ static int rkisp1_create_links(struct rkisp1_device *dev) if (dev->isp_ver != ISP_V10_1) { /* SP links */ source = &dev->isp_sdev.sd.entity; - sink = &dev->stream[RKISP1_STREAM_SP].vnode.vdev.entity; + sink = &dev->stream[RKISP_STREAM_SP].vnode.vdev.entity; ret = media_create_pad_link(source, - RKISP1_ISP_PAD_SOURCE_PATH, + RKISP_ISP_PAD_SOURCE_PATH, sink, 0, flags); if (ret < 0) return ret; @@ -321,13 +321,13 @@ static int rkisp1_create_links(struct rkisp1_device *dev) /* MP links */ source = &dev->isp_sdev.sd.entity; - sink = &dev->stream[RKISP1_STREAM_MP].vnode.vdev.entity; - ret = media_create_pad_link(source, RKISP1_ISP_PAD_SOURCE_PATH, - sink, 0, flags); + sink = &dev->stream[RKISP_STREAM_MP].vnode.vdev.entity; + ret = media_create_pad_link(source, RKISP_ISP_PAD_SOURCE_PATH, + sink, 0, flags); if (ret < 0) return ret; -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) { #else if (dev->isp_ver == ISP_V12 || @@ -335,9 +335,9 @@ static int rkisp1_create_links(struct rkisp1_device *dev) #endif /* MIPI RAW links */ source = &dev->isp_sdev.sd.entity; - sink = &dev->stream[RKISP1_STREAM_RAW].vnode.vdev.entity; + sink = &dev->stream[RKISP_STREAM_RAW].vnode.vdev.entity; ret = media_create_pad_link(source, - RKISP1_ISP_PAD_SOURCE_PATH, sink, 0, flags); + RKISP_ISP_PAD_SOURCE_PATH, sink, 0, flags); if (ret < 0) return ret; } @@ -345,11 +345,11 @@ static int rkisp1_create_links(struct rkisp1_device *dev) /* 3A stats links */ source = &dev->isp_sdev.sd.entity; sink = &dev->stats_vdev.vnode.vdev.entity; - return media_create_pad_link(source, RKISP1_ISP_PAD_SOURCE_STATS, + return media_create_pad_link(source, RKISP_ISP_PAD_SOURCE_STATS, sink, 0, flags); } -static int _set_pipeline_default_fmt(struct rkisp1_device *dev) +static int _set_pipeline_default_fmt(struct rkisp_device *dev) { struct v4l2_subdev *isp; struct v4l2_subdev_format fmt; @@ -399,51 +399,51 @@ static int _set_pipeline_default_fmt(struct rkisp1_device *dev) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; memset(&cfg, 0, sizeof(cfg)); - /* change fmt&size for RKISP1_ISP_PAD_SINK */ - fmt.pad = RKISP1_ISP_PAD_SINK; - sel.pad = RKISP1_ISP_PAD_SINK; + /* change fmt&size for RKISP_ISP_PAD_SINK */ + fmt.pad = RKISP_ISP_PAD_SINK; + sel.pad = RKISP_ISP_PAD_SINK; v4l2_subdev_call(isp, pad, set_fmt, &cfg, &fmt); v4l2_subdev_call(isp, pad, set_selection, &cfg, &sel); - /* change fmt&size for RKISP1_ISP_PAD_SOURCE_PATH */ - if ((fmt.format.code & RKISP1_MEDIA_BUS_FMT_MASK) == - RKISP1_MEDIA_BUS_FMT_BAYER) + /* change fmt&size for RKISP_ISP_PAD_SOURCE_PATH */ + if ((fmt.format.code & RKISP_MEDIA_BUS_FMT_MASK) == + RKISP_MEDIA_BUS_FMT_BAYER) fmt.format.code = MEDIA_BUS_FMT_YUYV8_2X8; - fmt.pad = RKISP1_ISP_PAD_SOURCE_PATH; - sel.pad = RKISP1_ISP_PAD_SOURCE_PATH; + fmt.pad = RKISP_ISP_PAD_SOURCE_PATH; + sel.pad = RKISP_ISP_PAD_SOURCE_PATH; v4l2_subdev_call(isp, pad, set_fmt, &cfg, &fmt); v4l2_subdev_call(isp, pad, set_selection, &cfg, &sel); /* change fmt&size of MP/SP */ - rkisp1_set_stream_def_fmt(dev, RKISP1_STREAM_MP, - width, height, V4L2_PIX_FMT_YUYV); + rkisp_set_stream_def_fmt(dev, RKISP_STREAM_MP, + width, height, V4L2_PIX_FMT_YUYV); if (dev->isp_ver != ISP_V10_1) - rkisp1_set_stream_def_fmt(dev, RKISP1_STREAM_SP, - width, height, V4L2_PIX_FMT_YUYV); + rkisp_set_stream_def_fmt(dev, RKISP_STREAM_SP, + width, height, V4L2_PIX_FMT_YUYV); if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) - rkisp1_set_stream_def_fmt(dev, RKISP1_STREAM_RAW, ori_width, - ori_height, rkisp1_mbus_pixelcode_to_v4l2(ori_code)); + rkisp_set_stream_def_fmt(dev, RKISP_STREAM_RAW, ori_width, + ori_height, rkisp_mbus_pixelcode_to_v4l2(ori_code)); return 0; } static int subdev_notifier_complete(struct v4l2_async_notifier *notifier) { - struct rkisp1_device *dev; + struct rkisp_device *dev; int ret; - dev = container_of(notifier, struct rkisp1_device, notifier); + dev = container_of(notifier, struct rkisp_device, notifier); mutex_lock(&dev->media_dev.graph_mutex); - ret = rkisp1_create_links(dev); + ret = rkisp_create_links(dev); if (ret < 0) goto unlock; ret = v4l2_device_register_subdev_nodes(&dev->v4l2_dev); if (ret < 0) goto unlock; - ret = rkisp1_update_sensor_info(dev); + ret = rkisp_update_sensor_info(dev); if (ret < 0) { v4l2_err(&dev->v4l2_dev, "update sensor failed\n"); goto unlock; @@ -460,7 +460,7 @@ unlock: return ret; } -struct rkisp1_async_subdev { +struct rkisp_async_subdev { struct v4l2_async_subdev asd; struct v4l2_mbus_config mbus; }; @@ -469,10 +469,10 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier, struct v4l2_subdev *subdev, struct v4l2_async_subdev *asd) { - struct rkisp1_device *isp_dev = container_of(notifier, - struct rkisp1_device, notifier); - struct rkisp1_async_subdev *s_asd = container_of(asd, - struct rkisp1_async_subdev, asd); + struct rkisp_device *isp_dev = container_of(notifier, + struct rkisp_device, notifier); + struct rkisp_async_subdev *s_asd = container_of(asd, + struct rkisp_async_subdev, asd); if (isp_dev->num_sensors == ARRAY_SIZE(isp_dev->sensors)) return -EBUSY; @@ -481,17 +481,17 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier, isp_dev->sensors[isp_dev->num_sensors].sd = subdev; ++isp_dev->num_sensors; - v4l2_dbg(1, rkisp1_debug, subdev, "Async registered subdev\n"); + v4l2_dbg(1, rkisp_debug, subdev, "Async registered subdev\n"); return 0; } -static int rkisp1_fwnode_parse(struct device *dev, +static int rkisp_fwnode_parse(struct device *dev, struct v4l2_fwnode_endpoint *vep, struct v4l2_async_subdev *asd) { - struct rkisp1_async_subdev *rk_asd = - container_of(asd, struct rkisp1_async_subdev, asd); + struct rkisp_async_subdev *rk_asd = + container_of(asd, struct rkisp_async_subdev, asd); struct v4l2_fwnode_bus_parallel *bus = &vep->bus.parallel; /* @@ -513,15 +513,15 @@ static const struct v4l2_async_notifier_operations subdev_notifier_ops = { .complete = subdev_notifier_complete, }; -static int isp_subdev_notifier(struct rkisp1_device *isp_dev) +static int isp_subdev_notifier(struct rkisp_device *isp_dev) { struct v4l2_async_notifier *ntf = &isp_dev->notifier; struct device *dev = isp_dev->dev; int ret; ret = v4l2_async_notifier_parse_fwnode_endpoints( - dev, ntf, sizeof(struct rkisp1_async_subdev), - rkisp1_fwnode_parse); + dev, ntf, sizeof(struct rkisp_async_subdev), + rkisp_fwnode_parse); if (ret < 0) return ret; @@ -535,28 +535,27 @@ static int isp_subdev_notifier(struct rkisp1_device *isp_dev) /***************************** platform deive *******************************/ -static int rkisp1_register_platform_subdevs(struct rkisp1_device *dev) +static int rkisp_register_platform_subdevs(struct rkisp_device *dev) { int ret; - ret = rkisp1_register_isp_subdev(dev, &dev->v4l2_dev); + ret = rkisp_register_isp_subdev(dev, &dev->v4l2_dev); if (ret < 0) return ret; - ret = rkisp1_register_stream_vdevs(dev); + ret = rkisp_register_stream_vdevs(dev); if (ret < 0) goto err_unreg_isp_subdev; - ret = rkisp1_register_dmarx_vdev(dev); + ret = rkisp_register_dmarx_vdev(dev); if (ret < 0) goto err_unreg_stream_vdev; - ret = rkisp1_register_stats_vdev(&dev->stats_vdev, &dev->v4l2_dev, dev); + ret = rkisp_register_stats_vdev(&dev->stats_vdev, &dev->v4l2_dev, dev); if (ret < 0) goto err_unreg_dmarx_vdev; - ret = rkisp1_register_params_vdev(&dev->params_vdev, &dev->v4l2_dev, - dev); + ret = rkisp_register_params_vdev(&dev->params_vdev, &dev->v4l2_dev, dev); if (ret < 0) goto err_unreg_stats_vdev; @@ -569,103 +568,103 @@ static int rkisp1_register_platform_subdevs(struct rkisp1_device *dev) return 0; err_unreg_params_vdev: - rkisp1_unregister_params_vdev(&dev->params_vdev); + rkisp_unregister_params_vdev(&dev->params_vdev); err_unreg_stats_vdev: - rkisp1_unregister_stats_vdev(&dev->stats_vdev); + rkisp_unregister_stats_vdev(&dev->stats_vdev); err_unreg_dmarx_vdev: - rkisp1_unregister_dmarx_vdev(dev); + rkisp_unregister_dmarx_vdev(dev); err_unreg_stream_vdev: - rkisp1_unregister_stream_vdevs(dev); + rkisp_unregister_stream_vdevs(dev); err_unreg_isp_subdev: - rkisp1_unregister_isp_subdev(dev); + rkisp_unregister_isp_subdev(dev); return ret; } -static irqreturn_t rkisp1_irq_handler(int irq, void *ctx) +static irqreturn_t rkisp_irq_handler(int irq, void *ctx) { struct device *dev = ctx; - struct rkisp1_device *rkisp1_dev = dev_get_drvdata(dev); + struct rkisp_device *rkisp_dev = dev_get_drvdata(dev); unsigned int mis_val; - mis_val = readl(rkisp1_dev->base_addr + CIF_ISP_MIS); + mis_val = readl(rkisp_dev->base_addr + CIF_ISP_MIS); if (mis_val) - rkisp1_isp_isr(mis_val, rkisp1_dev); + rkisp_isp_isr(mis_val, rkisp_dev); - mis_val = readl(rkisp1_dev->base_addr + CIF_MIPI_MIS); + mis_val = readl(rkisp_dev->base_addr + CIF_MIPI_MIS); if (mis_val) - rkisp1_mipi_isr(mis_val, rkisp1_dev); + rkisp_mipi_isr(mis_val, rkisp_dev); - mis_val = readl(rkisp1_dev->base_addr + CIF_MI_MIS); + mis_val = readl(rkisp_dev->base_addr + CIF_MI_MIS); if (mis_val) - rkisp1_mi_isr(mis_val, rkisp1_dev); + rkisp_mi_isr(mis_val, rkisp_dev); return IRQ_HANDLED; } -static irqreturn_t rkisp1_isp_irq_hdl(int irq, void *ctx) +static irqreturn_t rkisp_isp_irq_hdl(int irq, void *ctx) { struct device *dev = ctx; - struct rkisp1_device *rkisp1_dev = dev_get_drvdata(dev); + struct rkisp_device *rkisp_dev = dev_get_drvdata(dev); unsigned int mis_val; - mis_val = readl(rkisp1_dev->base_addr + CIF_ISP_MIS); + mis_val = readl(rkisp_dev->base_addr + CIF_ISP_MIS); if (mis_val) - rkisp1_isp_isr(mis_val, rkisp1_dev); + rkisp_isp_isr(mis_val, rkisp_dev); return IRQ_HANDLED; } -static irqreturn_t rkisp1_mi_irq_hdl(int irq, void *ctx) +static irqreturn_t rkisp_mi_irq_hdl(int irq, void *ctx) { struct device *dev = ctx; - struct rkisp1_device *rkisp1_dev = dev_get_drvdata(dev); + struct rkisp_device *rkisp_dev = dev_get_drvdata(dev); unsigned int mis_val; - mis_val = readl(rkisp1_dev->base_addr + CIF_MI_MIS); + mis_val = readl(rkisp_dev->base_addr + CIF_MI_MIS); if (mis_val) - rkisp1_mi_isr(mis_val, rkisp1_dev); + rkisp_mi_isr(mis_val, rkisp_dev); return IRQ_HANDLED; } -static irqreturn_t rkisp1_mipi_irq_hdl(int irq, void *ctx) +static irqreturn_t rkisp_mipi_irq_hdl(int irq, void *ctx) { struct device *dev = ctx; - struct rkisp1_device *rkisp1_dev = dev_get_drvdata(dev); + struct rkisp_device *rkisp_dev = dev_get_drvdata(dev); unsigned int mis_val; unsigned int err1, err2, err3; -#if RKISP1_RK3326_USE_OLDMIPI - if (rkisp1_dev->isp_ver == ISP_V13) { +#if RKISP_RK3326_USE_OLDMIPI + if (rkisp_dev->isp_ver == ISP_V13) { #else - if (rkisp1_dev->isp_ver == ISP_V13 || - rkisp1_dev->isp_ver == ISP_V12) { + if (rkisp_dev->isp_ver == ISP_V13 || + rkisp_dev->isp_ver == ISP_V12) { #endif - err1 = readl(rkisp1_dev->base_addr + CIF_ISP_CSI0_ERR1); - err2 = readl(rkisp1_dev->base_addr + CIF_ISP_CSI0_ERR2); - err3 = readl(rkisp1_dev->base_addr + CIF_ISP_CSI0_ERR3); + err1 = readl(rkisp_dev->base_addr + CIF_ISP_CSI0_ERR1); + err2 = readl(rkisp_dev->base_addr + CIF_ISP_CSI0_ERR2); + err3 = readl(rkisp_dev->base_addr + CIF_ISP_CSI0_ERR3); if (err3 & 0x1) - rkisp1_mipi_dmatx0_end(err3, rkisp1_dev); + rkisp_mipi_dmatx0_end(err3, rkisp_dev); if (err1 || err2 || err3) - rkisp1_mipi_v13_isr(err1, err2, err3, rkisp1_dev); + rkisp_mipi_v13_isr(err1, err2, err3, rkisp_dev); } else { - mis_val = readl(rkisp1_dev->base_addr + CIF_MIPI_MIS); + mis_val = readl(rkisp_dev->base_addr + CIF_MIPI_MIS); if (mis_val) - rkisp1_mipi_isr(mis_val, rkisp1_dev); + rkisp_mipi_isr(mis_val, rkisp_dev); /* * As default interrupt mask for csi_rx are on, * when resetting isp, interrupt from csi_rx maybe arise, * we should clear them. */ -#if RKISP1_RK3326_USE_OLDMIPI - if (rkisp1_dev->isp_ver == ISP_V12) { +#if RKISP_RK3326_USE_OLDMIPI + if (rkisp_dev->isp_ver == ISP_V12) { /* read error state register to clear interrupt state */ - readl(rkisp1_dev->base_addr + CIF_ISP_CSI0_ERR1); - readl(rkisp1_dev->base_addr + CIF_ISP_CSI0_ERR2); - readl(rkisp1_dev->base_addr + CIF_ISP_CSI0_ERR3); + readl(rkisp_dev->base_addr + CIF_ISP_CSI0_ERR1); + readl(rkisp_dev->base_addr + CIF_ISP_CSI0_ERR2); + readl(rkisp_dev->base_addr + CIF_ISP_CSI0_ERR3); } #endif } @@ -737,27 +736,27 @@ static const unsigned int rk3399_isp_clk_rate[] = { }; static struct isp_irqs_data rk1808_isp_irqs[] = { - {"isp_irq", rkisp1_isp_irq_hdl}, - {"mi_irq", rkisp1_mi_irq_hdl}, - {"mipi_irq", rkisp1_mipi_irq_hdl} + {"isp_irq", rkisp_isp_irq_hdl}, + {"mi_irq", rkisp_mi_irq_hdl}, + {"mipi_irq", rkisp_mipi_irq_hdl} }; static struct isp_irqs_data rk3288_isp_irqs[] = { - {"isp_irq", rkisp1_irq_handler} + {"isp_irq", rkisp_irq_handler} }; static struct isp_irqs_data rk3326_isp_irqs[] = { - {"isp_irq", rkisp1_isp_irq_hdl}, - {"mi_irq", rkisp1_mi_irq_hdl}, - {"mipi_irq", rkisp1_mipi_irq_hdl} + {"isp_irq", rkisp_isp_irq_hdl}, + {"mi_irq", rkisp_mi_irq_hdl}, + {"mipi_irq", rkisp_mipi_irq_hdl} }; static struct isp_irqs_data rk3368_isp_irqs[] = { - {"isp_irq", rkisp1_irq_handler} + {"isp_irq", rkisp_irq_handler} }; static struct isp_irqs_data rk3399_isp_irqs[] = { - {"isp_irq", rkisp1_irq_handler} + {"isp_irq", rkisp_irq_handler} }; static const struct isp_match_data rk1808_isp_match_data = { @@ -810,7 +809,7 @@ static const struct isp_match_data rk3399_isp_match_data = { .num_irqs = ARRAY_SIZE(rk3399_isp_irqs) }; -static const struct of_device_id rkisp1_plat_of_match[] = { +static const struct of_device_id rkisp_plat_of_match[] = { { .compatible = "rockchip,rk1808-rkisp1", .data = &rk1808_isp_match_data, @@ -830,22 +829,22 @@ static const struct of_device_id rkisp1_plat_of_match[] = { {}, }; -static void rkisp1_disable_sys_clk(struct rkisp1_device *rkisp1_dev) +static void rkisp_disable_sys_clk(struct rkisp_device *rkisp_dev) { int i; - for (i = rkisp1_dev->num_clks - 1; i >= 0; i--) - if (!IS_ERR(rkisp1_dev->clks[i])) - clk_disable_unprepare(rkisp1_dev->clks[i]); + for (i = rkisp_dev->num_clks - 1; i >= 0; i--) + if (!IS_ERR(rkisp_dev->clks[i])) + clk_disable_unprepare(rkisp_dev->clks[i]); } -static int rkisp1_enable_sys_clk(struct rkisp1_device *rkisp1_dev) +static int rkisp_enable_sys_clk(struct rkisp_device *rkisp_dev) { int i, ret = -EINVAL; - for (i = 0; i < rkisp1_dev->num_clks; i++) { - if (!IS_ERR(rkisp1_dev->clks[i])) { - ret = clk_prepare_enable(rkisp1_dev->clks[i]); + for (i = 0; i < rkisp_dev->num_clks; i++) { + if (!IS_ERR(rkisp_dev->clks[i])) { + ret = clk_prepare_enable(rkisp_dev->clks[i]); if (ret < 0) goto err; } @@ -853,8 +852,8 @@ static int rkisp1_enable_sys_clk(struct rkisp1_device *rkisp1_dev) return 0; err: for (--i; i >= 0; --i) - if (!IS_ERR(rkisp1_dev->clks[i])) - clk_disable_unprepare(rkisp1_dev->clks[i]); + if (!IS_ERR(rkisp_dev->clks[i])) + clk_disable_unprepare(rkisp_dev->clks[i]); return ret; } @@ -876,14 +875,14 @@ static inline bool is_iommu_enable(struct device *dev) return true; } -static int rkisp1_vs_irq_parse(struct platform_device *pdev) +static int rkisp_vs_irq_parse(struct platform_device *pdev) { int ret; int vs_irq; unsigned long vs_irq_flags; struct gpio_desc *vs_irq_gpio; struct device *dev = &pdev->dev; - struct rkisp1_device *isp_dev = dev_get_drvdata(dev); + struct rkisp_device *isp_dev = dev_get_drvdata(dev); /* this irq recevice the message of sensor vs from preisp */ isp_dev->vs_irq = -1; @@ -901,7 +900,7 @@ static int rkisp1_vs_irq_parse(struct platform_device *pdev) dev_info(dev, "register_irq: %d\n", vs_irq); ret = devm_request_irq(dev, vs_irq, - rkisp1_vs_isr_handler, + rkisp_vs_isr_handler, vs_irq_flags, "vs_irq_gpio_int", dev); @@ -919,29 +918,29 @@ static int rkisp1_vs_irq_parse(struct platform_device *pdev) return 0; } -static const struct media_device_ops rkisp1_media_ops = { +static const struct media_device_ops rkisp_media_ops = { .link_notify = v4l2_pipeline_link_notify, }; -static int rkisp1_plat_probe(struct platform_device *pdev) +static int rkisp_plat_probe(struct platform_device *pdev) { const struct of_device_id *match; struct device_node *node = pdev->dev.of_node; struct device *dev = &pdev->dev; struct v4l2_device *v4l2_dev; - struct rkisp1_device *isp_dev; + struct rkisp_device *isp_dev; const struct isp_match_data *match_data; struct resource *res; int i, ret, irq; - sprintf(rkisp1_version, "v%02x.%02x.%02x", - RKISP1_DRIVER_VERSION >> 16, - (RKISP1_DRIVER_VERSION & 0xff00) >> 8, - RKISP1_DRIVER_VERSION & 0x00ff); + sprintf(rkisp_version, "v%02x.%02x.%02x", + RKISP_DRIVER_VERSION >> 16, + (RKISP_DRIVER_VERSION & 0xff00) >> 8, + RKISP_DRIVER_VERSION & 0x00ff); - dev_info(dev, "rkisp1 driver version: %s\n", rkisp1_version); + dev_info(dev, "rkisp driver version: %s\n", rkisp_version); - match = of_match_node(rkisp1_plat_of_match, node); + match = of_match_node(rkisp_plat_of_match, node); isp_dev = devm_kzalloc(dev, sizeof(*isp_dev), GFP_KERNEL); if (!isp_dev) return -ENOMEM; @@ -1001,7 +1000,7 @@ static int rkisp1_plat_probe(struct platform_device *pdev) } ret = devm_request_irq(dev, irq, - rkisp1_irq_handler, + rkisp_irq_handler, IRQF_SHARED, dev_driver_string(dev), dev); @@ -1029,21 +1028,21 @@ static int rkisp1_plat_probe(struct platform_device *pdev) atomic_set(&isp_dev->pipe.stream_cnt, 0); atomic_set(&isp_dev->open_cnt, 0); init_waitqueue_head(&isp_dev->sync_onoff); - isp_dev->pipe.open = rkisp1_pipeline_open; - isp_dev->pipe.close = rkisp1_pipeline_close; - isp_dev->pipe.set_stream = rkisp1_pipeline_set_stream; + isp_dev->pipe.open = rkisp_pipeline_open; + isp_dev->pipe.close = rkisp_pipeline_close; + isp_dev->pipe.set_stream = rkisp_pipeline_set_stream; - rkisp1_stream_init(isp_dev, RKISP1_STREAM_SP); - rkisp1_stream_init(isp_dev, RKISP1_STREAM_MP); - rkisp1_stream_init(isp_dev, RKISP1_STREAM_RAW); + rkisp_stream_init(isp_dev, RKISP_STREAM_SP); + rkisp_stream_init(isp_dev, RKISP_STREAM_MP); + rkisp_stream_init(isp_dev, RKISP_STREAM_RAW); - strlcpy(isp_dev->media_dev.model, "rkisp1", + strlcpy(isp_dev->media_dev.model, DRIVER_NAME, sizeof(isp_dev->media_dev.model)); isp_dev->media_dev.dev = &pdev->dev; - isp_dev->media_dev.ops = &rkisp1_media_ops; + isp_dev->media_dev.ops = &rkisp_media_ops; v4l2_dev = &isp_dev->v4l2_dev; v4l2_dev->mdev = &isp_dev->media_dev; - strlcpy(v4l2_dev->name, "rkisp1", sizeof(v4l2_dev->name)); + strlcpy(v4l2_dev->name, DRIVER_NAME, sizeof(v4l2_dev->name)); v4l2_ctrl_handler_init(&isp_dev->ctrl_handler, 5); v4l2_dev->ctrl_handler = &isp_dev->ctrl_handler; @@ -1063,7 +1062,7 @@ static int rkisp1_plat_probe(struct platform_device *pdev) } /* create & register platefom subdev (from of_node) */ - ret = rkisp1_register_platform_subdevs(isp_dev); + ret = rkisp_register_platform_subdevs(isp_dev); if (ret < 0) goto err_unreg_media_dev; @@ -1076,13 +1075,13 @@ static int rkisp1_plat_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); - ret = rkisp1_vs_irq_parse(pdev); + ret = rkisp_vs_irq_parse(pdev); if (ret) goto err_runtime_disable; - mutex_lock(&rkisp1_dev_mutex); - list_add_tail(&isp_dev->list, &rkisp1_device_list); - mutex_unlock(&rkisp1_dev_mutex); + mutex_lock(&rkisp_dev_mutex); + list_add_tail(&isp_dev->list, &rkisp_device_list); + mutex_unlock(&rkisp_dev_mutex); return 0; err_runtime_disable: @@ -1095,44 +1094,44 @@ err_unreg_v4l2_dev: return ret; } -static int rkisp1_plat_remove(struct platform_device *pdev) +static int rkisp_plat_remove(struct platform_device *pdev) { - struct rkisp1_device *isp_dev = platform_get_drvdata(pdev); + struct rkisp_device *isp_dev = platform_get_drvdata(pdev); pm_runtime_disable(&pdev->dev); media_device_unregister(&isp_dev->media_dev); v4l2_device_unregister(&isp_dev->v4l2_dev); - rkisp1_unregister_params_vdev(&isp_dev->params_vdev); - rkisp1_unregister_stats_vdev(&isp_dev->stats_vdev); - rkisp1_unregister_stream_vdevs(isp_dev); - rkisp1_unregister_isp_subdev(isp_dev); + rkisp_unregister_params_vdev(&isp_dev->params_vdev); + rkisp_unregister_stats_vdev(&isp_dev->stats_vdev); + rkisp_unregister_stream_vdevs(isp_dev); + rkisp_unregister_isp_subdev(isp_dev); media_device_cleanup(&isp_dev->media_dev); return 0; } -static int __maybe_unused rkisp1_runtime_suspend(struct device *dev) +static int __maybe_unused rkisp_runtime_suspend(struct device *dev) { - struct rkisp1_device *isp_dev = dev_get_drvdata(dev); + struct rkisp_device *isp_dev = dev_get_drvdata(dev); if (isp_dev->isp_ver == ISP_V12 || isp_dev->isp_ver == ISP_V13) { if (isp_dev->mipi_irq >= 0) disable_irq(isp_dev->mipi_irq); } - rkisp1_disable_sys_clk(isp_dev); + rkisp_disable_sys_clk(isp_dev); return pinctrl_pm_select_sleep_state(dev); } -static int __maybe_unused rkisp1_runtime_resume(struct device *dev) +static int __maybe_unused rkisp_runtime_resume(struct device *dev) { - struct rkisp1_device *isp_dev = dev_get_drvdata(dev); + struct rkisp_device *isp_dev = dev_get_drvdata(dev); int ret; ret = pinctrl_pm_select_default_state(dev); if (ret < 0) return ret; - rkisp1_enable_sys_clk(isp_dev); + rkisp_enable_sys_clk(isp_dev); if (isp_dev->isp_ver == ISP_V12 || isp_dev->isp_ver == ISP_V13) { writel(0, isp_dev->base_addr + CIF_ISP_CSI0_MASK1); @@ -1145,36 +1144,36 @@ static int __maybe_unused rkisp1_runtime_resume(struct device *dev) return 0; } -static int __init rkisp1_clr_unready_dev(void) +static int __init rkisp_clr_unready_dev(void) { - struct rkisp1_device *isp_dev; + struct rkisp_device *isp_dev; - mutex_lock(&rkisp1_dev_mutex); - list_for_each_entry(isp_dev, &rkisp1_device_list, list) + mutex_lock(&rkisp_dev_mutex); + list_for_each_entry(isp_dev, &rkisp_device_list, list) v4l2_async_notifier_clr_unready_dev(&isp_dev->notifier); - mutex_unlock(&rkisp1_dev_mutex); + mutex_unlock(&rkisp_dev_mutex); return 0; } -late_initcall_sync(rkisp1_clr_unready_dev); +late_initcall_sync(rkisp_clr_unready_dev); -static const struct dev_pm_ops rkisp1_plat_pm_ops = { +static const struct dev_pm_ops rkisp_plat_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(rkisp1_runtime_suspend, rkisp1_runtime_resume, NULL) + SET_RUNTIME_PM_OPS(rkisp_runtime_suspend, rkisp_runtime_resume, NULL) }; -static struct platform_driver rkisp1_plat_drv = { +static struct platform_driver rkisp_plat_drv = { .driver = { .name = DRIVER_NAME, - .of_match_table = of_match_ptr(rkisp1_plat_of_match), - .pm = &rkisp1_plat_pm_ops, + .of_match_table = of_match_ptr(rkisp_plat_of_match), + .pm = &rkisp_plat_pm_ops, }, - .probe = rkisp1_plat_probe, - .remove = rkisp1_plat_remove, + .probe = rkisp_plat_probe, + .remove = rkisp_plat_remove, }; -module_platform_driver(rkisp1_plat_drv); +module_platform_driver(rkisp_plat_drv); MODULE_AUTHOR("Rockchip Camera/ISP team"); -MODULE_DESCRIPTION("Rockchip ISP1 platform driver"); +MODULE_DESCRIPTION("Rockchip ISP platform driver"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/media/platform/rockchip/isp1/dev.h b/drivers/media/platform/rockchip/isp/dev.h similarity index 72% rename from drivers/media/platform/rockchip/isp1/dev.h rename to drivers/media/platform/rockchip/isp/dev.h index 980f7711302d..ddaeb100acb0 100644 --- a/drivers/media/platform/rockchip/isp1/dev.h +++ b/drivers/media/platform/rockchip/isp/dev.h @@ -32,12 +32,12 @@ * SOFTWARE. */ -#ifndef _RKISP1_DEV_H -#define _RKISP1_DEV_H +#ifndef _RKISP_DEV_H +#define _RKISP_DEV_H #include "capture.h" #include "dmarx.h" -#include "rkisp1.h" +#include "rkisp.h" #include "isp_params.h" #include "isp_stats.h" @@ -55,17 +55,17 @@ #define GRP_ID_ISP_SP BIT(4) #define GRP_ID_ISP_DMARX BIT(5) -#define RKISP1_MAX_BUS_CLK 8 -#define RKISP1_MAX_SENSOR 2 -#define RKISP1_MAX_PIPELINE 4 +#define RKISP_MAX_BUS_CLK 8 +#define RKISP_MAX_SENSOR 2 +#define RKISP_MAX_PIPELINE 4 -#define RKISP1_MEDIA_BUS_FMT_MASK 0xF000 -#define RKISP1_MEDIA_BUS_FMT_BAYER 0x3000 +#define RKISP_MEDIA_BUS_FMT_MASK 0xF000 +#define RKISP_MEDIA_BUS_FMT_BAYER 0x3000 -#define RKISP1_CONTI_ERR_MAX 50 +#define RKISP_CONTI_ERR_MAX 50 /* ISP_V10_1 for only support MP */ -enum rkisp1_isp_ver { +enum rkisp_isp_ver { ISP_V10 = 0x00, ISP_V10_1 = 0x01, ISP_V11 = 0x10, @@ -73,13 +73,13 @@ enum rkisp1_isp_ver { ISP_V13 = 0x30, }; -enum rkisp1_isp_state { +enum rkisp_isp_state { ISP_STOP = 0, ISP_START, ISP_ERROR }; -enum rkisp1_isp_inp { +enum rkisp_isp_inp { INP_INVAL = 0, INP_CSI, INP_DVP, @@ -87,7 +87,7 @@ enum rkisp1_isp_inp { }; /* - * struct rkisp1_pipeline - An ISP hardware pipeline + * struct rkisp_pipeline - An ISP hardware pipeline * * Capture device call other devices via pipeline * @@ -95,23 +95,23 @@ enum rkisp1_isp_inp { * @power_cnt: pipeline power count * @stream_cnt: stream power count */ -struct rkisp1_pipeline { +struct rkisp_pipeline { struct media_pipeline pipe; int num_subdevs; atomic_t power_cnt; atomic_t stream_cnt; - struct v4l2_subdev *subdevs[RKISP1_MAX_PIPELINE]; - int (*open)(struct rkisp1_pipeline *p, + struct v4l2_subdev *subdevs[RKISP_MAX_PIPELINE]; + int (*open)(struct rkisp_pipeline *p, struct media_entity *me, bool prepare); - int (*close)(struct rkisp1_pipeline *p); - int (*set_stream)(struct rkisp1_pipeline *p, bool on); + int (*close)(struct rkisp_pipeline *p); + int (*set_stream)(struct rkisp_pipeline *p, bool on); }; /* - * struct rkisp1_sensor_info - Sensor infomations + * struct rkisp_sensor_info - Sensor infomations * @mbus: media bus configuration */ -struct rkisp1_sensor_info { +struct rkisp_sensor_info { struct v4l2_subdev *sd; struct v4l2_mbus_config mbus; struct v4l2_subdev_format fmt; @@ -119,42 +119,42 @@ struct rkisp1_sensor_info { }; /* - * struct rkisp1_device - ISP platform device + * struct rkisp_device - ISP platform device * @base_addr: base register address * @active_sensor: sensor in-use, set when streaming on * @isp_sdev: ISP sub-device - * @rkisp1_stream: capture video device + * @rkisp_stream: capture video device * @stats_vdev: ISP statistics output device * @params_vdev: ISP input parameters device */ -struct rkisp1_device { +struct rkisp_device { struct list_head list; struct regmap *grf; void __iomem *base_addr; int irq; struct device *dev; - struct clk *clks[RKISP1_MAX_BUS_CLK]; + struct clk *clks[RKISP_MAX_BUS_CLK]; int num_clks; struct v4l2_device v4l2_dev; struct v4l2_ctrl_handler ctrl_handler; struct media_device media_dev; struct v4l2_async_notifier notifier; - struct v4l2_subdev *subdevs[RKISP1_SD_MAX]; - struct rkisp1_sensor_info *active_sensor; - struct rkisp1_sensor_info sensors[RKISP1_MAX_SENSOR]; + struct v4l2_subdev *subdevs[RKISP_SD_MAX]; + struct rkisp_sensor_info *active_sensor; + struct rkisp_sensor_info sensors[RKISP_MAX_SENSOR]; int num_sensors; - struct rkisp1_isp_subdev isp_sdev; - struct rkisp1_stream stream[RKISP1_MAX_STREAM]; - struct rkisp1_isp_stats_vdev stats_vdev; - struct rkisp1_isp_params_vdev params_vdev; - struct rkisp1_dmarx_device dmarx_dev; - struct rkisp1_pipeline pipe; + struct rkisp_isp_subdev isp_sdev; + struct rkisp_stream stream[RKISP_MAX_STREAM]; + struct rkisp_isp_stats_vdev stats_vdev; + struct rkisp_isp_params_vdev params_vdev; + struct rkisp_dmarx_device dmarx_dev; + struct rkisp_pipeline pipe; struct iommu_domain *domain; - enum rkisp1_isp_ver isp_ver; + enum rkisp_isp_ver isp_ver; const unsigned int *clk_rate_tbl; int num_clk_rate_tbl; atomic_t open_cnt; - struct rkisp1_emd_data emd_data_fifo[RKISP1_EMDDATA_FIFO_MAX]; + struct rkisp_emd_data emd_data_fifo[RKISP_EMDDATA_FIFO_MAX]; unsigned int emd_data_idx; unsigned int emd_vc; unsigned int emd_dt; @@ -162,9 +162,9 @@ struct rkisp1_device { int mipi_irq; struct gpio_desc *vs_irq_gpio; struct v4l2_subdev *hdr_sensor; - enum rkisp1_isp_state isp_state; + enum rkisp_isp_state isp_state; unsigned int isp_err_cnt; - enum rkisp1_isp_inp isp_inp; + enum rkisp_isp_inp isp_inp; struct mutex apilock; /* mutex to serialize the calls of stream */ struct mutex iqlock; /* mutex to serialize the calls of iq */ wait_queue_head_t sync_onoff; diff --git a/drivers/media/platform/rockchip/isp1/dmarx.c b/drivers/media/platform/rockchip/isp/dmarx.c similarity index 77% rename from drivers/media/platform/rockchip/isp1/dmarx.c rename to drivers/media/platform/rockchip/isp/dmarx.c index 07e27954e36e..41b122c67820 100644 --- a/drivers/media/platform/rockchip/isp1/dmarx.c +++ b/drivers/media/platform/rockchip/isp/dmarx.c @@ -100,7 +100,7 @@ static const struct capture_fmt dmarx_fmts[] = { } }; -static struct stream_config rkisp1_dmarx_stream_config = { +static struct stream_config rkisp_dmarx_stream_config = { .fmts = dmarx_fmts, .fmt_size = ARRAY_SIZE(dmarx_fmts), .mi = { @@ -112,7 +112,7 @@ static struct stream_config rkisp1_dmarx_stream_config = { }; static const -struct capture_fmt *find_fmt(struct rkisp1_stream *stream, +struct capture_fmt *find_fmt(struct rkisp_stream *stream, const u32 pixelfmt) { const struct capture_fmt *fmt; @@ -126,13 +126,13 @@ struct capture_fmt *find_fmt(struct rkisp1_stream *stream, return NULL; } -static int dmarx_config_mi(struct rkisp1_stream *stream) +static int dmarx_config_mi(struct rkisp_stream *stream) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; void __iomem *base = dev->base_addr; struct capture_fmt *dmarx_in_fmt = &stream->out_isp_fmt; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "%s %dx%x y_stride:%d\n", __func__, stream->out_fmt.width, stream->out_fmt.height, @@ -155,34 +155,34 @@ static int dmarx_config_mi(struct rkisp1_stream *stream) return 0; } -static void update_dmarx(struct rkisp1_stream *stream) +static void update_dmarx(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; if (stream->curr_buf) { mi_set_y_addr(stream, - stream->curr_buf->buff_addr[RKISP1_PLANE_Y]); + stream->curr_buf->buff_addr[RKISP_PLANE_Y]); mi_set_cb_addr(stream, - stream->curr_buf->buff_addr[RKISP1_PLANE_CB]); + stream->curr_buf->buff_addr[RKISP_PLANE_CB]); mi_set_cr_addr(stream, - stream->curr_buf->buff_addr[RKISP1_PLANE_CR]); + stream->curr_buf->buff_addr[RKISP_PLANE_CR]); mi_dmarx_start(base); stream->frame_end = false; } } -static void dmarx_stop_mi(struct rkisp1_stream *stream) +static void dmarx_stop_mi(struct rkisp_stream *stream) { mi_dmarx_ready_disable(stream); } -static struct streams_ops rkisp1_dmarx_streams_ops = { +static struct streams_ops rkisp_dmarx_streams_ops = { .config_mi = dmarx_config_mi, .stop_mi = dmarx_stop_mi, .update_mi = update_dmarx, }; -static int dmarx_frame_end(struct rkisp1_stream *stream) +static int dmarx_frame_end(struct rkisp_stream *stream) { unsigned long lock_flags = 0; @@ -196,7 +196,7 @@ static int dmarx_frame_end(struct rkisp1_stream *stream) if (!list_empty(&stream->buf_queue)) { stream->curr_buf = list_first_entry(&stream->buf_queue, - struct rkisp1_buffer, + struct rkisp_buffer, queue); list_del(&stream->curr_buf->queue); } @@ -208,9 +208,9 @@ static int dmarx_frame_end(struct rkisp1_stream *stream) /***************************** vb2 operations*******************************/ -static void dmarx_stop(struct rkisp1_stream *stream) +static void dmarx_stop(struct rkisp_stream *stream) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; int ret = 0; @@ -232,7 +232,7 @@ static void dmarx_stop(struct rkisp1_stream *stream) stream->frame_end = false; } -static int dmarx_start(struct rkisp1_stream *stream) +static int dmarx_start(struct rkisp_stream *stream) { int ret; @@ -246,14 +246,14 @@ static int dmarx_start(struct rkisp1_stream *stream) return 0; } -static int rkisp1_queue_setup(struct vb2_queue *queue, +static int rkisp_queue_setup(struct vb2_queue *queue, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], struct device *alloc_ctxs[]) { - struct rkisp1_stream *stream = queue->drv_priv; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = queue->drv_priv; + struct rkisp_device *dev = stream->ispdev; const struct v4l2_pix_format_mplane *pixm = NULL; const struct capture_fmt *isp_fmt = NULL; u32 i; @@ -270,22 +270,22 @@ static int rkisp1_queue_setup(struct vb2_queue *queue, sizes[i] = plane_fmt->sizeimage; } - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, "%s count %d, size %d\n", + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "%s count %d, size %d\n", v4l2_type_names[queue->type], *num_buffers, sizes[0]); return 0; } /* - * The vb2_buffer are stored in rkisp1_buffer, in order to unify + * The vb2_buffer are stored in rkisp_buffer, in order to unify * mplane buffer and none-mplane buffer. */ -static void rkisp1_buf_queue(struct vb2_buffer *vb) +static void rkisp_buf_queue(struct vb2_buffer *vb) { struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct rkisp1_buffer *ispbuf = to_rkisp1_buffer(vbuf); + struct rkisp_buffer *ispbuf = to_rkisp_buffer(vbuf); struct vb2_queue *queue = vb->vb2_queue; - struct rkisp1_stream *stream = queue->drv_priv; + struct rkisp_stream *stream = queue->drv_priv; unsigned long lock_flags = 0; struct v4l2_pix_format_mplane *pixm = &stream->out_fmt; struct capture_fmt *isp_fmt = &stream->out_isp_fmt; @@ -324,8 +324,8 @@ static void rkisp1_buf_queue(struct vb2_buffer *vb) static void dmarx_stop_streaming(struct vb2_queue *queue) { - struct rkisp1_stream *stream = queue->drv_priv; - struct rkisp1_buffer *buf; + struct rkisp_stream *stream = queue->drv_priv; + struct rkisp_buffer *buf; unsigned long lock_flags = 0; dmarx_stop(stream); @@ -337,7 +337,7 @@ static void dmarx_stop_streaming(struct vb2_queue *queue) } while (!list_empty(&stream->buf_queue)) { buf = list_first_entry(&stream->buf_queue, - struct rkisp1_buffer, queue); + struct rkisp_buffer, queue); list_del(&buf->queue); vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); } @@ -347,8 +347,8 @@ static void dmarx_stop_streaming(struct vb2_queue *queue) static int dmarx_start_streaming(struct vb2_queue *queue, unsigned int count) { - struct rkisp1_stream *stream = queue->drv_priv; - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_stream *stream = queue->drv_priv; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; int ret = 0; @@ -371,8 +371,8 @@ static int dmarx_start_streaming(struct vb2_queue *queue, } static struct vb2_ops dmarx_vb2_ops = { - .queue_setup = rkisp1_queue_setup, - .buf_queue = rkisp1_buf_queue, + .queue_setup = rkisp_queue_setup, + .buf_queue = rkisp_buf_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, .stop_streaming = dmarx_stop_streaming, @@ -380,10 +380,10 @@ static struct vb2_ops dmarx_vb2_ops = { }; static int rkisp_init_vb2_queue(struct vb2_queue *q, - struct rkisp1_stream *stream, + struct rkisp_stream *stream, enum v4l2_buf_type buf_type) { - struct rkisp1_vdev_node *node; + struct rkisp_vdev_node *node; node = queue_to_node(q); @@ -392,7 +392,7 @@ static int rkisp_init_vb2_queue(struct vb2_queue *q, q->drv_priv = stream; q->ops = &dmarx_vb2_ops; q->mem_ops = &vb2_dma_contig_memops; - q->buf_struct_size = sizeof(struct rkisp1_buffer); + q->buf_struct_size = sizeof(struct rkisp_buffer); q->min_buffers_needed = CIF_ISP_REQ_BUFS_MIN; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = &stream->ispdev->apilock; @@ -400,7 +400,7 @@ static int rkisp_init_vb2_queue(struct vb2_queue *q, return vb2_queue_init(q); } -static int rkisp1_set_fmt(struct rkisp1_stream *stream, +static int rkisp_set_fmt(struct rkisp_stream *stream, struct v4l2_pix_format_mplane *pixm, bool try) { @@ -469,7 +469,7 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, pixm->plane_fmt[0].bytesperline / DIV_ROUND_UP(fmt->bpp[0], 8); - v4l2_dbg(1, rkisp1_debug, &stream->ispdev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &stream->ispdev->v4l2_dev, "%s: stream: %d req(%d, %d) out(%d, %d)\n", __func__, stream->id, pixm->width, pixm->height, stream->out_fmt.width, stream->out_fmt.height); @@ -480,26 +480,26 @@ static int rkisp1_set_fmt(struct rkisp1_stream *stream, /************************* v4l2_file_operations***************************/ -static const struct v4l2_file_operations rkisp1_fops = { - .open = rkisp1_fh_open, - .release = rkisp1_fop_release, +static const struct v4l2_file_operations rkisp_fops = { + .open = rkisp_fh_open, + .release = rkisp_fop_release, .unlocked_ioctl = video_ioctl2, .poll = vb2_fop_poll, .mmap = vb2_fop_mmap, }; -static int rkisp1_try_fmt_vid_out_mplane(struct file *file, void *fh, +static int rkisp_try_fmt_vid_out_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); - return rkisp1_set_fmt(stream, &f->fmt.pix_mp, true); + return rkisp_set_fmt(stream, &f->fmt.pix_mp, true); } -static int rkisp1_enum_fmt_vid_out_mplane(struct file *file, void *priv, +static int rkisp_enum_fmt_vid_out_mplane(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); const struct capture_fmt *fmt = NULL; if (f->index >= stream->config->fmt_size) @@ -511,36 +511,36 @@ static int rkisp1_enum_fmt_vid_out_mplane(struct file *file, void *priv, return 0; } -static int rkisp1_s_fmt_vid_out_mplane(struct file *file, +static int rkisp_s_fmt_vid_out_mplane(struct file *file, void *priv, struct v4l2_format *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); struct video_device *vdev = &stream->vnode.vdev; - struct rkisp1_vdev_node *node = vdev_to_node(vdev); - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_vdev_node *node = vdev_to_node(vdev); + struct rkisp_device *dev = stream->ispdev; if (vb2_is_busy(&node->buf_queue)) { v4l2_err(&dev->v4l2_dev, "%s queue busy\n", __func__); return -EBUSY; } - return rkisp1_set_fmt(stream, &f->fmt.pix_mp, false); + return rkisp_set_fmt(stream, &f->fmt.pix_mp, false); } -static int rkisp1_g_fmt_vid_out_mplane(struct file *file, void *fh, +static int rkisp_g_fmt_vid_out_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); f->fmt.pix_mp = stream->out_fmt; return 0; } -static int rkisp1_querycap(struct file *file, void *priv, +static int rkisp_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct rkisp1_stream *stream = video_drvdata(file); + struct rkisp_stream *stream = video_drvdata(file); struct device *dev = stream->ispdev->dev; struct video_device *vdev = video_devdata(file); @@ -554,7 +554,7 @@ static int rkisp1_querycap(struct file *file, void *priv, return 0; } -static const struct v4l2_ioctl_ops rkisp1_dmarx_ioctl = { +static const struct v4l2_ioctl_ops rkisp_dmarx_ioctl = { .vidioc_reqbufs = vb2_ioctl_reqbufs, .vidioc_querybuf = vb2_ioctl_querybuf, .vidioc_create_bufs = vb2_ioctl_create_bufs, @@ -564,37 +564,37 @@ static const struct v4l2_ioctl_ops rkisp1_dmarx_ioctl = { .vidioc_prepare_buf = vb2_ioctl_prepare_buf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_try_fmt_vid_out_mplane = rkisp1_try_fmt_vid_out_mplane, - .vidioc_enum_fmt_vid_out_mplane = rkisp1_enum_fmt_vid_out_mplane, - .vidioc_s_fmt_vid_out_mplane = rkisp1_s_fmt_vid_out_mplane, - .vidioc_g_fmt_vid_out_mplane = rkisp1_g_fmt_vid_out_mplane, - .vidioc_querycap = rkisp1_querycap, + .vidioc_try_fmt_vid_out_mplane = rkisp_try_fmt_vid_out_mplane, + .vidioc_enum_fmt_vid_out_mplane = rkisp_enum_fmt_vid_out_mplane, + .vidioc_s_fmt_vid_out_mplane = rkisp_s_fmt_vid_out_mplane, + .vidioc_g_fmt_vid_out_mplane = rkisp_g_fmt_vid_out_mplane, + .vidioc_querycap = rkisp_querycap, }; -static void rkisp1_unregister_dmarx_video(struct rkisp1_stream *stream) +static void rkisp_unregister_dmarx_video(struct rkisp_stream *stream) { media_entity_cleanup(&stream->vnode.vdev.entity); video_unregister_device(&stream->vnode.vdev); } -static int rkisp1_register_dmarx_video(struct rkisp1_stream *stream) +static int rkisp_register_dmarx_video(struct rkisp_stream *stream) { - struct rkisp1_device *dev = stream->ispdev; + struct rkisp_device *dev = stream->ispdev; struct v4l2_device *v4l2_dev = &dev->v4l2_dev; struct video_device *vdev = &stream->vnode.vdev; - struct rkisp1_vdev_node *node; + struct rkisp_vdev_node *node; int ret = 0; node = vdev_to_node(vdev); vdev->release = video_device_release_empty; - vdev->fops = &rkisp1_fops; + vdev->fops = &rkisp_fops; vdev->minor = -1; vdev->v4l2_dev = v4l2_dev; vdev->lock = &dev->apilock; video_set_drvdata(vdev, stream); - vdev->ioctl_ops = &rkisp1_dmarx_ioctl; + vdev->ioctl_ops = &rkisp_dmarx_ioctl; vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING; vdev->vfl_dir = VFL_DIR_TX; @@ -623,13 +623,13 @@ unreg: /**************** Interrupter Handler ****************/ -void rkisp1_dmarx_isr(u32 mis_val, struct rkisp1_device *dev) +void rkisp_dmarx_isr(u32 mis_val, struct rkisp_device *dev) { void __iomem *base = dev->base_addr; - struct rkisp1_stream *stream; + struct rkisp_stream *stream; if (mis_val & CIF_MI_DMA_READY) { - stream = &dev->dmarx_dev.stream[RKISP1_STREAM_DMARX]; + stream = &dev->dmarx_dev.stream[RKISP_STREAM_DMARX]; stream->frame_end = true; writel(CIF_MI_DMA_READY, base + CIF_MI_ICR); @@ -643,10 +643,10 @@ void rkisp1_dmarx_isr(u32 mis_val, struct rkisp1_device *dev) } } -int rkisp1_register_dmarx_vdev(struct rkisp1_device *dev) +int rkisp_register_dmarx_vdev(struct rkisp_device *dev) { - struct rkisp1_dmarx_device *dmarx_dev = &dev->dmarx_dev; - struct rkisp1_stream *stream; + struct rkisp_dmarx_device *dmarx_dev = &dev->dmarx_dev; + struct rkisp_stream *stream; struct video_device *vdev; struct media_entity *source, *sink; int ret = 0; @@ -655,17 +655,17 @@ int rkisp1_register_dmarx_vdev(struct rkisp1_device *dev) dmarx_dev->ispdev = dev; if (dev->isp_ver <= ISP_V13) { - stream = &dmarx_dev->stream[RKISP1_STREAM_DMARX]; + stream = &dmarx_dev->stream[RKISP_STREAM_DMARX]; INIT_LIST_HEAD(&stream->buf_queue); init_waitqueue_head(&stream->done); spin_lock_init(&stream->vbq_lock); - stream->id = RKISP1_STREAM_DMARX; + stream->id = RKISP_STREAM_DMARX; stream->ispdev = dev; - stream->ops = &rkisp1_dmarx_streams_ops; - stream->config = &rkisp1_dmarx_stream_config; + stream->ops = &rkisp_dmarx_streams_ops; + stream->config = &rkisp_dmarx_stream_config; vdev = &stream->vnode.vdev; strlcpy(vdev->name, DMA_VDEV_NAME, sizeof(vdev->name)); - ret = rkisp1_register_dmarx_video(stream); + ret = rkisp_register_dmarx_video(stream); if (ret < 0) return ret; @@ -673,19 +673,19 @@ int rkisp1_register_dmarx_vdev(struct rkisp1_device *dev) source = &vdev->entity; sink = &dev->isp_sdev.sd.entity; ret = media_create_pad_link(source, 0, - sink, RKISP1_ISP_PAD_SINK, 0); + sink, RKISP_ISP_PAD_SINK, 0); } return ret; } -void rkisp1_unregister_dmarx_vdev(struct rkisp1_device *dev) +void rkisp_unregister_dmarx_vdev(struct rkisp_device *dev) { - struct rkisp1_dmarx_device *dmarx_dev = &dev->dmarx_dev; - struct rkisp1_stream *stream; + struct rkisp_dmarx_device *dmarx_dev = &dev->dmarx_dev; + struct rkisp_stream *stream; if (dev->isp_ver <= ISP_V13) { - stream = &dmarx_dev->stream[RKISP1_STREAM_DMARX]; - rkisp1_unregister_dmarx_video(stream); + stream = &dmarx_dev->stream[RKISP_STREAM_DMARX]; + rkisp_unregister_dmarx_video(stream); } } diff --git a/drivers/media/platform/rockchip/isp/dmarx.h b/drivers/media/platform/rockchip/isp/dmarx.h new file mode 100644 index 000000000000..cbcf6c31bd9e --- /dev/null +++ b/drivers/media/platform/rockchip/isp/dmarx.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. */ + +#ifndef _RKISP_DMARX_H +#define _RKISP_DMARX_H + +#include "capture.h" +#include "common.h" + +#define RKISP_STREAM_DMARX 0 +#define RKISP_MAX_DMARX_STREAM 1 + +struct rkisp_dmarx_device; + +enum rkisp_dmarx_pad { + RKISP_DMARX_PAD_SINK, + RKISP_DMARX_PAD_SOURCE, + RKISP_DMARX_PAD_MAX +}; + +struct rkisp_dmarx_device { + struct rkisp_device *ispdev; + struct rkisp_stream stream[RKISP_MAX_DMARX_STREAM]; +}; + +void rkisp_dmarx_isr(u32 mis_val, struct rkisp_device *dev); +void rkisp_unregister_dmarx_vdev(struct rkisp_device *dev); +int rkisp_register_dmarx_vdev(struct rkisp_device *dev); +#endif /* _RKISP_DMARX_H */ diff --git a/drivers/media/platform/rockchip/isp1/isp_params.c b/drivers/media/platform/rockchip/isp/isp_params.c similarity index 64% rename from drivers/media/platform/rockchip/isp1/isp_params.c rename to drivers/media/platform/rockchip/isp/isp_params.c index fa1aacce7190..11f34eb08f2b 100644 --- a/drivers/media/platform/rockchip/isp1/isp_params.c +++ b/drivers/media/platform/rockchip/isp/isp_params.c @@ -41,8 +41,8 @@ #include "dev.h" #include "regs.h" -#define RKISP1_ISP_PARAMS_REQ_BUFS_MIN 2 -#define RKISP1_ISP_PARAMS_REQ_BUFS_MAX 8 +#define RKISP_ISP_PARAMS_REQ_BUFS_MIN 2 +#define RKISP_ISP_PARAMS_REQ_BUFS_MAX 8 #define BLS_START_H_MAX_IS_VALID(val) ((val) < CIFISP_BLS_START_H_MAX) #define BLS_STOP_H_MAX_IS_VALID(val) ((val) < CIFISP_BLS_STOP_H_MAX) @@ -55,92 +55,92 @@ #define BLS_FIX_SUB_IS_VALID(val) \ ((val) > (s16) CIFISP_BLS_FIX_SUB_MIN && (val) < CIFISP_BLS_FIX_SUB_MAX) -#define RKISP1_ISP_DPCC_LINE_THRESH(n) (CIF_ISP_DPCC_LINE_THRESH_1 + 0x14 * (n)) -#define RKISP1_ISP_DPCC_LINE_MAD_FAC(n) (CIF_ISP_DPCC_LINE_MAD_FAC_1 + 0x14 * (n)) -#define RKISP1_ISP_DPCC_PG_FAC(n) (CIF_ISP_DPCC_PG_FAC_1 + 0x14 * (n)) -#define RKISP1_ISP_DPCC_RND_THRESH(n) (CIF_ISP_DPCC_RND_THRESH_1 + 0x14 * (n)) -#define RKISP1_ISP_DPCC_RG_FAC(n) (CIF_ISP_DPCC_RG_FAC_1 + 0x14 * (n)) -#define RKISP1_ISP_CC_COEFF(n) (CIF_ISP_CC_COEFF_0 + (n) * 4) +#define RKISP_ISP_DPCC_LINE_THRESH(n) (CIF_ISP_DPCC_LINE_THRESH_1 + 0x14 * (n)) +#define RKISP_ISP_DPCC_LINE_MAD_FAC(n) (CIF_ISP_DPCC_LINE_MAD_FAC_1 + 0x14 * (n)) +#define RKISP_ISP_DPCC_PG_FAC(n) (CIF_ISP_DPCC_PG_FAC_1 + 0x14 * (n)) +#define RKISP_ISP_DPCC_RND_THRESH(n) (CIF_ISP_DPCC_RND_THRESH_1 + 0x14 * (n)) +#define RKISP_ISP_DPCC_RG_FAC(n) (CIF_ISP_DPCC_RG_FAC_1 + 0x14 * (n)) +#define RKISP_ISP_CC_COEFF(n) (CIF_ISP_CC_COEFF_0 + (n) * 4) -static inline void rkisp1_iowrite32(struct rkisp1_isp_params_vdev *params_vdev, - u32 value, u32 addr) +static inline void rkisp_iowrite32(struct rkisp_isp_params_vdev *params_vdev, + u32 value, u32 addr) { iowrite32(value, params_vdev->dev->base_addr + addr); } -static inline u32 rkisp1_ioread32(struct rkisp1_isp_params_vdev *params_vdev, +static inline u32 rkisp_ioread32(struct rkisp_isp_params_vdev *params_vdev, u32 addr) { return ioread32(params_vdev->dev->base_addr + addr); } -static inline void isp_param_set_bits(struct rkisp1_isp_params_vdev +static inline void isp_param_set_bits(struct rkisp_isp_params_vdev *params_vdev, u32 reg, u32 bit_mask) { u32 val; - val = rkisp1_ioread32(params_vdev, reg); - rkisp1_iowrite32(params_vdev, val | bit_mask, reg); + val = rkisp_ioread32(params_vdev, reg); + rkisp_iowrite32(params_vdev, val | bit_mask, reg); } -static inline void isp_param_clear_bits(struct rkisp1_isp_params_vdev +static inline void isp_param_clear_bits(struct rkisp_isp_params_vdev *params_vdev, u32 reg, u32 bit_mask) { u32 val; - val = rkisp1_ioread32(params_vdev, reg); - rkisp1_iowrite32(params_vdev, val & ~bit_mask, reg); + val = rkisp_ioread32(params_vdev, reg); + rkisp_iowrite32(params_vdev, val & ~bit_mask, reg); } /* ISP BP interface function */ -static void isp_dpcc_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_dpcc_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_dpcc_config *arg) { unsigned int i; u32 mode; /* avoid to override the old enable value */ - mode = rkisp1_ioread32(params_vdev, CIF_ISP_DPCC_MODE); + mode = rkisp_ioread32(params_vdev, CIF_ISP_DPCC_MODE); mode &= CIF_ISP_DPCC_ENA; mode |= arg->mode & ~CIF_ISP_DPCC_ENA; - rkisp1_iowrite32(params_vdev, mode, CIF_ISP_DPCC_MODE); - rkisp1_iowrite32(params_vdev, arg->output_mode, - CIF_ISP_DPCC_OUTPUT_MODE); - rkisp1_iowrite32(params_vdev, arg->set_use, CIF_ISP_DPCC_SET_USE); + rkisp_iowrite32(params_vdev, mode, CIF_ISP_DPCC_MODE); + rkisp_iowrite32(params_vdev, arg->output_mode, + CIF_ISP_DPCC_OUTPUT_MODE); + rkisp_iowrite32(params_vdev, arg->set_use, CIF_ISP_DPCC_SET_USE); - rkisp1_iowrite32(params_vdev, arg->methods[0].method, - CIF_ISP_DPCC_METHODS_SET_1); - rkisp1_iowrite32(params_vdev, arg->methods[1].method, - CIF_ISP_DPCC_METHODS_SET_2); - rkisp1_iowrite32(params_vdev, arg->methods[2].method, - CIF_ISP_DPCC_METHODS_SET_3); + rkisp_iowrite32(params_vdev, arg->methods[0].method, + CIF_ISP_DPCC_METHODS_SET_1); + rkisp_iowrite32(params_vdev, arg->methods[1].method, + CIF_ISP_DPCC_METHODS_SET_2); + rkisp_iowrite32(params_vdev, arg->methods[2].method, + CIF_ISP_DPCC_METHODS_SET_3); for (i = 0; i < CIFISP_DPCC_METHODS_MAX; i++) { - rkisp1_iowrite32(params_vdev, arg->methods[i].line_thresh, - RKISP1_ISP_DPCC_LINE_THRESH(i)); - rkisp1_iowrite32(params_vdev, arg->methods[i].line_mad_fac, - RKISP1_ISP_DPCC_LINE_MAD_FAC(i)); - rkisp1_iowrite32(params_vdev, arg->methods[i].pg_fac, - RKISP1_ISP_DPCC_PG_FAC(i)); - rkisp1_iowrite32(params_vdev, arg->methods[i].rnd_thresh, - RKISP1_ISP_DPCC_RND_THRESH(i)); - rkisp1_iowrite32(params_vdev, arg->methods[i].rg_fac, - RKISP1_ISP_DPCC_RG_FAC(i)); + rkisp_iowrite32(params_vdev, arg->methods[i].line_thresh, + RKISP_ISP_DPCC_LINE_THRESH(i)); + rkisp_iowrite32(params_vdev, arg->methods[i].line_mad_fac, + RKISP_ISP_DPCC_LINE_MAD_FAC(i)); + rkisp_iowrite32(params_vdev, arg->methods[i].pg_fac, + RKISP_ISP_DPCC_PG_FAC(i)); + rkisp_iowrite32(params_vdev, arg->methods[i].rnd_thresh, + RKISP_ISP_DPCC_RND_THRESH(i)); + rkisp_iowrite32(params_vdev, arg->methods[i].rg_fac, + RKISP_ISP_DPCC_RG_FAC(i)); } - rkisp1_iowrite32(params_vdev, arg->rnd_offs, CIF_ISP_DPCC_RND_OFFS); - rkisp1_iowrite32(params_vdev, arg->ro_limits, CIF_ISP_DPCC_RO_LIMITS); + rkisp_iowrite32(params_vdev, arg->rnd_offs, CIF_ISP_DPCC_RND_OFFS); + rkisp_iowrite32(params_vdev, arg->ro_limits, CIF_ISP_DPCC_RO_LIMITS); } /* ISP black level subtraction interface function */ -static void isp_bls_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_bls_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_bls_config *arg) { /* avoid to override the old enable value */ u32 new_control; - new_control = rkisp1_ioread32(params_vdev, CIF_ISP_BLS_CTRL); + new_control = rkisp_ioread32(params_vdev, CIF_ISP_BLS_CTRL); new_control &= CIF_ISP_BLS_ENA; /* fixed subtraction values */ if (!arg->enable_auto) { @@ -148,44 +148,44 @@ static void isp_bls_config(struct rkisp1_isp_params_vdev *params_vdev, switch (params_vdev->raw_type) { case RAW_BGGR: - rkisp1_iowrite32(params_vdev, - pval->r, CIF_ISP_BLS_D_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gr, CIF_ISP_BLS_C_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gb, CIF_ISP_BLS_B_FIXED); - rkisp1_iowrite32(params_vdev, - pval->b, CIF_ISP_BLS_A_FIXED); + rkisp_iowrite32(params_vdev, + pval->r, CIF_ISP_BLS_D_FIXED); + rkisp_iowrite32(params_vdev, + pval->gr, CIF_ISP_BLS_C_FIXED); + rkisp_iowrite32(params_vdev, + pval->gb, CIF_ISP_BLS_B_FIXED); + rkisp_iowrite32(params_vdev, + pval->b, CIF_ISP_BLS_A_FIXED); break; case RAW_GBRG: - rkisp1_iowrite32(params_vdev, - pval->r, CIF_ISP_BLS_C_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gr, CIF_ISP_BLS_D_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gb, CIF_ISP_BLS_A_FIXED); - rkisp1_iowrite32(params_vdev, - pval->b, CIF_ISP_BLS_B_FIXED); + rkisp_iowrite32(params_vdev, + pval->r, CIF_ISP_BLS_C_FIXED); + rkisp_iowrite32(params_vdev, + pval->gr, CIF_ISP_BLS_D_FIXED); + rkisp_iowrite32(params_vdev, + pval->gb, CIF_ISP_BLS_A_FIXED); + rkisp_iowrite32(params_vdev, + pval->b, CIF_ISP_BLS_B_FIXED); break; case RAW_GRBG: - rkisp1_iowrite32(params_vdev, - pval->r, CIF_ISP_BLS_B_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gr, CIF_ISP_BLS_A_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gb, CIF_ISP_BLS_D_FIXED); - rkisp1_iowrite32(params_vdev, - pval->b, CIF_ISP_BLS_C_FIXED); + rkisp_iowrite32(params_vdev, + pval->r, CIF_ISP_BLS_B_FIXED); + rkisp_iowrite32(params_vdev, + pval->gr, CIF_ISP_BLS_A_FIXED); + rkisp_iowrite32(params_vdev, + pval->gb, CIF_ISP_BLS_D_FIXED); + rkisp_iowrite32(params_vdev, + pval->b, CIF_ISP_BLS_C_FIXED); break; case RAW_RGGB: - rkisp1_iowrite32(params_vdev, - pval->r, CIF_ISP_BLS_A_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gr, CIF_ISP_BLS_B_FIXED); - rkisp1_iowrite32(params_vdev, - pval->gb, CIF_ISP_BLS_C_FIXED); - rkisp1_iowrite32(params_vdev, - pval->b, CIF_ISP_BLS_D_FIXED); + rkisp_iowrite32(params_vdev, + pval->r, CIF_ISP_BLS_A_FIXED); + rkisp_iowrite32(params_vdev, + pval->gr, CIF_ISP_BLS_B_FIXED); + rkisp_iowrite32(params_vdev, + pval->gb, CIF_ISP_BLS_C_FIXED); + rkisp_iowrite32(params_vdev, + pval->b, CIF_ISP_BLS_D_FIXED); break; default: break; @@ -193,56 +193,56 @@ static void isp_bls_config(struct rkisp1_isp_params_vdev *params_vdev, } else { if (arg->en_windows & BIT(1)) { - rkisp1_iowrite32(params_vdev, arg->bls_window2.h_offs, - CIF_ISP_BLS_H2_START); - rkisp1_iowrite32(params_vdev, arg->bls_window2.h_size, - CIF_ISP_BLS_H2_STOP); - rkisp1_iowrite32(params_vdev, arg->bls_window2.v_offs, - CIF_ISP_BLS_V2_START); - rkisp1_iowrite32(params_vdev, arg->bls_window2.v_size, - CIF_ISP_BLS_V2_STOP); + rkisp_iowrite32(params_vdev, arg->bls_window2.h_offs, + CIF_ISP_BLS_H2_START); + rkisp_iowrite32(params_vdev, arg->bls_window2.h_size, + CIF_ISP_BLS_H2_STOP); + rkisp_iowrite32(params_vdev, arg->bls_window2.v_offs, + CIF_ISP_BLS_V2_START); + rkisp_iowrite32(params_vdev, arg->bls_window2.v_size, + CIF_ISP_BLS_V2_STOP); new_control |= CIF_ISP_BLS_WINDOW_2; } if (arg->en_windows & BIT(0)) { - rkisp1_iowrite32(params_vdev, arg->bls_window1.h_offs, - CIF_ISP_BLS_H1_START); - rkisp1_iowrite32(params_vdev, arg->bls_window1.h_size, - CIF_ISP_BLS_H1_STOP); - rkisp1_iowrite32(params_vdev, arg->bls_window1.v_offs, - CIF_ISP_BLS_V1_START); - rkisp1_iowrite32(params_vdev, arg->bls_window1.v_size, - CIF_ISP_BLS_V1_STOP); + rkisp_iowrite32(params_vdev, arg->bls_window1.h_offs, + CIF_ISP_BLS_H1_START); + rkisp_iowrite32(params_vdev, arg->bls_window1.h_size, + CIF_ISP_BLS_H1_STOP); + rkisp_iowrite32(params_vdev, arg->bls_window1.v_offs, + CIF_ISP_BLS_V1_START); + rkisp_iowrite32(params_vdev, arg->bls_window1.v_size, + CIF_ISP_BLS_V1_STOP); new_control |= CIF_ISP_BLS_WINDOW_1; } - rkisp1_iowrite32(params_vdev, arg->bls_samples, - CIF_ISP_BLS_SAMPLES); + rkisp_iowrite32(params_vdev, arg->bls_samples, + CIF_ISP_BLS_SAMPLES); new_control |= CIF_ISP_BLS_MODE_MEASURED; } - rkisp1_iowrite32(params_vdev, new_control, CIF_ISP_BLS_CTRL); + rkisp_iowrite32(params_vdev, new_control, CIF_ISP_BLS_CTRL); } /* ISP LS correction interface function */ static void -isp_lsc_matrix_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +isp_lsc_matrix_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_lsc_config *pconfig) { int i, j; unsigned int isp_lsc_status, sram_addr, isp_lsc_table_sel; unsigned int data; - isp_lsc_status = rkisp1_ioread32(params_vdev, CIF_ISP_LSC_STATUS); + isp_lsc_status = rkisp_ioread32(params_vdev, CIF_ISP_LSC_STATUS); /* CIF_ISP_LSC_TABLE_ADDRESS_153 = ( 17 * 18 ) >> 1 */ sram_addr = (isp_lsc_status & CIF_ISP_LSC_ACTIVE_TABLE) ? CIF_ISP_LSC_TABLE_ADDRESS_0 : CIF_ISP_LSC_TABLE_ADDRESS_153; - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_R_TABLE_ADDR); - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GR_TABLE_ADDR); - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GB_TABLE_ADDR); - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_B_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_R_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GR_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GB_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_B_TABLE_ADDR); /* program data tables (table size is 9 * 17 = 153) */ for (i = 0; i < CIF_ISP_LSC_SECTORS_MAX * CIF_ISP_LSC_SECTORS_MAX; @@ -255,75 +255,75 @@ isp_lsc_matrix_config_v10(struct rkisp1_isp_params_vdev *params_vdev, data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->r_data_tbl[i + j], pconfig->r_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_R_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_R_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->gr_data_tbl[i + j], pconfig->gr_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_GR_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_GR_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->gb_data_tbl[i + j], pconfig->gb_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_GB_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_GB_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->b_data_tbl[i + j], pconfig->b_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_B_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_B_TABLE_DATA); } data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->r_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_R_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->gr_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_GR_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->gb_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_GB_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V10( pconfig->b_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_B_TABLE_DATA); } isp_lsc_table_sel = (isp_lsc_status & CIF_ISP_LSC_ACTIVE_TABLE) ? CIF_ISP_LSC_TABLE_0 : CIF_ISP_LSC_TABLE_1; - rkisp1_iowrite32(params_vdev, isp_lsc_table_sel, CIF_ISP_LSC_TABLE_SEL); + rkisp_iowrite32(params_vdev, isp_lsc_table_sel, CIF_ISP_LSC_TABLE_SEL); } static void -isp_lsc_matrix_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +isp_lsc_matrix_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_lsc_config *pconfig) { int i, j; unsigned int isp_lsc_status, sram_addr, isp_lsc_table_sel; unsigned int data; - isp_lsc_status = rkisp1_ioread32(params_vdev, CIF_ISP_LSC_STATUS); + isp_lsc_status = rkisp_ioread32(params_vdev, CIF_ISP_LSC_STATUS); /* CIF_ISP_LSC_TABLE_ADDRESS_153 = ( 17 * 18 ) >> 1 */ sram_addr = (isp_lsc_status & CIF_ISP_LSC_ACTIVE_TABLE) ? CIF_ISP_LSC_TABLE_ADDRESS_0 : CIF_ISP_LSC_TABLE_ADDRESS_153; - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_R_TABLE_ADDR); - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GR_TABLE_ADDR); - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GB_TABLE_ADDR); - rkisp1_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_B_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_R_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GR_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_GB_TABLE_ADDR); + rkisp_iowrite32(params_vdev, sram_addr, CIF_ISP_LSC_B_TABLE_ADDR); /* program data tables (table size is 9 * 17 = 153) */ for (i = 0; i < CIF_ISP_LSC_SECTORS_MAX * CIF_ISP_LSC_SECTORS_MAX; @@ -336,58 +336,58 @@ isp_lsc_matrix_config_v12(struct rkisp1_isp_params_vdev *params_vdev, data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->r_data_tbl[i + j], pconfig->r_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_R_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_R_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->gr_data_tbl[i + j], pconfig->gr_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_GR_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_GR_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->gb_data_tbl[i + j], pconfig->gb_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_GB_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_GB_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->b_data_tbl[i + j], pconfig->b_data_tbl[i + j + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_B_TABLE_DATA); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_B_TABLE_DATA); } data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->r_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_R_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->gr_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_GR_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->gb_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_GB_TABLE_DATA); data = CIF_ISP_LSC_TABLE_DATA_V12( pconfig->b_data_tbl[i + j], 0); - rkisp1_iowrite32(params_vdev, data, + rkisp_iowrite32(params_vdev, data, CIF_ISP_LSC_B_TABLE_DATA); } isp_lsc_table_sel = (isp_lsc_status & CIF_ISP_LSC_ACTIVE_TABLE) ? CIF_ISP_LSC_TABLE_0 : CIF_ISP_LSC_TABLE_1; - rkisp1_iowrite32(params_vdev, isp_lsc_table_sel, CIF_ISP_LSC_TABLE_SEL); + rkisp_iowrite32(params_vdev, isp_lsc_table_sel, CIF_ISP_LSC_TABLE_SEL); } -static void isp_lsc_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_lsc_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_lsc_config *arg) { int i; @@ -395,7 +395,7 @@ static void isp_lsc_config(struct rkisp1_isp_params_vdev *params_vdev, unsigned int data; /* To config must be off , store the current status firstly */ - lsc_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_LSC_CTRL); + lsc_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_LSC_CTRL); isp_param_clear_bits(params_vdev, CIF_ISP_LSC_CTRL, CIF_ISP_LSC_CTRL_ENA); params_vdev->ops->lsc_matrix_config(params_vdev, arg); @@ -404,26 +404,26 @@ static void isp_lsc_config(struct rkisp1_isp_params_vdev *params_vdev, /* program x size tables */ data = CIF_ISP_LSC_SECT_SIZE(arg->x_size_tbl[i * 2], arg->x_size_tbl[i * 2 + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_XSIZE_01 + i * 4); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_XSIZE_01 + i * 4); /* program x grad tables */ data = CIF_ISP_LSC_SECT_SIZE(arg->x_grad_tbl[i * 2], arg->x_grad_tbl[i * 2 + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_XGRAD_01 + i * 4); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_XGRAD_01 + i * 4); /* program y size tables */ data = CIF_ISP_LSC_SECT_SIZE(arg->y_size_tbl[i * 2], arg->y_size_tbl[i * 2 + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_YSIZE_01 + i * 4); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_YSIZE_01 + i * 4); /* program y grad tables */ data = CIF_ISP_LSC_SECT_SIZE(arg->y_grad_tbl[i * 2], arg->y_grad_tbl[i * 2 + 1]); - rkisp1_iowrite32(params_vdev, data, - CIF_ISP_LSC_YGRAD_01 + i * 4); + rkisp_iowrite32(params_vdev, data, + CIF_ISP_LSC_YGRAD_01 + i * 4); } /* restore the lsc ctrl status */ @@ -439,221 +439,221 @@ static void isp_lsc_config(struct rkisp1_isp_params_vdev *params_vdev, } /* ISP Filtering function */ -static void isp_flt_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_flt_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_flt_config *arg) { u32 filt_mode; - rkisp1_iowrite32(params_vdev, arg->thresh_bl0, CIF_ISP_FILT_THRESH_BL0); - rkisp1_iowrite32(params_vdev, arg->thresh_bl1, CIF_ISP_FILT_THRESH_BL1); - rkisp1_iowrite32(params_vdev, arg->thresh_sh0, CIF_ISP_FILT_THRESH_SH0); - rkisp1_iowrite32(params_vdev, arg->thresh_sh1, CIF_ISP_FILT_THRESH_SH1); - rkisp1_iowrite32(params_vdev, arg->fac_bl0, CIF_ISP_FILT_FAC_BL0); - rkisp1_iowrite32(params_vdev, arg->fac_bl1, CIF_ISP_FILT_FAC_BL1); - rkisp1_iowrite32(params_vdev, arg->fac_mid, CIF_ISP_FILT_FAC_MID); - rkisp1_iowrite32(params_vdev, arg->fac_sh0, CIF_ISP_FILT_FAC_SH0); - rkisp1_iowrite32(params_vdev, arg->fac_sh1, CIF_ISP_FILT_FAC_SH1); - rkisp1_iowrite32(params_vdev, arg->lum_weight, CIF_ISP_FILT_LUM_WEIGHT); + rkisp_iowrite32(params_vdev, arg->thresh_bl0, CIF_ISP_FILT_THRESH_BL0); + rkisp_iowrite32(params_vdev, arg->thresh_bl1, CIF_ISP_FILT_THRESH_BL1); + rkisp_iowrite32(params_vdev, arg->thresh_sh0, CIF_ISP_FILT_THRESH_SH0); + rkisp_iowrite32(params_vdev, arg->thresh_sh1, CIF_ISP_FILT_THRESH_SH1); + rkisp_iowrite32(params_vdev, arg->fac_bl0, CIF_ISP_FILT_FAC_BL0); + rkisp_iowrite32(params_vdev, arg->fac_bl1, CIF_ISP_FILT_FAC_BL1); + rkisp_iowrite32(params_vdev, arg->fac_mid, CIF_ISP_FILT_FAC_MID); + rkisp_iowrite32(params_vdev, arg->fac_sh0, CIF_ISP_FILT_FAC_SH0); + rkisp_iowrite32(params_vdev, arg->fac_sh1, CIF_ISP_FILT_FAC_SH1); + rkisp_iowrite32(params_vdev, arg->lum_weight, CIF_ISP_FILT_LUM_WEIGHT); /* avoid to override the old enable value */ - filt_mode = rkisp1_ioread32(params_vdev, CIF_ISP_FILT_MODE); + filt_mode = rkisp_ioread32(params_vdev, CIF_ISP_FILT_MODE); filt_mode &= CIF_ISP_FLT_ENA; if (arg->mode) filt_mode |= CIF_ISP_FLT_MODE_DNR; filt_mode |= CIF_ISP_FLT_CHROMA_V_MODE(arg->chr_v_mode) | CIF_ISP_FLT_CHROMA_H_MODE(arg->chr_h_mode) | CIF_ISP_FLT_GREEN_STAGE1(arg->grn_stage1); - rkisp1_iowrite32(params_vdev, filt_mode, CIF_ISP_FILT_MODE); + rkisp_iowrite32(params_vdev, filt_mode, CIF_ISP_FILT_MODE); } /* ISP demosaic interface function */ -static void isp_bdm_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_bdm_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_bdm_config *arg) { u32 bdm_th; /* avoid to override the old enable value */ - bdm_th = rkisp1_ioread32(params_vdev, CIF_ISP_DEMOSAIC); + bdm_th = rkisp_ioread32(params_vdev, CIF_ISP_DEMOSAIC); bdm_th &= CIF_ISP_DEMOSAIC_BYPASS; bdm_th |= arg->demosaic_th & ~CIF_ISP_DEMOSAIC_BYPASS; /* set demosaic threshold */ - rkisp1_iowrite32(params_vdev, bdm_th, CIF_ISP_DEMOSAIC); + rkisp_iowrite32(params_vdev, bdm_th, CIF_ISP_DEMOSAIC); } /* ISP GAMMA correction interface function */ -static void isp_sdg_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_sdg_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_sdg_config *arg) { int i; - rkisp1_iowrite32(params_vdev, - arg->xa_pnts.gamma_dx0, CIF_ISP_GAMMA_DX_LO); - rkisp1_iowrite32(params_vdev, - arg->xa_pnts.gamma_dx1, CIF_ISP_GAMMA_DX_HI); + rkisp_iowrite32(params_vdev, + arg->xa_pnts.gamma_dx0, CIF_ISP_GAMMA_DX_LO); + rkisp_iowrite32(params_vdev, + arg->xa_pnts.gamma_dx1, CIF_ISP_GAMMA_DX_HI); for (i = 0; i < CIFISP_DEGAMMA_CURVE_SIZE; i++) { - rkisp1_iowrite32(params_vdev, arg->curve_r.gamma_y[i], - CIF_ISP_GAMMA_R_Y0 + i * 4); - rkisp1_iowrite32(params_vdev, arg->curve_g.gamma_y[i], - CIF_ISP_GAMMA_G_Y0 + i * 4); - rkisp1_iowrite32(params_vdev, arg->curve_b.gamma_y[i], - CIF_ISP_GAMMA_B_Y0 + i * 4); + rkisp_iowrite32(params_vdev, arg->curve_r.gamma_y[i], + CIF_ISP_GAMMA_R_Y0 + i * 4); + rkisp_iowrite32(params_vdev, arg->curve_g.gamma_y[i], + CIF_ISP_GAMMA_G_Y0 + i * 4); + rkisp_iowrite32(params_vdev, arg->curve_b.gamma_y[i], + CIF_ISP_GAMMA_B_Y0 + i * 4); } } /* ISP GAMMA correction interface function */ -static void isp_goc_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_goc_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_goc_config *arg) { int i; - rkisp1_iowrite32(params_vdev, arg->mode, CIF_ISP_GAMMA_OUT_MODE_V10); + rkisp_iowrite32(params_vdev, arg->mode, CIF_ISP_GAMMA_OUT_MODE_V10); for (i = 0; i < params_vdev->config->gamma_out_max_samples; i++) - rkisp1_iowrite32(params_vdev, arg->gamma_y[i], - CIF_ISP_GAMMA_OUT_Y_0_V10 + i * 4); + rkisp_iowrite32(params_vdev, arg->gamma_y[i], + CIF_ISP_GAMMA_OUT_Y_0_V10 + i * 4); } -static void isp_goc_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_goc_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_goc_config *arg) { int i; u32 value; - rkisp1_iowrite32(params_vdev, arg->mode, CIF_ISP_GAMMA_OUT_MODE_V12); + rkisp_iowrite32(params_vdev, arg->mode, CIF_ISP_GAMMA_OUT_MODE_V12); for (i = 0; i < params_vdev->config->gamma_out_max_samples / 2; i++) { value = CIF_ISP_GAMMA_REG_VALUE_V12( arg->gamma_y[2 * i + 1], arg->gamma_y[2 * i]); - rkisp1_iowrite32(params_vdev, value, - CIF_ISP_GAMMA_OUT_Y_0_V12 + i * 4); + rkisp_iowrite32(params_vdev, value, + CIF_ISP_GAMMA_OUT_Y_0_V12 + i * 4); } } /* ISP Cross Talk */ -static void isp_ctk_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_ctk_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_ctk_config *arg) { - rkisp1_iowrite32(params_vdev, arg->coeff0, CIF_ISP_CT_COEFF_0); - rkisp1_iowrite32(params_vdev, arg->coeff1, CIF_ISP_CT_COEFF_1); - rkisp1_iowrite32(params_vdev, arg->coeff2, CIF_ISP_CT_COEFF_2); - rkisp1_iowrite32(params_vdev, arg->coeff3, CIF_ISP_CT_COEFF_3); - rkisp1_iowrite32(params_vdev, arg->coeff4, CIF_ISP_CT_COEFF_4); - rkisp1_iowrite32(params_vdev, arg->coeff5, CIF_ISP_CT_COEFF_5); - rkisp1_iowrite32(params_vdev, arg->coeff6, CIF_ISP_CT_COEFF_6); - rkisp1_iowrite32(params_vdev, arg->coeff7, CIF_ISP_CT_COEFF_7); - rkisp1_iowrite32(params_vdev, arg->coeff8, CIF_ISP_CT_COEFF_8); - rkisp1_iowrite32(params_vdev, arg->ct_offset_r, CIF_ISP_CT_OFFSET_R); - rkisp1_iowrite32(params_vdev, arg->ct_offset_g, CIF_ISP_CT_OFFSET_G); - rkisp1_iowrite32(params_vdev, arg->ct_offset_b, CIF_ISP_CT_OFFSET_B); + rkisp_iowrite32(params_vdev, arg->coeff0, CIF_ISP_CT_COEFF_0); + rkisp_iowrite32(params_vdev, arg->coeff1, CIF_ISP_CT_COEFF_1); + rkisp_iowrite32(params_vdev, arg->coeff2, CIF_ISP_CT_COEFF_2); + rkisp_iowrite32(params_vdev, arg->coeff3, CIF_ISP_CT_COEFF_3); + rkisp_iowrite32(params_vdev, arg->coeff4, CIF_ISP_CT_COEFF_4); + rkisp_iowrite32(params_vdev, arg->coeff5, CIF_ISP_CT_COEFF_5); + rkisp_iowrite32(params_vdev, arg->coeff6, CIF_ISP_CT_COEFF_6); + rkisp_iowrite32(params_vdev, arg->coeff7, CIF_ISP_CT_COEFF_7); + rkisp_iowrite32(params_vdev, arg->coeff8, CIF_ISP_CT_COEFF_8); + rkisp_iowrite32(params_vdev, arg->ct_offset_r, CIF_ISP_CT_OFFSET_R); + rkisp_iowrite32(params_vdev, arg->ct_offset_g, CIF_ISP_CT_OFFSET_G); + rkisp_iowrite32(params_vdev, arg->ct_offset_b, CIF_ISP_CT_OFFSET_B); } -static void isp_ctk_enable(struct rkisp1_isp_params_vdev *params_vdev, bool en) +static void isp_ctk_enable(struct rkisp_isp_params_vdev *params_vdev, bool en) { if (en) return; /* Write back the default values. */ - rkisp1_iowrite32(params_vdev, 0x80, CIF_ISP_CT_COEFF_0); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_1); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_2); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_3); - rkisp1_iowrite32(params_vdev, 0x80, CIF_ISP_CT_COEFF_4); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_5); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_6); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_7); - rkisp1_iowrite32(params_vdev, 0x80, CIF_ISP_CT_COEFF_8); + rkisp_iowrite32(params_vdev, 0x80, CIF_ISP_CT_COEFF_0); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_1); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_2); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_3); + rkisp_iowrite32(params_vdev, 0x80, CIF_ISP_CT_COEFF_4); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_5); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_6); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_COEFF_7); + rkisp_iowrite32(params_vdev, 0x80, CIF_ISP_CT_COEFF_8); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_OFFSET_R); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_OFFSET_G); - rkisp1_iowrite32(params_vdev, 0, CIF_ISP_CT_OFFSET_B); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_OFFSET_R); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_OFFSET_G); + rkisp_iowrite32(params_vdev, 0, CIF_ISP_CT_OFFSET_B); } /* ISP White Balance Mode */ -static void isp_awb_meas_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_awb_meas_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_meas_config *arg) { u32 reg_val = 0; /* based on the mode,configure the awb module */ if (arg->awb_mode == CIFISP_AWB_MODE_YCBCR) { /* Reference Cb and Cr */ - rkisp1_iowrite32(params_vdev, - CIF_ISP_AWB_REF_CR_SET(arg->awb_ref_cr) | - arg->awb_ref_cb, CIF_ISP_AWB_REF_V10); + rkisp_iowrite32(params_vdev, + CIF_ISP_AWB_REF_CR_SET(arg->awb_ref_cr) | + arg->awb_ref_cb, CIF_ISP_AWB_REF_V10); /* Yc Threshold */ - rkisp1_iowrite32(params_vdev, - CIF_ISP_AWB_MAX_Y_SET(arg->max_y) | - CIF_ISP_AWB_MIN_Y_SET(arg->min_y) | - CIF_ISP_AWB_MAX_CS_SET(arg->max_csum) | - arg->min_c, CIF_ISP_AWB_THRESH_V10); + rkisp_iowrite32(params_vdev, + CIF_ISP_AWB_MAX_Y_SET(arg->max_y) | + CIF_ISP_AWB_MIN_Y_SET(arg->min_y) | + CIF_ISP_AWB_MAX_CS_SET(arg->max_csum) | + arg->min_c, CIF_ISP_AWB_THRESH_V10); } - reg_val = rkisp1_ioread32(params_vdev, CIF_ISP_AWB_PROP_V10); + reg_val = rkisp_ioread32(params_vdev, CIF_ISP_AWB_PROP_V10); if (arg->enable_ymax_cmp) reg_val |= CIF_ISP_AWB_YMAX_CMP_EN; else reg_val &= ~CIF_ISP_AWB_YMAX_CMP_EN; - rkisp1_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V10); + rkisp_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V10); /* window offset */ - rkisp1_iowrite32(params_vdev, - arg->awb_wnd.v_offs, CIF_ISP_AWB_WND_V_OFFS_V10); - rkisp1_iowrite32(params_vdev, - arg->awb_wnd.h_offs, CIF_ISP_AWB_WND_H_OFFS_V10); + rkisp_iowrite32(params_vdev, + arg->awb_wnd.v_offs, CIF_ISP_AWB_WND_V_OFFS_V10); + rkisp_iowrite32(params_vdev, + arg->awb_wnd.h_offs, CIF_ISP_AWB_WND_H_OFFS_V10); /* AWB window size */ - rkisp1_iowrite32(params_vdev, - arg->awb_wnd.v_size, CIF_ISP_AWB_WND_V_SIZE_V10); - rkisp1_iowrite32(params_vdev, - arg->awb_wnd.h_size, CIF_ISP_AWB_WND_H_SIZE_V10); + rkisp_iowrite32(params_vdev, + arg->awb_wnd.v_size, CIF_ISP_AWB_WND_V_SIZE_V10); + rkisp_iowrite32(params_vdev, + arg->awb_wnd.h_size, CIF_ISP_AWB_WND_H_SIZE_V10); /* Number of frames */ - rkisp1_iowrite32(params_vdev, - arg->frames, CIF_ISP_AWB_FRAMES_V10); + rkisp_iowrite32(params_vdev, + arg->frames, CIF_ISP_AWB_FRAMES_V10); } -static void isp_awb_meas_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_awb_meas_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_meas_config *arg) { u32 reg_val = 0; /* based on the mode,configure the awb module */ if (arg->awb_mode == CIFISP_AWB_MODE_YCBCR) { /* Reference Cb and Cr */ - rkisp1_iowrite32(params_vdev, - CIF_ISP_AWB_REF_CR_SET(arg->awb_ref_cr) | - arg->awb_ref_cb, CIF_ISP_AWB_REF_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_AWB_REF_CR_SET(arg->awb_ref_cr) | + arg->awb_ref_cb, CIF_ISP_AWB_REF_V12); /* Yc Threshold */ - rkisp1_iowrite32(params_vdev, - CIF_ISP_AWB_MAX_Y_SET(arg->max_y) | - CIF_ISP_AWB_MIN_Y_SET(arg->min_y) | - CIF_ISP_AWB_MAX_CS_SET(arg->max_csum) | - arg->min_c, CIF_ISP_AWB_THRESH_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_AWB_MAX_Y_SET(arg->max_y) | + CIF_ISP_AWB_MIN_Y_SET(arg->min_y) | + CIF_ISP_AWB_MAX_CS_SET(arg->max_csum) | + arg->min_c, CIF_ISP_AWB_THRESH_V12); } - reg_val = rkisp1_ioread32(params_vdev, CIF_ISP_AWB_PROP_V12); + reg_val = rkisp_ioread32(params_vdev, CIF_ISP_AWB_PROP_V12); if (arg->enable_ymax_cmp) reg_val |= CIF_ISP_AWB_YMAX_CMP_EN; else reg_val &= ~CIF_ISP_AWB_YMAX_CMP_EN; reg_val &= ~CIF_ISP_AWB_SET_FRAMES_MASK_V12; reg_val |= CIF_ISP_AWB_SET_FRAMES_V12(arg->frames); - rkisp1_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V12); + rkisp_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V12); /* window offset */ - rkisp1_iowrite32(params_vdev, - arg->awb_wnd.v_offs << 16 | - arg->awb_wnd.h_offs, - CIF_ISP_AWB_OFFS_V12); + rkisp_iowrite32(params_vdev, + arg->awb_wnd.v_offs << 16 | + arg->awb_wnd.h_offs, + CIF_ISP_AWB_OFFS_V12); /* AWB window size */ - rkisp1_iowrite32(params_vdev, - arg->awb_wnd.v_size << 16 | - arg->awb_wnd.h_size, - CIF_ISP_AWB_SIZE_V12); + rkisp_iowrite32(params_vdev, + arg->awb_wnd.v_size << 16 | + arg->awb_wnd.h_size, + CIF_ISP_AWB_SIZE_V12); } -static void isp_awb_meas_enable_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_awb_meas_enable_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_meas_config *arg, bool en) { - u32 reg_val = rkisp1_ioread32(params_vdev, CIF_ISP_AWB_PROP_V10); + u32 reg_val = rkisp_ioread32(params_vdev, CIF_ISP_AWB_PROP_V10); /* switch off */ reg_val &= CIF_ISP_AWB_MODE_MASK_NONE; @@ -664,24 +664,24 @@ static void isp_awb_meas_enable_v10(struct rkisp1_isp_params_vdev *params_vdev, else reg_val |= CIF_ISP_AWB_MODE_YCBCR_EN; - rkisp1_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V10); + rkisp_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V10); /* Measurements require AWB block be active. */ /* TODO: need to enable here ? awb_gain_enable has done this */ isp_param_set_bits(params_vdev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_AWB_ENA); } else { - rkisp1_iowrite32(params_vdev, - reg_val, CIF_ISP_AWB_PROP_V10); + rkisp_iowrite32(params_vdev, + reg_val, CIF_ISP_AWB_PROP_V10); isp_param_clear_bits(params_vdev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_AWB_ENA); } } -static void isp_awb_meas_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_awb_meas_enable_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_meas_config *arg, bool en) { - u32 reg_val = rkisp1_ioread32(params_vdev, CIF_ISP_AWB_PROP_V12); + u32 reg_val = rkisp_ioread32(params_vdev, CIF_ISP_AWB_PROP_V12); /* switch off */ reg_val &= CIF_ISP_AWB_MODE_MASK_NONE; @@ -692,72 +692,72 @@ static void isp_awb_meas_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, else reg_val |= CIF_ISP_AWB_MODE_YCBCR_EN; - rkisp1_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V12); + rkisp_iowrite32(params_vdev, reg_val, CIF_ISP_AWB_PROP_V12); /* Measurements require AWB block be active. */ /* TODO: need to enable here ? awb_gain_enable has done this */ isp_param_set_bits(params_vdev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_AWB_ENA); } else { - rkisp1_iowrite32(params_vdev, - reg_val, CIF_ISP_AWB_PROP_V12); + rkisp_iowrite32(params_vdev, + reg_val, CIF_ISP_AWB_PROP_V12); isp_param_clear_bits(params_vdev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_AWB_ENA); } } -static void isp_awb_gain_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_awb_gain_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_gain_config *arg) { - rkisp1_iowrite32(params_vdev, - CIF_ISP_AWB_GAIN_R_SET(arg->gain_green_r) | - arg->gain_green_b, CIF_ISP_AWB_GAIN_G_V10); + rkisp_iowrite32(params_vdev, + CIF_ISP_AWB_GAIN_R_SET(arg->gain_green_r) | + arg->gain_green_b, CIF_ISP_AWB_GAIN_G_V10); - rkisp1_iowrite32(params_vdev, CIF_ISP_AWB_GAIN_R_SET(arg->gain_red) | - arg->gain_blue, CIF_ISP_AWB_GAIN_RB_V10); + rkisp_iowrite32(params_vdev, CIF_ISP_AWB_GAIN_R_SET(arg->gain_red) | + arg->gain_blue, CIF_ISP_AWB_GAIN_RB_V10); } -static void isp_awb_gain_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_awb_gain_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_gain_config *arg) { - rkisp1_iowrite32(params_vdev, - CIF_ISP_AWB_GAIN_R_SET(arg->gain_green_r) | - arg->gain_green_b, CIF_ISP_AWB_GAIN_G_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_AWB_GAIN_R_SET(arg->gain_green_r) | + arg->gain_green_b, CIF_ISP_AWB_GAIN_G_V12); - rkisp1_iowrite32(params_vdev, CIF_ISP_AWB_GAIN_R_SET(arg->gain_red) | - arg->gain_blue, CIF_ISP_AWB_GAIN_RB_V12); + rkisp_iowrite32(params_vdev, CIF_ISP_AWB_GAIN_R_SET(arg->gain_red) | + arg->gain_blue, CIF_ISP_AWB_GAIN_RB_V12); } -static void isp_aec_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_aec_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_aec_config *arg) { unsigned int block_hsize, block_vsize; u32 exp_ctrl; /* avoid to override the old enable value */ - exp_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_EXP_CTRL); + exp_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_EXP_CTRL); exp_ctrl &= CIF_ISP_EXP_ENA; if (arg->autostop) exp_ctrl |= CIF_ISP_EXP_CTRL_AUTOSTOP; if (arg->mode == CIFISP_EXP_MEASURING_MODE_1) exp_ctrl |= CIF_ISP_EXP_CTRL_MEASMODE_1; - rkisp1_iowrite32(params_vdev, exp_ctrl, CIF_ISP_EXP_CTRL); + rkisp_iowrite32(params_vdev, exp_ctrl, CIF_ISP_EXP_CTRL); - rkisp1_iowrite32(params_vdev, - arg->meas_window.h_offs, CIF_ISP_EXP_H_OFFSET_V10); - rkisp1_iowrite32(params_vdev, - arg->meas_window.v_offs, CIF_ISP_EXP_V_OFFSET_V10); + rkisp_iowrite32(params_vdev, + arg->meas_window.h_offs, CIF_ISP_EXP_H_OFFSET_V10); + rkisp_iowrite32(params_vdev, + arg->meas_window.v_offs, CIF_ISP_EXP_V_OFFSET_V10); block_hsize = arg->meas_window.h_size / CIF_ISP_EXP_COLUMN_NUM_V10 - 1; block_vsize = arg->meas_window.v_size / CIF_ISP_EXP_ROW_NUM_V10 - 1; - rkisp1_iowrite32(params_vdev, CIF_ISP_EXP_H_SIZE_SET_V10(block_hsize), - CIF_ISP_EXP_H_SIZE_V10); - rkisp1_iowrite32(params_vdev, CIF_ISP_EXP_V_SIZE_SET_V10(block_vsize), - CIF_ISP_EXP_V_SIZE_V10); + rkisp_iowrite32(params_vdev, CIF_ISP_EXP_H_SIZE_SET_V10(block_hsize), + CIF_ISP_EXP_H_SIZE_V10); + rkisp_iowrite32(params_vdev, CIF_ISP_EXP_V_SIZE_SET_V10(block_vsize), + CIF_ISP_EXP_V_SIZE_V10); } -static void isp_aec_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_aec_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_aec_config *arg) { u32 exp_ctrl; @@ -768,30 +768,30 @@ static void isp_aec_config_v12(struct rkisp1_isp_params_vdev *params_vdev, }; /* avoid to override the old enable value */ - exp_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_EXP_CTRL); + exp_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_EXP_CTRL); exp_ctrl &= CIF_ISP_EXP_ENA; if (arg->autostop) exp_ctrl |= CIF_ISP_EXP_CTRL_AUTOSTOP; if (arg->mode == CIFISP_EXP_MEASURING_MODE_1) exp_ctrl |= CIF_ISP_EXP_CTRL_MEASMODE_1; exp_ctrl |= CIF_ISP_EXP_CTRL_WNDNUM_SET_V12(wnd_num_idx); - rkisp1_iowrite32(params_vdev, exp_ctrl, CIF_ISP_EXP_CTRL); + rkisp_iowrite32(params_vdev, exp_ctrl, CIF_ISP_EXP_CTRL); - rkisp1_iowrite32(params_vdev, - CIF_ISP_EXP_V_OFFSET_SET_V12(arg->meas_window.v_offs) | - CIF_ISP_EXP_H_OFFSET_SET_V12(arg->meas_window.h_offs), - CIF_ISP_EXP_OFFS_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_EXP_V_OFFSET_SET_V12(arg->meas_window.v_offs) | + CIF_ISP_EXP_H_OFFSET_SET_V12(arg->meas_window.h_offs), + CIF_ISP_EXP_OFFS_V12); block_hsize = arg->meas_window.h_size / ae_wnd_num[wnd_num_idx] - 1; block_vsize = arg->meas_window.v_size / ae_wnd_num[wnd_num_idx] - 1; - rkisp1_iowrite32(params_vdev, - CIF_ISP_EXP_V_SIZE_SET_V12(block_vsize) | - CIF_ISP_EXP_H_SIZE_SET_V12(block_hsize), - CIF_ISP_EXP_SIZE_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_EXP_V_SIZE_SET_V12(block_vsize) | + CIF_ISP_EXP_H_SIZE_SET_V12(block_hsize), + CIF_ISP_EXP_SIZE_V12); } -static void isp_cproc_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_cproc_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_cproc_config *arg) { struct cifisp_isp_other_cfg *cur_other_cfg = ¶ms_vdev->cur_params.others; @@ -799,10 +799,10 @@ static void isp_cproc_config(struct rkisp1_isp_params_vdev *params_vdev, u32 effect = cur_ie_config->effect; u32 quantization = params_vdev->quantization; - rkisp1_iowrite32(params_vdev, arg->contrast, CIF_C_PROC_CONTRAST); - rkisp1_iowrite32(params_vdev, arg->hue, CIF_C_PROC_HUE); - rkisp1_iowrite32(params_vdev, arg->sat, CIF_C_PROC_SATURATION); - rkisp1_iowrite32(params_vdev, arg->brightness, CIF_C_PROC_BRIGHTNESS); + rkisp_iowrite32(params_vdev, arg->contrast, CIF_C_PROC_CONTRAST); + rkisp_iowrite32(params_vdev, arg->hue, CIF_C_PROC_HUE); + rkisp_iowrite32(params_vdev, arg->sat, CIF_C_PROC_SATURATION); + rkisp_iowrite32(params_vdev, arg->brightness, CIF_C_PROC_BRIGHTNESS); if (quantization != V4L2_QUANTIZATION_FULL_RANGE || effect != V4L2_COLORFX_NONE) { @@ -818,7 +818,7 @@ static void isp_cproc_config(struct rkisp1_isp_params_vdev *params_vdev, } } -static void isp_hst_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_hst_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_hst_config *arg) { unsigned int block_hsize, block_vsize; @@ -833,31 +833,31 @@ static void isp_hst_config_v10(struct rkisp1_isp_params_vdev *params_vdev, u32 hist_prop; /* avoid to override the old enable value */ - hist_prop = rkisp1_ioread32(params_vdev, CIF_ISP_HIST_PROP_V10); + hist_prop = rkisp_ioread32(params_vdev, CIF_ISP_HIST_PROP_V10); hist_prop &= CIF_ISP_HIST_PROP_MODE_MASK_V10; hist_prop |= CIF_ISP_HIST_PREDIV_SET_V10(arg->histogram_predivider); - rkisp1_iowrite32(params_vdev, hist_prop, CIF_ISP_HIST_PROP_V10); - rkisp1_iowrite32(params_vdev, + rkisp_iowrite32(params_vdev, hist_prop, CIF_ISP_HIST_PROP_V10); + rkisp_iowrite32(params_vdev, arg->meas_window.h_offs, CIF_ISP_HIST_H_OFFS_V10); - rkisp1_iowrite32(params_vdev, + rkisp_iowrite32(params_vdev, arg->meas_window.v_offs, CIF_ISP_HIST_V_OFFS_V10); block_hsize = arg->meas_window.h_size / CIF_ISP_HIST_COLUMN_NUM_V10 - 1; block_vsize = arg->meas_window.v_size / CIF_ISP_HIST_ROW_NUM_V10 - 1; - rkisp1_iowrite32(params_vdev, block_hsize, CIF_ISP_HIST_H_SIZE_V10); - rkisp1_iowrite32(params_vdev, block_vsize, CIF_ISP_HIST_V_SIZE_V10); + rkisp_iowrite32(params_vdev, block_hsize, CIF_ISP_HIST_H_SIZE_V10); + rkisp_iowrite32(params_vdev, block_vsize, CIF_ISP_HIST_V_SIZE_V10); weight = arg->hist_weight; for (i = 0; i < ARRAY_SIZE(hist_weight_regs); ++i, weight += 4) - rkisp1_iowrite32(params_vdev, CIF_ISP_HIST_WEIGHT_SET_V10( - weight[0], weight[1], weight[2], weight[3]), - hist_weight_regs[i]); + rkisp_iowrite32(params_vdev, CIF_ISP_HIST_WEIGHT_SET_V10( + weight[0], weight[1], weight[2], weight[3]), + hist_weight_regs[i]); } -static void isp_hst_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_hst_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_hst_config *arg) { u32 i, j; @@ -874,7 +874,7 @@ static void isp_hst_config_v12(struct rkisp1_isp_params_vdev *params_vdev, wnd_num_idx = 1; memset(weight15x15, 0x00, sizeof(weight15x15)); /* avoid to override the old enable value */ - hist_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_HIST_CTRL_V12); + hist_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_HIST_CTRL_V12); hist_ctrl &= CIF_ISP_HIST_CTRL_MODE_MASK_V12 | CIF_ISP_HIST_CTRL_EN_MASK_V12; hist_ctrl = hist_ctrl | @@ -884,18 +884,18 @@ static void isp_hst_config_v12(struct rkisp1_isp_params_vdev *params_vdev, CIF_ISP_HIST_CTRL_AUTOSTOP_SET_V12(0) | CIF_ISP_HIST_CTRL_WNDNUM_SET_V12(1) | CIF_ISP_HIST_CTRL_STEPSIZE_SET_V12(arg->histogram_predivider); - rkisp1_iowrite32(params_vdev, hist_ctrl, CIF_ISP_HIST_CTRL_V12); + rkisp_iowrite32(params_vdev, hist_ctrl, CIF_ISP_HIST_CTRL_V12); - rkisp1_iowrite32(params_vdev, - CIF_ISP_HIST_OFFS_SET_V12(arg->meas_window.h_offs, - arg->meas_window.v_offs), - CIF_ISP_HIST_OFFS_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_HIST_OFFS_SET_V12(arg->meas_window.h_offs, + arg->meas_window.v_offs), + CIF_ISP_HIST_OFFS_V12); block_hsize = arg->meas_window.h_size / hist_wnd_num[wnd_num_idx] - 1; block_vsize = arg->meas_window.v_size / hist_wnd_num[wnd_num_idx] - 1; - rkisp1_iowrite32(params_vdev, - CIF_ISP_HIST_SIZE_SET_V12(block_hsize, block_vsize), - CIF_ISP_HIST_SIZE_V12); + rkisp_iowrite32(params_vdev, + CIF_ISP_HIST_SIZE_SET_V12(block_hsize, block_vsize), + CIF_ISP_HIST_SIZE_V12); for (i = 0; i < hist_wnd_num[wnd_num_idx]; i++) { for (j = 0; j < hist_wnd_num[wnd_num_idx]; j++) { @@ -911,20 +911,20 @@ static void isp_hst_config_v12(struct rkisp1_isp_params_vdev *params_vdev, weight15x15[4 * i + 1], weight15x15[4 * i + 2], weight15x15[4 * i + 3]); - rkisp1_iowrite32(params_vdev, value, - CIF_ISP_HIST_WEIGHT_V12 + 4 * i); + rkisp_iowrite32(params_vdev, value, + CIF_ISP_HIST_WEIGHT_V12 + 4 * i); } value = CIF_ISP_HIST_WEIGHT_SET_V12( weight15x15[4 * i + 0], 0, 0, 0); - rkisp1_iowrite32(params_vdev, value, - CIF_ISP_HIST_WEIGHT_V12 + 4 * i); + rkisp_iowrite32(params_vdev, value, + CIF_ISP_HIST_WEIGHT_V12 + 4 * i); } -static void isp_hst_enable_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_hst_enable_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_hst_config *arg, bool en) { if (en) { - u32 hist_prop = rkisp1_ioread32(params_vdev, CIF_ISP_HIST_PROP_V10); + u32 hist_prop = rkisp_ioread32(params_vdev, CIF_ISP_HIST_PROP_V10); hist_prop &= ~CIF_ISP_HIST_PROP_MODE_MASK_V10; hist_prop |= arg->mode; @@ -935,11 +935,11 @@ static void isp_hst_enable_v10(struct rkisp1_isp_params_vdev *params_vdev, } } -static void isp_hst_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_hst_enable_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_hst_config *arg, bool en) { if (en) { - u32 hist_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_HIST_CTRL_V12); + u32 hist_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_HIST_CTRL_V12); hist_ctrl &= ~CIF_ISP_HIST_CTRL_MODE_MASK_V12; hist_ctrl |= CIF_ISP_HIST_CTRL_MODE_SET_V12(arg->mode); @@ -952,79 +952,79 @@ static void isp_hst_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, } } -static void isp_afm_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_afm_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_afc_config *arg) { int i; size_t num_of_win = min_t(size_t, ARRAY_SIZE(arg->afm_win), arg->num_afm_win); - u32 afm_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_AFM_CTRL); + u32 afm_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_AFM_CTRL); /* Switch off to configure. */ isp_param_clear_bits(params_vdev, CIF_ISP_AFM_CTRL, CIF_ISP_AFM_ENA); for (i = 0; i < num_of_win; i++) { - rkisp1_iowrite32(params_vdev, - CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_offs) | - CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_offs), - CIF_ISP_AFM_LT_A + i * 8); - rkisp1_iowrite32(params_vdev, - CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_size + - arg->afm_win[i].h_offs) | - CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_size + - arg->afm_win[i].v_offs), - CIF_ISP_AFM_RB_A + i * 8); + rkisp_iowrite32(params_vdev, + CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_offs) | + CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_offs), + CIF_ISP_AFM_LT_A + i * 8); + rkisp_iowrite32(params_vdev, + CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_size + + arg->afm_win[i].h_offs) | + CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_size + + arg->afm_win[i].v_offs), + CIF_ISP_AFM_RB_A + i * 8); } - rkisp1_iowrite32(params_vdev, arg->thres, CIF_ISP_AFM_THRES); - rkisp1_iowrite32(params_vdev, arg->var_shift, CIF_ISP_AFM_VAR_SHIFT); + rkisp_iowrite32(params_vdev, arg->thres, CIF_ISP_AFM_THRES); + rkisp_iowrite32(params_vdev, arg->var_shift, CIF_ISP_AFM_VAR_SHIFT); /* restore afm status */ - rkisp1_iowrite32(params_vdev, afm_ctrl, CIF_ISP_AFM_CTRL); + rkisp_iowrite32(params_vdev, afm_ctrl, CIF_ISP_AFM_CTRL); } -static void isp_afm_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_afm_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_afc_config *arg) { unsigned int i; u32 lum_var_shift, afm_var_shift; size_t num_of_win = min_t(size_t, ARRAY_SIZE(arg->afm_win), arg->num_afm_win); - u32 afm_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_AFM_CTRL); + u32 afm_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_AFM_CTRL); /* Switch off to configure. */ isp_param_clear_bits(params_vdev, CIF_ISP_AFM_CTRL, CIF_ISP_AFM_ENA); for (i = 0; i < num_of_win; i++) { - rkisp1_iowrite32(params_vdev, - CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_offs) | - CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_offs), - CIF_ISP_AFM_LT_A + i * 8); - rkisp1_iowrite32(params_vdev, - CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_size + - arg->afm_win[i].h_offs) | - CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_size + - arg->afm_win[i].v_offs), - CIF_ISP_AFM_RB_A + i * 8); + rkisp_iowrite32(params_vdev, + CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_offs) | + CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_offs), + CIF_ISP_AFM_LT_A + i * 8); + rkisp_iowrite32(params_vdev, + CIF_ISP_AFM_WINDOW_X(arg->afm_win[i].h_size + + arg->afm_win[i].h_offs) | + CIF_ISP_AFM_WINDOW_Y(arg->afm_win[i].v_size + + arg->afm_win[i].v_offs), + CIF_ISP_AFM_RB_A + i * 8); } - rkisp1_iowrite32(params_vdev, arg->thres, CIF_ISP_AFM_THRES); + rkisp_iowrite32(params_vdev, arg->thres, CIF_ISP_AFM_THRES); lum_var_shift = CIF_ISP_AFM_GET_LUM_SHIFT_a_V12(arg->var_shift); afm_var_shift = CIF_ISP_AFM_GET_AFM_SHIFT_a_V12(arg->var_shift); - rkisp1_iowrite32(params_vdev, - CIF_ISP_AFM_SET_SHIFT_a_V12(lum_var_shift, afm_var_shift) | - CIF_ISP_AFM_SET_SHIFT_b_V12(lum_var_shift, afm_var_shift) | - CIF_ISP_AFM_SET_SHIFT_c_V12(lum_var_shift, afm_var_shift), - CIF_ISP_AFM_VAR_SHIFT); + rkisp_iowrite32(params_vdev, + CIF_ISP_AFM_SET_SHIFT_a_V12(lum_var_shift, afm_var_shift) | + CIF_ISP_AFM_SET_SHIFT_b_V12(lum_var_shift, afm_var_shift) | + CIF_ISP_AFM_SET_SHIFT_c_V12(lum_var_shift, afm_var_shift), + CIF_ISP_AFM_VAR_SHIFT); /* restore afm status */ - rkisp1_iowrite32(params_vdev, afm_ctrl, CIF_ISP_AFM_CTRL); + rkisp_iowrite32(params_vdev, afm_ctrl, CIF_ISP_AFM_CTRL); } -static void isp_ie_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_ie_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_ie_config *arg) { u32 eff_ctrl; - eff_ctrl = rkisp1_ioread32(params_vdev, CIF_IMG_EFF_CTRL); + eff_ctrl = rkisp_ioread32(params_vdev, CIF_IMG_EFF_CTRL); eff_ctrl &= ~CIF_IMG_EFF_CTRL_MODE_MASK; if (params_vdev->quantization == V4L2_QUANTIZATION_FULL_RANGE) @@ -1035,7 +1035,7 @@ static void isp_ie_config(struct rkisp1_isp_params_vdev *params_vdev, eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_SEPIA; break; case V4L2_COLORFX_SET_CBCR: - rkisp1_iowrite32(params_vdev, arg->eff_tint, CIF_IMG_EFF_TINT); + rkisp_iowrite32(params_vdev, arg->eff_tint, CIF_IMG_EFF_TINT); eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_SEPIA; break; /* @@ -1044,26 +1044,26 @@ static void isp_ie_config(struct rkisp1_isp_params_vdev *params_vdev, */ case V4L2_COLORFX_AQUA: eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_COLOR_SEL; - rkisp1_iowrite32(params_vdev, arg->color_sel, - CIF_IMG_EFF_COLOR_SEL); + rkisp_iowrite32(params_vdev, arg->color_sel, + CIF_IMG_EFF_COLOR_SEL); break; case V4L2_COLORFX_EMBOSS: eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_EMBOSS; - rkisp1_iowrite32(params_vdev, arg->eff_mat_1, - CIF_IMG_EFF_MAT_1); - rkisp1_iowrite32(params_vdev, arg->eff_mat_2, - CIF_IMG_EFF_MAT_2); - rkisp1_iowrite32(params_vdev, arg->eff_mat_3, - CIF_IMG_EFF_MAT_3); + rkisp_iowrite32(params_vdev, arg->eff_mat_1, + CIF_IMG_EFF_MAT_1); + rkisp_iowrite32(params_vdev, arg->eff_mat_2, + CIF_IMG_EFF_MAT_2); + rkisp_iowrite32(params_vdev, arg->eff_mat_3, + CIF_IMG_EFF_MAT_3); break; case V4L2_COLORFX_SKETCH: eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_SKETCH; - rkisp1_iowrite32(params_vdev, arg->eff_mat_3, - CIF_IMG_EFF_MAT_3); - rkisp1_iowrite32(params_vdev, arg->eff_mat_4, - CIF_IMG_EFF_MAT_4); - rkisp1_iowrite32(params_vdev, arg->eff_mat_5, - CIF_IMG_EFF_MAT_5); + rkisp_iowrite32(params_vdev, arg->eff_mat_3, + CIF_IMG_EFF_MAT_3); + rkisp_iowrite32(params_vdev, arg->eff_mat_4, + CIF_IMG_EFF_MAT_4); + rkisp_iowrite32(params_vdev, arg->eff_mat_5, + CIF_IMG_EFF_MAT_5); break; case V4L2_COLORFX_BW: eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_BLACKWHITE; @@ -1075,10 +1075,10 @@ static void isp_ie_config(struct rkisp1_isp_params_vdev *params_vdev, break; } - rkisp1_iowrite32(params_vdev, eff_ctrl, CIF_IMG_EFF_CTRL); + rkisp_iowrite32(params_vdev, eff_ctrl, CIF_IMG_EFF_CTRL); } -static void isp_ie_enable(struct rkisp1_isp_params_vdev *params_vdev, bool en) +static void isp_ie_enable(struct rkisp_isp_params_vdev *params_vdev, bool en) { if (en) { isp_param_set_bits(params_vdev, CIF_ICCL, CIF_ICCL_IE_CLK); @@ -1093,7 +1093,7 @@ static void isp_ie_enable(struct rkisp1_isp_params_vdev *params_vdev, bool en) } } -static void isp_csm_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_csm_config(struct rkisp_isp_params_vdev *params_vdev, bool full_range) { const u16 full_range_coeff[] = { @@ -1110,16 +1110,16 @@ static void isp_csm_config(struct rkisp1_isp_params_vdev *params_vdev, if (full_range) { for (i = 0; i < ARRAY_SIZE(full_range_coeff); i++) - rkisp1_iowrite32(params_vdev, full_range_coeff[i], - CIF_ISP_CC_COEFF_0 + i * 4); + rkisp_iowrite32(params_vdev, full_range_coeff[i], + CIF_ISP_CC_COEFF_0 + i * 4); isp_param_set_bits(params_vdev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_CSM_Y_FULL_ENA | CIF_ISP_CTRL_ISP_CSM_C_FULL_ENA); } else { for (i = 0; i < ARRAY_SIZE(limited_range_coeff); i++) - rkisp1_iowrite32(params_vdev, limited_range_coeff[i], - CIF_ISP_CC_COEFF_0 + i * 4); + rkisp_iowrite32(params_vdev, limited_range_coeff[i], + CIF_ISP_CC_COEFF_0 + i * 4); isp_param_clear_bits(params_vdev, CIF_ISP_CTRL, CIF_ISP_CTRL_ISP_CSM_Y_FULL_ENA | @@ -1128,7 +1128,7 @@ static void isp_csm_config(struct rkisp1_isp_params_vdev *params_vdev, } /* ISP De-noise Pre-Filter(DPF) function */ -static void isp_dpf_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_dpf_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_dpf_config *arg) { unsigned int isp_dpf_mode; @@ -1175,97 +1175,97 @@ static void isp_dpf_config(struct rkisp1_isp_params_vdev *params_vdev, isp_dpf_mode |= CIF_ISP_DPF_MODE_GR_FLT_DIS; isp_param_set_bits(params_vdev, CIF_ISP_DPF_MODE, isp_dpf_mode); - rkisp1_iowrite32(params_vdev, arg->gain.nf_b_gain, - CIF_ISP_DPF_NF_GAIN_B); - rkisp1_iowrite32(params_vdev, arg->gain.nf_r_gain, - CIF_ISP_DPF_NF_GAIN_R); - rkisp1_iowrite32(params_vdev, arg->gain.nf_gb_gain, - CIF_ISP_DPF_NF_GAIN_GB); - rkisp1_iowrite32(params_vdev, arg->gain.nf_gr_gain, - CIF_ISP_DPF_NF_GAIN_GR); + rkisp_iowrite32(params_vdev, arg->gain.nf_b_gain, + CIF_ISP_DPF_NF_GAIN_B); + rkisp_iowrite32(params_vdev, arg->gain.nf_r_gain, + CIF_ISP_DPF_NF_GAIN_R); + rkisp_iowrite32(params_vdev, arg->gain.nf_gb_gain, + CIF_ISP_DPF_NF_GAIN_GB); + rkisp_iowrite32(params_vdev, arg->gain.nf_gr_gain, + CIF_ISP_DPF_NF_GAIN_GR); for (i = 0; i < CIFISP_DPF_MAX_NLF_COEFFS; i++) { - rkisp1_iowrite32(params_vdev, arg->nll.coeff[i], - CIF_ISP_DPF_NULL_COEFF_0 + i * 4); + rkisp_iowrite32(params_vdev, arg->nll.coeff[i], + CIF_ISP_DPF_NULL_COEFF_0 + i * 4); } spatial_coeff = arg->g_flt.spatial_coeff[0] | (arg->g_flt.spatial_coeff[1] << 8) | (arg->g_flt.spatial_coeff[2] << 16) | (arg->g_flt.spatial_coeff[3] << 24); - rkisp1_iowrite32(params_vdev, spatial_coeff, - CIF_ISP_DPF_S_WEIGHT_G_1_4); + rkisp_iowrite32(params_vdev, spatial_coeff, + CIF_ISP_DPF_S_WEIGHT_G_1_4); spatial_coeff = arg->g_flt.spatial_coeff[4] | (arg->g_flt.spatial_coeff[5] << 8); - rkisp1_iowrite32(params_vdev, spatial_coeff, - CIF_ISP_DPF_S_WEIGHT_G_5_6); + rkisp_iowrite32(params_vdev, spatial_coeff, + CIF_ISP_DPF_S_WEIGHT_G_5_6); spatial_coeff = arg->rb_flt.spatial_coeff[0] | (arg->rb_flt.spatial_coeff[1] << 8) | (arg->rb_flt.spatial_coeff[2] << 16) | (arg->rb_flt.spatial_coeff[3] << 24); - rkisp1_iowrite32(params_vdev, spatial_coeff, - CIF_ISP_DPF_S_WEIGHT_RB_1_4); + rkisp_iowrite32(params_vdev, spatial_coeff, + CIF_ISP_DPF_S_WEIGHT_RB_1_4); spatial_coeff = arg->rb_flt.spatial_coeff[4] | (arg->rb_flt.spatial_coeff[5] << 8); - rkisp1_iowrite32(params_vdev, spatial_coeff, + rkisp_iowrite32(params_vdev, spatial_coeff, CIF_ISP_DPF_S_WEIGHT_RB_5_6); } -static void isp_dpf_strength_config(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_dpf_strength_config(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_dpf_strength_config *arg) { - rkisp1_iowrite32(params_vdev, arg->b, CIF_ISP_DPF_STRENGTH_B); - rkisp1_iowrite32(params_vdev, arg->g, CIF_ISP_DPF_STRENGTH_G); - rkisp1_iowrite32(params_vdev, arg->r, CIF_ISP_DPF_STRENGTH_R); + rkisp_iowrite32(params_vdev, arg->b, CIF_ISP_DPF_STRENGTH_B); + rkisp_iowrite32(params_vdev, arg->g, CIF_ISP_DPF_STRENGTH_G); + rkisp_iowrite32(params_vdev, arg->r, CIF_ISP_DPF_STRENGTH_R); } -static void isp_dummy_enable(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_dummy_enable(struct rkisp_isp_params_vdev *params_vdev, bool en) { } -static void isp_wdr_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_wdr_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_wdr_config *arg) { } -static void isp_wdr_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_wdr_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_wdr_config *arg) { int i; for (i = 0; i < CIFISP_WDR_SIZE; i++) { if (i <= 39) - rkisp1_iowrite32(params_vdev, arg->c_wdr[i], - CIF_ISP_WDR_CTRL + i * 4); + rkisp_iowrite32(params_vdev, arg->c_wdr[i], + CIF_ISP_WDR_CTRL + i * 4); else - rkisp1_iowrite32(params_vdev, arg->c_wdr[i], - CIF_ISP_RKWDR_CTRL0 + (i - 40) * 4); + rkisp_iowrite32(params_vdev, arg->c_wdr[i], + CIF_ISP_RKWDR_CTRL0 + (i - 40) * 4); } } -static void isp_wdr_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, +static void isp_wdr_enable_v12(struct rkisp_isp_params_vdev *params_vdev, bool en) { if (en) - rkisp1_iowrite32(params_vdev, 0x030cf1, - CIF_ISP_RKWDR_CTRL0); + rkisp_iowrite32(params_vdev, 0x030cf1, + CIF_ISP_RKWDR_CTRL0); else - rkisp1_iowrite32(params_vdev, 0x030cf0, - CIF_ISP_RKWDR_CTRL0); + rkisp_iowrite32(params_vdev, 0x030cf0, + CIF_ISP_RKWDR_CTRL0); } static void -isp_demosaiclp_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +isp_demosaiclp_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_demosaiclp_config *arg) { } static void -isp_demosaiclp_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +isp_demosaiclp_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_demosaiclp_config *arg) { u32 val; @@ -1275,79 +1275,79 @@ isp_demosaiclp_config_v12(struct rkisp1_isp_params_vdev *params_vdev, arg->lu_divided[1], arg->lu_divided[2], arg->lu_divided[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_LU_DIVID); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_LU_DIVID); val = CIF_ISP_PACK_4BYTE(arg->thgrad_divided[0], arg->thgrad_divided[1], arg->thgrad_divided[2], arg->thgrad_divided[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_THGRAD_DIVID0123); - rkisp1_iowrite32(params_vdev, - arg->thgrad_divided[4], - CIF_ISP_FILT_THGRAD_DIVID4); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_THGRAD_DIVID0123); + rkisp_iowrite32(params_vdev, + arg->thgrad_divided[4], + CIF_ISP_FILT_THGRAD_DIVID4); val = CIF_ISP_PACK_4BYTE(arg->thdiff_divided[0], arg->thdiff_divided[1], arg->thdiff_divided[2], arg->thdiff_divided[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_THDIFF_DIVID0123); - rkisp1_iowrite32(params_vdev, - arg->thdiff_divided[4], - CIF_ISP_FILT_THDIFF_DIVID4); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_THDIFF_DIVID0123); + rkisp_iowrite32(params_vdev, + arg->thdiff_divided[4], + CIF_ISP_FILT_THDIFF_DIVID4); val = CIF_ISP_PACK_4BYTE(arg->thcsc_divided[0], arg->thcsc_divided[1], arg->thcsc_divided[2], arg->thcsc_divided[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_THCSC_DIVID0123); - rkisp1_iowrite32(params_vdev, arg->thcsc_divided[4], - CIF_ISP_FILT_THCSC_DIVID4); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_THCSC_DIVID0123); + rkisp_iowrite32(params_vdev, arg->thcsc_divided[4], + CIF_ISP_FILT_THCSC_DIVID4); val = CIF_ISP_PACK_2SHORT(arg->thvar_divided[0], arg->thvar_divided[1]); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_THVAR_DIVID01); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_THVAR_DIVID01); val = CIF_ISP_PACK_2SHORT(arg->thvar_divided[2], arg->thvar_divided[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_THVAR_DIVID23); - rkisp1_iowrite32(params_vdev, arg->thvar_divided[4], - CIF_ISP_FILT_THVAR_DIVID4); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_THVAR_DIVID23); + rkisp_iowrite32(params_vdev, arg->thvar_divided[4], + CIF_ISP_FILT_THVAR_DIVID4); - rkisp1_iowrite32(params_vdev, arg->th_grad, - CIF_ISP_FILT_TH_GRAD); - rkisp1_iowrite32(params_vdev, arg->th_diff, - CIF_ISP_FILT_TH_DIFF); - rkisp1_iowrite32(params_vdev, arg->th_csc, - CIF_ISP_FILT_TH_CSC); - rkisp1_iowrite32(params_vdev, arg->th_var, - CIF_ISP_FILT_TH_VAR); + rkisp_iowrite32(params_vdev, arg->th_grad, + CIF_ISP_FILT_TH_GRAD); + rkisp_iowrite32(params_vdev, arg->th_diff, + CIF_ISP_FILT_TH_DIFF); + rkisp_iowrite32(params_vdev, arg->th_csc, + CIF_ISP_FILT_TH_CSC); + rkisp_iowrite32(params_vdev, arg->th_var, + CIF_ISP_FILT_TH_VAR); val = CIF_ISP_PACK_4BYTE(arg->thvar_r_fct, arg->thdiff_r_fct, arg->thgrad_r_fct, 0); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_R_FCT); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_R_FCT); val = CIF_ISP_PACK_4BYTE(arg->thgrad_b_fct, arg->thdiff_b_fct, arg->thvar_b_fct, 0); - rkisp1_iowrite32(params_vdev, val, - CIF_ISP_FILT_B_FCT); + rkisp_iowrite32(params_vdev, val, + CIF_ISP_FILT_B_FCT); isp_param_set_bits(params_vdev, CIF_ISP_FILT_MODE, arg->rb_filter_en << 3 | arg->hp_filter_en << 2); - level_sel = rkisp1_ioread32(params_vdev, CIF_ISP_FILT_LELEL_SEL); + level_sel = rkisp_ioread32(params_vdev, CIF_ISP_FILT_LELEL_SEL); level_sel &= CIF_ISP_FLT_LEVEL_OLD_LP; level_sel |= arg->th_var_en << 20 | arg->th_csc_en << 19 | @@ -1358,12 +1358,12 @@ isp_demosaiclp_config_v12(struct rkisp1_isp_params_vdev *params_vdev, arg->pattern_level_sel << 4 | arg->edge_level_sel; - rkisp1_iowrite32(params_vdev, level_sel, - CIF_ISP_FILT_LELEL_SEL); + rkisp_iowrite32(params_vdev, level_sel, + CIF_ISP_FILT_LELEL_SEL); } static void -isp_demosaiclp_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, +isp_demosaiclp_enable_v12(struct rkisp_isp_params_vdev *params_vdev, bool en) { if (en) @@ -1377,13 +1377,13 @@ isp_demosaiclp_enable_v12(struct rkisp1_isp_params_vdev *params_vdev, } static void -isp_rkiesharp_config_v10(struct rkisp1_isp_params_vdev *params_vdev, +isp_rkiesharp_config_v10(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_rkiesharp_config *arg) { } static void -isp_rkiesharp_config_v12(struct rkisp1_isp_params_vdev *params_vdev, +isp_rkiesharp_config_v12(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_rkiesharp_config *arg) { u32 i; @@ -1395,29 +1395,29 @@ isp_rkiesharp_config_v12(struct rkisp1_isp_params_vdev *params_vdev, arg->yavg_thr[1], arg->yavg_thr[2], arg->yavg_thr[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_YAVG_THR); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_YAVG_THR); val = CIF_ISP_PACK_4BYTE(arg->delta1[0], arg->delta2[0], arg->delta1[1], arg->delta2[1]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_DELTA_P0_P1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_DELTA_P0_P1); val = CIF_ISP_PACK_4BYTE(arg->delta1[2], arg->delta2[2], arg->delta1[3], arg->delta2[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_DELTA_P2_P3); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_DELTA_P2_P3); val = CIF_ISP_PACK_4BYTE(arg->delta1[4], arg->delta2[4], 0, 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_DELTA_P4); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_DELTA_P4); for (i = 0; i < 5; i++) minmax[i] = arg->minnumber[i] << 4 | arg->maxnumber[i]; @@ -1425,265 +1425,265 @@ isp_rkiesharp_config_v12(struct rkisp1_isp_params_vdev *params_vdev, minmax[1], minmax[2], minmax[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_NPIXEL_P0_P1_P2_P3); - rkisp1_iowrite32(params_vdev, minmax[4], - CIF_RKSHARP_NPIXEL_P4); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_NPIXEL_P0_P1_P2_P3); + rkisp_iowrite32(params_vdev, minmax[4], + CIF_RKSHARP_NPIXEL_P4); val = CIF_ISP_PACK_4BYTE(arg->gauss_flat_coe[0], arg->gauss_flat_coe[1], arg->gauss_flat_coe[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_FLAT_COE1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_FLAT_COE1); val = CIF_ISP_PACK_4BYTE(arg->gauss_flat_coe[3], arg->gauss_flat_coe[4], arg->gauss_flat_coe[5], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_FLAT_COE2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_FLAT_COE2); val = CIF_ISP_PACK_4BYTE(arg->gauss_flat_coe[6], arg->gauss_flat_coe[7], arg->gauss_flat_coe[8], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_FLAT_COE3); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_FLAT_COE3); val = CIF_ISP_PACK_4BYTE(arg->gauss_noise_coe[0], arg->gauss_noise_coe[1], arg->gauss_noise_coe[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_NOISE_COE1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_NOISE_COE1); val = CIF_ISP_PACK_4BYTE(arg->gauss_noise_coe[3], arg->gauss_noise_coe[4], arg->gauss_noise_coe[5], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_NOISE_COE2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_NOISE_COE2); val = CIF_ISP_PACK_4BYTE(arg->gauss_noise_coe[6], arg->gauss_noise_coe[7], arg->gauss_noise_coe[8], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_NOISE_COE3); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_NOISE_COE3); val = CIF_ISP_PACK_4BYTE(arg->gauss_other_coe[0], arg->gauss_other_coe[1], arg->gauss_other_coe[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_OTHER_COE1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_OTHER_COE1); val = CIF_ISP_PACK_4BYTE(arg->gauss_other_coe[3], arg->gauss_other_coe[4], arg->gauss_other_coe[5], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_OTHER_COE2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_OTHER_COE2); val = CIF_ISP_PACK_4BYTE(arg->gauss_other_coe[6], arg->gauss_other_coe[7], arg->gauss_other_coe[8], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GAUSS_OTHER_COE3); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GAUSS_OTHER_COE3); val = CIF_ISP_PACK_4BYTE(arg->line1_filter_coe[0], arg->line1_filter_coe[1], arg->line1_filter_coe[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE1_FILTER_COE1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE1_FILTER_COE1); val = CIF_ISP_PACK_4BYTE(arg->line1_filter_coe[3], arg->line1_filter_coe[4], arg->line1_filter_coe[5], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE1_FILTER_COE2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE1_FILTER_COE2); val = CIF_ISP_PACK_4BYTE(arg->line2_filter_coe[0], arg->line2_filter_coe[1], arg->line2_filter_coe[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE2_FILTER_COE1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE2_FILTER_COE1); val = CIF_ISP_PACK_4BYTE(arg->line2_filter_coe[3], arg->line2_filter_coe[4], arg->line2_filter_coe[5], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE2_FILTER_COE2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE2_FILTER_COE2); val = CIF_ISP_PACK_4BYTE(arg->line2_filter_coe[6], arg->line2_filter_coe[7], arg->line2_filter_coe[8], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE2_FILTER_COE3); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE2_FILTER_COE3); val = CIF_ISP_PACK_4BYTE(arg->line3_filter_coe[0], arg->line3_filter_coe[1], arg->line3_filter_coe[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE3_FILTER_COE1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE3_FILTER_COE1); val = CIF_ISP_PACK_4BYTE(arg->line3_filter_coe[3], arg->line3_filter_coe[4], arg->line3_filter_coe[5], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_LINE3_FILTER_COE2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_LINE3_FILTER_COE2); val = CIF_ISP_PACK_2SHORT(arg->grad_seq[0], arg->grad_seq[1]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GRAD_SEQ_P0_P1); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GRAD_SEQ_P0_P1); val = CIF_ISP_PACK_2SHORT(arg->grad_seq[2], arg->grad_seq[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_GRAD_SEQ_P2_P3); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_GRAD_SEQ_P2_P3); val = CIF_ISP_PACK_4BYTE(arg->sharp_factor[0], arg->sharp_factor[1], arg->sharp_factor[2], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_SHARP_FACTOR_P0_P1_P2); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_SHARP_FACTOR_P0_P1_P2); val = CIF_ISP_PACK_4BYTE(arg->sharp_factor[3], arg->sharp_factor[4], 0, 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_SHARP_FACTOR_P3_P4); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_SHARP_FACTOR_P3_P4); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_flat_coe[0], arg->uv_gauss_flat_coe[1], arg->uv_gauss_flat_coe[2], arg->uv_gauss_flat_coe[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_FLAT_COE11_COE14); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_FLAT_COE11_COE14); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_flat_coe[4], arg->uv_gauss_flat_coe[5], arg->uv_gauss_flat_coe[6], arg->uv_gauss_flat_coe[7]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_FLAT_COE15_COE23); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_FLAT_COE15_COE23); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_flat_coe[8], arg->uv_gauss_flat_coe[9], arg->uv_gauss_flat_coe[10], arg->uv_gauss_flat_coe[11]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_FLAT_COE24_COE32); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_FLAT_COE24_COE32); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_flat_coe[12], arg->uv_gauss_flat_coe[13], arg->uv_gauss_flat_coe[14], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_FLAT_COE33_COE35); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_FLAT_COE33_COE35); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_noise_coe[0], arg->uv_gauss_noise_coe[1], arg->uv_gauss_noise_coe[2], arg->uv_gauss_noise_coe[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_NOISE_COE11_COE14); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_NOISE_COE11_COE14); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_noise_coe[4], arg->uv_gauss_noise_coe[5], arg->uv_gauss_noise_coe[6], arg->uv_gauss_noise_coe[7]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_NOISE_COE15_COE23); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_NOISE_COE15_COE23); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_noise_coe[8], arg->uv_gauss_noise_coe[9], arg->uv_gauss_noise_coe[10], arg->uv_gauss_noise_coe[11]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_NOISE_COE24_COE32); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_NOISE_COE24_COE32); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_noise_coe[12], arg->uv_gauss_noise_coe[13], arg->uv_gauss_noise_coe[14], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_NOISE_COE33_COE35); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_NOISE_COE33_COE35); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_other_coe[0], arg->uv_gauss_other_coe[1], arg->uv_gauss_other_coe[2], arg->uv_gauss_other_coe[3]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_OTHER_COE11_COE14); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_OTHER_COE11_COE14); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_other_coe[4], arg->uv_gauss_other_coe[5], arg->uv_gauss_other_coe[6], arg->uv_gauss_other_coe[7]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_OTHER_COE15_COE23); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_OTHER_COE15_COE23); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_other_coe[8], arg->uv_gauss_other_coe[9], arg->uv_gauss_other_coe[10], arg->uv_gauss_other_coe[11]); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_OTHER_COE24_COE32); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_OTHER_COE24_COE32); val = CIF_ISP_PACK_4BYTE(arg->uv_gauss_other_coe[12], arg->uv_gauss_other_coe[13], arg->uv_gauss_other_coe[14], 0); - rkisp1_iowrite32(params_vdev, val, - CIF_RKSHARP_UV_GAUSS_OTHER_COE33_COE35); + rkisp_iowrite32(params_vdev, val, + CIF_RKSHARP_UV_GAUSS_OTHER_COE33_COE35); - rkisp1_iowrite32(params_vdev, arg->switch_avg, - CIF_RKSHARP_CTRL); + rkisp_iowrite32(params_vdev, arg->switch_avg, + CIF_RKSHARP_CTRL); - rkisp1_iowrite32(params_vdev, - arg->coring_thr, - CIF_IMG_EFF_SHARPEN); + rkisp_iowrite32(params_vdev, + arg->coring_thr, + CIF_IMG_EFF_SHARPEN); - val = rkisp1_ioread32(params_vdev, CIF_IMG_EFF_MAT_3) & 0x0F; + val = rkisp_ioread32(params_vdev, CIF_IMG_EFF_MAT_3) & 0x0F; val |= (arg->lap_mat_coe[0] & 0x0F) << 4 | (arg->lap_mat_coe[1] & 0x0F) << 8 | (arg->lap_mat_coe[2] & 0x0F) << 12; - rkisp1_iowrite32(params_vdev, val, CIF_IMG_EFF_MAT_3); + rkisp_iowrite32(params_vdev, val, CIF_IMG_EFF_MAT_3); val = (arg->lap_mat_coe[3] & 0x0F) << 0 | (arg->lap_mat_coe[4] & 0x0F) << 4 | (arg->lap_mat_coe[5] & 0x0F) << 8 | (arg->lap_mat_coe[6] & 0x0F) << 12; - rkisp1_iowrite32(params_vdev, val, CIF_IMG_EFF_MAT_4); + rkisp_iowrite32(params_vdev, val, CIF_IMG_EFF_MAT_4); val = (arg->lap_mat_coe[7] & 0x0F) << 0 | (arg->lap_mat_coe[8] & 0x0F) << 4; - rkisp1_iowrite32(params_vdev, val, CIF_IMG_EFF_MAT_5); + rkisp_iowrite32(params_vdev, val, CIF_IMG_EFF_MAT_5); - eff_ctrl = rkisp1_ioread32(params_vdev, CIF_IMG_EFF_CTRL); + eff_ctrl = rkisp_ioread32(params_vdev, CIF_IMG_EFF_CTRL); eff_ctrl &= ~CIF_IMG_EFF_CTRL_MODE_MASK; eff_ctrl |= CIF_IMG_EFF_CTRL_MODE_RKSHARPEN; if (arg->full_range) eff_ctrl |= CIF_IMG_EFF_CTRL_YCBCR_FULL; - rkisp1_iowrite32(params_vdev, eff_ctrl, CIF_IMG_EFF_CTRL); + rkisp_iowrite32(params_vdev, eff_ctrl, CIF_IMG_EFF_CTRL); } -static struct rkisp1_isp_params_ops rkisp1_v10_isp_params_ops = { +static struct rkisp_isp_params_ops rkisp_v10_isp_params_ops = { .dpcc_config = isp_dpcc_config, .bls_config = isp_bls_config, .lsc_config = isp_lsc_config, @@ -1715,7 +1715,7 @@ static struct rkisp1_isp_params_ops rkisp1_v10_isp_params_ops = { .rkiesharp_enable = isp_dummy_enable, }; -static struct rkisp1_isp_params_ops rkisp1_v12_isp_params_ops = { +static struct rkisp_isp_params_ops rkisp_v12_isp_params_ops = { .dpcc_config = isp_dpcc_config, .bls_config = isp_bls_config, .lsc_config = isp_lsc_config, @@ -1747,22 +1747,22 @@ static struct rkisp1_isp_params_ops rkisp1_v12_isp_params_ops = { .rkiesharp_enable = isp_ie_enable, }; -static struct rkisp1_isp_params_config rkisp1_v10_isp_params_config = { +static struct rkisp_isp_params_config rkisp_v10_isp_params_config = { .gamma_out_max_samples = 17, .hst_weight_grids_size = 28, }; -static struct rkisp1_isp_params_config rkisp1_v12_isp_params_config = { +static struct rkisp_isp_params_config rkisp_v12_isp_params_config = { .gamma_out_max_samples = 34, .hst_weight_grids_size = 81, }; static __maybe_unused -void __isp_isr_other_config(struct rkisp1_isp_params_vdev *params_vdev, +void __isp_isr_other_config(struct rkisp_isp_params_vdev *params_vdev, const struct rkisp1_isp_params_cfg *new_params) { unsigned int module_en_update, module_cfg_update, module_ens; - struct rkisp1_isp_params_ops *ops = params_vdev->ops; + struct rkisp_isp_params_ops *ops = params_vdev->ops; struct ispsd_in_fmt *in_fmt = ¶ms_vdev->dev->isp_sdev.in_fmt; bool ie_enable; bool iesharp_enable; @@ -2034,11 +2034,11 @@ void __isp_isr_other_config(struct rkisp1_isp_params_vdev *params_vdev, } static __maybe_unused -void __isp_isr_meas_config(struct rkisp1_isp_params_vdev *params_vdev, +void __isp_isr_meas_config(struct rkisp_isp_params_vdev *params_vdev, struct rkisp1_isp_params_cfg *new_params) { unsigned int module_en_update, module_cfg_update, module_ens; - struct rkisp1_isp_params_ops *ops = params_vdev->ops; + struct rkisp_isp_params_ops *ops = params_vdev->ops; module_en_update = new_params->module_en_update; module_cfg_update = new_params->module_cfg_update; @@ -2107,7 +2107,7 @@ void __isp_isr_meas_config(struct rkisp1_isp_params_vdev *params_vdev, } static __maybe_unused -void __preisp_isr_update_hdrae_para(struct rkisp1_isp_params_vdev *params_vdev, +void __preisp_isr_update_hdrae_para(struct rkisp_isp_params_vdev *params_vdev, struct rkisp1_isp_params_cfg *new_params) { struct preisp_hdrae_para_s *hdrae; @@ -2166,10 +2166,10 @@ void __preisp_isr_update_hdrae_para(struct rkisp1_isp_params_vdev *params_vdev, params_vdev->dev->hdr_sensor = NULL; } -void rkisp1_params_isr(struct rkisp1_isp_params_vdev *params_vdev, u32 isp_mis) +void rkisp_params_isr(struct rkisp_isp_params_vdev *params_vdev, u32 isp_mis) { struct rkisp1_isp_params_cfg *new_params; - struct rkisp1_buffer *cur_buf = NULL; + struct rkisp_buffer *cur_buf = NULL; unsigned int cur_frame_id = -1; cur_frame_id = atomic_read(¶ms_vdev->dev->isp_sdev.frm_sync_seq) - 1; @@ -2182,7 +2182,7 @@ void rkisp1_params_isr(struct rkisp1_isp_params_vdev *params_vdev, u32 isp_mis) /* get one empty buffer */ if (!list_empty(¶ms_vdev->params)) cur_buf = list_first_entry(¶ms_vdev->params, - struct rkisp1_buffer, queue); + struct rkisp_buffer, queue); if (!cur_buf) { spin_unlock(¶ms_vdev->config_lock); return; @@ -2199,9 +2199,9 @@ void rkisp1_params_isr(struct rkisp1_isp_params_vdev *params_vdev, u32 isp_mis) __isp_isr_meas_config(params_vdev, new_params); /* update shadow register immediately */ - isp_ctrl = rkisp1_ioread32(params_vdev, CIF_ISP_CTRL); + isp_ctrl = rkisp_ioread32(params_vdev, CIF_ISP_CTRL); isp_ctrl |= CIF_ISP_CTRL_ISP_CFG_UPD; - rkisp1_iowrite32(params_vdev, isp_ctrl, CIF_ISP_CTRL); + rkisp_iowrite32(params_vdev, isp_ctrl, CIF_ISP_CTRL); __preisp_isr_update_hdrae_para(params_vdev, new_params); @@ -2213,7 +2213,7 @@ void rkisp1_params_isr(struct rkisp1_isp_params_vdev *params_vdev, u32 isp_mis) static const struct cifisp_awb_meas_config awb_params_default_config = { { - 0, 0, RKISP1_DEFAULT_WIDTH, RKISP1_DEFAULT_HEIGHT + 0, 0, RKISP_DEFAULT_WIDTH, RKISP_DEFAULT_HEIGHT }, CIFISP_AWB_MODE_YCBCR, 200, 30, 20, 20, 0, 128, 128 }; @@ -2222,8 +2222,8 @@ static const struct cifisp_aec_config aec_params_default_config = { CIFISP_EXP_MEASURING_MODE_0, CIFISP_EXP_CTRL_AUTOSTOP_0, { - RKISP1_DEFAULT_WIDTH >> 2, RKISP1_DEFAULT_HEIGHT >> 2, - RKISP1_DEFAULT_WIDTH >> 1, RKISP1_DEFAULT_HEIGHT >> 1 + RKISP_DEFAULT_WIDTH >> 2, RKISP_DEFAULT_HEIGHT >> 2, + RKISP_DEFAULT_WIDTH >> 1, RKISP_DEFAULT_HEIGHT >> 1 } }; @@ -2231,8 +2231,8 @@ static const struct cifisp_hst_config hst_params_default_config = { CIFISP_HISTOGRAM_MODE_RGB_COMBINED, 3, { - RKISP1_DEFAULT_WIDTH >> 2, RKISP1_DEFAULT_HEIGHT >> 2, - RKISP1_DEFAULT_WIDTH >> 1, RKISP1_DEFAULT_HEIGHT >> 1 + RKISP_DEFAULT_WIDTH >> 2, RKISP_DEFAULT_HEIGHT >> 2, + RKISP_DEFAULT_WIDTH >> 1, RKISP_DEFAULT_HEIGHT >> 1 }, { 0, /* To be filled in with 0x01 at runtime. */ @@ -2251,9 +2251,9 @@ static const struct cifisp_afc_config afc_params_default_config = { }; static -void rkisp1_params_config_parameter(struct rkisp1_isp_params_vdev *params_vdev) +void rkisp_params_config_parameter(struct rkisp_isp_params_vdev *params_vdev) { - struct rkisp1_isp_params_ops *ops = params_vdev->ops; + struct rkisp_isp_params_ops *ops = params_vdev->ops; struct cifisp_hst_config hst = hst_params_default_config; struct device *dev = params_vdev->dev->dev; int i; @@ -2321,20 +2321,20 @@ void rkisp1_params_config_parameter(struct rkisp1_isp_params_vdev *params_vdev) } /* Not called when the camera active, thus not isr protection. */ -void rkisp1_params_configure_isp(struct rkisp1_isp_params_vdev *params_vdev, +void rkisp_params_configure_isp(struct rkisp_isp_params_vdev *params_vdev, struct ispsd_in_fmt *in_fmt, enum v4l2_quantization quantization) { params_vdev->quantization = quantization; params_vdev->raw_type = in_fmt->bayer_pat; params_vdev->in_mbus_code = in_fmt->mbus_code; - rkisp1_params_config_parameter(params_vdev); + rkisp_params_config_parameter(params_vdev); } /* Not called when the camera active, thus not isr protection. */ -void rkisp1_params_disable_isp(struct rkisp1_isp_params_vdev *params_vdev) +void rkisp_params_disable_isp(struct rkisp_isp_params_vdev *params_vdev) { - struct rkisp1_isp_params_ops *ops = params_vdev->ops; + struct rkisp_isp_params_ops *ops = params_vdev->ops; isp_param_clear_bits(params_vdev, CIF_ISP_DPCC_MODE, CIF_ISP_DPCC_ENA); isp_param_clear_bits(params_vdev, CIF_ISP_LSC_CTRL, @@ -2361,11 +2361,11 @@ void rkisp1_params_disable_isp(struct rkisp1_isp_params_vdev *params_vdev) CIF_ISP_DPF_MODE_EN); } -static int rkisp1_params_enum_fmt_meta_out(struct file *file, void *priv, +static int rkisp_params_enum_fmt_meta_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { struct video_device *video = video_devdata(file); - struct rkisp1_isp_params_vdev *params_vdev = video_get_drvdata(video); + struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(video); if (f->index > 0 || f->type != video->queue->type) return -EINVAL; @@ -2375,11 +2375,11 @@ static int rkisp1_params_enum_fmt_meta_out(struct file *file, void *priv, return 0; } -static int rkisp1_params_g_fmt_meta_out(struct file *file, void *fh, +static int rkisp_params_g_fmt_meta_out(struct file *file, void *fh, struct v4l2_format *f) { struct video_device *video = video_devdata(file); - struct rkisp1_isp_params_vdev *params_vdev = video_get_drvdata(video); + struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(video); struct v4l2_meta_format *meta = &f->fmt.meta; if (f->type != video->queue->type) @@ -2392,11 +2392,11 @@ static int rkisp1_params_g_fmt_meta_out(struct file *file, void *fh, return 0; } -static int rkisp1_params_querycap(struct file *file, +static int rkisp_params_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { struct video_device *vdev = video_devdata(file); - struct rkisp1_isp_params_vdev *params_vdev = video_get_drvdata(vdev); + struct rkisp_isp_params_vdev *params_vdev = video_get_drvdata(vdev); snprintf(cap->driver, sizeof(cap->driver), "%s_v%d", DRIVER_NAME, @@ -2407,7 +2407,7 @@ static int rkisp1_params_querycap(struct file *file, return 0; } -static int rkisp1_params_subs_evt(struct v4l2_fh *fh, +static int rkisp_params_subs_evt(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub) { if (sub->id != 0) @@ -2423,7 +2423,7 @@ static int rkisp1_params_subs_evt(struct v4l2_fh *fh, } /* ISP params video device IOCTLs */ -static const struct v4l2_ioctl_ops rkisp1_params_ioctl = { +static const struct v4l2_ioctl_ops rkisp_params_ioctl = { .vidioc_reqbufs = vb2_ioctl_reqbufs, .vidioc_querybuf = vb2_ioctl_querybuf, .vidioc_create_bufs = vb2_ioctl_create_bufs, @@ -2433,26 +2433,26 @@ static const struct v4l2_ioctl_ops rkisp1_params_ioctl = { .vidioc_expbuf = vb2_ioctl_expbuf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_enum_fmt_meta_out = rkisp1_params_enum_fmt_meta_out, - .vidioc_g_fmt_meta_out = rkisp1_params_g_fmt_meta_out, - .vidioc_s_fmt_meta_out = rkisp1_params_g_fmt_meta_out, - .vidioc_try_fmt_meta_out = rkisp1_params_g_fmt_meta_out, - .vidioc_querycap = rkisp1_params_querycap, - .vidioc_subscribe_event = rkisp1_params_subs_evt, + .vidioc_enum_fmt_meta_out = rkisp_params_enum_fmt_meta_out, + .vidioc_g_fmt_meta_out = rkisp_params_g_fmt_meta_out, + .vidioc_s_fmt_meta_out = rkisp_params_g_fmt_meta_out, + .vidioc_try_fmt_meta_out = rkisp_params_g_fmt_meta_out, + .vidioc_querycap = rkisp_params_querycap, + .vidioc_subscribe_event = rkisp_params_subs_evt, .vidioc_unsubscribe_event = v4l2_event_unsubscribe }; -static int rkisp1_params_vb2_queue_setup(struct vb2_queue *vq, +static int rkisp_params_vb2_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], struct device *alloc_ctxs[]) { - struct rkisp1_isp_params_vdev *params_vdev = vq->drv_priv; + struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv; *num_buffers = clamp_t(u32, *num_buffers, - RKISP1_ISP_PARAMS_REQ_BUFS_MIN, - RKISP1_ISP_PARAMS_REQ_BUFS_MAX); + RKISP_ISP_PARAMS_REQ_BUFS_MIN, + RKISP_ISP_PARAMS_REQ_BUFS_MAX); *num_planes = 1; @@ -2464,12 +2464,12 @@ static int rkisp1_params_vb2_queue_setup(struct vb2_queue *vq, return 0; } -static void rkisp1_params_vb2_buf_queue(struct vb2_buffer *vb) +static void rkisp_params_vb2_buf_queue(struct vb2_buffer *vb) { struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct rkisp1_buffer *params_buf = to_rkisp1_buffer(vbuf); + struct rkisp_buffer *params_buf = to_rkisp_buffer(vbuf); struct vb2_queue *vq = vb->vb2_queue; - struct rkisp1_isp_params_vdev *params_vdev = vq->drv_priv; + struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv; struct rkisp1_isp_params_cfg *new_params; unsigned long flags; @@ -2493,11 +2493,11 @@ static void rkisp1_params_vb2_buf_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); } -static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq) +static void rkisp_params_vb2_stop_streaming(struct vb2_queue *vq) { - struct rkisp1_isp_params_vdev *params_vdev = vq->drv_priv; - struct rkisp1_device *dev = params_vdev->dev; - struct rkisp1_buffer *buf; + struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv; + struct rkisp_device *dev = params_vdev->dev; + struct rkisp_buffer *buf; unsigned long flags; int i; @@ -2507,11 +2507,11 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq) wake_up(&dev->sync_onoff); spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); - for (i = 0; i < RKISP1_ISP_PARAMS_REQ_BUFS_MAX; i++) { + for (i = 0; i < RKISP_ISP_PARAMS_REQ_BUFS_MAX; i++) { spin_lock_irqsave(¶ms_vdev->config_lock, flags); if (!list_empty(¶ms_vdev->params)) { buf = list_first_entry(¶ms_vdev->params, - struct rkisp1_buffer, queue); + struct rkisp_buffer, queue); list_del(&buf->queue); spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); @@ -2532,9 +2532,9 @@ static void rkisp1_params_vb2_stop_streaming(struct vb2_queue *vq) } static int -rkisp1_params_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) +rkisp_params_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) { - struct rkisp1_isp_params_vdev *params_vdev = queue->drv_priv; + struct rkisp_isp_params_vdev *params_vdev = queue->drv_priv; unsigned long flags; spin_lock_irqsave(¶ms_vdev->config_lock, flags); @@ -2544,17 +2544,17 @@ rkisp1_params_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) return 0; } -static struct vb2_ops rkisp1_params_vb2_ops = { - .queue_setup = rkisp1_params_vb2_queue_setup, +static struct vb2_ops rkisp_params_vb2_ops = { + .queue_setup = rkisp_params_vb2_queue_setup, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, - .buf_queue = rkisp1_params_vb2_buf_queue, - .start_streaming = rkisp1_params_vb2_start_streaming, - .stop_streaming = rkisp1_params_vb2_stop_streaming, + .buf_queue = rkisp_params_vb2_buf_queue, + .start_streaming = rkisp_params_vb2_start_streaming, + .stop_streaming = rkisp_params_vb2_stop_streaming, }; -struct v4l2_file_operations rkisp1_params_fops = { +struct v4l2_file_operations rkisp_params_fops = { .mmap = vb2_fop_mmap, .unlocked_ioctl = video_ioctl2, .poll = vb2_fop_poll, @@ -2563,19 +2563,19 @@ struct v4l2_file_operations rkisp1_params_fops = { }; static int -rkisp1_params_init_vb2_queue(struct vb2_queue *q, - struct rkisp1_isp_params_vdev *params_vdev) +rkisp_params_init_vb2_queue(struct vb2_queue *q, + struct rkisp_isp_params_vdev *params_vdev) { - struct rkisp1_vdev_node *node; + struct rkisp_vdev_node *node; node = queue_to_node(q); q->type = V4L2_BUF_TYPE_META_OUTPUT; q->io_modes = VB2_MMAP | VB2_USERPTR; q->drv_priv = params_vdev; - q->ops = &rkisp1_params_vb2_ops; + q->ops = &rkisp_params_vb2_ops; q->mem_ops = &vb2_vmalloc_memops; - q->buf_struct_size = sizeof(struct rkisp1_buffer); + q->buf_struct_size = sizeof(struct rkisp_buffer); q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = ¶ms_vdev->dev->iqlock; q->dev = params_vdev->dev->dev; @@ -2583,7 +2583,7 @@ rkisp1_params_init_vb2_queue(struct vb2_queue *q, return vb2_queue_init(q); } -static void rkisp1_init_params_vdev(struct rkisp1_isp_params_vdev *params_vdev) +static void rkisp_init_params_vdev(struct rkisp_isp_params_vdev *params_vdev) { params_vdev->vdev_fmt.fmt.meta.dataformat = V4L2_META_FMT_RK_ISP1_PARAMS; @@ -2592,20 +2592,20 @@ static void rkisp1_init_params_vdev(struct rkisp1_isp_params_vdev *params_vdev) if (params_vdev->dev->isp_ver == ISP_V12 || params_vdev->dev->isp_ver == ISP_V13) { - params_vdev->ops = &rkisp1_v12_isp_params_ops; - params_vdev->config = &rkisp1_v12_isp_params_config; + params_vdev->ops = &rkisp_v12_isp_params_ops; + params_vdev->config = &rkisp_v12_isp_params_config; } else { - params_vdev->ops = &rkisp1_v10_isp_params_ops; - params_vdev->config = &rkisp1_v10_isp_params_config; + params_vdev->ops = &rkisp_v10_isp_params_ops; + params_vdev->config = &rkisp_v10_isp_params_config; } } -int rkisp1_register_params_vdev(struct rkisp1_isp_params_vdev *params_vdev, +int rkisp_register_params_vdev(struct rkisp_isp_params_vdev *params_vdev, struct v4l2_device *v4l2_dev, - struct rkisp1_device *dev) + struct rkisp_device *dev) { int ret; - struct rkisp1_vdev_node *node = ¶ms_vdev->vnode; + struct rkisp_vdev_node *node = ¶ms_vdev->vnode; struct video_device *vdev = &node->vdev; params_vdev->dev = dev; @@ -2614,8 +2614,8 @@ int rkisp1_register_params_vdev(struct rkisp1_isp_params_vdev *params_vdev, strlcpy(vdev->name, "rkisp1-input-params", sizeof(vdev->name)); video_set_drvdata(vdev, params_vdev); - vdev->ioctl_ops = &rkisp1_params_ioctl; - vdev->fops = &rkisp1_params_fops; + vdev->ioctl_ops = &rkisp_params_ioctl; + vdev->fops = &rkisp_params_fops; vdev->release = video_device_release_empty; /* * Provide a mutex to v4l2 core. It will be used @@ -2626,8 +2626,8 @@ int rkisp1_register_params_vdev(struct rkisp1_isp_params_vdev *params_vdev, vdev->queue = &node->buf_queue; vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_META_OUTPUT; vdev->vfl_dir = VFL_DIR_TX; - rkisp1_params_init_vb2_queue(vdev->queue, params_vdev); - rkisp1_init_params_vdev(params_vdev); + rkisp_params_init_vb2_queue(vdev->queue, params_vdev); + rkisp_init_params_vdev(params_vdev); video_set_drvdata(vdev, params_vdev); node->pad.flags = MEDIA_PAD_FL_SOURCE; @@ -2648,9 +2648,9 @@ err_release_queue: return ret; } -void rkisp1_unregister_params_vdev(struct rkisp1_isp_params_vdev *params_vdev) +void rkisp_unregister_params_vdev(struct rkisp_isp_params_vdev *params_vdev) { - struct rkisp1_vdev_node *node = ¶ms_vdev->vnode; + struct rkisp_vdev_node *node = ¶ms_vdev->vnode; struct video_device *vdev = &node->vdev; video_unregister_device(vdev); diff --git a/drivers/media/platform/rockchip/isp1/isp_params.h b/drivers/media/platform/rockchip/isp/isp_params.h similarity index 54% rename from drivers/media/platform/rockchip/isp1/isp_params.h rename to drivers/media/platform/rockchip/isp/isp_params.h index ea707b7cf0e4..7e557932dd25 100644 --- a/drivers/media/platform/rockchip/isp1/isp_params.h +++ b/drivers/media/platform/rockchip/isp/isp_params.h @@ -32,90 +32,89 @@ * SOFTWARE. */ -#ifndef _RKISP1_ISP_H -#define _RKISP1_ISP_H +#ifndef _RKISP_ISP_H +#define _RKISP_ISP_H #include #include #include "common.h" -struct rkisp1_isp_params_vdev; -struct rkisp1_isp_params_ops { - void (*dpcc_config)(struct rkisp1_isp_params_vdev *params_vdev, +struct rkisp_isp_params_vdev; +struct rkisp_isp_params_ops { + void (*dpcc_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_dpcc_config *arg); - void (*bls_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*bls_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_bls_config *arg); - void (*lsc_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*lsc_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_lsc_config *arg); - void (*lsc_matrix_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*lsc_matrix_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_lsc_config *pconfig); - void (*flt_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*flt_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_flt_config *arg); - void (*bdm_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*bdm_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_bdm_config *arg); - void (*sdg_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*sdg_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_sdg_config *arg); - void (*goc_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*goc_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_goc_config *arg); - void (*ctk_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*ctk_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_ctk_config *arg); - void (*ctk_enable)(struct rkisp1_isp_params_vdev *params_vdev, + void (*ctk_enable)(struct rkisp_isp_params_vdev *params_vdev, bool en); - void (*awb_meas_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*awb_meas_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_meas_config *arg); - void (*awb_meas_enable)(struct rkisp1_isp_params_vdev *params_vdev, + void (*awb_meas_enable)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_meas_config *arg, bool en); - void (*awb_gain_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*awb_gain_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_awb_gain_config *arg); - void (*aec_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*aec_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_aec_config *arg); - void (*cproc_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*cproc_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_cproc_config *arg); - void (*hst_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*hst_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_hst_config *arg); - void (*hst_enable)(struct rkisp1_isp_params_vdev *params_vdev, + void (*hst_enable)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_hst_config *arg, bool en); - void (*afm_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*afm_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_afc_config *arg); - void (*ie_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*ie_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_ie_config *arg); - void (*ie_enable)(struct rkisp1_isp_params_vdev *params_vdev, + void (*ie_enable)(struct rkisp_isp_params_vdev *params_vdev, bool en); - void (*csm_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*csm_config)(struct rkisp_isp_params_vdev *params_vdev, bool full_range); - void (*dpf_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*dpf_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_dpf_config *arg); - void (*dpf_strength_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*dpf_strength_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_dpf_strength_config *arg); - void (*wdr_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*wdr_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_wdr_config *arg); - void (*wdr_enable)(struct rkisp1_isp_params_vdev *params_vdev, - bool en); - void (*demosaiclp_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*wdr_enable)(struct rkisp_isp_params_vdev *params_vdev, bool en); + void (*demosaiclp_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_demosaiclp_config *arg); - void (*demosaiclp_enable)(struct rkisp1_isp_params_vdev *params_vdev, + void (*demosaiclp_enable)(struct rkisp_isp_params_vdev *params_vdev, bool en); - void (*rkiesharp_config)(struct rkisp1_isp_params_vdev *params_vdev, + void (*rkiesharp_config)(struct rkisp_isp_params_vdev *params_vdev, const struct cifisp_rkiesharp_config *arg); - void (*rkiesharp_enable)(struct rkisp1_isp_params_vdev *params_vdev, + void (*rkiesharp_enable)(struct rkisp_isp_params_vdev *params_vdev, bool en); }; -struct rkisp1_isp_params_config { +struct rkisp_isp_params_config { const int gamma_out_max_samples; const int hst_weight_grids_size; }; /* - * struct rkisp1_isp_subdev - ISP input parameters device + * struct rkisp_isp_subdev - ISP input parameters device * * @cur_params: Current ISP parameters * @first_params: the first params should take effect immediately */ -struct rkisp1_isp_params_vdev { - struct rkisp1_vdev_node vnode; - struct rkisp1_device *dev; +struct rkisp_isp_params_vdev { + struct rkisp_vdev_node vnode; + struct rkisp_device *dev; spinlock_t config_lock; struct list_head params; @@ -125,27 +124,27 @@ struct rkisp1_isp_params_vdev { bool first_params; enum v4l2_quantization quantization; - enum rkisp1_fmt_raw_pat_type raw_type; + enum rkisp_fmt_raw_pat_type raw_type; u32 in_mbus_code; struct preisp_hdrae_para_s hdrae_para; - struct rkisp1_isp_params_ops *ops; - struct rkisp1_isp_params_config *config; + struct rkisp_isp_params_ops *ops; + struct rkisp_isp_params_config *config; }; /* config params before ISP streaming */ -void rkisp1_params_configure_isp(struct rkisp1_isp_params_vdev *params_vdev, +void rkisp_params_configure_isp(struct rkisp_isp_params_vdev *params_vdev, struct ispsd_in_fmt *in_fmt, enum v4l2_quantization quantization); -void rkisp1_params_disable_isp(struct rkisp1_isp_params_vdev *params_vdev); +void rkisp_params_disable_isp(struct rkisp_isp_params_vdev *params_vdev); -int rkisp1_register_params_vdev(struct rkisp1_isp_params_vdev *params_vdev, +int rkisp_register_params_vdev(struct rkisp_isp_params_vdev *params_vdev, struct v4l2_device *v4l2_dev, - struct rkisp1_device *dev); + struct rkisp_device *dev); -void rkisp1_unregister_params_vdev(struct rkisp1_isp_params_vdev *params_vdev); +void rkisp_unregister_params_vdev(struct rkisp_isp_params_vdev *params_vdev); -void rkisp1_params_isr(struct rkisp1_isp_params_vdev *params_vdev, u32 isp_mis); +void rkisp_params_isr(struct rkisp_isp_params_vdev *params_vdev, u32 isp_mis); -#endif /* _RKISP1_ISP_H */ +#endif /* _RKISP_ISP_H */ diff --git a/drivers/media/platform/rockchip/isp1/isp_stats.c b/drivers/media/platform/rockchip/isp/isp_stats.c similarity index 74% rename from drivers/media/platform/rockchip/isp1/isp_stats.c rename to drivers/media/platform/rockchip/isp/isp_stats.c index c061441875d9..adca6e54febe 100644 --- a/drivers/media/platform/rockchip/isp1/isp_stats.c +++ b/drivers/media/platform/rockchip/isp/isp_stats.c @@ -40,14 +40,14 @@ #include "dev.h" #include "regs.h" -#define RKISP1_ISP_STATS_REQ_BUFS_MIN 2 -#define RKISP1_ISP_STATS_REQ_BUFS_MAX 8 +#define RKISP_ISP_STATS_REQ_BUFS_MIN 2 +#define RKISP_ISP_STATS_REQ_BUFS_MAX 8 -static int rkisp1_stats_enum_fmt_meta_cap(struct file *file, void *priv, +static int rkisp_stats_enum_fmt_meta_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { struct video_device *video = video_devdata(file); - struct rkisp1_isp_stats_vdev *stats_vdev = video_get_drvdata(video); + struct rkisp_isp_stats_vdev *stats_vdev = video_get_drvdata(video); if (f->index > 0 || f->type != video->queue->type) return -EINVAL; @@ -56,11 +56,11 @@ static int rkisp1_stats_enum_fmt_meta_cap(struct file *file, void *priv, return 0; } -static int rkisp1_stats_g_fmt_meta_cap(struct file *file, void *priv, +static int rkisp_stats_g_fmt_meta_cap(struct file *file, void *priv, struct v4l2_format *f) { struct video_device *video = video_devdata(file); - struct rkisp1_isp_stats_vdev *stats_vdev = video_get_drvdata(video); + struct rkisp_isp_stats_vdev *stats_vdev = video_get_drvdata(video); struct v4l2_meta_format *meta = &f->fmt.meta; if (f->type != video->queue->type) @@ -73,11 +73,11 @@ static int rkisp1_stats_g_fmt_meta_cap(struct file *file, void *priv, return 0; } -static int rkisp1_stats_querycap(struct file *file, +static int rkisp_stats_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { struct video_device *vdev = video_devdata(file); - struct rkisp1_isp_stats_vdev *stats_vdev = video_get_drvdata(vdev); + struct rkisp_isp_stats_vdev *stats_vdev = video_get_drvdata(vdev); strcpy(cap->driver, DRIVER_NAME); snprintf(cap->driver, sizeof(cap->driver), @@ -90,7 +90,7 @@ static int rkisp1_stats_querycap(struct file *file, } /* ISP video device IOCTLs */ -static const struct v4l2_ioctl_ops rkisp1_stats_ioctl = { +static const struct v4l2_ioctl_ops rkisp_stats_ioctl = { .vidioc_reqbufs = vb2_ioctl_reqbufs, .vidioc_querybuf = vb2_ioctl_querybuf, .vidioc_create_bufs = vb2_ioctl_create_bufs, @@ -100,14 +100,14 @@ static const struct v4l2_ioctl_ops rkisp1_stats_ioctl = { .vidioc_expbuf = vb2_ioctl_expbuf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_enum_fmt_meta_cap = rkisp1_stats_enum_fmt_meta_cap, - .vidioc_g_fmt_meta_cap = rkisp1_stats_g_fmt_meta_cap, - .vidioc_s_fmt_meta_cap = rkisp1_stats_g_fmt_meta_cap, - .vidioc_try_fmt_meta_cap = rkisp1_stats_g_fmt_meta_cap, - .vidioc_querycap = rkisp1_stats_querycap + .vidioc_enum_fmt_meta_cap = rkisp_stats_enum_fmt_meta_cap, + .vidioc_g_fmt_meta_cap = rkisp_stats_g_fmt_meta_cap, + .vidioc_s_fmt_meta_cap = rkisp_stats_g_fmt_meta_cap, + .vidioc_try_fmt_meta_cap = rkisp_stats_g_fmt_meta_cap, + .vidioc_querycap = rkisp_stats_querycap }; -struct v4l2_file_operations rkisp1_stats_fops = { +struct v4l2_file_operations rkisp_stats_fops = { .mmap = vb2_fop_mmap, .unlocked_ioctl = video_ioctl2, .poll = vb2_fop_poll, @@ -115,18 +115,18 @@ struct v4l2_file_operations rkisp1_stats_fops = { .release = vb2_fop_release }; -static int rkisp1_stats_vb2_queue_setup(struct vb2_queue *vq, +static int rkisp_stats_vb2_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], struct device *alloc_ctxs[]) { - struct rkisp1_isp_stats_vdev *stats_vdev = vq->drv_priv; + struct rkisp_isp_stats_vdev *stats_vdev = vq->drv_priv; *num_planes = 1; - *num_buffers = clamp_t(u32, *num_buffers, RKISP1_ISP_STATS_REQ_BUFS_MIN, - RKISP1_ISP_STATS_REQ_BUFS_MAX); + *num_buffers = clamp_t(u32, *num_buffers, RKISP_ISP_STATS_REQ_BUFS_MIN, + RKISP_ISP_STATS_REQ_BUFS_MAX); sizes[0] = sizeof(struct rkisp1_stat_buffer); @@ -135,12 +135,12 @@ static int rkisp1_stats_vb2_queue_setup(struct vb2_queue *vq, return 0; } -static void rkisp1_stats_vb2_buf_queue(struct vb2_buffer *vb) +static void rkisp_stats_vb2_buf_queue(struct vb2_buffer *vb) { struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct rkisp1_buffer *stats_buf = to_rkisp1_buffer(vbuf); + struct rkisp_buffer *stats_buf = to_rkisp_buffer(vbuf); struct vb2_queue *vq = vb->vb2_queue; - struct rkisp1_isp_stats_vdev *stats_dev = vq->drv_priv; + struct rkisp_isp_stats_vdev *stats_dev = vq->drv_priv; stats_buf->vaddr[0] = vb2_plane_vaddr(vb, 0); @@ -149,10 +149,10 @@ static void rkisp1_stats_vb2_buf_queue(struct vb2_buffer *vb) spin_unlock_bh(&stats_dev->rd_lock); } -static void rkisp1_stats_vb2_stop_streaming(struct vb2_queue *vq) +static void rkisp_stats_vb2_stop_streaming(struct vb2_queue *vq) { - struct rkisp1_isp_stats_vdev *stats_vdev = vq->drv_priv; - struct rkisp1_buffer *buf; + struct rkisp_isp_stats_vdev *stats_vdev = vq->drv_priv; + struct rkisp_buffer *buf; unsigned long flags; int i; @@ -164,11 +164,11 @@ static void rkisp1_stats_vb2_stop_streaming(struct vb2_queue *vq) tasklet_disable(&stats_vdev->rd_tasklet); spin_lock_bh(&stats_vdev->rd_lock); - for (i = 0; i < RKISP1_ISP_STATS_REQ_BUFS_MAX; i++) { + for (i = 0; i < RKISP_ISP_STATS_REQ_BUFS_MAX; i++) { if (list_empty(&stats_vdev->stat)) break; buf = list_first_entry(&stats_vdev->stat, - struct rkisp1_buffer, queue); + struct rkisp_buffer, queue); list_del(&buf->queue); vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); } @@ -176,10 +176,10 @@ static void rkisp1_stats_vb2_stop_streaming(struct vb2_queue *vq) } static int -rkisp1_stats_vb2_start_streaming(struct vb2_queue *queue, +rkisp_stats_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) { - struct rkisp1_isp_stats_vdev *stats_vdev = queue->drv_priv; + struct rkisp_isp_stats_vdev *stats_vdev = queue->drv_priv; stats_vdev->streamon = true; kfifo_reset(&stats_vdev->rd_kfifo); @@ -188,28 +188,28 @@ rkisp1_stats_vb2_start_streaming(struct vb2_queue *queue, return 0; } -static struct vb2_ops rkisp1_stats_vb2_ops = { - .queue_setup = rkisp1_stats_vb2_queue_setup, - .buf_queue = rkisp1_stats_vb2_buf_queue, +static struct vb2_ops rkisp_stats_vb2_ops = { + .queue_setup = rkisp_stats_vb2_queue_setup, + .buf_queue = rkisp_stats_vb2_buf_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, - .stop_streaming = rkisp1_stats_vb2_stop_streaming, - .start_streaming = rkisp1_stats_vb2_start_streaming, + .stop_streaming = rkisp_stats_vb2_stop_streaming, + .start_streaming = rkisp_stats_vb2_start_streaming, }; -static int rkisp1_stats_init_vb2_queue(struct vb2_queue *q, - struct rkisp1_isp_stats_vdev *stats_vdev) +static int rkisp_stats_init_vb2_queue(struct vb2_queue *q, + struct rkisp_isp_stats_vdev *stats_vdev) { - struct rkisp1_vdev_node *node; + struct rkisp_vdev_node *node; node = queue_to_node(q); q->type = V4L2_BUF_TYPE_META_CAPTURE; q->io_modes = VB2_MMAP | VB2_USERPTR; q->drv_priv = stats_vdev; - q->ops = &rkisp1_stats_vb2_ops; + q->ops = &rkisp_stats_vb2_ops; q->mem_ops = &vb2_vmalloc_memops; - q->buf_struct_size = sizeof(struct rkisp1_buffer); + q->buf_struct_size = sizeof(struct rkisp_buffer); q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = &stats_vdev->dev->iqlock; q->dev = stats_vdev->dev->dev; @@ -217,7 +217,7 @@ static int rkisp1_stats_init_vb2_queue(struct vb2_queue *q, return vb2_queue_init(q); } -static void rkisp1_stats_get_awb_meas_v10(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_awb_meas_v10(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { /* Protect against concurrent access from ISR? */ @@ -236,7 +236,7 @@ static void rkisp1_stats_get_awb_meas_v10(struct rkisp1_isp_stats_vdev *stats_vd CIF_ISP_AWB_GET_MEAN_Y_G(reg_val); } -static void rkisp1_stats_get_awb_meas_v12(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_awb_meas_v12(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { /* Protect against concurrent access from ISR? */ @@ -255,7 +255,7 @@ static void rkisp1_stats_get_awb_meas_v12(struct rkisp1_isp_stats_vdev *stats_vd CIF_ISP_AWB_GET_MEAN_Y_G(reg_val); } -static void rkisp1_stats_get_aec_meas_v10(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_aec_meas_v10(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { unsigned int i; @@ -266,7 +266,7 @@ static void rkisp1_stats_get_aec_meas_v10(struct rkisp1_isp_stats_vdev *stats_vd pbuf->params.ae.exp_mean[i] = (u8)readl(addr + i * 4); } -static void rkisp1_stats_get_aec_meas_v12(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_aec_meas_v12(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { int i; @@ -285,7 +285,7 @@ static void rkisp1_stats_get_aec_meas_v12(struct rkisp1_isp_stats_vdev *stats_vd pbuf->params.ae.exp_mean[4 * i + 0] = CIF_ISP_EXP_GET_MEAN_xy0_V12(value); } -static void rkisp1_stats_get_afc_meas(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_afc_meas(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { void __iomem *base_addr; @@ -303,7 +303,7 @@ static void rkisp1_stats_get_afc_meas(struct rkisp1_isp_stats_vdev *stats_vdev, af->window[2].lum = readl(base_addr + CIF_ISP_AFM_LUM_C); } -static void rkisp1_stats_get_hst_meas_v10(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_hst_meas_v10(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { int i; @@ -314,7 +314,7 @@ static void rkisp1_stats_get_hst_meas_v10(struct rkisp1_isp_stats_vdev *stats_vd pbuf->params.hist.hist_bins[i] = readl(addr + (i * 4)); } -static void rkisp1_stats_get_hst_meas_v12(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_hst_meas_v12(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { int i; @@ -329,12 +329,12 @@ static void rkisp1_stats_get_hst_meas_v12(struct rkisp1_isp_stats_vdev *stats_vd } } -static void rkisp1_stats_get_bls_meas(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_bls_meas(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { - struct rkisp1_device *dev = stats_vdev->dev; + struct rkisp_device *dev = stats_vdev->dev; const struct ispsd_in_fmt *in_fmt = - rkisp1_get_ispsd_in_fmt(&dev->isp_sdev); + rkisp_get_ispsd_in_fmt(&dev->isp_sdev); void __iomem *base = stats_vdev->dev->base_addr; struct cifisp_bls_meas_val *bls_val; @@ -362,25 +362,25 @@ static void rkisp1_stats_get_bls_meas(struct rkisp1_isp_stats_vdev *stats_vdev, } } -static void rkisp1_stats_get_emb_data(struct rkisp1_isp_stats_vdev *stats_vdev, +static void rkisp_stats_get_emb_data(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf) { unsigned int i; - struct rkisp1_device *dev = stats_vdev->dev; + struct rkisp_device *dev = stats_vdev->dev; unsigned int ph = 0, out = 0, packet_len = 0, playload_len = 0; unsigned int mipi_kfifo_len; unsigned int idx; unsigned char *fifo_data; - idx = RKISP1_EMDDATA_FIFO_MAX; - for (i = 0; i < RKISP1_EMDDATA_FIFO_MAX; i++) { + idx = RKISP_EMDDATA_FIFO_MAX; + for (i = 0; i < RKISP_EMDDATA_FIFO_MAX; i++) { if (dev->emd_data_fifo[i].frame_id == pbuf->frame_id) { idx = i; break; } } - if (idx == RKISP1_EMDDATA_FIFO_MAX) + if (idx == RKISP_EMDDATA_FIFO_MAX) return; if (kfifo_is_empty(&dev->emd_data_fifo[idx].mipi_kfifo)) @@ -407,53 +407,53 @@ static void rkisp1_stats_get_emb_data(struct rkisp1_isp_stats_vdev *stats_vdev, playload_len += packet_len; fifo_data += packet_len; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "packet_len: 0x%x, ph: 0x%x\n", packet_len, ph); } pbuf->meas_type |= CIFISP_STAT_EMB_DATA; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "playload_len: %d, pbuf->frame_id %d\n", playload_len, pbuf->frame_id); } -static struct rkisp1_stats_ops rkisp1_v10_stats_ops = { - .get_awb_meas = rkisp1_stats_get_awb_meas_v10, - .get_aec_meas = rkisp1_stats_get_aec_meas_v10, - .get_afc_meas = rkisp1_stats_get_afc_meas, - .get_hst_meas = rkisp1_stats_get_hst_meas_v10, - .get_bls_meas = rkisp1_stats_get_bls_meas, - .get_emb_data = rkisp1_stats_get_emb_data, +static struct rkisp_stats_ops rkisp_v10_stats_ops = { + .get_awb_meas = rkisp_stats_get_awb_meas_v10, + .get_aec_meas = rkisp_stats_get_aec_meas_v10, + .get_afc_meas = rkisp_stats_get_afc_meas, + .get_hst_meas = rkisp_stats_get_hst_meas_v10, + .get_bls_meas = rkisp_stats_get_bls_meas, + .get_emb_data = rkisp_stats_get_emb_data, }; -static struct rkisp1_stats_ops rkisp1_v12_stats_ops = { - .get_awb_meas = rkisp1_stats_get_awb_meas_v12, - .get_aec_meas = rkisp1_stats_get_aec_meas_v12, - .get_afc_meas = rkisp1_stats_get_afc_meas, - .get_hst_meas = rkisp1_stats_get_hst_meas_v12, - .get_bls_meas = rkisp1_stats_get_bls_meas, +static struct rkisp_stats_ops rkisp_v12_stats_ops = { + .get_awb_meas = rkisp_stats_get_awb_meas_v12, + .get_aec_meas = rkisp_stats_get_aec_meas_v12, + .get_afc_meas = rkisp_stats_get_afc_meas, + .get_hst_meas = rkisp_stats_get_hst_meas_v12, + .get_bls_meas = rkisp_stats_get_bls_meas, }; -static struct rkisp1_stats_config rkisp1_v10_stats_config = { +static struct rkisp_stats_config rkisp_v10_stats_config = { .ae_mean_max = 25, .hist_bin_n_max = 16, }; -static struct rkisp1_stats_config rkisp1_v12_stats_config = { +static struct rkisp_stats_config rkisp_v12_stats_config = { .ae_mean_max = 81, .hist_bin_n_max = 32, }; static void -rkisp1_stats_send_measurement(struct rkisp1_isp_stats_vdev *stats_vdev, - struct rkisp1_isp_readout_work *meas_work) +rkisp_stats_send_measurement(struct rkisp_isp_stats_vdev *stats_vdev, + struct rkisp_isp_readout_work *meas_work) { unsigned int cur_frame_id = -1; struct rkisp1_stat_buffer *cur_stat_buf; - struct rkisp1_buffer *cur_buf = NULL; - struct rkisp1_stats_ops *ops = stats_vdev->ops; + struct rkisp_buffer *cur_buf = NULL; + struct rkisp_stats_ops *ops = stats_vdev->ops; cur_frame_id = atomic_read(&stats_vdev->dev->isp_sdev.frm_sync_seq) - 1; if (cur_frame_id != meas_work->frame_id) { @@ -467,7 +467,7 @@ rkisp1_stats_send_measurement(struct rkisp1_isp_stats_vdev *stats_vdev, /* get one empty buffer */ if (!list_empty(&stats_vdev->stat)) { cur_buf = list_first_entry(&stats_vdev->stat, - struct rkisp1_buffer, queue); + struct rkisp_buffer, queue); list_del(&cur_buf->queue); } spin_unlock(&stats_vdev->rd_lock); @@ -511,12 +511,12 @@ rkisp1_stats_send_measurement(struct rkisp1_isp_stats_vdev *stats_vdev, vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); } -static void rkisp1_stats_readout_task(unsigned long data) +static void rkisp_stats_readout_task(unsigned long data) { unsigned int out = 0; - struct rkisp1_isp_readout_work work; - struct rkisp1_isp_stats_vdev *vdev = - (struct rkisp1_isp_stats_vdev *)data; + struct rkisp_isp_readout_work work; + struct rkisp_isp_stats_vdev *vdev = + (struct rkisp_isp_stats_vdev *)data; while (!kfifo_is_empty(&vdev->rd_kfifo)) { out = kfifo_out(&vdev->rd_kfifo, @@ -524,15 +524,15 @@ static void rkisp1_stats_readout_task(unsigned long data) if (!out) break; - if (work.readout == RKISP1_ISP_READOUT_MEAS) - rkisp1_stats_send_measurement(vdev, &work); + if (work.readout == RKISP_ISP_READOUT_MEAS) + rkisp_stats_send_measurement(vdev, &work); } } -int rkisp1_stats_isr(struct rkisp1_isp_stats_vdev *stats_vdev, u32 isp_ris) +int rkisp_stats_isr(struct rkisp_isp_stats_vdev *stats_vdev, u32 isp_ris) { unsigned int isp_mis_tmp = 0; - struct rkisp1_isp_readout_work work; + struct rkisp_isp_readout_work work; unsigned int cur_frame_id = atomic_read(&stats_vdev->dev->isp_sdev.frm_sync_seq) - 1; #ifdef LOG_ISR_EXE_TIME @@ -560,7 +560,7 @@ int rkisp1_stats_isr(struct rkisp1_isp_stats_vdev *stats_vdev, u32 isp_ris) if (isp_ris & (CIF_ISP_FRAME | CIF_ISP_AWB_DONE | CIF_ISP_AFM_FIN | CIF_ISP_EXP_END | CIF_ISP_HIST_MEASURE_RDY)) { - work.readout = RKISP1_ISP_READOUT_MEAS; + work.readout = RKISP_ISP_READOUT_MEAS; work.frame_id = cur_frame_id; work.isp_ris = isp_ris; work.timestamp = ktime_get_ns(); @@ -594,7 +594,7 @@ unlock: return 0; } -static void rkisp1_init_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev) +static void rkisp_init_stats_vdev(struct rkisp_isp_stats_vdev *stats_vdev) { stats_vdev->vdev_fmt.fmt.meta.dataformat = V4L2_META_FMT_RK_ISP1_STAT_3A; @@ -603,20 +603,20 @@ static void rkisp1_init_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev) if (stats_vdev->dev->isp_ver == ISP_V12 || stats_vdev->dev->isp_ver == ISP_V13) { - stats_vdev->ops = &rkisp1_v12_stats_ops; - stats_vdev->config = &rkisp1_v12_stats_config; + stats_vdev->ops = &rkisp_v12_stats_ops; + stats_vdev->config = &rkisp_v12_stats_config; } else { - stats_vdev->ops = &rkisp1_v10_stats_ops; - stats_vdev->config = &rkisp1_v10_stats_config; + stats_vdev->ops = &rkisp_v10_stats_ops; + stats_vdev->config = &rkisp_v10_stats_config; } } -int rkisp1_register_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev, +int rkisp_register_stats_vdev(struct rkisp_isp_stats_vdev *stats_vdev, struct v4l2_device *v4l2_dev, - struct rkisp1_device *dev) + struct rkisp_device *dev) { int ret; - struct rkisp1_vdev_node *node = &stats_vdev->vnode; + struct rkisp_vdev_node *node = &stats_vdev->vnode; struct video_device *vdev = &node->vdev; stats_vdev->dev = dev; @@ -627,16 +627,16 @@ int rkisp1_register_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev, strlcpy(vdev->name, "rkisp1-statistics", sizeof(vdev->name)); video_set_drvdata(vdev, stats_vdev); - vdev->ioctl_ops = &rkisp1_stats_ioctl; - vdev->fops = &rkisp1_stats_fops; + vdev->ioctl_ops = &rkisp_stats_ioctl; + vdev->fops = &rkisp_stats_fops; vdev->release = video_device_release_empty; vdev->lock = &dev->iqlock; vdev->v4l2_dev = v4l2_dev; vdev->queue = &node->buf_queue; vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; vdev->vfl_dir = VFL_DIR_RX; - rkisp1_stats_init_vb2_queue(vdev->queue, stats_vdev); - rkisp1_init_stats_vdev(stats_vdev); + rkisp_stats_init_vb2_queue(vdev->queue, stats_vdev); + rkisp_init_stats_vdev(stats_vdev); video_set_drvdata(vdev, stats_vdev); node->pad.flags = MEDIA_PAD_FL_SINK; @@ -652,7 +652,7 @@ int rkisp1_register_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev, } ret = kfifo_alloc(&stats_vdev->rd_kfifo, - RKISP1_READOUT_WORK_SIZE, + RKISP_READOUT_WORK_SIZE, GFP_KERNEL); if (ret) { dev_err(&vdev->dev, @@ -662,7 +662,7 @@ int rkisp1_register_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev, } tasklet_init(&stats_vdev->rd_tasklet, - rkisp1_stats_readout_task, + rkisp_stats_readout_task, (unsigned long)stats_vdev); tasklet_disable(&stats_vdev->rd_tasklet); @@ -675,9 +675,9 @@ err_release_queue: return ret; } -void rkisp1_unregister_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev) +void rkisp_unregister_stats_vdev(struct rkisp_isp_stats_vdev *stats_vdev) { - struct rkisp1_vdev_node *node = &stats_vdev->vnode; + struct rkisp_vdev_node *node = &stats_vdev->vnode; struct video_device *vdev = &node->vdev; kfifo_free(&stats_vdev->rd_kfifo); diff --git a/drivers/media/platform/rockchip/isp1/isp_stats.h b/drivers/media/platform/rockchip/isp/isp_stats.h similarity index 64% rename from drivers/media/platform/rockchip/isp1/isp_stats.h rename to drivers/media/platform/rockchip/isp/isp_stats.h index bdb4779b1f69..d9ae23fd4d8e 100644 --- a/drivers/media/platform/rockchip/isp1/isp_stats.h +++ b/drivers/media/platform/rockchip/isp/isp_stats.h @@ -32,61 +32,61 @@ * SOFTWARE. */ -#ifndef _RKISP1_ISP_STATS_H -#define _RKISP1_ISP_STATS_H +#ifndef _RKISP_ISP_STATS_H +#define _RKISP_ISP_STATS_H #include #include #include #include "common.h" -#define RKISP1_READOUT_WORK_SIZE \ - (8 * sizeof(struct rkisp1_isp_readout_work)) +#define RKISP_READOUT_WORK_SIZE \ + (8 * sizeof(struct rkisp_isp_readout_work)) -struct rkisp1_isp_stats_vdev; +struct rkisp_isp_stats_vdev; -enum rkisp1_isp_readout_cmd { - RKISP1_ISP_READOUT_MEAS, - RKISP1_ISP_READOUT_META, +enum rkisp_isp_readout_cmd { + RKISP_ISP_READOUT_MEAS, + RKISP_ISP_READOUT_META, }; -struct rkisp1_isp_readout_work { +struct rkisp_isp_readout_work { unsigned int frame_id; unsigned int isp_ris; - enum rkisp1_isp_readout_cmd readout; + enum rkisp_isp_readout_cmd readout; unsigned long long timestamp; }; -struct rkisp1_stats_ops { - void (*get_awb_meas)(struct rkisp1_isp_stats_vdev *stats_vdev, +struct rkisp_stats_ops { + void (*get_awb_meas)(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf); - void (*get_aec_meas)(struct rkisp1_isp_stats_vdev *stats_vdev, + void (*get_aec_meas)(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf); - void (*get_afc_meas)(struct rkisp1_isp_stats_vdev *stats_vdev, + void (*get_afc_meas)(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf); - void (*get_hst_meas)(struct rkisp1_isp_stats_vdev *stats_vdev, + void (*get_hst_meas)(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf); - void (*get_bls_meas)(struct rkisp1_isp_stats_vdev *stats_vdev, + void (*get_bls_meas)(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf); - void (*get_emb_data)(struct rkisp1_isp_stats_vdev *stats_vdev, + void (*get_emb_data)(struct rkisp_isp_stats_vdev *stats_vdev, struct rkisp1_stat_buffer *pbuf); }; -struct rkisp1_stats_config { +struct rkisp_stats_config { const int ae_mean_max; const int hist_bin_n_max; }; /* - * struct rkisp1_isp_stats_vdev - ISP Statistics device + * struct rkisp_isp_stats_vdev - ISP Statistics device * * @irq_lock: buffer queue lock * @stat: stats buffer list * @readout_wq: workqueue for statistics information read */ -struct rkisp1_isp_stats_vdev { - struct rkisp1_vdev_node vnode; - struct rkisp1_device *dev; +struct rkisp_isp_stats_vdev { + struct rkisp_vdev_node vnode; + struct rkisp_device *dev; spinlock_t irq_lock; struct list_head stat; @@ -97,16 +97,16 @@ struct rkisp1_isp_stats_vdev { struct kfifo rd_kfifo; struct tasklet_struct rd_tasklet; - struct rkisp1_stats_ops *ops; - struct rkisp1_stats_config *config; + struct rkisp_stats_ops *ops; + struct rkisp_stats_config *config; }; -int rkisp1_stats_isr(struct rkisp1_isp_stats_vdev *stats_vdev, u32 isp_ris); +int rkisp_stats_isr(struct rkisp_isp_stats_vdev *stats_vdev, u32 isp_ris); -int rkisp1_register_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev, +int rkisp_register_stats_vdev(struct rkisp_isp_stats_vdev *stats_vdev, struct v4l2_device *v4l2_dev, - struct rkisp1_device *dev); + struct rkisp_device *dev); -void rkisp1_unregister_stats_vdev(struct rkisp1_isp_stats_vdev *stats_vdev); +void rkisp_unregister_stats_vdev(struct rkisp_isp_stats_vdev *stats_vdev); -#endif /* _RKISP1_ISP_STATS_H */ +#endif /* _RKISP_ISP_STATS_H */ diff --git a/drivers/media/platform/rockchip/isp1/regs.c b/drivers/media/platform/rockchip/isp/regs.c similarity index 93% rename from drivers/media/platform/rockchip/isp1/regs.c rename to drivers/media/platform/rockchip/isp/regs.c index 82f6cd92475e..ac806f7903e0 100644 --- a/drivers/media/platform/rockchip/isp1/regs.c +++ b/drivers/media/platform/rockchip/isp/regs.c @@ -35,7 +35,7 @@ #include #include "regs.h" -void disable_dcrop(struct rkisp1_stream *stream, bool async) +void disable_dcrop(struct rkisp_stream *stream, bool async) { void __iomem *base = stream->ispdev->base_addr; void __iomem *dc_ctrl_addr = base + stream->config->dual_crop.ctrl; @@ -51,7 +51,7 @@ void disable_dcrop(struct rkisp1_stream *stream, bool async) writel(val, dc_ctrl_addr); } -void config_dcrop(struct rkisp1_stream *stream, struct v4l2_rect *rect, bool async) +void config_dcrop(struct rkisp_stream *stream, struct v4l2_rect *rect, bool async) { void __iomem *base = stream->ispdev->base_addr; void __iomem *dc_ctrl_addr = base + stream->config->dual_crop.ctrl; @@ -69,7 +69,7 @@ void config_dcrop(struct rkisp1_stream *stream, struct v4l2_rect *rect, bool asy writel(dc_ctrl, dc_ctrl_addr); } -void dump_rsz_regs(struct rkisp1_stream *stream) +void dump_rsz_regs(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; @@ -105,7 +105,7 @@ void dump_rsz_regs(struct rkisp1_stream *stream) readl(base + stream->config->rsz.phase_vc_shd)); } -static void update_rsz_shadow(struct rkisp1_stream *stream, bool async) +static void update_rsz_shadow(struct rkisp_stream *stream, bool async) { void *addr = stream->ispdev->base_addr + stream->config->rsz.ctrl; u32 ctrl_cfg = readl(addr); @@ -116,7 +116,7 @@ static void update_rsz_shadow(struct rkisp1_stream *stream, bool async) writel(CIF_RSZ_CTRL_CFG_UPD | ctrl_cfg, addr); } -static void set_scale(struct rkisp1_stream *stream, struct v4l2_rect *in_y, +static void set_scale(struct rkisp_stream *stream, struct v4l2_rect *in_y, struct v4l2_rect *in_c, struct v4l2_rect *out_y, struct v4l2_rect *out_c) { @@ -185,7 +185,7 @@ static void set_scale(struct rkisp1_stream *stream, struct v4l2_rect *in_y, writel(rsz_ctrl, rsz_ctrl_addr); } -void config_rsz(struct rkisp1_stream *stream, struct v4l2_rect *in_y, +void config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y, struct v4l2_rect *in_c, struct v4l2_rect *out_y, struct v4l2_rect *out_c, bool async) { @@ -208,7 +208,7 @@ void config_rsz(struct rkisp1_stream *stream, struct v4l2_rect *in_y, update_rsz_shadow(stream, async); } -void disable_rsz(struct rkisp1_stream *stream, bool async) +void disable_rsz(struct rkisp_stream *stream, bool async) { writel(0, stream->ispdev->base_addr + stream->config->rsz.ctrl); @@ -216,7 +216,7 @@ void disable_rsz(struct rkisp1_stream *stream, bool async) update_rsz_shadow(stream, async); } -void config_mi_ctrl(struct rkisp1_stream *stream, u32 burst) +void config_mi_ctrl(struct rkisp_stream *stream, u32 burst) { void __iomem *base = stream->ispdev->base_addr; void __iomem *addr = base + CIF_MI_CTRL; diff --git a/drivers/media/platform/rockchip/isp1/regs.h b/drivers/media/platform/rockchip/isp/regs.h similarity index 98% rename from drivers/media/platform/rockchip/isp1/regs.h rename to drivers/media/platform/rockchip/isp/regs.h index d31ef1b127f5..754fc216e3e5 100644 --- a/drivers/media/platform/rockchip/isp1/regs.h +++ b/drivers/media/platform/rockchip/isp/regs.h @@ -32,8 +32,8 @@ * SOFTWARE. */ -#ifndef _RKISP1_REGS_H -#define _RKISP1_REGS_H +#ifndef _RKISP_REGS_H +#define _RKISP_REGS_H #include "dev.h" #define CIF_ISP_PACK_4BYTE(a, b, c, d) \ @@ -1608,17 +1608,17 @@ #define CIF_ISP_CSI0_TX_IBUF_STATUS_RO (CIF_ISP_CSI0_BASE + 0x00000078) #define CIF_ISP_CSI0_VERSION (CIF_ISP_CSI0_BASE + 0x0000007c) -void disable_dcrop(struct rkisp1_stream *stream, bool async); -void config_dcrop(struct rkisp1_stream *stream, struct v4l2_rect *rect, +void disable_dcrop(struct rkisp_stream *stream, bool async); +void config_dcrop(struct rkisp_stream *stream, struct v4l2_rect *rect, bool async); -void dump_rsz_regs(struct rkisp1_stream *stream); -void disable_rsz(struct rkisp1_stream *stream, bool async); -void config_rsz(struct rkisp1_stream *stream, struct v4l2_rect *in_y, +void dump_rsz_regs(struct rkisp_stream *stream); +void disable_rsz(struct rkisp_stream *stream, bool async); +void config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y, struct v4l2_rect *in_c, struct v4l2_rect *out_y, struct v4l2_rect *out_c, bool async); -void config_mi_ctrl(struct rkisp1_stream *stream, u32 burst); +void config_mi_ctrl(struct rkisp_stream *stream, u32 burst); void mp_clr_frame_end_int(void __iomem *base); void sp_clr_frame_end_int(void __iomem *base); @@ -1628,70 +1628,70 @@ bool sp_is_frame_end_int_masked(void __iomem *base); bool mp_is_stream_stopped(void __iomem *base); bool sp_is_stream_stopped(void __iomem *base); -static inline void mi_set_y_size(struct rkisp1_stream *stream, int val) +static inline void mi_set_y_size(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.y_size_init); } -static inline void mi_set_cb_size(struct rkisp1_stream *stream, int val) +static inline void mi_set_cb_size(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.cb_size_init); } -static inline void mi_set_cr_size(struct rkisp1_stream *stream, int val) +static inline void mi_set_cr_size(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.cr_size_init); } -static inline void mi_set_y_addr(struct rkisp1_stream *stream, int val) +static inline void mi_set_y_addr(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.y_base_ad_init); } -static inline void mi_set_cb_addr(struct rkisp1_stream *stream, int val) +static inline void mi_set_cb_addr(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.cb_base_ad_init); } -static inline void mi_set_cr_addr(struct rkisp1_stream *stream, int val) +static inline void mi_set_cr_addr(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.cr_base_ad_init); } -static inline void mi_set_y_offset(struct rkisp1_stream *stream, int val) +static inline void mi_set_y_offset(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.y_offs_cnt_init); } -static inline void mi_set_cb_offset(struct rkisp1_stream *stream, int val) +static inline void mi_set_cb_offset(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.cb_offs_cnt_init); } -static inline void mi_set_cr_offset(struct rkisp1_stream *stream, int val) +static inline void mi_set_cr_offset(struct rkisp_stream *stream, int val) { void __iomem *base = stream->ispdev->base_addr; writel(val, base + stream->config->mi.cr_offs_cnt_init); } -static inline void mi_frame_end_int_enable(struct rkisp1_stream *stream) +static inline void mi_frame_end_int_enable(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; void __iomem *addr = base + CIF_MI_IMSC; @@ -1699,7 +1699,7 @@ static inline void mi_frame_end_int_enable(struct rkisp1_stream *stream) writel(CIF_MI_FRAME(stream) | readl(addr), addr); } -static inline void mi_frame_end_int_disable(struct rkisp1_stream *stream) +static inline void mi_frame_end_int_disable(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; void __iomem *addr = base + CIF_MI_IMSC; @@ -1707,7 +1707,7 @@ static inline void mi_frame_end_int_disable(struct rkisp1_stream *stream) writel(~CIF_MI_FRAME(stream) & readl(addr), addr); } -static inline void mi_frame_end_int_clear(struct rkisp1_stream *stream) +static inline void mi_frame_end_int_clear(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; void __iomem *addr = base + CIF_MI_ICR; @@ -1943,7 +1943,7 @@ static inline void mi_ctrl2(void __iomem *base, u32 val) writel(val, base + CIF_MI_CTRL2); } -static inline void mi_dmarx_ready_enable(struct rkisp1_stream *stream) +static inline void mi_dmarx_ready_enable(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; void __iomem *addr = base + CIF_MI_IMSC; @@ -1951,7 +1951,7 @@ static inline void mi_dmarx_ready_enable(struct rkisp1_stream *stream) writel(CIF_MI_DMA_READY | readl(addr), addr); } -static inline void mi_dmarx_ready_disable(struct rkisp1_stream *stream) +static inline void mi_dmarx_ready_disable(struct rkisp_stream *stream) { void __iomem *base = stream->ispdev->base_addr; void __iomem *addr = base + CIF_MI_IMSC; @@ -1991,4 +1991,4 @@ static inline void mi_dmarx_start(void __iomem *base) writel(CIF_MI_DMA_START_ENABLE, addr); } -#endif /* _RKISP1_REGS_H */ +#endif /* _RKISP_REGS_H */ diff --git a/drivers/media/platform/rockchip/isp1/rkisp1.c b/drivers/media/platform/rockchip/isp/rkisp.c similarity index 81% rename from drivers/media/platform/rockchip/isp1/rkisp1.c rename to drivers/media/platform/rockchip/isp/rkisp.c index ad1329d86109..a631725d6bcf 100644 --- a/drivers/media/platform/rockchip/isp1/rkisp1.c +++ b/drivers/media/platform/rockchip/isp/rkisp.c @@ -70,16 +70,16 @@ * | | | in_crop | | | * | | | +---------------------------------+ | | | * | | | | ISP_IS | | | | - * | | | | rkisp1_isp_subdev: out_crop | | | | + * | | | | rkisp_isp_subdev: out_crop | | | | * | | | +---------------------------------+ | | | * | | +--------------------------------------------+ | | * | +---------------------------------------------------+ | * +---------------------------------------------------------+ */ -static inline struct rkisp1_device *sd_to_isp_dev(struct v4l2_subdev *sd) +static inline struct rkisp_device *sd_to_isp_dev(struct v4l2_subdev *sd) { - return container_of(sd->v4l2_dev, struct rkisp1_device, v4l2_dev); + return container_of(sd->v4l2_dev, struct rkisp_device, v4l2_dev); } /* Get sensor by enabled media link */ @@ -88,7 +88,7 @@ static struct v4l2_subdev *get_remote_sensor(struct v4l2_subdev *sd) struct media_pad *local, *remote; struct media_entity *sensor_me; - local = &sd->entity.pads[RKISP1_ISP_PAD_SINK]; + local = &sd->entity.pads[RKISP_ISP_PAD_SINK]; if (!local) return NULL; remote = media_entity_remote_pad(local); @@ -100,7 +100,7 @@ static struct v4l2_subdev *get_remote_sensor(struct v4l2_subdev *sd) return media_entity_to_v4l2_subdev(sensor_me); } -static void get_remote_mipi_sensor(struct rkisp1_device *dev, +static void get_remote_mipi_sensor(struct rkisp_device *dev, struct v4l2_subdev **sensor_sd) { struct media_graph graph; @@ -131,7 +131,7 @@ static void get_remote_mipi_sensor(struct rkisp1_device *dev, *sensor_sd = NULL; } -static struct rkisp1_sensor_info *sd_to_sensor(struct rkisp1_device *dev, +static struct rkisp_sensor_info *sd_to_sensor(struct rkisp_device *dev, struct v4l2_subdev *sd) { int i; @@ -143,10 +143,10 @@ static struct rkisp1_sensor_info *sd_to_sensor(struct rkisp1_device *dev, return NULL; } -int rkisp1_update_sensor_info(struct rkisp1_device *dev) +int rkisp_update_sensor_info(struct rkisp_device *dev) { struct v4l2_subdev *sd = &dev->isp_sdev.sd; - struct rkisp1_sensor_info *sensor; + struct rkisp_sensor_info *sensor; struct v4l2_subdev *sensor_sd; int ret = 0; @@ -169,7 +169,7 @@ int rkisp1_update_sensor_info(struct rkisp1_device *dev) return ret; } -u32 rkisp1_mbus_pixelcode_to_v4l2(u32 pixelcode) +u32 rkisp_mbus_pixelcode_to_v4l2(u32 pixelcode) { u32 pixelformat; @@ -219,7 +219,7 @@ u32 rkisp1_mbus_pixelcode_to_v4l2(u32 pixelcode) /**************** register operations ****************/ -static void rkisp1_config_clk(struct rkisp1_device *dev, int on) +static void rkisp_config_clk(struct rkisp_device *dev, int on) { u32 val = !on ? 0 : CIF_ICCL_ISP_CLK | CIF_ICCL_CP_CLK | CIF_ICCL_MRSZ_CLK | @@ -228,7 +228,7 @@ static void rkisp1_config_clk(struct rkisp1_device *dev, int on) writel(val, dev->base_addr + CIF_ICCL); -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) { #else if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) { @@ -248,7 +248,7 @@ static void rkisp1_config_clk(struct rkisp1_device *dev, int on) * This should only be called when configuring CIF * or at the frame end interrupt */ -static void rkisp1_config_ism(struct rkisp1_device *dev) +static void rkisp_config_ism(struct rkisp_device *dev) { void __iomem *base = dev->base_addr; struct v4l2_rect *out_crop = &dev->isp_sdev.out_crop; @@ -261,7 +261,7 @@ static void rkisp1_config_ism(struct rkisp1_device *dev) writel(out_crop->left, base + CIF_ISP_IS_H_OFFS); writel(out_crop->top, base + CIF_ISP_IS_V_OFFS); writel(out_crop->width, base + CIF_ISP_IS_H_SIZE); - if (dev->stream[RKISP1_STREAM_SP].interlaced) + if (dev->stream[RKISP_STREAM_SP].interlaced) writel(out_crop->height / 2, base + CIF_ISP_IS_V_SIZE); else writel(out_crop->height, base + CIF_ISP_IS_V_SIZE); @@ -276,13 +276,13 @@ static void rkisp1_config_ism(struct rkisp1_device *dev) /* * configure isp blocks with input format, size...... */ -static int rkisp1_config_isp(struct rkisp1_device *dev) +static int rkisp_config_isp(struct rkisp_device *dev) { struct ispsd_in_fmt *in_fmt; struct ispsd_out_fmt *out_fmt; struct v4l2_mbus_framefmt *in_frm; struct v4l2_rect *out_crop, *in_crop; - struct rkisp1_sensor_info *sensor; + struct rkisp_sensor_info *sensor; void __iomem *base = dev->base_addr; u32 isp_ctrl = 0; u32 irq_mask = 0; @@ -376,7 +376,7 @@ static int rkisp1_config_isp(struct rkisp1_device *dev) writel(in_crop->top, base + CIF_ISP_OUT_V_OFFS); writel(in_crop->width, base + CIF_ISP_OUT_H_SIZE); - if (dev->stream[RKISP1_STREAM_SP].interlaced) { + if (dev->stream[RKISP_STREAM_SP].interlaced) { writel(in_frm->height / 2, base + CIF_ISP_ACQ_V_SIZE); writel(in_crop->height / 2, base + CIF_ISP_OUT_V_SIZE); } else { @@ -390,15 +390,15 @@ static int rkisp1_config_isp(struct rkisp1_device *dev) writel(irq_mask, base + CIF_ISP_IMSC); if (out_fmt->fmt_type == FMT_BAYER) - rkisp1_params_disable_isp(&dev->params_vdev); + rkisp_params_disable_isp(&dev->params_vdev); else - rkisp1_params_configure_isp(&dev->params_vdev, in_fmt, - dev->isp_sdev.quantization); + rkisp_params_configure_isp(&dev->params_vdev, in_fmt, + dev->isp_sdev.quantization); return 0; } -static int rkisp1_config_dvp(struct rkisp1_device *dev) +static int rkisp_config_dvp(struct rkisp_device *dev) { struct ispsd_in_fmt *in_fmt = &dev->isp_sdev.in_fmt; void __iomem *base = dev->base_addr; @@ -436,12 +436,12 @@ static int rkisp1_config_dvp(struct rkisp1_device *dev) return 0; } -static int rkisp1_config_mipi(struct rkisp1_device *dev) +static int rkisp_config_mipi(struct rkisp_device *dev) { u32 mipi_ctrl; void __iomem *base = dev->base_addr; struct ispsd_in_fmt *in_fmt = &dev->isp_sdev.in_fmt; - struct rkisp1_sensor_info *sensor = dev->active_sensor; + struct rkisp_sensor_info *sensor = dev->active_sensor; struct v4l2_subdev *mipi_sensor; struct v4l2_ctrl *ctrl; u32 emd_vc, emd_dt; @@ -488,7 +488,7 @@ static int rkisp1_config_mipi(struct rkisp1_device *dev) dev->emd_vc = emd_vc; dev->emd_data_idx = 0; if (emd_vc <= CIF_ISP_ADD_DATA_VC_MAX) { - for (i = 0; i < RKISP1_EMDDATA_FIFO_MAX; i++) { + for (i = 0; i < RKISP_EMDDATA_FIFO_MAX; i++) { ret = kfifo_alloc(&dev->emd_data_fifo[i].mipi_kfifo, CIFISP_ADD_DATA_FIFO_SIZE, GFP_ATOMIC); @@ -501,7 +501,7 @@ static int rkisp1_config_mipi(struct rkisp1_device *dev) } } -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) { #else if (dev->isp_ver == ISP_V13 || @@ -535,7 +535,7 @@ static int rkisp1_config_mipi(struct rkisp1_device *dev) CIF_MIPI_CTRL_ERR_SOT_SYNC_HS_SKIP | CIF_MIPI_CTRL_CLOCKLANE_ENA; -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V12) { writel(0, base + CIF_ISP_CSI0_CTRL0); writel(0, base + CIF_ISP_CSI0_MASK1); @@ -573,7 +573,7 @@ static int rkisp1_config_mipi(struct rkisp1_device *dev) base + CIF_MIPI_IMSC); } - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, "\n MIPI_CTRL 0x%08x\n" + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "\n MIPI_CTRL 0x%08x\n" " MIPI_IMG_DATA_SEL 0x%08x\n" " MIPI_STATUS 0x%08x\n" " MIPI_IMSC 0x%08x\n", @@ -586,19 +586,19 @@ static int rkisp1_config_mipi(struct rkisp1_device *dev) } /* Configure MUX */ -static int rkisp1_config_path(struct rkisp1_device *dev) +static int rkisp_config_path(struct rkisp_device *dev) { int ret = 0; - struct rkisp1_sensor_info *sensor = dev->active_sensor; + struct rkisp_sensor_info *sensor = dev->active_sensor; u32 dpcl = readl(dev->base_addr + CIF_VI_DPCL); if (sensor && (sensor->mbus.type == V4L2_MBUS_BT656 || sensor->mbus.type == V4L2_MBUS_PARALLEL)) { - ret = rkisp1_config_dvp(dev); + ret = rkisp_config_dvp(dev); dpcl |= CIF_VI_DPCL_IF_SEL_PARALLEL; dev->isp_inp = INP_DVP; } else if (sensor && sensor->mbus.type == V4L2_MBUS_CSI2) { - ret = rkisp1_config_mipi(dev); + ret = rkisp_config_mipi(dev); dpcl |= CIF_VI_DPCL_IF_SEL_MIPI; dev->isp_inp = INP_CSI; } else if (dev->isp_inp == INP_DMARX_ISP) { @@ -611,53 +611,53 @@ static int rkisp1_config_path(struct rkisp1_device *dev) } /* Hareware configure Entry */ -static int rkisp1_config_cif(struct rkisp1_device *dev) +static int rkisp_config_cif(struct rkisp_device *dev) { int ret = 0; u32 cif_id; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "SP streaming = %d, MP streaming = %d\n", - dev->stream[RKISP1_STREAM_SP].streaming, - dev->stream[RKISP1_STREAM_MP].streaming); + dev->stream[RKISP_STREAM_SP].streaming, + dev->stream[RKISP_STREAM_MP].streaming); cif_id = readl(dev->base_addr + CIF_VI_ID); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, "CIF_ID 0x%08x\n", cif_id); + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "CIF_ID 0x%08x\n", cif_id); - ret = rkisp1_config_isp(dev); + ret = rkisp_config_isp(dev); if (ret < 0) return ret; - ret = rkisp1_config_path(dev); + ret = rkisp_config_path(dev); if (ret < 0) return ret; - rkisp1_config_ism(dev); + rkisp_config_ism(dev); return 0; } -static bool rkisp1_is_need_3a(struct rkisp1_device *dev) +static bool rkisp_is_need_3a(struct rkisp_device *dev) { - struct rkisp1_isp_subdev *isp_sdev = &dev->isp_sdev; + struct rkisp_isp_subdev *isp_sdev = &dev->isp_sdev; return isp_sdev->in_fmt.fmt_type == FMT_BAYER && isp_sdev->out_fmt.fmt_type == FMT_YUV; } -static void rkisp1_start_3a_run(struct rkisp1_device *dev) +static void rkisp_start_3a_run(struct rkisp_device *dev) { - struct rkisp1_isp_params_vdev *params_vdev = &dev->params_vdev; + struct rkisp_isp_params_vdev *params_vdev = &dev->params_vdev; struct video_device *vdev = ¶ms_vdev->vnode.vdev; struct v4l2_event ev = { .type = CIFISP_V4L2_EVENT_STREAM_START, }; int ret; - if (!rkisp1_is_need_3a(dev)) + if (!rkisp_is_need_3a(dev)) return; v4l2_event_queue(vdev, &ev); /* rk3326/px30 require first params queued before - * rkisp1_params_configure_isp() called + * rkisp_params_configure_isp() called */ ret = wait_event_timeout(dev->sync_onoff, params_vdev->streamon && !params_vdev->first_params, @@ -666,20 +666,20 @@ static void rkisp1_start_3a_run(struct rkisp1_device *dev) v4l2_warn(&dev->v4l2_dev, "waiting on params stream on event timeout\n"); else - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "Waiting for 3A on use %d ms\n", 1000 - ret); } -static void rkisp1_stop_3a_run(struct rkisp1_device *dev) +static void rkisp_stop_3a_run(struct rkisp_device *dev) { - struct rkisp1_isp_params_vdev *params_vdev = &dev->params_vdev; + struct rkisp_isp_params_vdev *params_vdev = &dev->params_vdev; struct video_device *vdev = ¶ms_vdev->vnode.vdev; struct v4l2_event ev = { .type = CIFISP_V4L2_EVENT_STREAM_STOP, }; int ret; - if (!rkisp1_is_need_3a(dev)) + if (!rkisp_is_need_3a(dev)) return; v4l2_event_queue(vdev, &ev); @@ -689,29 +689,29 @@ static void rkisp1_stop_3a_run(struct rkisp1_device *dev) v4l2_warn(&dev->v4l2_dev, "waiting on params stream off event timeout\n"); else - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "Waiting for 3A off use %d ms\n", 1000 - ret); } /* Mess register operations to stop isp */ -static int rkisp1_isp_stop(struct rkisp1_device *dev) +static int rkisp_isp_stop(struct rkisp_device *dev) { void __iomem *base = dev->base_addr; unsigned long old_rate, safe_rate; u32 val; u32 i; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "SP streaming = %d, MP streaming = %d\n", - dev->stream[RKISP1_STREAM_SP].streaming, - dev->stream[RKISP1_STREAM_MP].streaming); + dev->stream[RKISP_STREAM_SP].streaming, + dev->stream[RKISP_STREAM_MP].streaming); /* * ISP(mi) stop in mi frame end -> Stop ISP(mipi) -> * Stop ISP(isp) ->wait for ISP isp off */ /* stop and clear MI, MIPI, and ISP interrupts */ -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) { #else if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) { @@ -732,7 +732,7 @@ static int rkisp1_isp_stop(struct rkisp1_device *dev) writel(0, base + CIF_MI_IMSC); writel(~0, base + CIF_MI_ICR); -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) { #else if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) { @@ -754,10 +754,10 @@ static int rkisp1_isp_stop(struct rkisp1_device *dev) readx_poll_timeout_atomic(readl, base + CIF_ISP_RIS, val, val & CIF_ISP_OFF, 20, 100); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, - "streaming(MP:%d, SP:%d), MI_CTRL:%x, ISP_CTRL:%x, MIPI_CTRL:%x\n", - dev->stream[RKISP1_STREAM_SP].streaming, - dev->stream[RKISP1_STREAM_MP].streaming, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, + "streaming(MP:%d, SP:%d), MI_CTRL:%x, ISP_CTRL:%x, MIPI_CTRL:%x\n", + dev->stream[RKISP_STREAM_SP].streaming, + dev->stream[RKISP_STREAM_MP].streaming, readl(base + CIF_MI_CTRL), readl(base + CIF_ISP_CTRL), readl(base + CIF_MIPI_CTRL)); @@ -787,7 +787,7 @@ static int rkisp1_isp_stop(struct rkisp1_device *dev) writel(0, base + CIF_ISP_CSI0_MASK3); } - rkisp1_config_clk(dev, true); + rkisp_config_clk(dev, true); if (!in_interrupt()) { struct iommu_domain *domain; @@ -800,7 +800,7 @@ static int rkisp1_isp_stop(struct rkisp1_device *dev) dev->isp_state = ISP_STOP; if (dev->emd_vc <= CIF_ISP_ADD_DATA_VC_MAX) { - for (i = 0; i < RKISP1_EMDDATA_FIFO_MAX; i++) + for (i = 0; i < RKISP_EMDDATA_FIFO_MAX; i++) kfifo_free(&dev->emd_data_fifo[i].mipi_kfifo); dev->emd_vc = 0xFF; } @@ -812,20 +812,20 @@ static int rkisp1_isp_stop(struct rkisp1_device *dev) } /* Mess register operations to start isp */ -static int rkisp1_isp_start(struct rkisp1_device *dev) +static int rkisp_isp_start(struct rkisp_device *dev) { - struct rkisp1_sensor_info *sensor = dev->active_sensor; + struct rkisp_sensor_info *sensor = dev->active_sensor; void __iomem *base = dev->base_addr; u32 val; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "SP streaming = %d, MP streaming = %d\n", - dev->stream[RKISP1_STREAM_SP].streaming, - dev->stream[RKISP1_STREAM_MP].streaming); + dev->stream[RKISP_STREAM_SP].streaming, + dev->stream[RKISP_STREAM_MP].streaming); /* Activate MIPI */ if (sensor && sensor->mbus.type == V4L2_MBUS_CSI2) { -#if RKISP1_RK3326_USE_OLDMIPI +#if RKISP_RK3326_USE_OLDMIPI if (dev->isp_ver == ISP_V13) { #else if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) { @@ -857,11 +857,11 @@ static int rkisp1_isp_start(struct rkisp1_device *dev) */ usleep_range(1000, 1200); - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "SP streaming = %d, MP streaming = %d MI_CTRL 0x%08x\n" " ISP_CTRL 0x%08x MIPI_CTRL 0x%08x\n", - dev->stream[RKISP1_STREAM_SP].streaming, - dev->stream[RKISP1_STREAM_MP].streaming, + dev->stream[RKISP_STREAM_SP].streaming, + dev->stream[RKISP_STREAM_MP].streaming, readl(base + CIF_MI_CTRL), readl(base + CIF_ISP_CTRL), readl(base + CIF_MIPI_CTRL)); @@ -871,7 +871,7 @@ static int rkisp1_isp_start(struct rkisp1_device *dev) /***************************** isp sub-devs *******************************/ -static const struct ispsd_in_fmt rkisp1_isp_input_formats[] = { +static const struct ispsd_in_fmt rkisp_isp_input_formats[] = { { .mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, .fmt_type = FMT_BAYER, @@ -1037,7 +1037,7 @@ static const struct ispsd_in_fmt rkisp1_isp_input_formats[] = { } }; -static const struct ispsd_out_fmt rkisp1_isp_output_formats[] = { +static const struct ispsd_out_fmt rkisp_isp_output_formats[] = { { .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, .fmt_type = FMT_YUV, @@ -1083,10 +1083,10 @@ static const struct ispsd_out_fmt rkisp1_isp_output_formats[] = { static const struct ispsd_in_fmt *find_in_fmt(u32 mbus_code) { const struct ispsd_in_fmt *fmt; - int i, array_size = ARRAY_SIZE(rkisp1_isp_input_formats); + int i, array_size = ARRAY_SIZE(rkisp_isp_input_formats); for (i = 0; i < array_size; i++) { - fmt = &rkisp1_isp_input_formats[i]; + fmt = &rkisp_isp_input_formats[i]; if (fmt->mbus_code == mbus_code) return fmt; } @@ -1097,10 +1097,10 @@ static const struct ispsd_in_fmt *find_in_fmt(u32 mbus_code) static const struct ispsd_out_fmt *find_out_fmt(u32 mbus_code) { const struct ispsd_out_fmt *fmt; - int i, array_size = ARRAY_SIZE(rkisp1_isp_output_formats); + int i, array_size = ARRAY_SIZE(rkisp_isp_output_formats); for (i = 0; i < array_size; i++) { - fmt = &rkisp1_isp_output_formats[i]; + fmt = &rkisp_isp_output_formats[i]; if (fmt->mbus_code == mbus_code) return fmt; } @@ -1108,35 +1108,35 @@ static const struct ispsd_out_fmt *find_out_fmt(u32 mbus_code) return NULL; } -static int rkisp1_isp_sd_enum_mbus_code(struct v4l2_subdev *sd, +static int rkisp_isp_sd_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { int i = code->index; - if (code->pad == RKISP1_ISP_PAD_SINK) { - if (i >= ARRAY_SIZE(rkisp1_isp_input_formats)) + if (code->pad == RKISP_ISP_PAD_SINK) { + if (i >= ARRAY_SIZE(rkisp_isp_input_formats)) return -EINVAL; - code->code = rkisp1_isp_input_formats[i].mbus_code; + code->code = rkisp_isp_input_formats[i].mbus_code; } else { - if (i >= ARRAY_SIZE(rkisp1_isp_output_formats)) + if (i >= ARRAY_SIZE(rkisp_isp_output_formats)) return -EINVAL; - code->code = rkisp1_isp_output_formats[i].mbus_code; + code->code = rkisp_isp_output_formats[i].mbus_code; } return 0; } -#define sd_to_isp_sd(_sd) container_of(_sd, struct rkisp1_isp_subdev, sd) -static int rkisp1_isp_sd_get_fmt(struct v4l2_subdev *sd, +#define sd_to_isp_sd(_sd) container_of(_sd, struct rkisp_isp_subdev, sd) +static int rkisp_isp_sd_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct v4l2_mbus_framefmt *mf = &fmt->format; - struct rkisp1_isp_subdev *isp_sd = sd_to_isp_sd(sd); + struct rkisp_isp_subdev *isp_sd = sd_to_isp_sd(sd); - if ((fmt->pad != RKISP1_ISP_PAD_SINK) && - (fmt->pad != RKISP1_ISP_PAD_SOURCE_PATH)) + if (fmt->pad != RKISP_ISP_PAD_SINK && + fmt->pad != RKISP_ISP_PAD_SOURCE_PATH) return -EINVAL; if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { @@ -1145,9 +1145,9 @@ static int rkisp1_isp_sd_get_fmt(struct v4l2_subdev *sd, return 0; } - if (fmt->pad == RKISP1_ISP_PAD_SINK) { + if (fmt->pad == RKISP_ISP_PAD_SINK) { *mf = isp_sd->in_frm; - } else if (fmt->pad == RKISP1_ISP_PAD_SOURCE_PATH) { + } else if (fmt->pad == RKISP_ISP_PAD_SOURCE_PATH) { /* format of source pad */ mf->code = isp_sd->out_fmt.mbus_code; /* window size of source pad */ @@ -1160,17 +1160,17 @@ static int rkisp1_isp_sd_get_fmt(struct v4l2_subdev *sd, return 0; } -static void rkisp1_isp_sd_try_fmt(struct v4l2_subdev *sd, +static void rkisp_isp_sd_try_fmt(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_framefmt *fmt) { - struct rkisp1_device *isp_dev = sd_to_isp_dev(sd); - struct rkisp1_isp_subdev *isp_sd = &isp_dev->isp_sdev; + struct rkisp_device *isp_dev = sd_to_isp_dev(sd); + struct rkisp_isp_subdev *isp_sd = &isp_dev->isp_sdev; const struct ispsd_in_fmt *in_fmt; const struct ispsd_out_fmt *out_fmt; switch (pad) { - case RKISP1_ISP_PAD_SINK: + case RKISP_ISP_PAD_SINK: in_fmt = find_in_fmt(fmt->code); if (in_fmt) fmt->code = in_fmt->mbus_code; @@ -1200,7 +1200,7 @@ static void rkisp1_isp_sd_try_fmt(struct v4l2_subdev *sd, CIF_ISP_INPUT_H_MAX); } break; - case RKISP1_ISP_PAD_SOURCE_PATH: + case RKISP_ISP_PAD_SOURCE_PATH: out_fmt = find_out_fmt(fmt->code); if (out_fmt) fmt->code = out_fmt->mbus_code; @@ -1218,19 +1218,19 @@ static void rkisp1_isp_sd_try_fmt(struct v4l2_subdev *sd, fmt->field = V4L2_FIELD_NONE; } -static int rkisp1_isp_sd_set_fmt(struct v4l2_subdev *sd, +static int rkisp_isp_sd_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { - struct rkisp1_device *isp_dev = sd_to_isp_dev(sd); - struct rkisp1_isp_subdev *isp_sd = &isp_dev->isp_sdev; + struct rkisp_device *isp_dev = sd_to_isp_dev(sd); + struct rkisp_isp_subdev *isp_sd = &isp_dev->isp_sdev; struct v4l2_mbus_framefmt *mf = &fmt->format; - if ((fmt->pad != RKISP1_ISP_PAD_SINK) && - (fmt->pad != RKISP1_ISP_PAD_SOURCE_PATH)) + if (fmt->pad != RKISP_ISP_PAD_SINK && + fmt->pad != RKISP_ISP_PAD_SOURCE_PATH) return -EINVAL; - rkisp1_isp_sd_try_fmt(sd, fmt->pad, mf); + rkisp_isp_sd_try_fmt(sd, fmt->pad, mf); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { struct v4l2_mbus_framefmt *try_mf; @@ -1240,13 +1240,13 @@ static int rkisp1_isp_sd_set_fmt(struct v4l2_subdev *sd, return 0; } - if (fmt->pad == RKISP1_ISP_PAD_SINK) { + if (fmt->pad == RKISP_ISP_PAD_SINK) { const struct ispsd_in_fmt *in_fmt; in_fmt = find_in_fmt(mf->code); isp_sd->in_fmt = *in_fmt; isp_sd->in_frm = *mf; - } else if (fmt->pad == RKISP1_ISP_PAD_SOURCE_PATH) { + } else if (fmt->pad == RKISP_ISP_PAD_SOURCE_PATH) { const struct ispsd_out_fmt *out_fmt; /* Ignore width/height */ @@ -1262,24 +1262,24 @@ static int rkisp1_isp_sd_set_fmt(struct v4l2_subdev *sd, return 0; } -static void rkisp1_isp_sd_try_crop(struct v4l2_subdev *sd, +static void rkisp_isp_sd_try_crop(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) { - struct rkisp1_isp_subdev *isp_sd = sd_to_isp_sd(sd); + struct rkisp_isp_subdev *isp_sd = sd_to_isp_sd(sd); struct v4l2_mbus_framefmt in_frm = isp_sd->in_frm; struct v4l2_rect in_crop = isp_sd->in_crop; struct v4l2_rect *input = &sel->r; if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { - in_frm = *v4l2_subdev_get_try_format(sd, cfg, RKISP1_ISP_PAD_SINK); - in_crop = *v4l2_subdev_get_try_crop(sd, cfg, RKISP1_ISP_PAD_SINK); + in_frm = *v4l2_subdev_get_try_format(sd, cfg, RKISP_ISP_PAD_SINK); + in_crop = *v4l2_subdev_get_try_crop(sd, cfg, RKISP_ISP_PAD_SINK); } input->left = ALIGN(input->left, 2); input->width = ALIGN(input->width, 2); - if (sel->pad == RKISP1_ISP_PAD_SINK) { + if (sel->pad == RKISP_ISP_PAD_SINK) { input->left = clamp_t(u32, input->left, 0, in_frm.width); input->top = clamp_t(u32, input->top, 0, in_frm.height); input->width = clamp_t(u32, input->width, CIF_ISP_INPUT_W_MIN, @@ -1287,7 +1287,7 @@ static void rkisp1_isp_sd_try_crop(struct v4l2_subdev *sd, input->height = clamp_t(u32, input->height, CIF_ISP_INPUT_H_MIN, in_frm.height - input->top); - } else if (sel->pad == RKISP1_ISP_PAD_SOURCE_PATH) { + } else if (sel->pad == RKISP_ISP_PAD_SOURCE_PATH) { input->left = clamp_t(u32, input->left, 0, in_crop.width); input->top = clamp_t(u32, input->top, 0, in_crop.height); input->width = clamp_t(u32, input->width, CIF_ISP_OUTPUT_W_MIN, @@ -1297,14 +1297,14 @@ static void rkisp1_isp_sd_try_crop(struct v4l2_subdev *sd, } } -static int rkisp1_isp_sd_get_selection(struct v4l2_subdev *sd, +static int rkisp_isp_sd_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) { - struct rkisp1_isp_subdev *isp_sd = sd_to_isp_sd(sd); + struct rkisp_isp_subdev *isp_sd = sd_to_isp_sd(sd); - if (sel->pad != RKISP1_ISP_PAD_SOURCE_PATH && - sel->pad != RKISP1_ISP_PAD_SINK) + if (sel->pad != RKISP_ISP_PAD_SOURCE_PATH && + sel->pad != RKISP_ISP_PAD_SINK) return -EINVAL; if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { @@ -1317,7 +1317,7 @@ static int rkisp1_isp_sd_get_selection(struct v4l2_subdev *sd, switch (sel->target) { case V4L2_SEL_TGT_CROP_BOUNDS: - if (sel->pad == RKISP1_ISP_PAD_SINK) { + if (sel->pad == RKISP_ISP_PAD_SINK) { sel->r.height = isp_sd->in_frm.height; sel->r.width = isp_sd->in_frm.width; sel->r.left = 0; @@ -1327,7 +1327,7 @@ static int rkisp1_isp_sd_get_selection(struct v4l2_subdev *sd, } break; case V4L2_SEL_TGT_CROP: - if (sel->pad == RKISP1_ISP_PAD_SINK) + if (sel->pad == RKISP_ISP_PAD_SINK) sel->r = isp_sd->in_crop; else sel->r = isp_sd->out_crop; @@ -1339,23 +1339,23 @@ static int rkisp1_isp_sd_get_selection(struct v4l2_subdev *sd, return 0; } -static int rkisp1_isp_sd_set_selection(struct v4l2_subdev *sd, +static int rkisp_isp_sd_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) { - struct rkisp1_isp_subdev *isp_sd = sd_to_isp_sd(sd); - struct rkisp1_device *dev = sd_to_isp_dev(sd); + struct rkisp_isp_subdev *isp_sd = sd_to_isp_sd(sd); + struct rkisp_device *dev = sd_to_isp_dev(sd); - if (sel->pad != RKISP1_ISP_PAD_SOURCE_PATH && - sel->pad != RKISP1_ISP_PAD_SINK) + if (sel->pad != RKISP_ISP_PAD_SOURCE_PATH && + sel->pad != RKISP_ISP_PAD_SINK) return -EINVAL; if (sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "%s: pad: %d sel(%d,%d)/%dx%d\n", __func__, sel->pad, sel->r.left, sel->r.top, sel->r.width, sel->r.height); - rkisp1_isp_sd_try_crop(sd, cfg, sel); + rkisp_isp_sd_try_crop(sd, cfg, sel); if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { struct v4l2_rect *try_sel; @@ -1365,7 +1365,7 @@ static int rkisp1_isp_sd_set_selection(struct v4l2_subdev *sd, return 0; } - if (sel->pad == RKISP1_ISP_PAD_SINK) + if (sel->pad == RKISP_ISP_PAD_SINK) isp_sd->in_crop = sel->r; else isp_sd->out_crop = sel->r; @@ -1373,7 +1373,7 @@ static int rkisp1_isp_sd_set_selection(struct v4l2_subdev *sd, return 0; } -static void rkisp1_isp_read_add_fifo_data(struct rkisp1_device *dev) +static void rkisp_isp_read_add_fifo_data(struct rkisp_device *dev) { struct v4l2_device *v4l2_dev = &dev->v4l2_dev; void __iomem *base = dev->base_addr; @@ -1404,50 +1404,50 @@ static void rkisp1_isp_read_add_fifo_data(struct rkisp1_device *dev) if (data_len) { dev->emd_data_fifo[idx].frame_id = cur_frame_id; dev->emd_data_fifo[idx].data_len = data_len; - dev->emd_data_idx = (idx + 1) % RKISP1_EMDDATA_FIFO_MAX; + dev->emd_data_idx = (idx + 1) % RKISP_EMDDATA_FIFO_MAX; } - v4l2_dbg(1, rkisp1_debug, &dev->v4l2_dev, + v4l2_dbg(1, rkisp_debug, &dev->v4l2_dev, "emd kfifo size: %d, frame_id %d\n", kfifo_len(&dev->emd_data_fifo[idx].mipi_kfifo), dev->emd_data_fifo[idx].frame_id); } -static int rkisp1_isp_sd_s_stream(struct v4l2_subdev *sd, int on) +static int rkisp_isp_sd_s_stream(struct v4l2_subdev *sd, int on) { - struct rkisp1_device *isp_dev = sd_to_isp_dev(sd); + struct rkisp_device *isp_dev = sd_to_isp_dev(sd); int ret = 0; if (!on) { - rkisp1_stop_3a_run(isp_dev); + rkisp_stop_3a_run(isp_dev); - return rkisp1_isp_stop(isp_dev); + return rkisp_isp_stop(isp_dev); } - rkisp1_start_3a_run(isp_dev); + rkisp_start_3a_run(isp_dev); atomic_set(&isp_dev->isp_sdev.frm_sync_seq, 0); - ret = rkisp1_config_cif(isp_dev); + ret = rkisp_config_cif(isp_dev); if (ret < 0) return ret; - return rkisp1_isp_start(isp_dev); + return rkisp_isp_start(isp_dev); } -static int rkisp1_isp_sd_s_power(struct v4l2_subdev *sd, int on) +static int rkisp_isp_sd_s_power(struct v4l2_subdev *sd, int on) { - struct rkisp1_device *isp_dev = sd_to_isp_dev(sd); + struct rkisp_device *isp_dev = sd_to_isp_dev(sd); void __iomem *base = isp_dev->base_addr; int ret; - v4l2_dbg(1, rkisp1_debug, &isp_dev->v4l2_dev, "s_power: %d\n", on); + v4l2_dbg(1, rkisp_debug, &isp_dev->v4l2_dev, "s_power: %d\n", on); if (on) { ret = pm_runtime_get_sync(isp_dev->dev); if (ret < 0) return ret; - rkisp1_config_clk(isp_dev, on); + rkisp_config_clk(isp_dev, on); if (isp_dev->isp_ver == ISP_V12 || isp_dev->isp_ver == ISP_V13) { /* disable csi_rx interrupt */ @@ -1457,7 +1457,7 @@ static int rkisp1_isp_sd_s_power(struct v4l2_subdev *sd, int on) writel(0, base + CIF_ISP_CSI0_MASK3); } } else { - rkisp1_config_clk(isp_dev, on); + rkisp_config_clk(isp_dev, on); ret = pm_runtime_put(isp_dev->dev); if (ret < 0) return ret; @@ -1466,13 +1466,13 @@ static int rkisp1_isp_sd_s_power(struct v4l2_subdev *sd, int on) return 0; } -static int rkisp1_subdev_link_setup(struct media_entity *entity, +static int rkisp_subdev_link_setup(struct media_entity *entity, const struct media_pad *local, const struct media_pad *remote, u32 flags) { struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); - struct rkisp1_device *dev = sd_to_isp_dev(sd); + struct rkisp_device *dev = sd_to_isp_dev(sd); if (!strcmp(remote->entity->name, DMA_VDEV_NAME)) { if (flags & MEDIA_LNK_FL_ENABLED) @@ -1484,15 +1484,15 @@ static int rkisp1_subdev_link_setup(struct media_entity *entity, return 0; } -static int rkisp1_subdev_link_validate(struct media_link *link) +static int rkisp_subdev_link_validate(struct media_link *link) { - if (link->source->index == RKISP1_ISP_PAD_SINK_PARAMS) + if (link->source->index == RKISP_ISP_PAD_SINK_PARAMS) return 0; return v4l2_subdev_link_validate(link); } -static int rkisp1_subdev_fmt_link_validate(struct v4l2_subdev *sd, +static int rkisp_subdev_fmt_link_validate(struct v4l2_subdev *sd, struct media_link *link, struct v4l2_subdev_format *source_fmt, struct v4l2_subdev_format *sink_fmt) @@ -1509,7 +1509,7 @@ static int rkisp1_subdev_fmt_link_validate(struct v4l2_subdev *sd, } static void -riksp1_isp_queue_event_sof(struct rkisp1_isp_subdev *isp) +riksp1_isp_queue_event_sof(struct rkisp_isp_subdev *isp) { struct v4l2_event event = { .type = V4L2_EVENT_FRAME_SYNC, @@ -1519,7 +1519,7 @@ riksp1_isp_queue_event_sof(struct rkisp1_isp_subdev *isp) v4l2_event_queue(isp->sd.devnode, &event); } -static int rkisp1_isp_sd_subs_evt(struct v4l2_subdev *sd, struct v4l2_fh *fh, +static int rkisp_isp_sd_subs_evt(struct v4l2_subdev *sd, struct v4l2_fh *fh, struct v4l2_event_subscription *sub) { if (sub->type != V4L2_EVENT_FRAME_SYNC) @@ -1532,37 +1532,37 @@ static int rkisp1_isp_sd_subs_evt(struct v4l2_subdev *sd, struct v4l2_fh *fh, return v4l2_event_subscribe(fh, sub, 0, NULL); } -static const struct v4l2_subdev_pad_ops rkisp1_isp_sd_pad_ops = { - .enum_mbus_code = rkisp1_isp_sd_enum_mbus_code, - .get_selection = rkisp1_isp_sd_get_selection, - .set_selection = rkisp1_isp_sd_set_selection, - .get_fmt = rkisp1_isp_sd_get_fmt, - .set_fmt = rkisp1_isp_sd_set_fmt, - .link_validate = rkisp1_subdev_fmt_link_validate, +static const struct v4l2_subdev_pad_ops rkisp_isp_sd_pad_ops = { + .enum_mbus_code = rkisp_isp_sd_enum_mbus_code, + .get_selection = rkisp_isp_sd_get_selection, + .set_selection = rkisp_isp_sd_set_selection, + .get_fmt = rkisp_isp_sd_get_fmt, + .set_fmt = rkisp_isp_sd_set_fmt, + .link_validate = rkisp_subdev_fmt_link_validate, }; -static const struct media_entity_operations rkisp1_isp_sd_media_ops = { - .link_setup = rkisp1_subdev_link_setup, - .link_validate = rkisp1_subdev_link_validate, +static const struct media_entity_operations rkisp_isp_sd_media_ops = { + .link_setup = rkisp_subdev_link_setup, + .link_validate = rkisp_subdev_link_validate, }; -static const struct v4l2_subdev_video_ops rkisp1_isp_sd_video_ops = { - .s_stream = rkisp1_isp_sd_s_stream, +static const struct v4l2_subdev_video_ops rkisp_isp_sd_video_ops = { + .s_stream = rkisp_isp_sd_s_stream, }; -static const struct v4l2_subdev_core_ops rkisp1_isp_core_ops = { - .subscribe_event = rkisp1_isp_sd_subs_evt, +static const struct v4l2_subdev_core_ops rkisp_isp_core_ops = { + .subscribe_event = rkisp_isp_sd_subs_evt, .unsubscribe_event = v4l2_event_subdev_unsubscribe, - .s_power = rkisp1_isp_sd_s_power, + .s_power = rkisp_isp_sd_s_power, }; -static struct v4l2_subdev_ops rkisp1_isp_sd_ops = { - .core = &rkisp1_isp_core_ops, - .video = &rkisp1_isp_sd_video_ops, - .pad = &rkisp1_isp_sd_pad_ops, +static struct v4l2_subdev_ops rkisp_isp_sd_ops = { + .core = &rkisp_isp_core_ops, + .video = &rkisp_isp_sd_video_ops, + .pad = &rkisp_isp_sd_pad_ops, }; -static void rkisp1_isp_sd_init_default_fmt(struct rkisp1_isp_subdev *isp_sd) +static void rkisp_isp_sd_init_default_fmt(struct rkisp_isp_subdev *isp_sd) { struct v4l2_mbus_framefmt *in_frm = &isp_sd->in_frm; struct v4l2_rect *in_crop = &isp_sd->in_crop; @@ -1570,9 +1570,9 @@ static void rkisp1_isp_sd_init_default_fmt(struct rkisp1_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 = rkisp1_isp_input_formats[0]; - in_frm->width = RKISP1_DEFAULT_WIDTH; - in_frm->height = RKISP1_DEFAULT_HEIGHT; + *in_fmt = rkisp_isp_input_formats[0]; + in_frm->width = RKISP_DEFAULT_WIDTH; + in_frm->height = RKISP_DEFAULT_HEIGHT; in_frm->code = in_fmt->mbus_code; in_crop->width = in_frm->width; @@ -1582,29 +1582,29 @@ static void rkisp1_isp_sd_init_default_fmt(struct rkisp1_isp_subdev *isp_sd) /* propagate to source */ *out_crop = *in_crop; - *out_fmt = rkisp1_isp_output_formats[0]; + *out_fmt = rkisp_isp_output_formats[0]; } -int rkisp1_register_isp_subdev(struct rkisp1_device *isp_dev, +int rkisp_register_isp_subdev(struct rkisp_device *isp_dev, struct v4l2_device *v4l2_dev) { - struct rkisp1_isp_subdev *isp_sdev = &isp_dev->isp_sdev; + struct rkisp_isp_subdev *isp_sdev = &isp_dev->isp_sdev; struct v4l2_subdev *sd = &isp_sdev->sd; int ret; - v4l2_subdev_init(sd, &rkisp1_isp_sd_ops); + v4l2_subdev_init(sd, &rkisp_isp_sd_ops); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; - sd->entity.ops = &rkisp1_isp_sd_media_ops; + sd->entity.ops = &rkisp_isp_sd_media_ops; sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; snprintf(sd->name, sizeof(sd->name), "rkisp1-isp-subdev"); - isp_sdev->pads[RKISP1_ISP_PAD_SINK].flags = + isp_sdev->pads[RKISP_ISP_PAD_SINK].flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; - isp_sdev->pads[RKISP1_ISP_PAD_SINK_PARAMS].flags = MEDIA_PAD_FL_SINK; - isp_sdev->pads[RKISP1_ISP_PAD_SOURCE_PATH].flags = MEDIA_PAD_FL_SOURCE; - isp_sdev->pads[RKISP1_ISP_PAD_SOURCE_STATS].flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&sd->entity, RKISP1_ISP_PAD_MAX, - isp_sdev->pads); + isp_sdev->pads[RKISP_ISP_PAD_SINK_PARAMS].flags = MEDIA_PAD_FL_SINK; + isp_sdev->pads[RKISP_ISP_PAD_SOURCE_PATH].flags = MEDIA_PAD_FL_SOURCE; + isp_sdev->pads[RKISP_ISP_PAD_SOURCE_STATS].flags = MEDIA_PAD_FL_SOURCE; + ret = media_entity_pads_init(&sd->entity, RKISP_ISP_PAD_MAX, + isp_sdev->pads); if (ret < 0) return ret; @@ -1618,7 +1618,7 @@ int rkisp1_register_isp_subdev(struct rkisp1_device *isp_dev, goto err_cleanup_media_entity; } - rkisp1_isp_sd_init_default_fmt(isp_sdev); + rkisp_isp_sd_init_default_fmt(isp_sdev); isp_dev->hdr_sensor = NULL; isp_dev->isp_state = ISP_STOP; @@ -1628,7 +1628,7 @@ err_cleanup_media_entity: return ret; } -void rkisp1_unregister_isp_subdev(struct rkisp1_device *isp_dev) +void rkisp_unregister_isp_subdev(struct rkisp_device *isp_dev) { struct v4l2_subdev *sd = &isp_dev->isp_sdev.sd; @@ -1638,7 +1638,7 @@ void rkisp1_unregister_isp_subdev(struct rkisp1_device *isp_dev) /**************** Interrupter Handler ****************/ -void rkisp1_mipi_isr(unsigned int mis, struct rkisp1_device *dev) +void rkisp_mipi_isr(unsigned int mis, struct rkisp_device *dev) { struct v4l2_device *v4l2_dev = &dev->v4l2_dev; void __iomem *base = dev->base_addr; @@ -1680,8 +1680,8 @@ void rkisp1_mipi_isr(unsigned int mis, struct rkisp1_device *dev) } } -void rkisp1_mipi_v13_isr(unsigned int err1, unsigned int err2, - unsigned int err3, struct rkisp1_device *dev) +void rkisp_mipi_v13_isr(unsigned int err1, unsigned int err2, + unsigned int err3, struct rkisp_device *dev) { struct v4l2_device *v4l2_dev = &dev->v4l2_dev; void __iomem *base = dev->base_addr; @@ -1729,7 +1729,7 @@ void rkisp1_mipi_v13_isr(unsigned int err1, unsigned int err2, v4l2_warn(v4l2_dev, "MIPI error: err2: 0x%08x\n", err2); } -void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) +void rkisp_isp_isr(unsigned int isp_mis, struct rkisp_device *dev) { void __iomem *base = dev->base_addr; unsigned int isp_mis_tmp = 0; @@ -1737,7 +1737,7 @@ void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) /* start edge of v_sync */ if (isp_mis & CIF_ISP_V_START) { - if (dev->stream[RKISP1_STREAM_SP].interlaced) { + if (dev->stream[RKISP_STREAM_SP].interlaced) { /* 0 = ODD 1 = EVEN */ if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2) { void __iomem *addr = NULL; @@ -1750,10 +1750,10 @@ void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) addr = base + CIF_ISP_CSI0_FRAME_NUM_RO; if (addr) - dev->stream[RKISP1_STREAM_SP].u.sp.field = + dev->stream[RKISP_STREAM_SP].u.sp.field = (readl(addr) >> 16) % 2; } else { - dev->stream[RKISP1_STREAM_SP].u.sp.field = + dev->stream[RKISP_STREAM_SP].u.sp.field = (readl(base + CIF_ISP_FLAGS_SHD) >> 2) & BIT(0); } } @@ -1785,8 +1785,8 @@ void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) writel(CIF_ISP_DATA_LOSS, base + CIF_ISP_ICR); } - if (dev->isp_err_cnt++ > RKISP1_CONTI_ERR_MAX) { - rkisp1_isp_stop(dev); + if (dev->isp_err_cnt++ > RKISP_CONTI_ERR_MAX) { + rkisp_isp_stop(dev); dev->isp_state = ISP_ERROR; v4l2_err(&dev->v4l2_dev, "Too many isp error, stop isp!\n"); @@ -1813,7 +1813,7 @@ void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) v4l2_err(&dev->v4l2_dev, "isp icr frame end err: 0x%x\n", isp_mis_tmp); - rkisp1_isp_read_add_fifo_data(dev); + rkisp_isp_read_add_fifo_data(dev); } if (isp_mis & (CIF_ISP_FRAME | CIF_ISP_AWB_DONE | CIF_ISP_AFM_FIN)) { @@ -1825,7 +1825,7 @@ void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) CIF_ISP_HIST_MEASURE_RDY) & readl(base + CIF_ISP_RIS)); - rkisp1_stats_isr(&dev->stats_vdev, irq); + rkisp_stats_isr(&dev->stats_vdev, irq); } /* @@ -1833,16 +1833,16 @@ void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev) * lot of register writes. Do those only one per frame. * Do the updates in the order of the processing flow. */ - rkisp1_params_isr(&dev->params_vdev, isp_mis); + rkisp_params_isr(&dev->params_vdev, isp_mis); } -irqreturn_t rkisp1_vs_isr_handler(int irq, void *ctx) +irqreturn_t rkisp_vs_isr_handler(int irq, void *ctx) { struct device *dev = ctx; - struct rkisp1_device *rkisp1_dev = dev_get_drvdata(dev); + struct rkisp_device *rkisp_dev = dev_get_drvdata(dev); - if (rkisp1_dev->vs_irq >= 0) - riksp1_isp_queue_event_sof(&rkisp1_dev->isp_sdev); + if (rkisp_dev->vs_irq >= 0) + riksp1_isp_queue_event_sof(&rkisp_dev->isp_sdev); return IRQ_HANDLED; } diff --git a/drivers/media/platform/rockchip/isp1/rkisp1.h b/drivers/media/platform/rockchip/isp/rkisp.h similarity index 72% rename from drivers/media/platform/rockchip/isp1/rkisp1.h rename to drivers/media/platform/rockchip/isp/rkisp.h index afafc2c0f78f..28efb763bdb6 100644 --- a/drivers/media/platform/rockchip/isp1/rkisp1.h +++ b/drivers/media/platform/rockchip/isp/rkisp.h @@ -32,8 +32,8 @@ * SOFTWARE. */ -#ifndef _RKISP1_H -#define _RKISP1_H +#ifndef _RKISP_H +#define _RKISP_H #include #include @@ -55,7 +55,7 @@ #define CIF_ISP_OUTPUT_H_MIN CIF_ISP_INPUT_H_MIN #define CIF_ISP_ADD_DATA_VC_MAX 3 -struct rkisp1_stream; +struct rkisp_stream; /* * struct ispsd_in_fmt - ISP intput-pad format @@ -69,7 +69,7 @@ struct ispsd_in_fmt { u8 fmt_type; u32 mipi_dt; u32 yuv_seq; - enum rkisp1_fmt_raw_pat_type bayer_pat; + enum rkisp_fmt_raw_pat_type bayer_pat; u8 bus_width; }; @@ -78,22 +78,22 @@ struct ispsd_out_fmt { u8 fmt_type; }; -struct rkisp1_ie_config { +struct rkisp_ie_config { unsigned int effect; }; -enum rkisp1_isp_pad { - RKISP1_ISP_PAD_SINK, - RKISP1_ISP_PAD_SINK_PARAMS, - RKISP1_ISP_PAD_SOURCE_PATH, - RKISP1_ISP_PAD_SOURCE_STATS, - RKISP1_ISP_PAD_MAX +enum rkisp_isp_pad { + RKISP_ISP_PAD_SINK, + RKISP_ISP_PAD_SINK_PARAMS, + RKISP_ISP_PAD_SOURCE_PATH, + RKISP_ISP_PAD_SOURCE_STATS, + RKISP_ISP_PAD_MAX }; /* - * struct rkisp1_isp_subdev - ISP sub-device + * struct rkisp_isp_subdev - ISP sub-device * - * See Cropping regions of ISP in rkisp1.c for details + * See Cropping regions of ISP in rkisp.c for details * @in_frm: input size, don't have to be equal to sensor size * @in_fmt: intput format * @in_crop: crop for sink pad @@ -104,9 +104,9 @@ enum rkisp1_isp_pad { * @frm_sync_seq: frame sequence, to sync frame_id between video devices. * @quantization: output quantization */ -struct rkisp1_isp_subdev { +struct rkisp_isp_subdev { struct v4l2_subdev sd; - struct media_pad pads[RKISP1_ISP_PAD_MAX]; + struct media_pad pads[RKISP_ISP_PAD_MAX]; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_mbus_framefmt in_frm; struct ispsd_in_fmt in_fmt; @@ -118,46 +118,46 @@ struct rkisp1_isp_subdev { enum v4l2_quantization quantization; }; -struct rkisp1_emd_data { +struct rkisp_emd_data { struct kfifo mipi_kfifo; unsigned int data_len; unsigned int frame_id; }; -int rkisp1_register_isp_subdev(struct rkisp1_device *isp_dev, +int rkisp_register_isp_subdev(struct rkisp_device *isp_dev, struct v4l2_device *v4l2_dev); -void rkisp1_unregister_isp_subdev(struct rkisp1_device *isp_dev); +void rkisp_unregister_isp_subdev(struct rkisp_device *isp_dev); -void rkisp1_mipi_isr(unsigned int mipi_mis, struct rkisp1_device *dev); +void rkisp_mipi_isr(unsigned int mipi_mis, struct rkisp_device *dev); -void rkisp1_mipi_v13_isr(unsigned int err1, unsigned int err2, - unsigned int err3, struct rkisp1_device *dev); +void rkisp_mipi_v13_isr(unsigned int err1, unsigned int err2, + unsigned int err3, struct rkisp_device *dev); -void rkisp1_isp_isr(unsigned int isp_mis, struct rkisp1_device *dev); +void rkisp_isp_isr(unsigned int isp_mis, struct rkisp_device *dev); -irqreturn_t rkisp1_vs_isr_handler(int irq, void *ctx); +irqreturn_t rkisp_vs_isr_handler(int irq, void *ctx); -int rkisp1_update_sensor_info(struct rkisp1_device *dev); +int rkisp_update_sensor_info(struct rkisp_device *dev); -u32 rkisp1_mbus_pixelcode_to_v4l2(u32 pixelcode); +u32 rkisp_mbus_pixelcode_to_v4l2(u32 pixelcode); static inline -struct ispsd_out_fmt *rkisp1_get_ispsd_out_fmt(struct rkisp1_isp_subdev *isp_sdev) +struct ispsd_out_fmt *rkisp_get_ispsd_out_fmt(struct rkisp_isp_subdev *isp_sdev) { return &isp_sdev->out_fmt; } static inline -struct ispsd_in_fmt *rkisp1_get_ispsd_in_fmt(struct rkisp1_isp_subdev *isp_sdev) +struct ispsd_in_fmt *rkisp_get_ispsd_in_fmt(struct rkisp_isp_subdev *isp_sdev) { return &isp_sdev->in_fmt; } static inline -struct v4l2_rect *rkisp1_get_isp_sd_win(struct rkisp1_isp_subdev *isp_sdev) +struct v4l2_rect *rkisp_get_isp_sd_win(struct rkisp_isp_subdev *isp_sdev) { return &isp_sdev->out_crop; } -#endif /* _RKISP1_H */ +#endif /* _RKISP_H */ diff --git a/drivers/media/platform/rockchip/isp1/version.h b/drivers/media/platform/rockchip/isp/version.h similarity index 92% rename from drivers/media/platform/rockchip/isp1/version.h rename to drivers/media/platform/rockchip/isp/version.h index 3bfb0c98fd6e..0f4f9fc1e5b0 100644 --- a/drivers/media/platform/rockchip/isp1/version.h +++ b/drivers/media/platform/rockchip/isp/version.h @@ -1,12 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd. */ -#ifndef _RKISP1_VERSION_H -#define _RKISP1_VERSION_H +#ifndef _RKISP_VERSION_H +#define _RKISP_VERSION_H #include /* - *RKISP1 DRIVER VERSION NOTE + *RKISP DRIVER VERSION NOTE * *v0.1.0: *1. First version; @@ -56,6 +56,6 @@ *3. fix isp iommu work after suspend; */ -#define RKISP1_DRIVER_VERSION KERNEL_VERSION(0, 1, 0x5) +#define RKISP_DRIVER_VERSION KERNEL_VERSION(0, 1, 0x5) #endif diff --git a/drivers/media/platform/rockchip/isp1/Kconfig b/drivers/media/platform/rockchip/isp1/Kconfig deleted file mode 100644 index 5637cc758cc5..000000000000 --- a/drivers/media/platform/rockchip/isp1/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config VIDEO_ROCKCHIP_ISP1 - tristate "Rockchip Image Signal Processing v1 Unit driver" - depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API - depends on ARCH_ROCKCHIP || COMPILE_TEST - select VIDEOBUF2_DMA_CONTIG - select VIDEOBUF2_VMALLOC - select V4L2_FWNODE - select PHY_ROCKCHIP_MIPI_RX - default n - help - Support for ISP1 on the rockchip SoC. diff --git a/drivers/media/platform/rockchip/isp1/dmarx.h b/drivers/media/platform/rockchip/isp1/dmarx.h deleted file mode 100644 index abc3b39aa0b5..000000000000 --- a/drivers/media/platform/rockchip/isp1/dmarx.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. */ - -#ifndef _RKISP1_DMARX_H -#define _RKISP1_DMARX_H - -#include "capture.h" -#include "common.h" - -#define RKISP1_STREAM_DMARX 0 -#define RKISP1_MAX_DMARX_STREAM 1 - -struct rkisp1_dmarx_device; - -enum rkisp1_dmarx_pad { - RKISP1_DMARX_PAD_SINK, - RKISP1_DMARX_PAD_SOURCE, - RKISP1_DMARX_PAD_MAX -}; - -struct rkisp1_dmarx_device { - struct rkisp1_device *ispdev; - struct rkisp1_stream stream[RKISP1_MAX_DMARX_STREAM]; -}; - -void rkisp1_dmarx_isr(u32 mis_val, struct rkisp1_device *dev); -void rkisp1_unregister_dmarx_vdev(struct rkisp1_device *dev); -int rkisp1_register_dmarx_vdev(struct rkisp1_device *dev); -#endif /* _RKISP1_DMARX_H */