~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/media/v4l2-fwnode.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/media/v4l2-fwnode.h (Version linux-6.11.5) and /include/media/v4l2-fwnode.h (Version linux-6.0.19)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                                  2 /*
  3  * V4L2 fwnode binding parsing library              3  * V4L2 fwnode binding parsing library
  4  *                                                  4  *
  5  * Copyright (c) 2016 Intel Corporation.            5  * Copyright (c) 2016 Intel Corporation.
  6  * Author: Sakari Ailus <sakari.ailus@linux.in      6  * Author: Sakari Ailus <sakari.ailus@linux.intel.com>
  7  *                                                  7  *
  8  * Copyright (C) 2012 - 2013 Samsung Electroni      8  * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
  9  * Author: Sylwester Nawrocki <s.nawrocki@sams      9  * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
 10  *                                                 10  *
 11  * Copyright (C) 2012 Renesas Electronics Corp     11  * Copyright (C) 2012 Renesas Electronics Corp.
 12  * Author: Guennadi Liakhovetski <g.liakhovets     12  * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
 13  */                                                13  */
 14 #ifndef _V4L2_FWNODE_H                             14 #ifndef _V4L2_FWNODE_H
 15 #define _V4L2_FWNODE_H                             15 #define _V4L2_FWNODE_H
 16                                                    16 
 17 #include <linux/errno.h>                           17 #include <linux/errno.h>
 18 #include <linux/fwnode.h>                          18 #include <linux/fwnode.h>
 19 #include <linux/list.h>                            19 #include <linux/list.h>
 20 #include <linux/types.h>                           20 #include <linux/types.h>
 21                                                    21 
 22 #include <media/v4l2-mediabus.h>                   22 #include <media/v4l2-mediabus.h>
 23                                                    23 
                                                   >>  24 struct fwnode_handle;
                                                   >>  25 struct v4l2_async_notifier;
                                                   >>  26 struct v4l2_async_subdev;
                                                   >>  27 
 24 /**                                                28 /**
 25  * struct v4l2_fwnode_endpoint - the endpoint      29  * struct v4l2_fwnode_endpoint - the endpoint data structure
 26  * @base: fwnode endpoint of the v4l2_fwnode       30  * @base: fwnode endpoint of the v4l2_fwnode
 27  * @bus_type: bus type                             31  * @bus_type: bus type
 28  * @bus: bus configuration data structure          32  * @bus: bus configuration data structure
 29  * @bus.parallel: embedded &struct v4l2_mbus_c     33  * @bus.parallel: embedded &struct v4l2_mbus_config_parallel.
 30  *                Used if the bus is parallel.     34  *                Used if the bus is parallel.
 31  * @bus.mipi_csi1: embedded &struct v4l2_mbus_     35  * @bus.mipi_csi1: embedded &struct v4l2_mbus_config_mipi_csi1.
 32  *                 Used if the bus is MIPI All     36  *                 Used if the bus is MIPI Alliance's Camera Serial
 33  *                 Interface version 1 (MIPI C     37  *                 Interface version 1 (MIPI CSI1) or Standard
 34  *                 Mobile Imaging Architecture     38  *                 Mobile Imaging Architecture's Compact Camera Port 2
 35  *                 (SMIA CCP2).                    39  *                 (SMIA CCP2).
 36  * @bus.mipi_csi2: embedded &struct v4l2_mbus_     40  * @bus.mipi_csi2: embedded &struct v4l2_mbus_config_mipi_csi2.
 37  *                 Used if the bus is MIPI All     41  *                 Used if the bus is MIPI Alliance's Camera Serial
 38  *                 Interface version 2 (MIPI C     42  *                 Interface version 2 (MIPI CSI2).
 39  * @link_frequencies: array of supported link      43  * @link_frequencies: array of supported link frequencies
 40  * @nr_of_link_frequencies: number of elements     44  * @nr_of_link_frequencies: number of elements in link_frequenccies array
 41  */                                                45  */
 42 struct v4l2_fwnode_endpoint {                      46 struct v4l2_fwnode_endpoint {
 43         struct fwnode_endpoint base;               47         struct fwnode_endpoint base;
                                                   >>  48         /*
                                                   >>  49          * Fields below this line will be zeroed by
                                                   >>  50          * v4l2_fwnode_endpoint_parse()
                                                   >>  51          */
 44         enum v4l2_mbus_type bus_type;              52         enum v4l2_mbus_type bus_type;
 45         struct {                                   53         struct {
 46                 struct v4l2_mbus_config_parall     54                 struct v4l2_mbus_config_parallel parallel;
 47                 struct v4l2_mbus_config_mipi_c     55                 struct v4l2_mbus_config_mipi_csi1 mipi_csi1;
 48                 struct v4l2_mbus_config_mipi_c     56                 struct v4l2_mbus_config_mipi_csi2 mipi_csi2;
 49         } bus;                                     57         } bus;
 50         u64 *link_frequencies;                     58         u64 *link_frequencies;
 51         unsigned int nr_of_link_frequencies;       59         unsigned int nr_of_link_frequencies;
 52 };                                                 60 };
 53                                                    61 
 54 /**                                                62 /**
 55  * V4L2_FWNODE_PROPERTY_UNSET - identify a non     63  * V4L2_FWNODE_PROPERTY_UNSET - identify a non initialized property
 56  *                                                 64  *
 57  * All properties in &struct v4l2_fwnode_devic     65  * All properties in &struct v4l2_fwnode_device_properties are initialized
 58  * to this value.                                  66  * to this value.
 59  */                                                67  */
 60 #define V4L2_FWNODE_PROPERTY_UNSET   (-1U)         68 #define V4L2_FWNODE_PROPERTY_UNSET   (-1U)
 61                                                    69 
 62 /**                                                70 /**
 63  * enum v4l2_fwnode_orientation - possible dev     71  * enum v4l2_fwnode_orientation - possible device orientation
 64  * @V4L2_FWNODE_ORIENTATION_FRONT: device inst     72  * @V4L2_FWNODE_ORIENTATION_FRONT: device installed on the front side
 65  * @V4L2_FWNODE_ORIENTATION_BACK: device insta     73  * @V4L2_FWNODE_ORIENTATION_BACK: device installed on the back side
 66  * @V4L2_FWNODE_ORIENTATION_EXTERNAL: device e     74  * @V4L2_FWNODE_ORIENTATION_EXTERNAL: device externally located
 67  */                                                75  */
 68 enum v4l2_fwnode_orientation {                     76 enum v4l2_fwnode_orientation {
 69         V4L2_FWNODE_ORIENTATION_FRONT,             77         V4L2_FWNODE_ORIENTATION_FRONT,
 70         V4L2_FWNODE_ORIENTATION_BACK,              78         V4L2_FWNODE_ORIENTATION_BACK,
 71         V4L2_FWNODE_ORIENTATION_EXTERNAL           79         V4L2_FWNODE_ORIENTATION_EXTERNAL
 72 };                                                 80 };
 73                                                    81 
 74 /**                                                82 /**
 75  * struct v4l2_fwnode_device_properties - fwno     83  * struct v4l2_fwnode_device_properties - fwnode device properties
 76  * @orientation: device orientation. See &enum     84  * @orientation: device orientation. See &enum v4l2_fwnode_orientation
 77  * @rotation: device rotation                      85  * @rotation: device rotation
 78  */                                                86  */
 79 struct v4l2_fwnode_device_properties {             87 struct v4l2_fwnode_device_properties {
 80         enum v4l2_fwnode_orientation orientati     88         enum v4l2_fwnode_orientation orientation;
 81         unsigned int rotation;                     89         unsigned int rotation;
 82 };                                                 90 };
 83                                                    91 
 84 /**                                                92 /**
 85  * struct v4l2_fwnode_link - a link between tw     93  * struct v4l2_fwnode_link - a link between two endpoints
 86  * @local_node: pointer to device_node of this     94  * @local_node: pointer to device_node of this endpoint
 87  * @local_port: identifier of the port this en     95  * @local_port: identifier of the port this endpoint belongs to
 88  * @local_id: identifier of the id this endpoi     96  * @local_id: identifier of the id this endpoint belongs to
 89  * @remote_node: pointer to device_node of the     97  * @remote_node: pointer to device_node of the remote endpoint
 90  * @remote_port: identifier of the port the re     98  * @remote_port: identifier of the port the remote endpoint belongs to
 91  * @remote_id: identifier of the id the remote     99  * @remote_id: identifier of the id the remote endpoint belongs to
 92  */                                               100  */
 93 struct v4l2_fwnode_link {                         101 struct v4l2_fwnode_link {
 94         struct fwnode_handle *local_node;         102         struct fwnode_handle *local_node;
 95         unsigned int local_port;                  103         unsigned int local_port;
 96         unsigned int local_id;                    104         unsigned int local_id;
 97         struct fwnode_handle *remote_node;        105         struct fwnode_handle *remote_node;
 98         unsigned int remote_port;                 106         unsigned int remote_port;
 99         unsigned int remote_id;                   107         unsigned int remote_id;
100 };                                                108 };
101                                                   109 
102 /**                                               110 /**
103  * enum v4l2_connector_type - connector type      111  * enum v4l2_connector_type - connector type
104  * @V4L2_CONN_UNKNOWN:   unknown connector typ    112  * @V4L2_CONN_UNKNOWN:   unknown connector type, no V4L2 connector configuration
105  * @V4L2_CONN_COMPOSITE: analog composite conn    113  * @V4L2_CONN_COMPOSITE: analog composite connector
106  * @V4L2_CONN_SVIDEO:    analog svideo connect    114  * @V4L2_CONN_SVIDEO:    analog svideo connector
107  */                                               115  */
108 enum v4l2_connector_type {                        116 enum v4l2_connector_type {
109         V4L2_CONN_UNKNOWN,                        117         V4L2_CONN_UNKNOWN,
110         V4L2_CONN_COMPOSITE,                      118         V4L2_CONN_COMPOSITE,
111         V4L2_CONN_SVIDEO,                         119         V4L2_CONN_SVIDEO,
112 };                                                120 };
113                                                   121 
114 /**                                               122 /**
115  * struct v4l2_connector_link - connector link    123  * struct v4l2_connector_link - connector link data structure
116  * @head: structure to be used to add the link    124  * @head: structure to be used to add the link to the
117  *        &struct v4l2_fwnode_connector           125  *        &struct v4l2_fwnode_connector
118  * @fwnode_link: &struct v4l2_fwnode_link link    126  * @fwnode_link: &struct v4l2_fwnode_link link between the connector and the
119  *               device the connector belongs     127  *               device the connector belongs to.
120  */                                               128  */
121 struct v4l2_connector_link {                      129 struct v4l2_connector_link {
122         struct list_head head;                    130         struct list_head head;
123         struct v4l2_fwnode_link fwnode_link;      131         struct v4l2_fwnode_link fwnode_link;
124 };                                                132 };
125                                                   133 
126 /**                                               134 /**
127  * struct v4l2_fwnode_connector_analog - analo    135  * struct v4l2_fwnode_connector_analog - analog connector data structure
128  * @sdtv_stds: sdtv standards this connector s    136  * @sdtv_stds: sdtv standards this connector supports, set to V4L2_STD_ALL
129  *             if no restrictions are specifie    137  *             if no restrictions are specified.
130  */                                               138  */
131 struct v4l2_fwnode_connector_analog {             139 struct v4l2_fwnode_connector_analog {
132         v4l2_std_id sdtv_stds;                    140         v4l2_std_id sdtv_stds;
133 };                                                141 };
134                                                   142 
135 /**                                               143 /**
136  * struct v4l2_fwnode_connector - the connecto    144  * struct v4l2_fwnode_connector - the connector data structure
137  * @name: the connector device name               145  * @name: the connector device name
138  * @label: optional connector label               146  * @label: optional connector label
139  * @type: connector type                          147  * @type: connector type
140  * @links: list of all connector &struct v4l2_    148  * @links: list of all connector &struct v4l2_connector_link links
141  * @nr_of_links: total number of links            149  * @nr_of_links: total number of links
142  * @connector: connector configuration            150  * @connector: connector configuration
143  * @connector.analog: analog connector configu    151  * @connector.analog: analog connector configuration
144  *                    &struct v4l2_fwnode_conn    152  *                    &struct v4l2_fwnode_connector_analog
145  */                                               153  */
146 struct v4l2_fwnode_connector {                    154 struct v4l2_fwnode_connector {
147         const char *name;                         155         const char *name;
148         const char *label;                        156         const char *label;
149         enum v4l2_connector_type type;            157         enum v4l2_connector_type type;
150         struct list_head links;                   158         struct list_head links;
151         unsigned int nr_of_links;                 159         unsigned int nr_of_links;
152                                                   160 
153         union {                                   161         union {
154                 struct v4l2_fwnode_connector_a    162                 struct v4l2_fwnode_connector_analog analog;
155                 /* future connectors */           163                 /* future connectors */
156         } connector;                              164         } connector;
157 };                                                165 };
158                                                   166 
159 /**                                               167 /**
160  * enum v4l2_fwnode_bus_type - Video bus types    168  * enum v4l2_fwnode_bus_type - Video bus types defined by firmware properties
161  * @V4L2_FWNODE_BUS_TYPE_GUESS: Default value     169  * @V4L2_FWNODE_BUS_TYPE_GUESS: Default value if no bus-type fwnode property
162  * @V4L2_FWNODE_BUS_TYPE_CSI2_CPHY: MIPI CSI-2    170  * @V4L2_FWNODE_BUS_TYPE_CSI2_CPHY: MIPI CSI-2 bus, C-PHY physical layer
163  * @V4L2_FWNODE_BUS_TYPE_CSI1: MIPI CSI-1 bus     171  * @V4L2_FWNODE_BUS_TYPE_CSI1: MIPI CSI-1 bus
164  * @V4L2_FWNODE_BUS_TYPE_CCP2: SMIA Compact Ca    172  * @V4L2_FWNODE_BUS_TYPE_CCP2: SMIA Compact Camera Port 2 bus
165  * @V4L2_FWNODE_BUS_TYPE_CSI2_DPHY: MIPI CSI-2    173  * @V4L2_FWNODE_BUS_TYPE_CSI2_DPHY: MIPI CSI-2 bus, D-PHY physical layer
166  * @V4L2_FWNODE_BUS_TYPE_PARALLEL: Camera Para    174  * @V4L2_FWNODE_BUS_TYPE_PARALLEL: Camera Parallel Interface bus
167  * @V4L2_FWNODE_BUS_TYPE_BT656: BT.656 video f    175  * @V4L2_FWNODE_BUS_TYPE_BT656: BT.656 video format bus-type
168  * @V4L2_FWNODE_BUS_TYPE_DPI: Video Parallel I    176  * @V4L2_FWNODE_BUS_TYPE_DPI: Video Parallel Interface bus
169  * @NR_OF_V4L2_FWNODE_BUS_TYPE: Number of bus-    177  * @NR_OF_V4L2_FWNODE_BUS_TYPE: Number of bus-types
170  */                                               178  */
171 enum v4l2_fwnode_bus_type {                       179 enum v4l2_fwnode_bus_type {
172         V4L2_FWNODE_BUS_TYPE_GUESS = 0,           180         V4L2_FWNODE_BUS_TYPE_GUESS = 0,
173         V4L2_FWNODE_BUS_TYPE_CSI2_CPHY,           181         V4L2_FWNODE_BUS_TYPE_CSI2_CPHY,
174         V4L2_FWNODE_BUS_TYPE_CSI1,                182         V4L2_FWNODE_BUS_TYPE_CSI1,
175         V4L2_FWNODE_BUS_TYPE_CCP2,                183         V4L2_FWNODE_BUS_TYPE_CCP2,
176         V4L2_FWNODE_BUS_TYPE_CSI2_DPHY,           184         V4L2_FWNODE_BUS_TYPE_CSI2_DPHY,
177         V4L2_FWNODE_BUS_TYPE_PARALLEL,            185         V4L2_FWNODE_BUS_TYPE_PARALLEL,
178         V4L2_FWNODE_BUS_TYPE_BT656,               186         V4L2_FWNODE_BUS_TYPE_BT656,
179         V4L2_FWNODE_BUS_TYPE_DPI,                 187         V4L2_FWNODE_BUS_TYPE_DPI,
180         NR_OF_V4L2_FWNODE_BUS_TYPE                188         NR_OF_V4L2_FWNODE_BUS_TYPE
181 };                                                189 };
182                                                   190 
183 /**                                               191 /**
184  * v4l2_fwnode_endpoint_parse() - parse all fw    192  * v4l2_fwnode_endpoint_parse() - parse all fwnode node properties
185  * @fwnode: pointer to the endpoint's fwnode h    193  * @fwnode: pointer to the endpoint's fwnode handle
186  * @vep: pointer to the V4L2 fwnode data struc    194  * @vep: pointer to the V4L2 fwnode data structure
187  *                                                195  *
188  * This function parses the V4L2 fwnode endpoi    196  * This function parses the V4L2 fwnode endpoint specific parameters from the
189  * firmware. There are two ways to use this fu    197  * firmware. There are two ways to use this function, either by letting it
190  * obtain the type of the bus (by setting the     198  * obtain the type of the bus (by setting the @vep.bus_type field to
191  * V4L2_MBUS_UNKNOWN) or specifying the bus ty    199  * V4L2_MBUS_UNKNOWN) or specifying the bus type explicitly to one of the &enum
192  * v4l2_mbus_type types.                          200  * v4l2_mbus_type types.
193  *                                                201  *
194  * When @vep.bus_type is V4L2_MBUS_UNKNOWN, th    202  * When @vep.bus_type is V4L2_MBUS_UNKNOWN, the function will use the "bus-type"
195  * property to determine the type when it is a    203  * property to determine the type when it is available. The caller is
196  * responsible for validating the contents of     204  * responsible for validating the contents of @vep.bus_type field after the call
197  * returns.                                       205  * returns.
198  *                                                206  *
199  * As a deprecated functionality to support ol    207  * As a deprecated functionality to support older DT bindings without "bus-type"
200  * property for devices that support multiple     208  * property for devices that support multiple types, if the "bus-type" property
201  * does not exist, the function will attempt t    209  * does not exist, the function will attempt to guess the type based on the
202  * endpoint properties available. NEVER RELY O    210  * endpoint properties available. NEVER RELY ON GUESSING THE BUS TYPE IN NEW
203  * DRIVERS OR BINDINGS.                           211  * DRIVERS OR BINDINGS.
204  *                                                212  *
205  * It is also possible to set @vep.bus_type co    213  * It is also possible to set @vep.bus_type corresponding to an actual bus. In
206  * this case the function will only attempt to    214  * this case the function will only attempt to parse properties related to this
207  * bus, and it will return an error if the val    215  * bus, and it will return an error if the value of the "bus-type" property
208  * corresponds to a different bus.                216  * corresponds to a different bus.
209  *                                                217  *
210  * The caller is required to initialise all fi    218  * The caller is required to initialise all fields of @vep, either with
211  * explicitly values, or by zeroing them.         219  * explicitly values, or by zeroing them.
212  *                                                220  *
213  * The function does not change the V4L2 fwnod    221  * The function does not change the V4L2 fwnode endpoint state if it fails.
214  *                                                222  *
215  * NOTE: This function does not parse "link-fr    223  * NOTE: This function does not parse "link-frequencies" property as its size is
216  * not known in advance. Please use v4l2_fwnod    224  * not known in advance. Please use v4l2_fwnode_endpoint_alloc_parse() if you
217  * need properties of variable size.              225  * need properties of variable size.
218  *                                                226  *
219  * Return: %0 on success or a negative error c    227  * Return: %0 on success or a negative error code on failure:
220  *         %-ENOMEM on memory allocation failu    228  *         %-ENOMEM on memory allocation failure
221  *         %-EINVAL on parsing failure            229  *         %-EINVAL on parsing failure
222  *         %-ENXIO on mismatching bus types       230  *         %-ENXIO on mismatching bus types
223  */                                               231  */
224 int v4l2_fwnode_endpoint_parse(struct fwnode_h    232 int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
225                                struct v4l2_fwn    233                                struct v4l2_fwnode_endpoint *vep);
226                                                   234 
227 /**                                               235 /**
228  * v4l2_fwnode_endpoint_free() - free the V4L2    236  * v4l2_fwnode_endpoint_free() - free the V4L2 fwnode acquired by
229  * v4l2_fwnode_endpoint_alloc_parse()             237  * v4l2_fwnode_endpoint_alloc_parse()
230  * @vep: the V4L2 fwnode the resources of whic    238  * @vep: the V4L2 fwnode the resources of which are to be released
231  *                                                239  *
232  * It is safe to call this function with NULL     240  * It is safe to call this function with NULL argument or on a V4L2 fwnode the
233  * parsing of which failed.                       241  * parsing of which failed.
234  */                                               242  */
235 void v4l2_fwnode_endpoint_free(struct v4l2_fwn    243 void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
236                                                   244 
237 /**                                               245 /**
238  * v4l2_fwnode_endpoint_alloc_parse() - parse     246  * v4l2_fwnode_endpoint_alloc_parse() - parse all fwnode node properties
239  * @fwnode: pointer to the endpoint's fwnode h    247  * @fwnode: pointer to the endpoint's fwnode handle
240  * @vep: pointer to the V4L2 fwnode data struc    248  * @vep: pointer to the V4L2 fwnode data structure
241  *                                                249  *
242  * This function parses the V4L2 fwnode endpoi    250  * This function parses the V4L2 fwnode endpoint specific parameters from the
243  * firmware. There are two ways to use this fu    251  * firmware. There are two ways to use this function, either by letting it
244  * obtain the type of the bus (by setting the     252  * obtain the type of the bus (by setting the @vep.bus_type field to
245  * V4L2_MBUS_UNKNOWN) or specifying the bus ty    253  * V4L2_MBUS_UNKNOWN) or specifying the bus type explicitly to one of the &enum
246  * v4l2_mbus_type types.                          254  * v4l2_mbus_type types.
247  *                                                255  *
248  * When @vep.bus_type is V4L2_MBUS_UNKNOWN, th    256  * When @vep.bus_type is V4L2_MBUS_UNKNOWN, the function will use the "bus-type"
249  * property to determine the type when it is a    257  * property to determine the type when it is available. The caller is
250  * responsible for validating the contents of     258  * responsible for validating the contents of @vep.bus_type field after the call
251  * returns.                                       259  * returns.
252  *                                                260  *
253  * As a deprecated functionality to support ol    261  * As a deprecated functionality to support older DT bindings without "bus-type"
254  * property for devices that support multiple     262  * property for devices that support multiple types, if the "bus-type" property
255  * does not exist, the function will attempt t    263  * does not exist, the function will attempt to guess the type based on the
256  * endpoint properties available. NEVER RELY O    264  * endpoint properties available. NEVER RELY ON GUESSING THE BUS TYPE IN NEW
257  * DRIVERS OR BINDINGS.                           265  * DRIVERS OR BINDINGS.
258  *                                                266  *
259  * It is also possible to set @vep.bus_type co    267  * It is also possible to set @vep.bus_type corresponding to an actual bus. In
260  * this case the function will only attempt to    268  * this case the function will only attempt to parse properties related to this
261  * bus, and it will return an error if the val    269  * bus, and it will return an error if the value of the "bus-type" property
262  * corresponds to a different bus.                270  * corresponds to a different bus.
263  *                                                271  *
264  * The caller is required to initialise all fi    272  * The caller is required to initialise all fields of @vep, either with
265  * explicitly values, or by zeroing them.         273  * explicitly values, or by zeroing them.
266  *                                                274  *
267  * The function does not change the V4L2 fwnod    275  * The function does not change the V4L2 fwnode endpoint state if it fails.
268  *                                                276  *
269  * v4l2_fwnode_endpoint_alloc_parse() has two     277  * v4l2_fwnode_endpoint_alloc_parse() has two important differences to
270  * v4l2_fwnode_endpoint_parse():                  278  * v4l2_fwnode_endpoint_parse():
271  *                                                279  *
272  * 1. It also parses variable size data.          280  * 1. It also parses variable size data.
273  *                                                281  *
274  * 2. The memory it has allocated to store the    282  * 2. The memory it has allocated to store the variable size data must be freed
275  *    using v4l2_fwnode_endpoint_free() when n    283  *    using v4l2_fwnode_endpoint_free() when no longer needed.
276  *                                                284  *
277  * Return: %0 on success or a negative error c    285  * Return: %0 on success or a negative error code on failure:
278  *         %-ENOMEM on memory allocation failu    286  *         %-ENOMEM on memory allocation failure
279  *         %-EINVAL on parsing failure            287  *         %-EINVAL on parsing failure
280  *         %-ENXIO on mismatching bus types       288  *         %-ENXIO on mismatching bus types
281  */                                               289  */
282 int v4l2_fwnode_endpoint_alloc_parse(struct fw    290 int v4l2_fwnode_endpoint_alloc_parse(struct fwnode_handle *fwnode,
283                                      struct v4    291                                      struct v4l2_fwnode_endpoint *vep);
284                                                   292 
285 /**                                               293 /**
286  * v4l2_fwnode_parse_link() - parse a link bet    294  * v4l2_fwnode_parse_link() - parse a link between two endpoints
287  * @fwnode: pointer to the endpoint's fwnode a    295  * @fwnode: pointer to the endpoint's fwnode at the local end of the link
288  * @link: pointer to the V4L2 fwnode link data    296  * @link: pointer to the V4L2 fwnode link data structure
289  *                                                297  *
290  * Fill the link structure with the local and     298  * Fill the link structure with the local and remote nodes and port numbers.
291  * The local_node and remote_node fields are s    299  * The local_node and remote_node fields are set to point to the local and
292  * remote port's parent nodes respectively (th    300  * remote port's parent nodes respectively (the port parent node being the
293  * parent node of the port node if that node i    301  * parent node of the port node if that node isn't a 'ports' node, or the
294  * grand-parent node of the port node otherwis    302  * grand-parent node of the port node otherwise).
295  *                                                303  *
296  * A reference is taken to both the local and     304  * A reference is taken to both the local and remote nodes, the caller must use
297  * v4l2_fwnode_put_link() to drop the referenc    305  * v4l2_fwnode_put_link() to drop the references when done with the
298  * link.                                          306  * link.
299  *                                                307  *
300  * Return: 0 on success, or -ENOLINK if the re    308  * Return: 0 on success, or -ENOLINK if the remote endpoint fwnode can't be
301  * found.                                         309  * found.
302  */                                               310  */
303 int v4l2_fwnode_parse_link(struct fwnode_handl    311 int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
304                            struct v4l2_fwnode_    312                            struct v4l2_fwnode_link *link);
305                                                   313 
306 /**                                               314 /**
307  * v4l2_fwnode_put_link() - drop references to    315  * v4l2_fwnode_put_link() - drop references to nodes in a link
308  * @link: pointer to the V4L2 fwnode link data    316  * @link: pointer to the V4L2 fwnode link data structure
309  *                                                317  *
310  * Drop references to the local and remote nod    318  * Drop references to the local and remote nodes in the link. This function
311  * must be called on every link parsed with v4    319  * must be called on every link parsed with v4l2_fwnode_parse_link().
312  */                                               320  */
313 void v4l2_fwnode_put_link(struct v4l2_fwnode_l    321 void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link);
314                                                   322 
315 /**                                               323 /**
316  * v4l2_fwnode_connector_free() - free the V4L    324  * v4l2_fwnode_connector_free() - free the V4L2 connector acquired memory
317  * @connector: the V4L2 connector resources of    325  * @connector: the V4L2 connector resources of which are to be released
318  *                                                326  *
319  * Free all allocated memory and put all links    327  * Free all allocated memory and put all links acquired by
320  * v4l2_fwnode_connector_parse() and v4l2_fwno    328  * v4l2_fwnode_connector_parse() and v4l2_fwnode_connector_add_link().
321  *                                                329  *
322  * It is safe to call this function with NULL     330  * It is safe to call this function with NULL argument or on a V4L2 connector
323  * the parsing of which failed.                   331  * the parsing of which failed.
324  */                                               332  */
325 void v4l2_fwnode_connector_free(struct v4l2_fw    333 void v4l2_fwnode_connector_free(struct v4l2_fwnode_connector *connector);
326                                                   334 
327 /**                                               335 /**
328  * v4l2_fwnode_connector_parse() - initialize     336  * v4l2_fwnode_connector_parse() - initialize the 'struct v4l2_fwnode_connector'
329  * @fwnode: pointer to the subdev endpoint's f    337  * @fwnode: pointer to the subdev endpoint's fwnode handle where the connector
330  *          is connected to or to the connecto    338  *          is connected to or to the connector endpoint fwnode handle.
331  * @connector: pointer to the V4L2 fwnode conn    339  * @connector: pointer to the V4L2 fwnode connector data structure
332  *                                                340  *
333  * Fill the &struct v4l2_fwnode_connector with    341  * Fill the &struct v4l2_fwnode_connector with the connector type, label and
334  * all &enum v4l2_connector_type specific conn    342  * all &enum v4l2_connector_type specific connector data. The label is optional
335  * so it is set to %NULL if no one was found.     343  * so it is set to %NULL if no one was found. The function initialize the links
336  * to zero. Adding links to the connector is d    344  * to zero. Adding links to the connector is done by calling
337  * v4l2_fwnode_connector_add_link().              345  * v4l2_fwnode_connector_add_link().
338  *                                                346  *
339  * The memory allocated for the label must be     347  * The memory allocated for the label must be freed when no longer needed.
340  * Freeing the memory is done by v4l2_fwnode_c    348  * Freeing the memory is done by v4l2_fwnode_connector_free().
341  *                                                349  *
342  * Return:                                        350  * Return:
343  * * %0 on success or a negative error code on    351  * * %0 on success or a negative error code on failure:
344  * * %-EINVAL if @fwnode is invalid               352  * * %-EINVAL if @fwnode is invalid
345  * * %-ENOTCONN if connector type is unknown o    353  * * %-ENOTCONN if connector type is unknown or connector device can't be found
346  */                                               354  */
347 int v4l2_fwnode_connector_parse(struct fwnode_    355 int v4l2_fwnode_connector_parse(struct fwnode_handle *fwnode,
348                                 struct v4l2_fw    356                                 struct v4l2_fwnode_connector *connector);
349                                                   357 
350 /**                                               358 /**
351  * v4l2_fwnode_connector_add_link - add a link    359  * v4l2_fwnode_connector_add_link - add a link between a connector node and
352  *                                  a v4l2-sub    360  *                                  a v4l2-subdev node.
353  * @fwnode: pointer to the subdev endpoint's f    361  * @fwnode: pointer to the subdev endpoint's fwnode handle where the connector
354  *          is connected to                       362  *          is connected to
355  * @connector: pointer to the V4L2 fwnode conn    363  * @connector: pointer to the V4L2 fwnode connector data structure
356  *                                                364  *
357  * Add a new &struct v4l2_connector_link link     365  * Add a new &struct v4l2_connector_link link to the
358  * &struct v4l2_fwnode_connector connector lin    366  * &struct v4l2_fwnode_connector connector links list. The link local_node
359  * points to the connector node, the remote_no    367  * points to the connector node, the remote_node to the host v4l2 (sub)dev.
360  *                                                368  *
361  * The taken references to remote_node and loc    369  * The taken references to remote_node and local_node must be dropped and the
362  * allocated memory must be freed when no long    370  * allocated memory must be freed when no longer needed. Both is done by calling
363  * v4l2_fwnode_connector_free().                  371  * v4l2_fwnode_connector_free().
364  *                                                372  *
365  * Return:                                        373  * Return:
366  * * %0 on success or a negative error code on    374  * * %0 on success or a negative error code on failure:
367  * * %-EINVAL if @fwnode or @connector is inva    375  * * %-EINVAL if @fwnode or @connector is invalid or @connector type is unknown
368  * * %-ENOMEM on link memory allocation failur    376  * * %-ENOMEM on link memory allocation failure
369  * * %-ENOTCONN if remote connector device can    377  * * %-ENOTCONN if remote connector device can't be found
370  * * %-ENOLINK if link parsing between v4l2 (s    378  * * %-ENOLINK if link parsing between v4l2 (sub)dev and connector fails
371  */                                               379  */
372 int v4l2_fwnode_connector_add_link(struct fwno    380 int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode,
373                                    struct v4l2    381                                    struct v4l2_fwnode_connector *connector);
374                                                   382 
375 /**                                               383 /**
376  * v4l2_fwnode_device_parse() - parse fwnode d    384  * v4l2_fwnode_device_parse() - parse fwnode device properties
377  * @dev: pointer to &struct device                385  * @dev: pointer to &struct device
378  * @props: pointer to &struct v4l2_fwnode_devi    386  * @props: pointer to &struct v4l2_fwnode_device_properties where to store the
379  *         parsed properties values               387  *         parsed properties values
380  *                                                388  *
381  * This function parses and validates the V4L2    389  * This function parses and validates the V4L2 fwnode device properties from the
382  * firmware interface, and fills the @struct v    390  * firmware interface, and fills the @struct v4l2_fwnode_device_properties
383  * provided by the caller.                        391  * provided by the caller.
384  *                                                392  *
385  * Return:                                        393  * Return:
386  *      % 0 on success                            394  *      % 0 on success
387  *      %-EINVAL if a parsed property value is    395  *      %-EINVAL if a parsed property value is not valid
388  */                                               396  */
389 int v4l2_fwnode_device_parse(struct device *de    397 int v4l2_fwnode_device_parse(struct device *dev,
390                              struct v4l2_fwnod    398                              struct v4l2_fwnode_device_properties *props);
                                                   >> 399 
                                                   >> 400 /**
                                                   >> 401  * typedef parse_endpoint_func - Driver's callback function to be called on
                                                   >> 402  *      each V4L2 fwnode endpoint.
                                                   >> 403  *
                                                   >> 404  * @dev: pointer to &struct device
                                                   >> 405  * @vep: pointer to &struct v4l2_fwnode_endpoint
                                                   >> 406  * @asd: pointer to &struct v4l2_async_subdev
                                                   >> 407  *
                                                   >> 408  * Return:
                                                   >> 409  * * %0 on success
                                                   >> 410  * * %-ENOTCONN if the endpoint is to be skipped but this
                                                   >> 411  *   should not be considered as an error
                                                   >> 412  * * %-EINVAL if the endpoint configuration is invalid
                                                   >> 413  */
                                                   >> 414 typedef int (*parse_endpoint_func)(struct device *dev,
                                                   >> 415                                   struct v4l2_fwnode_endpoint *vep,
                                                   >> 416                                   struct v4l2_async_subdev *asd);
                                                   >> 417 
                                                   >> 418 /**
                                                   >> 419  * v4l2_async_nf_parse_fwnode_endpoints - Parse V4L2 fwnode endpoints in a
                                                   >> 420  *                                              device node
                                                   >> 421  * @dev: the device the endpoints of which are to be parsed
                                                   >> 422  * @notifier: notifier for @dev
                                                   >> 423  * @asd_struct_size: size of the driver's async sub-device struct, including
                                                   >> 424  *                   sizeof(struct v4l2_async_subdev). The &struct
                                                   >> 425  *                   v4l2_async_subdev shall be the first member of
                                                   >> 426  *                   the driver's async sub-device struct, i.e. both
                                                   >> 427  *                   begin at the same memory address.
                                                   >> 428  * @parse_endpoint: Driver's callback function called on each V4L2 fwnode
                                                   >> 429  *                  endpoint. Optional.
                                                   >> 430  *
                                                   >> 431  * DEPRECATED! This function is deprecated. Don't use it in new drivers.
                                                   >> 432  * Instead see an example in cio2_parse_firmware() function in
                                                   >> 433  * drivers/media/pci/intel/ipu3/ipu3-cio2.c .
                                                   >> 434  *
                                                   >> 435  * Parse the fwnode endpoints of the @dev device and populate the async sub-
                                                   >> 436  * devices list in the notifier. The @parse_endpoint callback function is
                                                   >> 437  * called for each endpoint with the corresponding async sub-device pointer to
                                                   >> 438  * let the caller initialize the driver-specific part of the async sub-device
                                                   >> 439  * structure.
                                                   >> 440  *
                                                   >> 441  * The notifier memory shall be zeroed before this function is called on the
                                                   >> 442  * notifier.
                                                   >> 443  *
                                                   >> 444  * This function may not be called on a registered notifier and may be called on
                                                   >> 445  * a notifier only once.
                                                   >> 446  *
                                                   >> 447  * The &struct v4l2_fwnode_endpoint passed to the callback function
                                                   >> 448  * @parse_endpoint is released once the function is finished. If there is a need
                                                   >> 449  * to retain that configuration, the user needs to allocate memory for it.
                                                   >> 450  *
                                                   >> 451  * Any notifier populated using this function must be released with a call to
                                                   >> 452  * v4l2_async_nf_cleanup() after it has been unregistered and the async
                                                   >> 453  * sub-devices are no longer in use, even if the function returned an error.
                                                   >> 454  *
                                                   >> 455  * Return: %0 on success, including when no async sub-devices are found
                                                   >> 456  *         %-ENOMEM if memory allocation failed
                                                   >> 457  *         %-EINVAL if graph or endpoint parsing failed
                                                   >> 458  *         Other error codes as returned by @parse_endpoint
                                                   >> 459  */
                                                   >> 460 int
                                                   >> 461 v4l2_async_nf_parse_fwnode_endpoints(struct device *dev,
                                                   >> 462                                      struct v4l2_async_notifier *notifier,
                                                   >> 463                                      size_t asd_struct_size,
                                                   >> 464                                      parse_endpoint_func parse_endpoint);
391                                                   465 
392 /* Helper macros to access the connector links    466 /* Helper macros to access the connector links. */
393                                                   467 
394 /** v4l2_connector_last_link - Helper macro to    468 /** v4l2_connector_last_link - Helper macro to get the first
395  *                             &struct v4l2_fw    469  *                             &struct v4l2_fwnode_connector link
396  * @v4l2c: &struct v4l2_fwnode_connector ownin    470  * @v4l2c: &struct v4l2_fwnode_connector owning the connector links
397  *                                                471  *
398  * This marco returns the first added &struct     472  * This marco returns the first added &struct v4l2_connector_link connector
399  * link or @NULL if the connector has no links    473  * link or @NULL if the connector has no links.
400  */                                               474  */
401 #define v4l2_connector_first_link(v4l2c)          475 #define v4l2_connector_first_link(v4l2c)                                       \
402         list_first_entry_or_null(&(v4l2c)->lin    476         list_first_entry_or_null(&(v4l2c)->links,                              \
403                                  struct v4l2_c    477                                  struct v4l2_connector_link, head)
404                                                   478 
405 /** v4l2_connector_last_link - Helper macro to    479 /** v4l2_connector_last_link - Helper macro to get the last
406  *                             &struct v4l2_fw    480  *                             &struct v4l2_fwnode_connector link
407  * @v4l2c: &struct v4l2_fwnode_connector ownin    481  * @v4l2c: &struct v4l2_fwnode_connector owning the connector links
408  *                                                482  *
409  * This marco returns the last &struct v4l2_co    483  * This marco returns the last &struct v4l2_connector_link added connector link.
410  */                                               484  */
411 #define v4l2_connector_last_link(v4l2c)           485 #define v4l2_connector_last_link(v4l2c)                                        \
412         list_last_entry(&(v4l2c)->links, struc    486         list_last_entry(&(v4l2c)->links, struct v4l2_connector_link, head)
413                                                   487 
414 #endif /* _V4L2_FWNODE_H */                       488 #endif /* _V4L2_FWNODE_H */
415                                                   489 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php