1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2010-2015, Intel Corporation.
5  */
6 
7 #include "assert_support.h"
8 #include "gp_device.h"
9 
10 #ifndef __INLINE_GP_DEVICE__
11 #include "gp_device_private.h"
12 #endif /* __INLINE_GP_DEVICE__ */
13 
gp_device_get_state(const gp_device_ID_t ID,gp_device_state_t * state)14 void gp_device_get_state(
15     const gp_device_ID_t		ID,
16     gp_device_state_t			*state)
17 {
18 	assert(ID < N_GP_DEVICE_ID);
19 	assert(state);
20 
21 	state->syncgen_enable = gp_device_reg_load(ID,
22 				_REG_GP_SYNCGEN_ENABLE_ADDR);
23 	state->syncgen_free_running = gp_device_reg_load(ID,
24 				      _REG_GP_SYNCGEN_FREE_RUNNING_ADDR);
25 	state->syncgen_pause = gp_device_reg_load(ID,
26 			       _REG_GP_SYNCGEN_PAUSE_ADDR);
27 	state->nr_frames = gp_device_reg_load(ID,
28 					      _REG_GP_NR_FRAMES_ADDR);
29 	state->syngen_nr_pix = gp_device_reg_load(ID,
30 			       _REG_GP_SYNGEN_NR_PIX_ADDR);
31 	state->syngen_nr_pix = gp_device_reg_load(ID,
32 			       _REG_GP_SYNGEN_NR_PIX_ADDR);
33 	state->syngen_nr_lines = gp_device_reg_load(ID,
34 				 _REG_GP_SYNGEN_NR_LINES_ADDR);
35 	state->syngen_hblank_cycles = gp_device_reg_load(ID,
36 				      _REG_GP_SYNGEN_HBLANK_CYCLES_ADDR);
37 	state->syngen_vblank_cycles = gp_device_reg_load(ID,
38 				      _REG_GP_SYNGEN_VBLANK_CYCLES_ADDR);
39 	state->isel_sof = gp_device_reg_load(ID,
40 					     _REG_GP_ISEL_SOF_ADDR);
41 	state->isel_eof = gp_device_reg_load(ID,
42 					     _REG_GP_ISEL_EOF_ADDR);
43 	state->isel_sol = gp_device_reg_load(ID,
44 					     _REG_GP_ISEL_SOL_ADDR);
45 	state->isel_eol = gp_device_reg_load(ID,
46 					     _REG_GP_ISEL_EOL_ADDR);
47 	state->isel_lfsr_enable = gp_device_reg_load(ID,
48 				  _REG_GP_ISEL_LFSR_ENABLE_ADDR);
49 	state->isel_lfsr_enable_b = gp_device_reg_load(ID,
50 				    _REG_GP_ISEL_LFSR_ENABLE_B_ADDR);
51 	state->isel_lfsr_reset_value = gp_device_reg_load(ID,
52 				       _REG_GP_ISEL_LFSR_RESET_VALUE_ADDR);
53 	state->isel_tpg_enable = gp_device_reg_load(ID,
54 				 _REG_GP_ISEL_TPG_ENABLE_ADDR);
55 	state->isel_tpg_enable_b = gp_device_reg_load(ID,
56 				   _REG_GP_ISEL_TPG_ENABLE_B_ADDR);
57 	state->isel_hor_cnt_mask = gp_device_reg_load(ID,
58 				   _REG_GP_ISEL_HOR_CNT_MASK_ADDR);
59 	state->isel_ver_cnt_mask = gp_device_reg_load(ID,
60 				   _REG_GP_ISEL_VER_CNT_MASK_ADDR);
61 	state->isel_xy_cnt_mask = gp_device_reg_load(ID,
62 				  _REG_GP_ISEL_XY_CNT_MASK_ADDR);
63 	state->isel_hor_cnt_delta = gp_device_reg_load(ID,
64 				    _REG_GP_ISEL_HOR_CNT_DELTA_ADDR);
65 	state->isel_ver_cnt_delta = gp_device_reg_load(ID,
66 				    _REG_GP_ISEL_VER_CNT_DELTA_ADDR);
67 	state->isel_tpg_mode = gp_device_reg_load(ID,
68 			       _REG_GP_ISEL_TPG_MODE_ADDR);
69 	state->isel_tpg_red1 = gp_device_reg_load(ID,
70 			       _REG_GP_ISEL_TPG_RED1_ADDR);
71 	state->isel_tpg_green1 = gp_device_reg_load(ID,
72 				 _REG_GP_ISEL_TPG_GREEN1_ADDR);
73 	state->isel_tpg_blue1 = gp_device_reg_load(ID,
74 				_REG_GP_ISEL_TPG_BLUE1_ADDR);
75 	state->isel_tpg_red2 = gp_device_reg_load(ID,
76 			       _REG_GP_ISEL_TPG_RED2_ADDR);
77 	state->isel_tpg_green2 = gp_device_reg_load(ID,
78 				 _REG_GP_ISEL_TPG_GREEN2_ADDR);
79 	state->isel_tpg_blue2 = gp_device_reg_load(ID,
80 				_REG_GP_ISEL_TPG_BLUE2_ADDR);
81 	state->isel_ch_id = gp_device_reg_load(ID,
82 					       _REG_GP_ISEL_CH_ID_ADDR);
83 	state->isel_fmt_type = gp_device_reg_load(ID,
84 			       _REG_GP_ISEL_FMT_TYPE_ADDR);
85 	state->isel_data_sel = gp_device_reg_load(ID,
86 			       _REG_GP_ISEL_DATA_SEL_ADDR);
87 	state->isel_sband_sel = gp_device_reg_load(ID,
88 				_REG_GP_ISEL_SBAND_SEL_ADDR);
89 	state->isel_sync_sel = gp_device_reg_load(ID,
90 			       _REG_GP_ISEL_SYNC_SEL_ADDR);
91 	state->syncgen_hor_cnt = gp_device_reg_load(ID,
92 				 _REG_GP_SYNCGEN_HOR_CNT_ADDR);
93 	state->syncgen_ver_cnt = gp_device_reg_load(ID,
94 				 _REG_GP_SYNCGEN_VER_CNT_ADDR);
95 	state->syncgen_frame_cnt = gp_device_reg_load(ID,
96 				   _REG_GP_SYNCGEN_FRAME_CNT_ADDR);
97 	state->soft_reset = gp_device_reg_load(ID,
98 					       _REG_GP_SOFT_RESET_ADDR);
99 	return;
100 }
101