Skip to content

Commit 62ed11e

Browse files
Mingwei Yanrkhuangtao
authored andcommitted
media: rockchip: vpss: offline wrap add reset and read hw seq
Signed-off-by: Mingwei Yan <[email protected]> Change-Id: I5d8a80492896e0e57c3efac3c5bf55c4e83c78ec
1 parent 7871f4d commit 62ed11e

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

drivers/media/platform/rockchip/vpss/hw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,7 @@ static int rkvpss_hw_probe(struct platform_device *pdev)
936936
hw_dev->is_shutdown = false;
937937
hw_dev->is_mmu = is_iommu_enable(dev);
938938
hw_dev->is_suspend = false;
939+
hw_dev->is_first = false;
939940
ret = of_reserved_mem_device_init(dev);
940941
if (ret) {
941942
is_mem_reserved = false;
@@ -1027,6 +1028,7 @@ static int __maybe_unused rkvpss_hw_runtime_resume(struct device *dev)
10271028
memset(buf, 0, RKVPSS_SW_REG_SIZE_MAX);
10281029
memcpy_fromio(buf, base, RKVPSS_SW_REG_SIZE);
10291030
}
1031+
hw_dev->is_first = true;
10301032
} else {
10311033
rkvpss_hw_reg_restore(hw_dev);
10321034
hw_dev->is_suspend = false;

drivers/media/platform/rockchip/vpss/hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct rkvpss_hw_dev {
6868
bool is_dma_contig;
6969
bool is_shutdown;
7070
bool is_suspend;
71+
bool is_first;
7172
};
7273

7374
#ifdef CONFIG_VIDEO_ROCKCHIP_VPSS_V10

drivers/media/platform/rockchip/vpss/regs_v20.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
/* VPSS */
88
#define RKVPSS2X_VPSS_BASE 0x0000
99
#define RKVPSS2X_VPSS_PIPE_ACK2 (RKVPSS2X_VPSS_BASE + 0xb8)
10+
#define RKVPSS2X_VPSS_FRAME_CNT (RKVPSS2X_VPSS_BASE + 0xc8)
11+
#define RKVPSS2X_VPSS2ENC_DEBUG (RKVPSS2X_VPSS_BASE + 0xcc)
1012

1113
/* CMSC identical */
1214

@@ -259,6 +261,11 @@
259261
#define RKVPSS2X_RATIO4_IN_FRM_END BIT(18)
260262
#define RKVPSS2X_RATIO5_IN_FRM_END BIT(19)
261263

264+
/* VPSS2ENC_DEBUG */
265+
#define RKVPSS2X_RO_VPSS2ENC_LINE_CNT(x) ((x) & 0x3fff)
266+
#define RKVPSS2X_RO_VPSS2ENC_FRM_CNT(x) (((x) & 0xffffff) >> 16)
267+
268+
262269
/* VPSS_CTRL_SHD */
263270
#define RKVPSS2X_VPSS2ENC_PATH_EN_SHD BIT(11)
264271

drivers/media/platform/rockchip/vpss/vpss_offline_rockit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ long vpss_rockit_action(int *file_id, unsigned int cmd, void *arg)
9595
case RKVPSS_CMD_CHECKPARAMS:
9696
case RKVPSS_CMD_WRAP_DVBM_INIT:
9797
case RKVPSS_CMD_WRAP_DVBM_DEINIT:
98+
case RKVPSS_CMD_GET_WRAP_SEQ:
9899
if (!rkvpss_ofl_check_file_id(global_ofl, *file_id)) {
99100
v4l2_err(&global_ofl->v4l2_dev, "file_id error\n");
100101
ret = -EINVAL;

drivers/media/platform/rockchip/vpss/vpss_offline_v20.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,8 @@ static int rkvpss_ofl_run(struct rkvpss_offline_dev *ofl,
17761776
if (!ret) {
17771777
v4l2_err(&ofl->v4l2_dev, "working timeout\n");
17781778
ret = -EAGAIN;
1779+
if (cfg->input.dmabuf)
1780+
rkvpss_soft_reset(ofl->hw);
17791781
} else {
17801782
ret = 0;
17811783
}
@@ -2397,6 +2399,28 @@ static void rkvpss_ofl_wrap_dvbm_deinit(struct rkvpss_offline_dev *ofl, int *id)
23972399
rkvpss_ofl_dvbm_deinit(ofl, *id);
23982400
}
23992401

2402+
static void rkvpss_ofl_get_wrap_seq(struct rkvpss_offline_dev *ofl, int *seq)
2403+
{
2404+
struct rkvpss_hw_dev *hw = ofl->hw;
2405+
u32 mask, val;
2406+
2407+
v4l2_dbg(4, rkvpss_debug, &ofl->v4l2_dev, "dev_id:%d\n", *seq);
2408+
2409+
mask = RKVPSS_VPSS2ENC_SEL | RKVPSS2X_SENSOR_ID(7);
2410+
val = RKVPSS_VPSS2ENC_SEL | RKVPSS2X_SENSOR_ID(*seq);
2411+
rkvpss_hw_set_bits(hw, RKVPSS_VPSS_CTRL, mask, val);
2412+
2413+
if (hw->is_first) {
2414+
hw->is_first = false;
2415+
rkvpss_hw_write(hw, RKVPSS2X_VPSS2ENC_DEBUG, 0x1);
2416+
v4l2_dbg(4, rkvpss_debug, &ofl->v4l2_dev, "wrap is first\n");
2417+
}
2418+
2419+
*seq = RKVPSS2X_RO_VPSS2ENC_FRM_CNT(rkvpss_hw_read(ofl->hw, RKVPSS2X_VPSS2ENC_DEBUG));
2420+
2421+
v4l2_dbg(4, rkvpss_debug, &ofl->v4l2_dev, "hw frmame coount:%d\n", *seq);
2422+
}
2423+
24002424
long rkvpss_ofl_action(struct rkvpss_offline_dev *ofl,
24012425
int file_id, unsigned int cmd, void *arg)
24022426
{
@@ -2432,6 +2456,9 @@ long rkvpss_ofl_action(struct rkvpss_offline_dev *ofl,
24322456
case RKVPSS_CMD_WRAP_DVBM_DEINIT:
24332457
rkvpss_ofl_wrap_dvbm_deinit(ofl, arg);
24342458
break;
2459+
case RKVPSS_CMD_GET_WRAP_SEQ:
2460+
rkvpss_ofl_get_wrap_seq(ofl, arg);
2461+
break;
24352462
default:
24362463
ret = -EFAULT;
24372464
}

include/uapi/linux/rk-vpss-config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@
101101
#define RKVPSS_CMD_WRAP_DVBM_DEINIT \
102102
_IOW('V', BASE_VIDIOC_PRIVATE + 104, int *)
103103

104+
#define RKVPSS_CMD_GET_WRAP_SEQ \
105+
_IOWR('V', BASE_VIDIOC_PRIVATE + 105, int *)
106+
104107
/********************************************************************/
105108

106109
/* struct rkvpss_mirror_flip

0 commit comments

Comments
 (0)