GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / gp_device.c
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2010-2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #include "assert_support.h"
16 #include "gp_device.h"
17
18 #ifndef __INLINE_GP_DEVICE__
19 #include "gp_device_private.h"
20 #endif /* __INLINE_GP_DEVICE__ */
21
22 void gp_device_get_state(
23         const gp_device_ID_t            ID,
24         gp_device_state_t                       *state)
25 {
26         assert(ID < N_GP_DEVICE_ID);
27         assert(state != NULL);
28
29         state->syncgen_enable = gp_device_reg_load(ID,
30                 _REG_GP_SYNCGEN_ENABLE_ADDR);
31         state->syncgen_free_running = gp_device_reg_load(ID,
32                 _REG_GP_SYNCGEN_FREE_RUNNING_ADDR);
33         state->syncgen_pause = gp_device_reg_load(ID,
34                 _REG_GP_SYNCGEN_PAUSE_ADDR);
35         state->nr_frames = gp_device_reg_load(ID,
36                 _REG_GP_NR_FRAMES_ADDR);
37         state->syngen_nr_pix = gp_device_reg_load(ID,
38                 _REG_GP_SYNGEN_NR_PIX_ADDR);
39         state->syngen_nr_pix = gp_device_reg_load(ID,
40                 _REG_GP_SYNGEN_NR_PIX_ADDR);
41         state->syngen_nr_lines = gp_device_reg_load(ID,
42                 _REG_GP_SYNGEN_NR_LINES_ADDR);
43         state->syngen_hblank_cycles = gp_device_reg_load(ID,
44                 _REG_GP_SYNGEN_HBLANK_CYCLES_ADDR);
45         state->syngen_vblank_cycles = gp_device_reg_load(ID,
46                 _REG_GP_SYNGEN_VBLANK_CYCLES_ADDR);
47         state->isel_sof = gp_device_reg_load(ID,
48                 _REG_GP_ISEL_SOF_ADDR);
49         state->isel_eof = gp_device_reg_load(ID,
50                 _REG_GP_ISEL_EOF_ADDR);
51         state->isel_sol = gp_device_reg_load(ID,
52                 _REG_GP_ISEL_SOL_ADDR);
53         state->isel_eol = gp_device_reg_load(ID,
54                 _REG_GP_ISEL_EOL_ADDR);
55         state->isel_lfsr_enable = gp_device_reg_load(ID,
56                 _REG_GP_ISEL_LFSR_ENABLE_ADDR);
57         state->isel_lfsr_enable_b = gp_device_reg_load(ID,
58                 _REG_GP_ISEL_LFSR_ENABLE_B_ADDR);
59         state->isel_lfsr_reset_value = gp_device_reg_load(ID,
60                 _REG_GP_ISEL_LFSR_RESET_VALUE_ADDR);
61         state->isel_tpg_enable = gp_device_reg_load(ID,
62                 _REG_GP_ISEL_TPG_ENABLE_ADDR);
63         state->isel_tpg_enable_b = gp_device_reg_load(ID,
64                 _REG_GP_ISEL_TPG_ENABLE_B_ADDR);
65         state->isel_hor_cnt_mask = gp_device_reg_load(ID,
66                 _REG_GP_ISEL_HOR_CNT_MASK_ADDR);
67         state->isel_ver_cnt_mask = gp_device_reg_load(ID,
68                 _REG_GP_ISEL_VER_CNT_MASK_ADDR);
69         state->isel_xy_cnt_mask = gp_device_reg_load(ID,
70                 _REG_GP_ISEL_XY_CNT_MASK_ADDR);
71         state->isel_hor_cnt_delta = gp_device_reg_load(ID,
72                 _REG_GP_ISEL_HOR_CNT_DELTA_ADDR);
73         state->isel_ver_cnt_delta = gp_device_reg_load(ID,
74                 _REG_GP_ISEL_VER_CNT_DELTA_ADDR);
75         state->isel_tpg_mode = gp_device_reg_load(ID,
76                 _REG_GP_ISEL_TPG_MODE_ADDR);
77         state->isel_tpg_red1 = gp_device_reg_load(ID,
78                 _REG_GP_ISEL_TPG_RED1_ADDR);
79         state->isel_tpg_green1 = gp_device_reg_load(ID,
80                 _REG_GP_ISEL_TPG_GREEN1_ADDR);
81         state->isel_tpg_blue1 = gp_device_reg_load(ID,
82                 _REG_GP_ISEL_TPG_BLUE1_ADDR);
83         state->isel_tpg_red2 = gp_device_reg_load(ID,
84                 _REG_GP_ISEL_TPG_RED2_ADDR);
85         state->isel_tpg_green2 = gp_device_reg_load(ID,
86                 _REG_GP_ISEL_TPG_GREEN2_ADDR);
87         state->isel_tpg_blue2 = gp_device_reg_load(ID,
88                 _REG_GP_ISEL_TPG_BLUE2_ADDR);
89         state->isel_ch_id = gp_device_reg_load(ID,
90                 _REG_GP_ISEL_CH_ID_ADDR);
91         state->isel_fmt_type = gp_device_reg_load(ID,
92                 _REG_GP_ISEL_FMT_TYPE_ADDR);
93         state->isel_data_sel = gp_device_reg_load(ID,
94                 _REG_GP_ISEL_DATA_SEL_ADDR);
95         state->isel_sband_sel = gp_device_reg_load(ID,
96                 _REG_GP_ISEL_SBAND_SEL_ADDR);
97         state->isel_sync_sel = gp_device_reg_load(ID,
98                 _REG_GP_ISEL_SYNC_SEL_ADDR);
99         state->syncgen_hor_cnt = gp_device_reg_load(ID,
100                 _REG_GP_SYNCGEN_HOR_CNT_ADDR);
101         state->syncgen_ver_cnt = gp_device_reg_load(ID,
102                 _REG_GP_SYNCGEN_VER_CNT_ADDR);
103         state->syncgen_frame_cnt = gp_device_reg_load(ID,
104                 _REG_GP_SYNCGEN_FRAME_CNT_ADDR);
105         state->soft_reset = gp_device_reg_load(ID,
106                 _REG_GP_SOFT_RESET_ADDR);
107 return;
108 }