Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[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) \
19         || defined(CONFIG_ARCH_ROCKCHIP)
20 /*GRF_IO_CON3                        0x100*/
21 #define CIF_DRIVER_STRENGTH_2MA            (0x00 << 12)
22 #define CIF_DRIVER_STRENGTH_4MA            (0x01 << 12)
23 #define CIF_DRIVER_STRENGTH_8MA            (0x02 << 12)
24 #define CIF_DRIVER_STRENGTH_12MA           (0x03 << 12)
25 #define CIF_DRIVER_STRENGTH_MASK           (0x03 << 28)
26
27 /*GRF_IO_CON4                        0x104*/
28 #define CIF_CLKOUT_AMP_3V3                 (0x00 << 10)
29 #define CIF_CLKOUT_AMP_1V8                 (0x01 << 10)
30 #define CIF_CLKOUT_AMP_MASK                (0x01 << 26)
31
32 #define write_grf_reg(addr, val)           \
33         __raw_writel(val, addr+RK_GRF_VIRT)
34 #define read_grf_reg(addr)                 \
35         __raw_readl(addr+RK_GRF_VIRT)
36 #define mask_grf_reg(addr, msk, val)       \
37         write_grf_reg(addr, (val)|((~(msk))&read_grf_reg(addr)))
38 #else
39 #define write_grf_reg(addr, val)
40 #define read_grf_reg(addr)                 0
41 #define mask_grf_reg(addr, msk, val)
42 #endif
43
44
45 typedef struct camsys_cif_clk_s {
46         struct clk *pd_cif;
47         struct clk *aclk_cif;
48         struct clk *hclk_cif;
49         struct clk *cif_clk_in;
50         bool in_on;
51
52         struct clk *cif_clk_out;
53         unsigned int out_on;
54
55         spinlock_t lock;
56 } camsys_cif_clk_t;
57
58
59 int camsys_cif_probe_cb(
60 struct platform_device *pdev, camsys_dev_t *camsys_dev);
61
62 #endif
63