1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef __INPUT_SYSTEM_PRIVATE_H_INCLUDED__
17 #define __INPUT_SYSTEM_PRIVATE_H_INCLUDED__
18 
19 #include "input_system_public.h"
20 
21 STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state(
22     const input_system_ID_t	ID,
23     input_system_state_t *state)
24 {
25 	u32 i;
26 
27 	(void)(ID);
28 
29 	/*  get the states of all CSI RX frontend devices */
30 	for (i = 0; i < N_CSI_RX_FRONTEND_ID; i++) {
31 		csi_rx_fe_ctrl_get_state(
32 		    (csi_rx_frontend_ID_t)i,
33 		    &state->csi_rx_fe_ctrl_state[i]);
34 	}
35 
36 	/*  get the states of all CIS RX backend devices */
37 	for (i = 0; i < N_CSI_RX_BACKEND_ID; i++) {
38 		csi_rx_be_ctrl_get_state(
39 		    (csi_rx_backend_ID_t)i,
40 		    &state->csi_rx_be_ctrl_state[i]);
41 	}
42 
43 	/* get the states of all pixelgen devices */
44 	for (i = 0; i < N_PIXELGEN_ID; i++) {
45 		pixelgen_ctrl_get_state(
46 		    (pixelgen_ID_t)i,
47 		    &state->pixelgen_ctrl_state[i]);
48 	}
49 
50 	/* get the states of all stream2mmio devices */
51 	for (i = 0; i < N_STREAM2MMIO_ID; i++) {
52 		stream2mmio_get_state(
53 		    (stream2mmio_ID_t)i,
54 		    &state->stream2mmio_state[i]);
55 	}
56 
57 	/* get the states of all ibuf-controller devices */
58 	for (i = 0; i < N_IBUF_CTRL_ID; i++) {
59 		ibuf_ctrl_get_state(
60 		    (ibuf_ctrl_ID_t)i,
61 		    &state->ibuf_ctrl_state[i]);
62 	}
63 
64 	/* get the states of all isys irq controllers */
65 	for (i = 0; i < N_ISYS_IRQ_ID; i++) {
66 		isys_irqc_state_get((isys_irq_ID_t)i, &state->isys_irqc_state[i]);
67 	}
68 
69 	/* TODO: get the states of all ISYS2401 DMA devices  */
70 	for (i = 0; i < N_ISYS2401_DMA_ID; i++) {
71 	}
72 
73 	return INPUT_SYSTEM_ERR_NO_ERROR;
74 }
75 
76 STORAGE_CLASS_INPUT_SYSTEM_C void input_system_dump_state(
77     const input_system_ID_t	ID,
78     input_system_state_t *state)
79 {
80 	u32 i;
81 
82 	(void)(ID);
83 
84 	/*  dump the states of all CSI RX frontend devices */
85 	for (i = 0; i < N_CSI_RX_FRONTEND_ID; i++) {
86 		csi_rx_fe_ctrl_dump_state(
87 		    (csi_rx_frontend_ID_t)i,
88 		    &state->csi_rx_fe_ctrl_state[i]);
89 	}
90 
91 	/*  dump the states of all CIS RX backend devices */
92 	for (i = 0; i < N_CSI_RX_BACKEND_ID; i++) {
93 		csi_rx_be_ctrl_dump_state(
94 		    (csi_rx_backend_ID_t)i,
95 		    &state->csi_rx_be_ctrl_state[i]);
96 	}
97 
98 	/* dump the states of all pixelgen devices */
99 	for (i = 0; i < N_PIXELGEN_ID; i++) {
100 		pixelgen_ctrl_dump_state(
101 		    (pixelgen_ID_t)i,
102 		    &state->pixelgen_ctrl_state[i]);
103 	}
104 
105 	/* dump the states of all st2mmio devices */
106 	for (i = 0; i < N_STREAM2MMIO_ID; i++) {
107 		stream2mmio_dump_state(
108 		    (stream2mmio_ID_t)i,
109 		    &state->stream2mmio_state[i]);
110 	}
111 
112 	/* dump the states of all ibuf-controller devices */
113 	for (i = 0; i < N_IBUF_CTRL_ID; i++) {
114 		ibuf_ctrl_dump_state(
115 		    (ibuf_ctrl_ID_t)i,
116 		    &state->ibuf_ctrl_state[i]);
117 	}
118 
119 	/* dump the states of all isys irq controllers */
120 	for (i = 0; i < N_ISYS_IRQ_ID; i++) {
121 		isys_irqc_state_dump((isys_irq_ID_t)i, &state->isys_irqc_state[i]);
122 	}
123 
124 	/* TODO: dump the states of all ISYS2401 DMA devices  */
125 	for (i = 0; i < N_ISYS2401_DMA_ID; i++) {
126 	}
127 
128 	return;
129 }
130 #endif /* __INPUT_SYSTEM_PRIVATE_H_INCLUDED__ */
131