hc
2023-10-16 def2367077573b56f9fc4f824e5c0377a3a4175a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * Rockchip VPU codec driver
 *
 * Copyright (C) 2016 Rockchip Electronics Co., Ltd.
 *    Jeffy Chen <jeffy.chen@rock-chips.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
 
#include "rockchip_vpu_common.h"
 
#include "rk3288_vpu_regs.h"
 
/*
 * Interrupt handlers.
 */
 
int rk3288_vpu_enc_irq(int irq, struct rockchip_vpu_dev *vpu)
{
   u32 status = vepu_read(vpu, VEPU_REG_INTERRUPT);
 
   vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
 
   if (status & VEPU_REG_INTERRUPT_BIT) {
       vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
       return 0;
   }
 
   return -1;
}
 
int rk3288_vpu_dec_irq(int irq, struct rockchip_vpu_dev *vpu)
{
   u32 status = vdpu_read(vpu, VDPU_REG_INTERRUPT);
 
   vdpu_write(vpu, 0, VDPU_REG_INTERRUPT);
 
   vpu_debug(3, "vdpu_irq status: %08x\n", status);
 
   if (status & VDPU_REG_INTERRUPT_DEC_IRQ) {
       vdpu_write(vpu, 0, VDPU_REG_CONFIG);
       return 0;
   }
 
   return -1;
}
 
/*
 * Initialization/clean-up.
 */
 
void rk3288_vpu_enc_reset(struct rockchip_vpu_ctx *ctx)
{
   struct rockchip_vpu_dev *vpu = ctx->dev;
 
   vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
   vepu_write(vpu, 0, VEPU_REG_ENC_CTRL);
   vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
}
 
void rk3288_vpu_dec_reset(struct rockchip_vpu_ctx *ctx)
{
   struct rockchip_vpu_dev *vpu = ctx->dev;
 
   vdpu_write(vpu, VDPU_REG_INTERRUPT_DEC_IRQ_DIS, VDPU_REG_INTERRUPT);
   vdpu_write(vpu, 0, VDPU_REG_CONFIG);
}