~ [ 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-4.16.18)


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

~ [ 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