mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
media: rockchip: vpss: refactor v_1 to v10
Signed-off-by: Mingwei Yan <mingwei.yan@rock-chips.com> Change-Id: I804ac9f1dd1cbd9309dec7dca49c5e17266cc83a
This commit is contained in:
@@ -11,7 +11,7 @@ config VIDEO_ROCKCHIP_VPSS
|
||||
help
|
||||
Support for VPSS on the rockchip SoC.
|
||||
|
||||
config VIDEO_ROCKCHIP_VPSS_V1
|
||||
config VIDEO_ROCKCHIP_VPSS_V10
|
||||
bool "vpss1 for rk3576"
|
||||
depends on CPU_RK3576
|
||||
depends on VIDEO_ROCKCHIP_VPSS
|
||||
|
||||
@@ -9,6 +9,6 @@ video_rkvpss-objs += hw.o \
|
||||
procfs.o \
|
||||
vpss_offline.o
|
||||
|
||||
video_rkvpss-$(CONFIG_VIDEO_ROCKCHIP_VPSS_V1) += \
|
||||
stream_v1.o \
|
||||
vpss_offline_v1.o
|
||||
video_rkvpss-$(CONFIG_VIDEO_ROCKCHIP_VPSS_V10) += \
|
||||
stream_v10.o \
|
||||
vpss_offline_v10.o
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
|
||||
void rkvpss_idx_write(struct rkvpss_device *dev, u32 reg, u32 val, int idx)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
struct irqs_data {
|
||||
const char *name;
|
||||
@@ -682,10 +682,12 @@ static const struct vpss_match_data rk3576_vpss_match_data = {
|
||||
};
|
||||
|
||||
static const struct of_device_id rkvpss_hw_of_match[] = {
|
||||
#ifdef CONFIG_VIDEO_ROCKCHIP_VPSS_V10
|
||||
{
|
||||
.compatible = "rockchip,rk3576-rkvpss",
|
||||
.data = &rk3576_vpss_match_data,
|
||||
},
|
||||
#endif
|
||||
{},
|
||||
};
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ struct rkvpss_hw_dev {
|
||||
bool is_suspend;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_VIDEO_ROCKCHIP_VPSS_V10
|
||||
static inline bool is_vpss_v10(const struct rkvpss_hw_dev *hw_dev) { return hw_dev->vpss_ver == VPSS_V10; }
|
||||
#else
|
||||
static inline bool is_vpss_v10(const struct rkvpss_hw_dev *hw_dev) { return false; }
|
||||
#endif
|
||||
|
||||
#define RKVPSS_ZME_TAP_COE(x, y) (((x) & 0x3ff) | (((y) & 0x3ff) << 16))
|
||||
extern const s16 rkvpss_zme_tap8_coe[11][17][8];
|
||||
extern const s16 rkvpss_zme_tap6_coe[11][17][8];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
9
drivers/media/platform/rockchip/vpss/regs.h
Normal file
9
drivers/media/platform/rockchip/vpss/regs.h
Normal file
@@ -0,0 +1,9 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2023 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKVPSS_REGS_H
|
||||
#define _RKVPSS_REGS_H
|
||||
|
||||
#include "regs_v10.h"
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2023 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKVPSS_REGS_H
|
||||
#define _RKVPSS_REGS_H
|
||||
#ifndef _RKVPSS_REGS_V10_H
|
||||
#define _RKVPSS_REGS_V10_H
|
||||
|
||||
#define RKVPSS_VPSS_BASE 0x0000
|
||||
#define RKVPSS_VPSS_CTRL (RKVPSS_VPSS_BASE + 0x0000)
|
||||
@@ -8,14 +8,14 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
#include "stream_v1.h"
|
||||
#include "stream_v10.h"
|
||||
|
||||
void rkvpss_cmsc_config(struct rkvpss_device *dev, bool sync)
|
||||
{
|
||||
if (dev->vpss_ver == VPSS_V10)
|
||||
rkvpss_cmsc_config_v1(dev, sync);
|
||||
if (is_vpss_v10(dev->hw_dev))
|
||||
rkvpss_cmsc_config_v10(dev, sync);
|
||||
}
|
||||
|
||||
int rkvpss_stream_buf_cnt(struct rkvpss_stream *stream)
|
||||
@@ -23,8 +23,8 @@ int rkvpss_stream_buf_cnt(struct rkvpss_stream *stream)
|
||||
struct rkvpss_device *vpss = stream->dev;
|
||||
int ret = 0;
|
||||
|
||||
if (vpss->vpss_ver == VPSS_V10)
|
||||
ret = rkvpss_stream_buf_cnt_v1(stream);
|
||||
if (is_vpss_v10(vpss->hw_dev))
|
||||
ret = rkvpss_stream_buf_cnt_v10(stream);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -33,33 +33,33 @@ int rkvpss_register_stream_vdevs(struct rkvpss_device *dev)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (dev->vpss_ver == VPSS_V10)
|
||||
ret = rkvpss_register_stream_vdevs_v1(dev);
|
||||
if (is_vpss_v10(dev->hw_dev))
|
||||
ret = rkvpss_register_stream_vdevs_v10(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rkvpss_unregister_stream_vdevs(struct rkvpss_device *dev)
|
||||
{
|
||||
if (dev->vpss_ver == VPSS_V10)
|
||||
rkvpss_unregister_stream_vdevs_v1(dev);
|
||||
if (is_vpss_v10(dev->hw_dev))
|
||||
rkvpss_unregister_stream_vdevs_v10(dev);
|
||||
}
|
||||
|
||||
void rkvpss_stream_default_fmt(struct rkvpss_device *dev, u32 id,
|
||||
u32 width, u32 height, u32 pixelformat)
|
||||
{
|
||||
if (dev->vpss_ver == VPSS_V10)
|
||||
rkvpss_stream_default_fmt_v1(dev, id, width, height, pixelformat);
|
||||
if (is_vpss_v10(dev->hw_dev))
|
||||
rkvpss_stream_default_fmt_v10(dev, id, width, height, pixelformat);
|
||||
}
|
||||
|
||||
void rkvpss_isr(struct rkvpss_device *dev, u32 mis_val)
|
||||
{
|
||||
if (dev->vpss_ver == VPSS_V10)
|
||||
rkvpss_isr_v1(dev, mis_val);
|
||||
if (is_vpss_v10(dev->hw_dev))
|
||||
rkvpss_isr_v10(dev, mis_val);
|
||||
}
|
||||
|
||||
void rkvpss_mi_isr(struct rkvpss_device *dev, u32 mis_val)
|
||||
{
|
||||
if (dev->vpss_ver == VPSS_V10)
|
||||
rkvpss_mi_isr_v1(dev, mis_val);
|
||||
if (is_vpss_v10(dev->hw_dev))
|
||||
rkvpss_mi_isr_v10(dev, mis_val);
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2025 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKVPSS_STREAM_V1_H
|
||||
#define _RKVPSS_STREAM_V1_H
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/slab.h>
|
||||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-event.h>
|
||||
#include <media/v4l2-fh.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-mc.h>
|
||||
#include <media/v4l2-subdev.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/videobuf2-dma-sg.h>
|
||||
#include <uapi/linux/rk-video-format.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_VPSS_V1)
|
||||
int rkvpss_register_stream_vdevs_v1(struct rkvpss_device *dev);
|
||||
void rkvpss_unregister_stream_vdevs_v1(struct rkvpss_device *dev);
|
||||
void rkvpss_stream_default_fmt_v1(struct rkvpss_device *dev, u32 id,
|
||||
u32 width, u32 height, u32 pixelformat);
|
||||
void rkvpss_isr_v1(struct rkvpss_device *dev, u32 mis_val);
|
||||
void rkvpss_mi_isr_v1(struct rkvpss_device *dev, u32 mis_val);
|
||||
void rkvpss_cmsc_config_v1(struct rkvpss_device *dev, bool sync);
|
||||
int rkvpss_stream_buf_cnt_v1(struct rkvpss_stream *stream);
|
||||
|
||||
#else
|
||||
static inline int rkvpss_register_stream_vdevs_v1(struct rkvpss_device *dev) {return -EINVAL; }
|
||||
static inline void rkvpss_unregister_stream_vdevs_v1(struct rkvpss_device *dev) {}
|
||||
static inline void rkvpss_stream_default_fmt_v1(struct rkvpss_device *dev, u32 id, u32 width, u32 height, u32 pixelformat) {}
|
||||
static inline void rkvpss_isr_v1(struct rkvpss_device *dev, u32 mis_val) {}
|
||||
static inline void rkvpss_mi_isr_v1(struct rkvpss_device *dev, u32 mis_val) {}
|
||||
static inline void rkvpss_cmsc_config_v1(struct rkvpss_device *dev, bool sync) {}
|
||||
static inline int rkvpss_stream_buf_cnt_v1(struct rkvpss_stream *stream) {return -EINVAL; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
#include "stream_v1.h"
|
||||
#include "stream_v10.h"
|
||||
|
||||
|
||||
#define STREAM_OUT_REQ_BUFS_MIN 0
|
||||
@@ -631,7 +631,7 @@ static void calc_unite_scl_params(struct rkvpss_stream *stream)
|
||||
}
|
||||
}
|
||||
|
||||
int rkvpss_stream_buf_cnt_v1(struct rkvpss_stream *stream)
|
||||
int rkvpss_stream_buf_cnt_v10(struct rkvpss_stream *stream)
|
||||
{
|
||||
unsigned long lock_flags = 0;
|
||||
struct rkvpss_buffer *buf, *tmp;
|
||||
@@ -1783,7 +1783,7 @@ static int check_wr_uvswap(struct rkvpss_stream *stream)
|
||||
bool wr_uv_swap = false;
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
check_stream = &dev->stream_vdev.stream[i];
|
||||
if (check_stream->streaming) {
|
||||
fmt = &check_stream->out_cap_fmt;
|
||||
@@ -2311,7 +2311,7 @@ static void cmsc_config_hw(struct rkvpss_device *dev, struct rkvpss_cmsc_cfg *cf
|
||||
int i, j, k, slope, hor;
|
||||
u32 win_en, mode, val, ctrl = 0;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
win_en = cfg->win[i].win_en;
|
||||
v4l2_dbg(4, rkvpss_debug, &dev->v4l2_dev,
|
||||
"%s unite:%d, unite_index:%d ch:%d win_en:0x%x\n", __func__,
|
||||
@@ -2367,7 +2367,7 @@ static void cmsc_config_hw(struct rkvpss_device *dev, struct rkvpss_cmsc_cfg *cf
|
||||
rkvpss_idx_write(dev, RKVPSS_CMSC_UPDATE, val, unite_index);
|
||||
}
|
||||
|
||||
void rkvpss_cmsc_config_v1(struct rkvpss_device *dev, bool sync)
|
||||
void rkvpss_cmsc_config_v10(struct rkvpss_device *dev, bool sync)
|
||||
{
|
||||
unsigned long lock_flags = 0;
|
||||
struct rkvpss_cmsc_cfg left_cfg = {0}, right_cfg = {0};
|
||||
@@ -2395,12 +2395,12 @@ void rkvpss_cmsc_config_v1(struct rkvpss_device *dev, bool sync)
|
||||
left_cfg.win[i].point[j] = dev->cmsc_cfg.win[i].point[j];
|
||||
}
|
||||
left_cfg.mosaic_block = dev->cmsc_cfg.mosaic_block;
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
left_cfg.win[i].win_en = dev->cmsc_cfg.win[i].win_en;
|
||||
left_cfg.win[i].mode = dev->cmsc_cfg.win[i].mode;
|
||||
}
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
for (j = 0; j < RKVPSS_CMSC_WIN_MAX; j++) {
|
||||
win = &left_cfg.win[j];
|
||||
if (!(left_cfg.win[i].win_en & BIT(j)))
|
||||
@@ -2440,12 +2440,12 @@ void rkvpss_cmsc_config_v1(struct rkvpss_device *dev, bool sync)
|
||||
right_cfg.win[i].point[j] = dev->cmsc_cfg.win[i].point[j];
|
||||
}
|
||||
right_cfg.mosaic_block = dev->cmsc_cfg.mosaic_block;
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
right_cfg.win[i].win_en = dev->cmsc_cfg.win[i].win_en;
|
||||
right_cfg.win[i].mode = dev->cmsc_cfg.win[i].mode;
|
||||
}
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
for (j = 0; j < RKVPSS_CMSC_WIN_MAX; j++) {
|
||||
win = &right_cfg.win[j];
|
||||
if (!(right_cfg.win[i].win_en & BIT(j)))
|
||||
@@ -2689,7 +2689,7 @@ unreg:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rkvpss_stream_default_fmt_v1(struct rkvpss_device *dev, u32 id,
|
||||
void rkvpss_stream_default_fmt_v10(struct rkvpss_device *dev, u32 id,
|
||||
u32 width, u32 height, u32 pixelformat)
|
||||
{
|
||||
struct rkvpss_stream *stream = &dev->stream_vdev.stream[id];
|
||||
@@ -2712,7 +2712,7 @@ void rkvpss_stream_default_fmt_v1(struct rkvpss_device *dev, u32 id,
|
||||
rkvpss_set_fmt(stream, &pixm, false);
|
||||
}
|
||||
|
||||
int rkvpss_register_stream_vdevs_v1(struct rkvpss_device *dev)
|
||||
int rkvpss_register_stream_vdevs_v10(struct rkvpss_device *dev)
|
||||
{
|
||||
struct rkvpss_stream_vdev *stream_vdev;
|
||||
struct rkvpss_stream *stream;
|
||||
@@ -2723,7 +2723,7 @@ int rkvpss_register_stream_vdevs_v1(struct rkvpss_device *dev)
|
||||
stream_vdev = &dev->stream_vdev;
|
||||
memset(stream_vdev, 0, sizeof(*stream_vdev));
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
stream = &stream_vdev->stream[i];
|
||||
stream->id = i;
|
||||
stream->dev = dev;
|
||||
@@ -2770,20 +2770,20 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rkvpss_unregister_stream_vdevs_v1(struct rkvpss_device *dev)
|
||||
void rkvpss_unregister_stream_vdevs_v10(struct rkvpss_device *dev)
|
||||
{
|
||||
struct rkvpss_stream_vdev *stream_vdev;
|
||||
struct rkvpss_stream *stream;
|
||||
int i;
|
||||
|
||||
stream_vdev = &dev->stream_vdev;
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
stream = &stream_vdev->stream[i];
|
||||
rkvpss_unregister_stream_video(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void rkvpss_isr_v1(struct rkvpss_device *dev, u32 mis_val)
|
||||
void rkvpss_isr_v10(struct rkvpss_device *dev, u32 mis_val)
|
||||
{
|
||||
v4l2_dbg(3, rkvpss_debug, &dev->v4l2_dev,
|
||||
"isr:0x%x\n", mis_val);
|
||||
@@ -2792,7 +2792,7 @@ void rkvpss_isr_v1(struct rkvpss_device *dev, u32 mis_val)
|
||||
rkvpss_check_idle(dev, VPSS_FRAME_END);
|
||||
}
|
||||
|
||||
void rkvpss_mi_isr_v1(struct rkvpss_device *dev, u32 mis_val)
|
||||
void rkvpss_mi_isr_v10(struct rkvpss_device *dev, u32 mis_val)
|
||||
{
|
||||
struct rkvpss_stream *stream;
|
||||
int i, ris = readl(dev->hw_dev->base_addr + RKVPSS_MI_RIS);
|
||||
@@ -2800,7 +2800,7 @@ void rkvpss_mi_isr_v1(struct rkvpss_device *dev, u32 mis_val)
|
||||
v4l2_dbg(3, rkvpss_debug, &dev->v4l2_dev,
|
||||
"mi isr:0x%x, ris:0x%x\n", mis_val, ris);
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
stream = &dev->stream_vdev.stream[i];
|
||||
|
||||
if (!stream->streaming ||
|
||||
42
drivers/media/platform/rockchip/vpss/stream_v10.h
Normal file
42
drivers/media/platform/rockchip/vpss/stream_v10.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2025 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKVPSS_STREAM_V10_H
|
||||
#define _RKVPSS_STREAM_V10_H
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/slab.h>
|
||||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-event.h>
|
||||
#include <media/v4l2-fh.h>
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/v4l2-mc.h>
|
||||
#include <media/v4l2-subdev.h>
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
#include <media/videobuf2-dma-sg.h>
|
||||
#include <uapi/linux/rk-video-format.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_VPSS_V10)
|
||||
int rkvpss_register_stream_vdevs_v10(struct rkvpss_device *dev);
|
||||
void rkvpss_unregister_stream_vdevs_v10(struct rkvpss_device *dev);
|
||||
void rkvpss_stream_default_fmt_v10(struct rkvpss_device *dev, u32 id,
|
||||
u32 width, u32 height, u32 pixelformat);
|
||||
void rkvpss_isr_v10(struct rkvpss_device *dev, u32 mis_val);
|
||||
void rkvpss_mi_isr_v10(struct rkvpss_device *dev, u32 mis_val);
|
||||
void rkvpss_cmsc_config_v10(struct rkvpss_device *dev, bool sync);
|
||||
int rkvpss_stream_buf_cnt_v10(struct rkvpss_stream *stream);
|
||||
|
||||
#else
|
||||
static inline int rkvpss_register_stream_vdevs_v10(struct rkvpss_device *dev) {return -EINVAL; }
|
||||
static inline void rkvpss_unregister_stream_vdevs_v10(struct rkvpss_device *dev) {}
|
||||
static inline void rkvpss_stream_default_fmt_v10(struct rkvpss_device *dev, u32 id, u32 width, u32 height, u32 pixelformat) {}
|
||||
static inline void rkvpss_isr_v10(struct rkvpss_device *dev, u32 mis_val) {}
|
||||
static inline void rkvpss_mi_isr_v10(struct rkvpss_device *dev, u32 mis_val) {}
|
||||
static inline void rkvpss_cmsc_config_v10(struct rkvpss_device *dev, bool sync) {}
|
||||
static inline int rkvpss_stream_buf_cnt_v10(struct rkvpss_stream *stream) {return -EINVAL; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "procfs.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
static const struct vpsssd_fmt rkvpss_formats[] = {
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "dev.h"
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
#include "vpss_offline_v1.h"
|
||||
#include "vpss_offline_v10.h"
|
||||
|
||||
void rkvpss_dump_reg(struct rkvpss_offline_dev *ofl, int sequence, int size)
|
||||
{
|
||||
@@ -70,23 +70,23 @@ void rkvpss_dump_reg(struct rkvpss_offline_dev *ofl, int sequence, int size)
|
||||
|
||||
void rkvpss_offline_irq(struct rkvpss_hw_dev *hw, u32 irq)
|
||||
{
|
||||
if (hw->vpss_ver == VPSS_V10)
|
||||
rkvpss_offline_irq_v1(hw, irq);
|
||||
if (is_vpss_v10(hw))
|
||||
rkvpss_offline_irq_v10(hw, irq);
|
||||
}
|
||||
|
||||
int rkvpss_register_offline(struct rkvpss_hw_dev *hw)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (hw->vpss_ver == VPSS_V10)
|
||||
ret = rkvpss_register_offline_v1(hw);
|
||||
if (is_vpss_v10(hw))
|
||||
ret = rkvpss_register_offline_v10(hw);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rkvpss_unregister_offline(struct rkvpss_hw_dev *hw)
|
||||
{
|
||||
if (hw->vpss_ver == VPSS_V10)
|
||||
rkvpss_unregister_offline_v1(hw);
|
||||
if (is_vpss_v10(hw))
|
||||
rkvpss_unregister_offline_v10(hw);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2024 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKVPSS_OFFLINE_V1_H
|
||||
#define _RKVPSS_OFFLINE_V1_H
|
||||
#define DEV_NUM_MAX 256
|
||||
#define UNITE_ENLARGE 16
|
||||
#define UNITE_LEFT_ENLARGE 16
|
||||
|
||||
|
||||
#if IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_VPSS_V1)
|
||||
int rkvpss_register_offline_v1(struct rkvpss_hw_dev *hw);
|
||||
void rkvpss_unregister_offline_v1(struct rkvpss_hw_dev *hw);
|
||||
void rkvpss_offline_irq_v1(struct rkvpss_hw_dev *hw, u32 irq);
|
||||
#else
|
||||
static inline int rkvpss_register_offline_v1(struct rkvpss_hw_dev *hw) {return -EINVAL; }
|
||||
static inline void rkvpss_unregister_offline_v1(struct rkvpss_hw_dev *hw) {}
|
||||
static inline void rkvpss_offline_irq_v1(struct rkvpss_hw_dev *hw, u32 irq) {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#include "dev.h"
|
||||
#include "vpss_offline.h"
|
||||
#include "hw.h"
|
||||
#include "regs_v1.h"
|
||||
#include "regs.h"
|
||||
|
||||
#include "procfs.h"
|
||||
#include "vpss_offline_v1.h"
|
||||
#include "vpss_offline_v10.h"
|
||||
|
||||
struct rkvpss_output_ch {
|
||||
u32 ctrl;
|
||||
@@ -571,7 +571,7 @@ static void scale_config(struct file *file,
|
||||
struct rkvpss_offline_dev *ofl = video_drvdata(file);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
|
||||
@@ -590,8 +590,8 @@ static int cmsc_config(struct rkvpss_offline_dev *ofl,
|
||||
struct rkvpss_cmsc_win *win;
|
||||
struct rkvpss_cmsc_point *point;
|
||||
int i, j, k;
|
||||
u32 ch_win_en[RKVPSS_OUT_V1_MAX];
|
||||
u32 ch_win_mode[RKVPSS_OUT_V1_MAX];
|
||||
u32 ch_win_en[RKVPSS_OUT_V10_MAX];
|
||||
u32 ch_win_mode[RKVPSS_OUT_V10_MAX];
|
||||
u32 win_color[RKVPSS_CMSC_WIN_MAX];
|
||||
u32 val, slope, hor, mask, mosaic_block = 0, ctrl = 0;
|
||||
u32 hw_in_w, hw_in_h;
|
||||
@@ -599,7 +599,7 @@ static int cmsc_config(struct rkvpss_offline_dev *ofl,
|
||||
if (!hw->is_ofl_cmsc)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
ch_win_en[i] = 0;
|
||||
@@ -632,7 +632,7 @@ static int cmsc_config(struct rkvpss_offline_dev *ofl,
|
||||
}
|
||||
|
||||
/* deal unite left params */
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!unite || !left)
|
||||
break;
|
||||
if (!cfg->output[i].enable)
|
||||
@@ -666,7 +666,7 @@ static int cmsc_config(struct rkvpss_offline_dev *ofl,
|
||||
}
|
||||
|
||||
/* deal unite right params */
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!unite || left)
|
||||
break;
|
||||
if (!cfg->output[i].enable)
|
||||
@@ -719,7 +719,7 @@ static int cmsc_config(struct rkvpss_offline_dev *ofl,
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
if (ch_win_en[i]) {
|
||||
@@ -788,7 +788,7 @@ static void aspt_config(struct file *file,
|
||||
u32 reg_base, val;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
|
||||
@@ -852,7 +852,7 @@ static void add_cfginfo(struct rkvpss_offline_dev *ofl, struct rkvpss_frame_cfg
|
||||
new_cfg->input.width = cfg->input.width;
|
||||
new_cfg->input.height = cfg->input.height;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
new_cfg->output[i].enable = cfg->output[i].enable;
|
||||
new_cfg->output[i].buf_fd = cfg->output[i].buf_fd;
|
||||
new_cfg->output[i].format = cfg->output[i].format;
|
||||
@@ -1126,7 +1126,7 @@ static void crop_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
|
||||
crop_en = 0;
|
||||
if (!unite) {
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
reg = RKVPSS_CROP0_0_H_OFFS;
|
||||
@@ -1145,7 +1145,7 @@ static void crop_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
}
|
||||
} else {
|
||||
if (left) {
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
|
||||
@@ -1168,7 +1168,7 @@ static void crop_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
crop_en |= RKVPSS_CROP_CHN_EN(i);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
reg = RKVPSS_CROP0_0_H_OFFS;
|
||||
@@ -1192,7 +1192,7 @@ static void crop_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
rkvpss_hw_write(hw, RKVPSS_CROP0_CTRL, crop_en);
|
||||
rkvpss_hw_write(hw, RKVPSS_CROP0_UPDATE, RKVPSS_CROP_FORCE_UPD);
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
v4l2_dbg(3, rkvpss_debug, &ofl->v4l2_dev,
|
||||
@@ -1212,12 +1212,12 @@ static int write_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
const struct vb2_mem_ops *mem_ops = hw->mem_ops;
|
||||
struct sg_table *sg_tbl;
|
||||
struct rkvpss_offline_buf *buf;
|
||||
struct rkvpss_output_ch out_ch[RKVPSS_OUT_V1_MAX] = { 0 };
|
||||
struct rkvpss_output_ch out_ch[RKVPSS_OUT_V10_MAX] = { 0 };
|
||||
int i;
|
||||
u32 w, h, val, reg, mask, mi_update, flip_en, unite_off = 0;
|
||||
bool ch_en = false, wr_uv_swap = false;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!hw->is_ofl_ch[i] && cfg->output[i].enable) {
|
||||
v4l2_err(&ofl->v4l2_dev,
|
||||
"dev_id:%d ch%d no select for offline mode, set to disable\n",
|
||||
@@ -1360,7 +1360,7 @@ static int write_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
mi_update = 0;
|
||||
flip_en = 0;
|
||||
mask = 0;
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (hw->is_ofl_ch[i])
|
||||
mask |= RKVPSS_MI_CHN_V_FLIP(i);
|
||||
if (!cfg->output[i].enable)
|
||||
@@ -1441,7 +1441,7 @@ static int write_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
rkvpss_hw_set_bits(hw, RKVPSS_MI_WR_VFLIP_CTRL, mask, flip_en);
|
||||
|
||||
/* config output uv swap */
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (cfg->output[i].enable &&
|
||||
(cfg->output[i].format == V4L2_PIX_FMT_VYUY ||
|
||||
cfg->output[i].format == V4L2_PIX_FMT_NV21 ||
|
||||
@@ -1449,7 +1449,7 @@ static int write_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
wr_uv_swap = true;
|
||||
}
|
||||
if (wr_uv_swap) {
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (cfg->output[i].enable && (cfg->output[i].format == V4L2_PIX_FMT_UYVY ||
|
||||
cfg->output[i].format == V4L2_PIX_FMT_NV12 ||
|
||||
cfg->output[i].format == V4L2_PIX_FMT_NV16)) {
|
||||
@@ -1460,7 +1460,7 @@ static int write_config(struct file *file, struct rkvpss_frame_cfg *cfg, bool un
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (cfg->output[i].format == V4L2_PIX_FMT_VYUY ||
|
||||
cfg->output[i].format == V4L2_PIX_FMT_NV21 ||
|
||||
cfg->output[i].format == V4L2_PIX_FMT_NV61) {
|
||||
@@ -1507,7 +1507,7 @@ static void calc_unite_scl_params(struct file *file, struct rkvpss_frame_cfg *cf
|
||||
u32 right_y_crop_total;
|
||||
u32 right_c_crop_total;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (cfg->output[i].enable == 0)
|
||||
continue;
|
||||
params = &ofl->unite_params[i];
|
||||
@@ -1619,7 +1619,7 @@ static int rkvpss_ofl_run(struct file *file, struct rkvpss_frame_cfg *cfg, bool
|
||||
|
||||
mask = 0;
|
||||
val = 0;
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!hw->is_ofl_ch[i])
|
||||
continue;
|
||||
mask |= (RKVPSS_ISP2VPSS_CHN0_SEL(3) << i * 2);
|
||||
@@ -1670,7 +1670,7 @@ static int rkvpss_module_get(struct file *file,
|
||||
else
|
||||
get->mirror_cmsc_en = 0;
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (hw->is_ofl_ch[i])
|
||||
get->ch_en[i] = 1;
|
||||
else
|
||||
@@ -1707,7 +1707,7 @@ static int rkvpss_module_sel(struct file *file,
|
||||
}
|
||||
|
||||
hw->is_ofl_cmsc = !!sel->mirror_cmsc_en;
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++)
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++)
|
||||
hw->is_ofl_ch[i] = !!sel->ch_en[i];
|
||||
unlock:
|
||||
mutex_unlock(&hw->dev_lock);
|
||||
@@ -1772,7 +1772,7 @@ static int rkvpss_check_params(struct file *file, struct rkvpss_frame_cfg *cfg,
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
/* check output format */
|
||||
@@ -1955,7 +1955,7 @@ static int rkvpss_check_params(struct file *file, struct rkvpss_frame_cfg *cfg,
|
||||
ret = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
if (!cfg->output[i].enable)
|
||||
continue;
|
||||
if (cfg->output[i].format != V4L2_PIX_FMT_NV12 &&
|
||||
@@ -2019,7 +2019,7 @@ static int rkvpss_prepare_run(struct file *file, struct rkvpss_frame_cfg *cfg)
|
||||
cfg->input.format, cfg->input.format >> 8,
|
||||
cfg->input.format >> 16, cfg->input.format >> 24,
|
||||
cfg->input.stride, cfg->input.rotate);
|
||||
for (i = 0; i < RKVPSS_OUT_V1_MAX; i++) {
|
||||
for (i = 0; i < RKVPSS_OUT_V10_MAX; i++) {
|
||||
v4l2_info(&ofl->v4l2_dev,
|
||||
"\t\t\tch%d enable:%d crop:(%d,%d)/%dx%d scl:%dx%d flip:%d buffd:%d format:%c%c%c%c stride:%d\n",
|
||||
i, cfg->output[i].enable,
|
||||
@@ -2210,7 +2210,7 @@ static const struct video_device offline_videodev = {
|
||||
.release = video_device_release_empty,
|
||||
};
|
||||
|
||||
void rkvpss_offline_irq_v1(struct rkvpss_hw_dev *hw, u32 irq)
|
||||
void rkvpss_offline_irq_v10(struct rkvpss_hw_dev *hw, u32 irq)
|
||||
{
|
||||
struct rkvpss_offline_dev *ofl = &hw->ofl_dev;
|
||||
|
||||
@@ -2221,7 +2221,7 @@ void rkvpss_offline_irq_v1(struct rkvpss_hw_dev *hw, u32 irq)
|
||||
complete(&ofl->cmpl);
|
||||
}
|
||||
|
||||
int rkvpss_register_offline_v1(struct rkvpss_hw_dev *hw)
|
||||
int rkvpss_register_offline_v10(struct rkvpss_hw_dev *hw)
|
||||
{
|
||||
struct rkvpss_offline_dev *ofl = &hw->ofl_dev;
|
||||
struct v4l2_device *v4l2_dev;
|
||||
@@ -2261,7 +2261,7 @@ unreg_v4l2:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rkvpss_unregister_offline_v1(struct rkvpss_hw_dev *hw)
|
||||
void rkvpss_unregister_offline_v10(struct rkvpss_hw_dev *hw)
|
||||
{
|
||||
mutex_destroy(&hw->ofl_dev.apilock);
|
||||
video_unregister_device(&hw->ofl_dev.vfd);
|
||||
22
drivers/media/platform/rockchip/vpss/vpss_offline_v10.h
Normal file
22
drivers/media/platform/rockchip/vpss/vpss_offline_v10.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright (c) 2024 Rockchip Electronics Co., Ltd. */
|
||||
|
||||
#ifndef _RKVPSS_OFFLINE_V10_H
|
||||
#define _RKVPSS_OFFLINE_V10_H
|
||||
#define DEV_NUM_MAX 256
|
||||
#define UNITE_ENLARGE 16
|
||||
#define UNITE_LEFT_ENLARGE 16
|
||||
|
||||
|
||||
#if IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_VPSS_V10)
|
||||
int rkvpss_register_offline_v10(struct rkvpss_hw_dev *hw);
|
||||
void rkvpss_unregister_offline_v10(struct rkvpss_hw_dev *hw);
|
||||
void rkvpss_offline_irq_v10(struct rkvpss_hw_dev *hw, u32 irq);
|
||||
#else
|
||||
static inline int rkvpss_register_offline_v10(struct rkvpss_hw_dev *hw) {return -EINVAL; }
|
||||
static inline void rkvpss_unregister_offline_v10(struct rkvpss_hw_dev *hw) {}
|
||||
static inline void rkvpss_offline_irq_v10(struct rkvpss_hw_dev *hw, u32 irq) {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* ioctl RKVPSS_CMD_MODULE_SEL to select function using
|
||||
*/
|
||||
|
||||
#define RKVPSS_OUT_V1_MAX 4
|
||||
#define RKVPSS_OUT_V10_MAX 4
|
||||
|
||||
/******vpss(online mode) v4l2 ioctl***************************/
|
||||
/* set before VIDIOC_S_FMT if dynamically changing output resolution */
|
||||
|
||||
Reference in New Issue
Block a user