Merge branch develop-3.10 into develop-3.10-next
[firefly-linux-kernel-4.4.55.git] / drivers / media / video / rk_camsys / camsys_cif.h
1 #ifndef __CAMSYS_CIF_H__
2 #define __CAMSYS_CIF_H__
3
4 #include "camsys_internal.h"
5
6 #define CAMSYS_CIF_IRQNAME                   "CifIrq"
7
8
9 #define CIF_BASE                                0x00
10 #define CIF_CTRL                                (CIF_BASE)
11 #define CIF_INITSTA                             (CIF_BASE+0x08)
12 #define CIF_FRAME_STATUS                        (CIF_BASE+0x60)
13 #define CIF_LAST_LINE                           (CIF_BASE+0x68)
14 #define CIF_LAST_PIX                            (CIF_BASE+0x6c)
15 #define CRU_PCLK_REG30                           0xbc
16
17
18 #if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188) || defined(CONFIG_ARCH_ROCKCHIP)
19 //GRF_IO_CON3                        0x100
20 #define CIF_DRIVER_STRENGTH_2MA            (0x00 << 12)
21 #define CIF_DRIVER_STRENGTH_4MA            (0x01 << 12)
22 #define CIF_DRIVER_STRENGTH_8MA            (0x02 << 12)
23 #define CIF_DRIVER_STRENGTH_12MA           (0x03 << 12)
24 #define CIF_DRIVER_STRENGTH_MASK           (0x03 << 28)
25
26 //GRF_IO_CON4                        0x104
27 #define CIF_CLKOUT_AMP_3V3                 (0x00 << 10)
28 #define CIF_CLKOUT_AMP_1V8                 (0x01 << 10)
29 #define CIF_CLKOUT_AMP_MASK                (0x01 << 26)
30
31 #define write_grf_reg(addr, val)           __raw_writel(val, addr+RK_GRF_VIRT)
32 #define read_grf_reg(addr)                 __raw_readl(addr+RK_GRF_VIRT)
33 #define mask_grf_reg(addr, msk, val)       write_grf_reg(addr,(val)|((~(msk))&read_grf_reg(addr)))
34 #else
35 #define write_grf_reg(addr, val)  
36 #define read_grf_reg(addr)                 0
37 #define mask_grf_reg(addr, msk, val)    
38 #endif
39
40
41 typedef struct camsys_cif_clk_s {
42         struct clk *pd_cif;
43         struct clk *aclk_cif;
44     struct clk *hclk_cif;
45     struct clk *cif_clk_in;
46     bool in_on;
47     
48     struct clk *cif_clk_out;
49     unsigned int out_on;
50     
51     spinlock_t lock;    
52 } camsys_cif_clk_t;
53
54
55 int camsys_cif_probe_cb(struct platform_device *pdev, camsys_dev_t *camsys_dev);
56
57 #endif
58