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  * 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 __FIFO_MONITOR_LOCAL_H_INCLUDED__
17 #define __FIFO_MONITOR_LOCAL_H_INCLUDED__
18 
19 #include <type_support.h>
20 #include "fifo_monitor_global.h"
21 
22 #include "hive_isp_css_defs.h"	/* ISP_STR_MON_PORT_SND_SP, ... */
23 
24 #define _hive_str_mon_valid_offset   0
25 #define _hive_str_mon_accept_offset  1
26 
27 #define	FIFO_CHANNEL_SP_VALID_MASK		0x55555555
28 #define	FIFO_CHANNEL_SP_VALID_B_MASK	0x00000055
29 #define	FIFO_CHANNEL_ISP_VALID_MASK		0x15555555
30 #define	FIFO_CHANNEL_MOD_VALID_MASK		0x55555555
31 
32 typedef enum fifo_switch {
33 	FIFO_SWITCH_IF,
34 	FIFO_SWITCH_GDC0,
35 	FIFO_SWITCH_GDC1,
36 	N_FIFO_SWITCH
37 } fifo_switch_t;
38 
39 typedef enum fifo_channel {
40 	FIFO_CHANNEL_ISP0_TO_SP0,
41 	FIFO_CHANNEL_SP0_TO_ISP0,
42 	FIFO_CHANNEL_ISP0_TO_IF0,
43 	FIFO_CHANNEL_IF0_TO_ISP0,
44 	FIFO_CHANNEL_ISP0_TO_IF1,
45 	FIFO_CHANNEL_IF1_TO_ISP0,
46 	FIFO_CHANNEL_ISP0_TO_DMA0,
47 	FIFO_CHANNEL_DMA0_TO_ISP0,
48 	FIFO_CHANNEL_ISP0_TO_GDC0,
49 	FIFO_CHANNEL_GDC0_TO_ISP0,
50 	FIFO_CHANNEL_ISP0_TO_GDC1,
51 	FIFO_CHANNEL_GDC1_TO_ISP0,
52 	FIFO_CHANNEL_ISP0_TO_HOST0,
53 	FIFO_CHANNEL_HOST0_TO_ISP0,
54 	FIFO_CHANNEL_SP0_TO_IF0,
55 	FIFO_CHANNEL_IF0_TO_SP0,
56 	FIFO_CHANNEL_SP0_TO_IF1,
57 	FIFO_CHANNEL_IF1_TO_SP0,
58 	FIFO_CHANNEL_SP0_TO_IF2,
59 	FIFO_CHANNEL_IF2_TO_SP0,
60 	FIFO_CHANNEL_SP0_TO_DMA0,
61 	FIFO_CHANNEL_DMA0_TO_SP0,
62 	FIFO_CHANNEL_SP0_TO_GDC0,
63 	FIFO_CHANNEL_GDC0_TO_SP0,
64 	FIFO_CHANNEL_SP0_TO_GDC1,
65 	FIFO_CHANNEL_GDC1_TO_SP0,
66 	FIFO_CHANNEL_SP0_TO_HOST0,
67 	FIFO_CHANNEL_HOST0_TO_SP0,
68 	FIFO_CHANNEL_SP0_TO_STREAM2MEM0,
69 	FIFO_CHANNEL_STREAM2MEM0_TO_SP0,
70 	FIFO_CHANNEL_SP0_TO_INPUT_SYSTEM0,
71 	FIFO_CHANNEL_INPUT_SYSTEM0_TO_SP0,
72 	/*
73 	 * No clue what this is
74 	 *
75 		FIFO_CHANNEL_SP0_TO_IRQ0,
76 		FIFO_CHANNEL_IRQ0_TO_SP0,
77 	 */
78 	N_FIFO_CHANNEL
79 } fifo_channel_t;
80 
81 struct fifo_channel_state_s {
82 	bool	src_valid;
83 	bool	fifo_accept;
84 	bool	fifo_valid;
85 	bool	sink_accept;
86 };
87 
88 /* The switch is tri-state */
89 struct fifo_switch_state_s {
90 	bool	is_none;
91 	bool	is_isp;
92 	bool	is_sp;
93 };
94 
95 struct fifo_monitor_state_s {
96 	struct fifo_channel_state_s	fifo_channels[N_FIFO_CHANNEL];
97 	struct fifo_switch_state_s	fifo_switches[N_FIFO_SWITCH];
98 };
99 
100 #endif /* __FIFO_MONITOR_LOCAL_H_INCLUDED__ */
101