• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __IRQ_PUBLIC_H_INCLUDED__
17 #define __IRQ_PUBLIC_H_INCLUDED__
18 
19 #include <type_support.h>
20 #include "system_local.h"
21 
22 /*! Read the control registers of IRQ[ID]
23 
24  \param	ID[in]				IRQ identifier
25  \param	state[out]			irq controller state structure
26 
27  \return none, state = IRQ[ID].state
28  */
29 void irq_controller_get_state(const irq_ID_t ID,
30 			      struct irq_controller_state *state);
31 
32 /*! Write to a control register of IRQ[ID]
33 
34  \param	ID[in]				IRQ identifier
35  \param	reg[in]				register index
36  \param value[in]			The data to be written
37 
38  \return none, IRQ[ID].ctrl[reg] = value
39  */
40 STORAGE_CLASS_IRQ_H void irq_reg_store(
41     const irq_ID_t		ID,
42     const unsigned int	reg,
43     const hrt_data		value);
44 
45 /*! Read from a control register of IRQ[ID]
46 
47  \param	ID[in]				IRQ identifier
48  \param	reg[in]				register index
49  \param value[in]			The data to be written
50 
51  \return IRQ[ID].ctrl[reg]
52  */
53 STORAGE_CLASS_IRQ_H hrt_data irq_reg_load(
54     const irq_ID_t		ID,
55     const unsigned int	reg);
56 
57 /*! Enable an IRQ channel of IRQ[ID] with a mode
58 
59  \param	ID[in]				IRQ (device) identifier
60  \param	irq[in]				IRQ (channel) identifier
61 
62  \return none, enable(IRQ[ID].channel[irq_ID])
63  */
64 void irq_enable_channel(
65     const irq_ID_t				ID,
66     const unsigned int			irq_ID);
67 
68 /*! Enable pulse interrupts for IRQ[ID] with a mode
69 
70  \param	ID[in]				IRQ (device) identifier
71  \param	enable				enable/disable pulse interrupts
72 
73  \return none
74  */
75 void irq_enable_pulse(
76     const irq_ID_t	ID,
77     bool			pulse);
78 
79 /*! Disable an IRQ channel of IRQ[ID]
80 
81  \param	ID[in]				IRQ (device) identifier
82  \param	irq[in]				IRQ (channel) identifier
83 
84  \return none, disable(IRQ[ID].channel[irq_ID])
85  */
86 void irq_disable_channel(
87     const irq_ID_t				ID,
88     const unsigned int			irq);
89 
90 /*! Clear the state of all IRQ channels of IRQ[ID]
91 
92  \param	ID[in]				IRQ (device) identifier
93 
94  \return none, clear(IRQ[ID].channel[])
95  */
96 void irq_clear_all(
97     const irq_ID_t				ID);
98 
99 /*! Return the ID of a signalling IRQ channel of IRQ[ID]
100 
101  \param	ID[in]				IRQ (device) identifier
102  \param irq_id[out]			active IRQ (channel) identifier
103 
104  \Note: This function operates as strtok(), based on the return
105   state the user is informed if there are additional signalling
106   channels
107 
108  \return state(IRQ[ID])
109  */
110 enum hrt_isp_css_irq_status irq_get_channel_id(
111     const irq_ID_t				ID,
112     unsigned int				*irq_id);
113 
114 /*! Raise an interrupt on channel irq_id of device IRQ[ID]
115 
116  \param	ID[in]				IRQ (device) identifier
117  \param	irq_id[in]			IRQ (channel) identifier
118 
119  \return none, signal(IRQ[ID].channel[irq_id])
120  */
121 void irq_raise(
122     const irq_ID_t				ID,
123     const irq_sw_channel_id_t	irq_id);
124 
125 /*! Test if any IRQ channel of the virtual super IRQ has raised a signal
126 
127  \return any(VIRQ.channel[irq_ID] != 0)
128  */
129 bool any_virq_signal(void);
130 
131 /*! Enable an IRQ channel of the virtual super IRQ
132 
133  \param	irq[in]				IRQ (channel) identifier
134  \param	en[in]				predicate channel enable
135 
136  \return none, VIRQ.channel[irq_ID].enable = en
137  */
138 void cnd_virq_enable_channel(
139     const enum virq_id				irq_ID,
140     const bool					en);
141 
142 /*! Clear the state of all IRQ channels of the virtual super IRQ
143 
144  \return none, clear(VIRQ.channel[])
145  */
146 void virq_clear_all(void);
147 
148 /*! Clear the IRQ info state of the virtual super IRQ
149 
150  \param irq_info[in/out]	The IRQ (channel) state
151 
152  \return none
153  */
154 void virq_clear_info(struct virq_info *irq_info);
155 
156 /*! Return the ID of a signalling IRQ channel of the virtual super IRQ
157 
158  \param irq_id[out]			active IRQ (channel) identifier
159 
160  \Note: This function operates as strtok(), based on the return
161   state the user is informed if there are additional signalling
162   channels
163 
164  \return state(IRQ[...])
165  */
166 enum hrt_isp_css_irq_status virq_get_channel_id(
167     enum virq_id					*irq_id);
168 
169 /*! Return the IDs of all signaling IRQ channels of the virtual super IRQ
170 
171  \param irq_info[out]		all active IRQ (channel) identifiers
172 
173  \Note: Unlike "irq_get_channel_id()" this function returns all
174   channel signaling info. The new info is OR'd with the current
175   info state. N.B. this is the same as repeatedly calling the function
176   "irq_get_channel_id()" in a (non-blocked) handler routine
177 
178  \return (error(state(IRQ[...]))
179  */
180 enum hrt_isp_css_irq_status
181 virq_get_channel_signals(struct virq_info *irq_info);
182 
183 #endif /* __IRQ_PUBLIC_H_INCLUDED__ */
184