1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Broadcom BCM2835 V4L2 driver
4  *
5  * Copyright © 2013 Raspberry Pi (Trading) Ltd.
6  *
7  * Authors: Vincent Sanders @ Collabora
8  *          Dave Stevenson @ Broadcom
9  *		(now dave.stevenson@raspberrypi.org)
10  *          Simon Mellor @ Broadcom
11  *          Luke Diamand @ Broadcom
12  */
13 
14 /* MMAL_PORT_TYPE_T */
15 enum mmal_port_type {
16 	MMAL_PORT_TYPE_UNKNOWN = 0,	/* Unknown port type */
17 	MMAL_PORT_TYPE_CONTROL,		/* Control port */
18 	MMAL_PORT_TYPE_INPUT,		/* Input port */
19 	MMAL_PORT_TYPE_OUTPUT,		/* Output port */
20 	MMAL_PORT_TYPE_CLOCK,		/* Clock port */
21 };
22 
23 /* The port is pass-through and doesn't need buffer headers allocated */
24 #define MMAL_PORT_CAPABILITY_PASSTHROUGH                       0x01
25 /*
26  *The port wants to allocate the buffer payloads.
27  * This signals a preference that payload allocation should be done
28  * on this port for efficiency reasons.
29  */
30 #define MMAL_PORT_CAPABILITY_ALLOCATION                        0x02
31 /*
32  * The port supports format change events.
33  * This applies to input ports and is used to let the client know
34  * whether the port supports being reconfigured via a format
35  * change event (i.e. without having to disable the port).
36  */
37 #define MMAL_PORT_CAPABILITY_SUPPORTS_EVENT_FORMAT_CHANGE      0x04
38 
39 /*
40  * mmal port structure (MMAL_PORT_T)
41  *
42  * most elements are informational only, the pointer values for
43  * interogation messages are generally provided as additional
44  * structures within the message. When used to set values only the
45  * buffer_num, buffer_size and userdata parameters are writable.
46  */
47 struct mmal_port {
48 	u32 priv;	/* Private member used by the framework */
49 	u32 name;	/* Port name. Used for debugging purposes (RO) */
50 
51 	u32 type;	/* Type of the port (RO) enum mmal_port_type */
52 	u16 index;	/* Index of the port in its type list (RO) */
53 	u16 index_all;	/* Index of the port in the list of all ports (RO) */
54 
55 	u32 is_enabled;	/* Indicates whether the port is enabled or not (RO) */
56 	u32 format;	/* Format of the elementary stream */
57 
58 	u32 buffer_num_min;	/* Minimum number of buffers the port
59 				 *   requires (RO).  This is set by the
60 				 *   component.
61 				 */
62 
63 	u32 buffer_size_min;	/* Minimum size of buffers the port
64 				 * requires (RO).  This is set by the
65 				 * component.
66 				 */
67 
68 	u32 buffer_alignment_min;/* Minimum alignment requirement for
69 				  * the buffers (RO).  A value of
70 				  * zero means no special alignment
71 				  * requirements.  This is set by the
72 				  * component.
73 				  */
74 
75 	u32 buffer_num_recommended;	/* Number of buffers the port
76 					 * recommends for optimal
77 					 * performance (RO).  A value of
78 					 * zero means no special
79 					 * recommendation.  This is set
80 					 * by the component.
81 					 */
82 
83 	u32 buffer_size_recommended;	/* Size of buffers the port
84 					 * recommends for optimal
85 					 * performance (RO).  A value of
86 					 * zero means no special
87 					 * recommendation.  This is set
88 					 * by the component.
89 					 */
90 
91 	u32 buffer_num;	/* Actual number of buffers the port will use.
92 			 * This is set by the client.
93 			 */
94 
95 	u32 buffer_size; /* Actual maximum size of the buffers that
96 			  * will be sent to the port. This is set by
97 			  * the client.
98 			  */
99 
100 	u32 component;	/* Component this port belongs to (Read Only) */
101 
102 	u32 userdata;	/* Field reserved for use by the client */
103 
104 	u32 capabilities;	/* Flags describing the capabilities of a
105 				 * port (RO).  Bitwise combination of \ref
106 				 * portcapabilities "Port capabilities"
107 				 * values.
108 				 */
109 };
110