Lines Matching +full:dt +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0-only
5 #include <linux/media-bus-format.h>
20 * A set of helper functions to aid DRM drivers in parsing standard DT
25 * drm_of_crtc_port_mask - find the mask of a registered CRTC by port OF node
27 * @port: port OF node
29 * Given a port OF node, return the possible mask of the corresponding
39 if (tmp->port == port) in drm_of_crtc_port_mask()
50 * drm_of_find_possible_crtcs - find the possible CRTCs for an encoder port
83 * drm_of_component_match_add - Add a component helper OF node match rule
87 * @node: of_node
92 struct device_node *node) in drm_of_component_match_add() argument
94 of_node_get(node); in drm_of_component_match_add()
96 compare, node); in drm_of_component_match_add()
101 * drm_of_component_probe - Generic probe function for a component based master
102 * @dev: master device containing the OF node
106 * Parse the platform device OF node and bind all the components associated
121 if (!dev->of_node) in drm_of_component_probe()
122 return -EINVAL; in drm_of_component_probe()
129 port = of_parse_phandle(dev->of_node, "ports", i); in drm_of_component_probe()
133 if (of_device_is_available(port->parent)) in drm_of_component_probe()
142 return -ENODEV; in drm_of_component_probe()
147 return -ENODEV; in drm_of_component_probe()
154 port = of_parse_phandle(dev->of_node, "ports", i); in drm_of_component_probe()
158 if (!of_device_is_available(port->parent)) { in drm_of_component_probe()
168 } else if (!of_device_is_available(remote->parent)) { in drm_of_component_probe()
187 * drm_of_encoder_active_endpoint - return the active encoder endpoint
188 * @node: device tree node containing encoder input ports
191 * Given an encoder device node and a drm_encoder with a connected crtc,
194 int drm_of_encoder_active_endpoint(struct device_node *node, in drm_of_encoder_active_endpoint() argument
199 struct drm_crtc *crtc = encoder->crtc; in drm_of_encoder_active_endpoint()
203 if (!node || !crtc) in drm_of_encoder_active_endpoint()
204 return -EINVAL; in drm_of_encoder_active_endpoint()
206 for_each_endpoint_of_node(node, ep) { in drm_of_encoder_active_endpoint()
209 if (port == crtc->port) { in drm_of_encoder_active_endpoint()
216 return -EINVAL; in drm_of_encoder_active_endpoint()
221 * drm_of_find_panel_or_bridge - return connected panel or bridge device
222 * @np: device tree node containing encoder output ports
223 * @port: port in the device tree node
224 * @endpoint: endpoint in the device tree node
228 * Given a DT node's port and endpoint number, find the connected node and
242 int ret = -EPROBE_DEFER; in drm_of_find_panel_or_bridge()
246 return -EINVAL; in drm_of_find_panel_or_bridge()
252 * node isn't found and the absence of the port is a legit case here, in drm_of_find_panel_or_bridge()
254 * device-tree node. in drm_of_find_panel_or_bridge()
257 return -ENODEV; in drm_of_find_panel_or_bridge()
261 return -ENODEV; in drm_of_find_panel_or_bridge()
296 of_property_read_bool(port_node, "dual-lvds-even-pixels"); in drm_of_lvds_get_port_pixels_type()
298 of_property_read_bool(port_node, "dual-lvds-odd-pixels"); in drm_of_lvds_get_port_pixels_type()
308 int pixels_type = -EPIPE; in drm_of_lvds_get_remote_pixels_type()
320 return -EPIPE; in drm_of_lvds_get_remote_pixels_type()
331 * support multiple sinks with different dual-link in drm_of_lvds_get_remote_pixels_type()
337 return -EINVAL; in drm_of_lvds_get_remote_pixels_type()
347 * A valid dual-lVDS bus is found when one port is marked with in __drm_of_lvds_get_dual_link_pixel_order()
348 * "dual-lvds-even-pixels", and the other port is marked with in __drm_of_lvds_get_dual_link_pixel_order()
349 * "dual-lvds-odd-pixels", bail out if the markers are not right. in __drm_of_lvds_get_dual_link_pixel_order()
352 return -EINVAL; in __drm_of_lvds_get_dual_link_pixel_order()
360 * drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link source pixel order
361 * @port1: First DT port node of the Dual-link LVDS source
362 * @port2: Second DT port node of the Dual-link LVDS source
364 * An LVDS dual-link connection is made of two links, with even pixels
366 * returns, for two ports of an LVDS dual-link source, which port shall transmit
369 * The pixel order is determined from the dual-lvds-even-pixels and
370 * dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
372 * returns -EINVAL.
374 * If either port is not connected, this function returns -EPIPE.
376 * @port1 and @port2 are typically DT sibling nodes, but may have different
381 * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 carries even pixels and @port2
383 * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 carries odd pixels and @port2
385 * * -EINVAL - @port1 and @port2 are not connected to a dual-link LVDS sink, or
387 * * -EPIPE - when @port1 or @port2 are not connected
395 return -EINVAL; in drm_of_lvds_get_dual_link_pixel_order()
410 * drm_of_lvds_get_dual_link_pixel_order_sink - Get LVDS dual-link sink pixel order
411 * @port1: First DT port node of the Dual-link LVDS sink
412 * @port2: Second DT port node of the Dual-link LVDS sink
414 * An LVDS dual-link connection is made of two links, with even pixels
416 * returns, for two ports of an LVDS dual-link sink, which port shall transmit
419 * The pixel order is determined from the dual-lvds-even-pixels and
420 * dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
422 * returns -EINVAL.
424 * If either port is not connected, this function returns -EPIPE.
426 * @port1 and @port2 are typically DT sibling nodes, but may have different
431 * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 receives even pixels and @port2
433 * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 receives odd pixels and @port2
435 * * -EINVAL - @port1 or @port2 are NULL
436 * * -EPIPE - when @port1 or @port2 are not connected
444 return -EINVAL; in drm_of_lvds_get_dual_link_pixel_order_sink()
448 return -EPIPE; in drm_of_lvds_get_dual_link_pixel_order_sink()
452 return -EPIPE; in drm_of_lvds_get_dual_link_pixel_order_sink()
459 * drm_of_lvds_get_data_mapping - Get LVDS data mapping
460 * @port: DT port node of the LVDS source or sink
462 * Convert DT "data-mapping" property string value into media bus format value.
465 * * MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - data-mapping is "jeida-18"
466 * * MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA - data-mapping is "jeida-24"
467 * * MEDIA_BUS_FMT_RGB101010_1X7X5_JEIDA - data-mapping is "jeida-30"
468 * * MEDIA_BUS_FMT_RGB888_1X7X4_SPWG - data-mapping is "vesa-24"
469 * * MEDIA_BUS_FMT_RGB101010_1X7X5_SPWG - data-mapping is "vesa-30"
470 * * -EINVAL - the "data-mapping" property is unsupported
471 * * -ENODEV - the "data-mapping" property is missing
478 ret = of_property_read_string(port, "data-mapping", &mapping); in drm_of_lvds_get_data_mapping()
480 return -ENODEV; in drm_of_lvds_get_data_mapping()
482 if (!strcmp(mapping, "jeida-18")) in drm_of_lvds_get_data_mapping()
484 if (!strcmp(mapping, "jeida-24")) in drm_of_lvds_get_data_mapping()
486 if (!strcmp(mapping, "jeida-30")) in drm_of_lvds_get_data_mapping()
488 if (!strcmp(mapping, "vesa-24")) in drm_of_lvds_get_data_mapping()
490 if (!strcmp(mapping, "vesa-30")) in drm_of_lvds_get_data_mapping()
493 return -EINVAL; in drm_of_lvds_get_data_mapping()
498 * drm_of_get_data_lanes_count - Get DSI/(e)DP data lane count
499 * @endpoint: DT endpoint node of the DSI/(e)DP source or sink
503 * Count DT "data-lanes" property elements and check for validity.
506 * * min..max - positive integer count of "data-lanes" elements
507 * * -ve - the "data-lanes" property is missing or invalid
508 * * -EINVAL - the "data-lanes" property is unsupported
515 ret = of_property_count_u32_elems(endpoint, "data-lanes"); in drm_of_get_data_lanes_count()
520 return -EINVAL; in drm_of_get_data_lanes_count()
527 * drm_of_get_data_lanes_count_ep - Get DSI/(e)DP data lane count by endpoint
528 * @port: DT port node of the DSI/(e)DP source or sink
529 * @port_reg: identifier (value of reg property) of the parent port node
530 * @reg: identifier (value of reg property) of the endpoint node
534 * Count DT "data-lanes" property elements and check for validity.
538 * * min..max - positive integer count of "data-lanes" elements
539 * * -EINVAL - the "data-mapping" property is unsupported
540 * * -ENODEV - the "data-mapping" property is missing
561 * drm_of_get_dsi_bus - find the DSI bus for a given device
565 * than MIPI-DCS (SPI, I2C, etc.) using the Device Tree.
569 * Returns pointer to mipi_dsi_host if successful, -EINVAL if the
570 * request is unsupported, -EPROBE_DEFER if the DSI host is found but
571 * not available, or -ENODEV otherwise.
581 endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1); in drm_of_get_dsi_bus()
583 return ERR_PTR(-ENODEV); in drm_of_get_dsi_bus()
586 * Follow the first endpoint to get the DSI host node and then in drm_of_get_dsi_bus()
592 return ERR_PTR(-ENODEV); in drm_of_get_dsi_bus()
595 * Get the DSI host from the DSI host node. If we get an error in drm_of_get_dsi_bus()
597 * yet. Release the DSI host node since we're done with it. in drm_of_get_dsi_bus()
602 return ERR_PTR(-EPROBE_DEFER); in drm_of_get_dsi_bus()