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