mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
media: rockchip: isp: capture to different version
Change-Id: I8513febd4e0e8a4fc3e1cff630fc1fc98af687b3 Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -13,6 +13,8 @@ video_rkisp-objs += rkisp.o \
|
||||
isp_params_v1x.o \
|
||||
isp_params_v2x.o \
|
||||
capture.o \
|
||||
capture_v1x.o \
|
||||
capture_v20.o \
|
||||
dmarx.o \
|
||||
csi.o \
|
||||
bridge.o \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,8 @@
|
||||
#define _RKISP_PATH_VIDEO_H
|
||||
|
||||
#include "common.h"
|
||||
#include "capture_v1x.h"
|
||||
#include "capture_v2x.h"
|
||||
|
||||
#define RDBK_MAX 3
|
||||
#define RDBK_L 0
|
||||
@@ -175,6 +177,7 @@ struct streams_ops {
|
||||
void (*set_data_path)(void __iomem *base);
|
||||
bool (*is_stream_stopped)(void __iomem *base);
|
||||
void (*update_mi)(struct rkisp_stream *stream);
|
||||
int (*frame_end)(struct rkisp_stream *stream);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -235,20 +238,18 @@ struct rkisp_capture_device {
|
||||
atomic_t refcnt;
|
||||
};
|
||||
|
||||
extern struct stream_config rkisp_mp_stream_config;
|
||||
extern struct stream_config rkisp_sp_stream_config;
|
||||
|
||||
void rkisp_unregister_stream_vdev(struct rkisp_stream *stream);
|
||||
int rkisp_register_stream_vdev(struct rkisp_stream *stream);
|
||||
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_set_stream_def_fmt(struct rkisp_device *dev, u32 id,
|
||||
u32 width, u32 height, u32 pixelformat);
|
||||
void rkisp_mipi_dmatx0_end(u32 status, struct rkisp_device *dev);
|
||||
int fcc_xysubs(u32 fcc, u32 *xsubs, u32 *ysubs);
|
||||
u32 width, u32 height, u32 pixelformat);
|
||||
int rkisp_fcc_xysubs(u32 fcc, u32 *xsubs, u32 *ysubs);
|
||||
int rkisp_mbus_code_xysubs(u32 code, u32 *xsubs, u32 *ysubs);
|
||||
int rkisp_fh_open(struct file *filp);
|
||||
int rkisp_fop_release(struct file *file);
|
||||
|
||||
struct rkisp_dummy_buffer *hdr_dqbuf(struct list_head *q);
|
||||
void hdr_qbuf(struct list_head *q, struct rkisp_dummy_buffer *buf);
|
||||
int hdr_config_dmatx(struct rkisp_device *dev);
|
||||
int hdr_update_dmatx_buf(struct rkisp_device *dev);
|
||||
void hdr_stop_dmatx(struct rkisp_device *dev);
|
||||
void hdr_destroy_buf(struct rkisp_device *dev);
|
||||
#endif /* _RKISP_PATH_VIDEO_H */
|
||||
|
||||
1002
drivers/media/platform/rockchip/isp/capture_v1x.c
Normal file
1002
drivers/media/platform/rockchip/isp/capture_v1x.c
Normal file
File diff suppressed because it is too large
Load Diff
10
drivers/media/platform/rockchip/isp/capture_v1x.h
Normal file
10
drivers/media/platform/rockchip/isp/capture_v1x.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2020 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKISP_CAPTURE_V1X_H
|
||||
#define _RKISP_CAPTURE_V1X_H
|
||||
|
||||
int rkisp_register_stream_v1x(struct rkisp_device *dev);
|
||||
void rkisp_unregister_stream_v1x(struct rkisp_device *dev);
|
||||
void rkisp_mi_v1x_isr(u32 mis_val, struct rkisp_device *dev);
|
||||
#endif
|
||||
2131
drivers/media/platform/rockchip/isp/capture_v20.c
Normal file
2131
drivers/media/platform/rockchip/isp/capture_v20.c
Normal file
File diff suppressed because it is too large
Load Diff
23
drivers/media/platform/rockchip/isp/capture_v2x.h
Normal file
23
drivers/media/platform/rockchip/isp/capture_v2x.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2020 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKISP_CAPTURE_V2X_H
|
||||
#define _RKISP_CAPTURE_V2X_H
|
||||
|
||||
extern struct stream_config rkisp2_dmatx0_stream_config;
|
||||
extern struct stream_config rkisp2_dmatx1_stream_config;
|
||||
extern struct stream_config rkisp2_dmatx2_stream_config;
|
||||
extern struct stream_config rkisp2_dmatx3_stream_config;
|
||||
|
||||
struct rkisp_dummy_buffer *hdr_dqbuf(struct list_head *q);
|
||||
void hdr_qbuf(struct list_head *q, struct rkisp_dummy_buffer *buf);
|
||||
int hdr_config_dmatx(struct rkisp_device *dev);
|
||||
int hdr_update_dmatx_buf(struct rkisp_device *dev);
|
||||
void hdr_stop_dmatx(struct rkisp_device *dev);
|
||||
void hdr_destroy_buf(struct rkisp_device *dev);
|
||||
|
||||
int rkisp_register_stream_v20(struct rkisp_device *dev);
|
||||
void rkisp_unregister_stream_v20(struct rkisp_device *dev);
|
||||
void rkisp_mi_v20_isr(u32 mis_val, struct rkisp_device *dev);
|
||||
void rkisp_mipi_v20_isr(u32 phy, u32 packet, u32 overflow, u32 state, struct rkisp_device *dev);
|
||||
#endif
|
||||
@@ -618,6 +618,7 @@ static int rkisp_init_vb2_queue(struct vb2_queue *q,
|
||||
q->lock = &stream->ispdev->apilock;
|
||||
q->dev = stream->ispdev->hw_dev->dev;
|
||||
q->allow_cache_hints = 1;
|
||||
q->bidirectional = 1;
|
||||
|
||||
return vb2_queue_init(q);
|
||||
}
|
||||
@@ -649,7 +650,7 @@ static int rkisp_set_fmt(struct rkisp_stream *stream,
|
||||
pixm->quantization = V4L2_QUANTIZATION_FULL_RANGE;
|
||||
|
||||
/* calculate size */
|
||||
fcc_xysubs(fmt->fourcc, &xsubs, &ysubs);
|
||||
rkisp_fcc_xysubs(fmt->fourcc, &xsubs, &ysubs);
|
||||
planes = fmt->cplanes ? fmt->cplanes : fmt->mplanes;
|
||||
for (i = 0; i < planes; i++) {
|
||||
struct v4l2_plane_pix_format *plane_fmt;
|
||||
|
||||
@@ -103,8 +103,6 @@ static irqreturn_t mipi_irq_hdl(int irq, void *ctx)
|
||||
err2 = readl(hw_dev->base_addr + CIF_ISP_CSI0_ERR2);
|
||||
err3 = readl(hw_dev->base_addr + CIF_ISP_CSI0_ERR3);
|
||||
|
||||
if (err3 & 0xf)
|
||||
rkisp_mipi_dmatx0_end(err3, isp);
|
||||
if (err1 || err2 || err3)
|
||||
rkisp_mipi_v13_isr(err1, err2, err3, isp);
|
||||
} else if (hw_dev->isp_ver == ISP_V20) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <media/v4l2-common.h>
|
||||
#include "regs.h"
|
||||
|
||||
void disable_dcrop(struct rkisp_stream *stream, bool async)
|
||||
void rkisp_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,8 +51,8 @@ void disable_dcrop(struct rkisp_stream *stream, bool async)
|
||||
writel(val, dc_ctrl_addr);
|
||||
}
|
||||
|
||||
void config_dcrop(struct rkisp_stream *stream,
|
||||
struct v4l2_rect *rect, bool async)
|
||||
void rkisp_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;
|
||||
@@ -70,7 +70,7 @@ void config_dcrop(struct rkisp_stream *stream,
|
||||
writel(dc_ctrl, dc_ctrl_addr);
|
||||
}
|
||||
|
||||
void dump_rsz_regs(struct rkisp_stream *stream)
|
||||
void rkisp_dump_rsz_regs(struct rkisp_stream *stream)
|
||||
{
|
||||
void __iomem *base = stream->ispdev->base_addr;
|
||||
|
||||
@@ -186,7 +186,7 @@ static void set_scale(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
writel(rsz_ctrl, rsz_ctrl_addr);
|
||||
}
|
||||
|
||||
void config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
void rkisp_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)
|
||||
{
|
||||
@@ -209,37 +209,10 @@ void config_rsz(struct rkisp_stream *stream, struct v4l2_rect *in_y,
|
||||
update_rsz_shadow(stream, async);
|
||||
}
|
||||
|
||||
void disable_rsz(struct rkisp_stream *stream, bool async)
|
||||
void rkisp_disable_rsz(struct rkisp_stream *stream, bool async)
|
||||
{
|
||||
writel(0, stream->ispdev->base_addr + stream->config->rsz.ctrl);
|
||||
|
||||
if (!async)
|
||||
update_rsz_shadow(stream, async);
|
||||
}
|
||||
|
||||
void config_mi_ctrl(struct rkisp_stream *stream, u32 burst)
|
||||
{
|
||||
void __iomem *base = stream->ispdev->base_addr;
|
||||
void __iomem *addr = base + CIF_MI_CTRL;
|
||||
u32 reg;
|
||||
|
||||
reg = readl(addr) & ~GENMASK(19, 16);
|
||||
writel(reg | burst, addr);
|
||||
reg = readl(addr);
|
||||
writel(reg | CIF_MI_CTRL_INIT_BASE_EN, addr);
|
||||
reg = readl(addr);
|
||||
writel(reg | CIF_MI_CTRL_INIT_OFFSET_EN, addr);
|
||||
}
|
||||
|
||||
bool mp_is_stream_stopped(void __iomem *base)
|
||||
{
|
||||
int en;
|
||||
|
||||
en = CIF_MI_CTRL_SHD_MP_IN_ENABLED | CIF_MI_CTRL_SHD_RAW_OUT_ENABLED;
|
||||
return !(readl(base + CIF_MI_CTRL_SHD) & en);
|
||||
}
|
||||
|
||||
bool sp_is_stream_stopped(void __iomem *base)
|
||||
{
|
||||
return !(readl(base + CIF_MI_CTRL_SHD) & CIF_MI_CTRL_SHD_SP_IN_ENABLED);
|
||||
}
|
||||
|
||||
@@ -1617,25 +1617,41 @@
|
||||
#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 rkisp_stream *stream, bool async);
|
||||
void config_dcrop(struct rkisp_stream *stream, struct v4l2_rect *rect,
|
||||
bool async);
|
||||
void rkisp_disable_dcrop(struct rkisp_stream *stream, bool async);
|
||||
void rkisp_config_dcrop(struct rkisp_stream *stream, struct v4l2_rect *rect, bool async);
|
||||
|
||||
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 rkisp_dump_rsz_regs(struct rkisp_stream *stream);
|
||||
void rkisp_disable_rsz(struct rkisp_stream *stream, bool async);
|
||||
void rkisp_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 rkisp_stream *stream, u32 burst);
|
||||
static inline void config_mi_ctrl(struct rkisp_stream *stream, u32 burst)
|
||||
{
|
||||
void __iomem *base = stream->ispdev->base_addr;
|
||||
void __iomem *addr = base + CIF_MI_CTRL;
|
||||
u32 reg;
|
||||
|
||||
void mp_clr_frame_end_int(void __iomem *base);
|
||||
void sp_clr_frame_end_int(void __iomem *base);
|
||||
reg = readl(addr) & ~GENMASK(19, 16);
|
||||
writel(reg | burst, addr);
|
||||
reg = readl(addr);
|
||||
writel(reg | CIF_MI_CTRL_INIT_BASE_EN, addr);
|
||||
reg = readl(addr);
|
||||
writel(reg | CIF_MI_CTRL_INIT_OFFSET_EN, addr);
|
||||
}
|
||||
|
||||
bool mp_is_frame_end_int_masked(void __iomem *base);
|
||||
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 bool mp_is_stream_stopped(void __iomem *base)
|
||||
{
|
||||
int en;
|
||||
|
||||
en = CIF_MI_CTRL_SHD_MP_IN_ENABLED | CIF_MI_CTRL_SHD_RAW_OUT_ENABLED;
|
||||
return !(readl(base + CIF_MI_CTRL_SHD) & en);
|
||||
}
|
||||
|
||||
static inline bool sp_is_stream_stopped(void __iomem *base)
|
||||
{
|
||||
return !(readl(base + CIF_MI_CTRL_SHD) & CIF_MI_CTRL_SHD_SP_IN_ENABLED);
|
||||
}
|
||||
|
||||
static inline void isp_set_bits(void __iomem *addr, u32 bit_mask, u32 val)
|
||||
{
|
||||
|
||||
@@ -2068,8 +2068,6 @@ static inline void raw_wr_set_pic_size(struct rkisp_stream *stream,
|
||||
{
|
||||
void __iomem *base = stream->ispdev->base_addr;
|
||||
|
||||
if (stream->out_isp_fmt.fmt_type == FMT_YUV)
|
||||
width *= 2;
|
||||
writel(height << 16 | width,
|
||||
base + stream->config->dma.pic_size);
|
||||
}
|
||||
|
||||
@@ -437,18 +437,6 @@ u32 rkisp_mbus_pixelcode_to_v4l2(u32 pixelcode)
|
||||
case MEDIA_BUS_FMT_SRGGB12_1X12:
|
||||
pixelformat = V4L2_PIX_FMT_SRGGB12;
|
||||
break;
|
||||
case MEDIA_BUS_FMT_YUYV8_2X8:
|
||||
pixelformat = V4L2_PIX_FMT_YUYV;
|
||||
break;
|
||||
case MEDIA_BUS_FMT_YVYU8_2X8:
|
||||
pixelformat = V4L2_PIX_FMT_YVYU;
|
||||
break;
|
||||
case MEDIA_BUS_FMT_UYVY8_2X8:
|
||||
pixelformat = V4L2_PIX_FMT_UYVY;
|
||||
break;
|
||||
case MEDIA_BUS_FMT_VYUY8_2X8:
|
||||
pixelformat = V4L2_PIX_FMT_VYUY;
|
||||
break;
|
||||
default:
|
||||
pixelformat = V4L2_PIX_FMT_SRGGB10;
|
||||
}
|
||||
|
||||
@@ -141,10 +141,6 @@ void rkisp_mipi_isr(unsigned int mipi_mis, struct rkisp_device *dev);
|
||||
void rkisp_mipi_v13_isr(unsigned int err1, unsigned int err2,
|
||||
unsigned int err3, struct rkisp_device *dev);
|
||||
|
||||
void rkisp_mipi_v20_isr(unsigned int phy, unsigned int packet,
|
||||
unsigned int overflow, unsigned int state,
|
||||
struct rkisp_device *dev);
|
||||
|
||||
void rkisp_isp_isr(unsigned int isp_mis, unsigned int isp3a_mis,
|
||||
struct rkisp_device *dev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user