Lines Matching +full:port +full:- +full:endpoint

1 // SPDX-License-Identifier: GPL-2.0-only
5 #include <linux/media-bus-format.h>
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
33 struct device_node *port) in drm_of_crtc_port_mask() argument
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
52 * @port: encoder port to scan for endpoints
54 * Scan all endpoints attached to a port, locate their attached CRTCs,
61 struct device_node *port) in drm_of_find_possible_crtcs() argument
66 for_each_endpoint_of_node(port, ep) { in drm_of_find_possible_crtcs()
83 * drm_of_component_match_add - Add a component helper OF node match rule
101 * drm_of_component_probe - Generic probe function for a component based master
117 struct device_node *ep, *port, *remote; in drm_of_component_probe() local
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()
130 if (!port) in drm_of_component_probe()
133 if (of_device_is_available(port->parent)) in drm_of_component_probe()
135 port); in drm_of_component_probe()
137 of_node_put(port); in drm_of_component_probe()
142 return -ENODEV; in drm_of_component_probe()
146 dev_err(dev, "no available port\n"); in drm_of_component_probe()
147 return -ENODEV; in drm_of_component_probe()
151 * For bound crtcs, bind the encoders attached to their remote endpoint in drm_of_component_probe()
154 port = of_parse_phandle(dev->of_node, "ports", i); in drm_of_component_probe()
155 if (!port) in drm_of_component_probe()
158 if (!of_device_is_available(port->parent)) { in drm_of_component_probe()
159 of_node_put(port); in drm_of_component_probe()
163 for_each_child_of_node(port, ep) { in drm_of_component_probe()
168 } else if (!of_device_is_available(remote->parent)) { in drm_of_component_probe()
179 of_node_put(port); in drm_of_component_probe()
187 * drm_of_encoder_active_endpoint - return the active encoder endpoint
192 * parse the encoder endpoint connecting to the crtc port.
196 struct of_endpoint *endpoint) in drm_of_encoder_active_endpoint() argument
199 struct drm_crtc *crtc = encoder->crtc; in drm_of_encoder_active_endpoint()
200 struct device_node *port; in drm_of_encoder_active_endpoint() local
204 return -EINVAL; in drm_of_encoder_active_endpoint()
207 port = of_graph_get_remote_port(ep); in drm_of_encoder_active_endpoint()
208 of_node_put(port); in drm_of_encoder_active_endpoint()
209 if (port == crtc->port) { in drm_of_encoder_active_endpoint()
210 ret = of_graph_parse_endpoint(ep, endpoint); 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
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
238 int port, int endpoint, in drm_of_find_panel_or_bridge() argument
242 int ret = -EPROBE_DEFER; in drm_of_find_panel_or_bridge()
246 return -EINVAL; in drm_of_find_panel_or_bridge()
251 * of_graph_get_remote_node() produces a noisy error message if port 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()
259 remote = of_graph_get_remote_node(np, port, endpoint); 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()
307 struct device_node *endpoint = NULL; in drm_of_lvds_get_remote_pixels_type() local
308 int pixels_type = -EPIPE; in drm_of_lvds_get_remote_pixels_type()
310 for_each_child_of_node(port_node, endpoint) { in drm_of_lvds_get_remote_pixels_type()
314 if (!of_node_name_eq(endpoint, "endpoint")) in drm_of_lvds_get_remote_pixels_type()
317 remote_port = of_graph_get_remote_port(endpoint); in drm_of_lvds_get_remote_pixels_type()
319 of_node_put(endpoint); 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()
336 of_node_put(endpoint); in drm_of_lvds_get_remote_pixels_type()
337 return -EINVAL; in drm_of_lvds_get_remote_pixels_type()
345 * drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link pixel order
346 * @port1: First DT port node of the Dual-link LVDS source
347 * @port2: Second DT port node of the Dual-link LVDS source
349 * An LVDS dual-link connection is made of two links, with even pixels
351 * returns, for two ports of an LVDS dual-link source, which port shall transmit
354 * The pixel order is determined from the dual-lvds-even-pixels and
355 * dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
357 * returns -EINVAL.
359 * If either port is not connected, this function returns -EPIPE.
366 * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 carries even pixels and @port2
368 * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 carries odd pixels and @port2
370 * * -EINVAL - @port1 and @port2 are not connected to a dual-link LVDS sink, or
372 * * -EPIPE - when @port1 or @port2 are not connected
380 return -EINVAL; in drm_of_lvds_get_dual_link_pixel_order()
391 * A valid dual-lVDS bus is found when one remote port is marked with in drm_of_lvds_get_dual_link_pixel_order()
392 * "dual-lvds-even-pixels", and the other remote port is marked with in drm_of_lvds_get_dual_link_pixel_order()
393 * "dual-lvds-odd-pixels", bail out if the markers are not right. in drm_of_lvds_get_dual_link_pixel_order()
396 return -EINVAL; in drm_of_lvds_get_dual_link_pixel_order()
405 * drm_of_lvds_get_data_mapping - Get LVDS data mapping
406 * @port: DT port node of the LVDS source or sink
408 * Convert DT "data-mapping" property string value into media bus format value.
411 * * MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - data-mapping is "jeida-18"
412 * * MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA - data-mapping is "jeida-24"
413 * * MEDIA_BUS_FMT_RGB888_1X7X4_SPWG - data-mapping is "vesa-24"
414 * * -EINVAL - the "data-mapping" property is unsupported
415 * * -ENODEV - the "data-mapping" property is missing
417 int drm_of_lvds_get_data_mapping(const struct device_node *port) in drm_of_lvds_get_data_mapping() argument
422 ret = of_property_read_string(port, "data-mapping", &mapping); in drm_of_lvds_get_data_mapping()
424 return -ENODEV; in drm_of_lvds_get_data_mapping()
426 if (!strcmp(mapping, "jeida-18")) in drm_of_lvds_get_data_mapping()
428 if (!strcmp(mapping, "jeida-24")) in drm_of_lvds_get_data_mapping()
430 if (!strcmp(mapping, "vesa-24")) in drm_of_lvds_get_data_mapping()
433 return -EINVAL; in drm_of_lvds_get_data_mapping()
438 * drm_of_get_data_lanes_count - Get DSI/(e)DP data lane count
439 * @endpoint: DT endpoint node of the DSI/(e)DP source or sink
443 * Count DT "data-lanes" property elements and check for validity.
446 * * min..max - positive integer count of "data-lanes" elements
447 * * -ve - the "data-lanes" property is missing or invalid
448 * * -EINVAL - the "data-lanes" property is unsupported
450 int drm_of_get_data_lanes_count(const struct device_node *endpoint, in drm_of_get_data_lanes_count() argument
455 ret = of_property_count_u32_elems(endpoint, "data-lanes"); in drm_of_get_data_lanes_count()
460 return -EINVAL; in drm_of_get_data_lanes_count()
467 * drm_of_get_data_lanes_count_ep - Get DSI/(e)DP data lane count by endpoint
468 * @port: DT port node of the DSI/(e)DP source or sink
469 * @port_reg: identifier (value of reg property) of the parent port node
470 * @reg: identifier (value of reg property) of the endpoint node
474 * Count DT "data-lanes" property elements and check for validity.
475 * This variant uses endpoint specifier.
478 * * min..max - positive integer count of "data-lanes" elements
479 * * -EINVAL - the "data-mapping" property is unsupported
480 * * -ENODEV - the "data-mapping" property is missing
482 int drm_of_get_data_lanes_count_ep(const struct device_node *port, in drm_of_get_data_lanes_count_ep() argument
487 struct device_node *endpoint; in drm_of_get_data_lanes_count_ep() local
490 endpoint = of_graph_get_endpoint_by_regs(port, port_reg, reg); in drm_of_get_data_lanes_count_ep()
491 ret = drm_of_get_data_lanes_count(endpoint, min, max); in drm_of_get_data_lanes_count_ep()
492 of_node_put(endpoint); in drm_of_get_data_lanes_count_ep()
501 * drm_of_get_dsi_bus - find the DSI bus for a given device
505 * than MIPI-DCS (SPI, I2C, etc.) using the Device Tree.
507 * Returns pointer to mipi_dsi_host if successful, -EINVAL if the
508 * request is unsupported, -EPROBE_DEFER if the DSI host is found but
509 * not available, or -ENODEV otherwise.
514 struct device_node *endpoint, *dsi_host_node; in drm_of_get_dsi_bus() local
517 * Get first endpoint child from device. in drm_of_get_dsi_bus()
519 endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); in drm_of_get_dsi_bus()
520 if (!endpoint) in drm_of_get_dsi_bus()
521 return ERR_PTR(-ENODEV); in drm_of_get_dsi_bus()
524 * Follow the first endpoint to get the DSI host node and then in drm_of_get_dsi_bus()
525 * release the endpoint since we no longer need it. in drm_of_get_dsi_bus()
527 dsi_host_node = of_graph_get_remote_port_parent(endpoint); in drm_of_get_dsi_bus()
528 of_node_put(endpoint); in drm_of_get_dsi_bus()
530 return ERR_PTR(-ENODEV); in drm_of_get_dsi_bus()
540 return ERR_PTR(-EPROBE_DEFER); in drm_of_get_dsi_bus()