Lines Matching +full:remote +full:- +full:endpoint

1 // SPDX-License-Identifier: GPL-2.0-only
5 #include <linux/media-bus-format.h>
24 * drm_of_crtc_port_mask - find the mask of a registered CRTC by port OF node
38 if (tmp->port == port) in drm_of_crtc_port_mask()
49 * drm_of_find_possible_crtcs - find the possible CRTCs for an encoder port
82 * drm_of_component_match_add - Add a component helper OF node match rule
100 * drm_of_component_probe - Generic probe function for a component based master
116 struct device_node *ep, *port, *remote; in drm_of_component_probe() local
120 if (!dev->of_node) in drm_of_component_probe()
121 return -EINVAL; in drm_of_component_probe()
128 port = of_parse_phandle(dev->of_node, "ports", i); in drm_of_component_probe()
132 if (of_device_is_available(port->parent)) in drm_of_component_probe()
141 return -ENODEV; in drm_of_component_probe()
146 return -ENODEV; in drm_of_component_probe()
150 * For bound crtcs, bind the encoders attached to their remote endpoint in drm_of_component_probe()
153 port = of_parse_phandle(dev->of_node, "ports", i); in drm_of_component_probe()
157 if (!of_device_is_available(port->parent)) { in drm_of_component_probe()
163 remote = of_graph_get_remote_port_parent(ep); in drm_of_component_probe()
164 if (!remote || !of_device_is_available(remote)) { in drm_of_component_probe()
165 of_node_put(remote); in drm_of_component_probe()
167 } else if (!of_device_is_available(remote->parent)) { in drm_of_component_probe()
169 remote); in drm_of_component_probe()
170 of_node_put(remote); in drm_of_component_probe()
175 remote); in drm_of_component_probe()
176 of_node_put(remote); in drm_of_component_probe()
186 * drm_of_encoder_active_endpoint - return the active encoder endpoint
191 * parse the encoder endpoint connecting to the crtc port.
195 struct of_endpoint *endpoint) in drm_of_encoder_active_endpoint() argument
198 struct drm_crtc *crtc = encoder->crtc; in drm_of_encoder_active_endpoint()
203 return -EINVAL; in drm_of_encoder_active_endpoint()
208 if (port == crtc->port) { in drm_of_encoder_active_endpoint()
209 ret = of_graph_parse_endpoint(ep, endpoint); in drm_of_encoder_active_endpoint()
215 return -EINVAL; in drm_of_encoder_active_endpoint()
220 * drm_of_find_panel_or_bridge - return connected panel or bridge device
223 * @endpoint: endpoint in the device tree node
227 * Given a DT node's port and endpoint number, find the connected node and
237 int port, int endpoint, in drm_of_find_panel_or_bridge() argument
241 int ret = -EPROBE_DEFER; in drm_of_find_panel_or_bridge()
242 struct device_node *remote; in drm_of_find_panel_or_bridge() local
245 return -EINVAL; in drm_of_find_panel_or_bridge()
253 * device-tree node. in drm_of_find_panel_or_bridge()
256 return -ENODEV; in drm_of_find_panel_or_bridge()
258 remote = of_graph_get_remote_node(np, port, endpoint); in drm_of_find_panel_or_bridge()
259 if (!remote) in drm_of_find_panel_or_bridge()
260 return -ENODEV; in drm_of_find_panel_or_bridge()
263 *panel = of_drm_find_panel(remote); in drm_of_find_panel_or_bridge()
273 *bridge = of_drm_find_bridge(remote); in drm_of_find_panel_or_bridge()
282 of_node_put(remote); in drm_of_find_panel_or_bridge()
295 of_property_read_bool(port_node, "dual-lvds-even-pixels"); in drm_of_lvds_get_port_pixels_type()
297 of_property_read_bool(port_node, "dual-lvds-odd-pixels"); in drm_of_lvds_get_port_pixels_type()
306 struct device_node *endpoint = NULL; in drm_of_lvds_get_remote_pixels_type() local
307 int pixels_type = -EPIPE; in drm_of_lvds_get_remote_pixels_type()
309 for_each_child_of_node(port_node, endpoint) { in drm_of_lvds_get_remote_pixels_type()
313 if (!of_node_name_eq(endpoint, "endpoint")) in drm_of_lvds_get_remote_pixels_type()
316 remote_port = of_graph_get_remote_port(endpoint); in drm_of_lvds_get_remote_pixels_type()
318 of_node_put(endpoint); in drm_of_lvds_get_remote_pixels_type()
319 return -EPIPE; in drm_of_lvds_get_remote_pixels_type()
328 * Sanity check, ensure that all remote endpoints have the same in drm_of_lvds_get_remote_pixels_type()
330 * support multiple sinks with different dual-link in drm_of_lvds_get_remote_pixels_type()
335 of_node_put(endpoint); in drm_of_lvds_get_remote_pixels_type()
336 return -EINVAL; in drm_of_lvds_get_remote_pixels_type()
344 * drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link pixel order
345 * @port1: First DT port node of the Dual-link LVDS source
346 * @port2: Second DT port node of the Dual-link LVDS source
348 * An LVDS dual-link connection is made of two links, with even pixels
350 * returns, for two ports of an LVDS dual-link source, which port shall transmit
353 * The pixel order is determined from the dual-lvds-even-pixels and
354 * dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
356 * returns -EINVAL.
358 * If either port is not connected, this function returns -EPIPE.
365 * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 carries even pixels and @port2
367 * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 carries odd pixels and @port2
369 * * -EINVAL - @port1 and @port2 are not connected to a dual-link LVDS sink, or
371 * * -EPIPE - when @port1 or @port2 are not connected
379 return -EINVAL; in drm_of_lvds_get_dual_link_pixel_order()
390 * A valid dual-lVDS bus is found when one remote port is marked with in drm_of_lvds_get_dual_link_pixel_order()
391 * "dual-lvds-even-pixels", and the other remote port is marked with in drm_of_lvds_get_dual_link_pixel_order()
392 * "dual-lvds-odd-pixels", bail out if the markers are not right. in drm_of_lvds_get_dual_link_pixel_order()
395 return -EINVAL; in drm_of_lvds_get_dual_link_pixel_order()
404 * drm_of_lvds_get_data_mapping - Get LVDS data mapping
407 * Convert DT "data-mapping" property string value into media bus format value.
410 * * MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - data-mapping is "jeida-18"
411 * * MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA - data-mapping is "jeida-24"
412 * * MEDIA_BUS_FMT_RGB888_1X7X4_SPWG - data-mapping is "vesa-24"
413 * * -EINVAL - the "data-mapping" property is unsupported
414 * * -ENODEV - the "data-mapping" property is missing
421 ret = of_property_read_string(port, "data-mapping", &mapping); in drm_of_lvds_get_data_mapping()
423 return -ENODEV; in drm_of_lvds_get_data_mapping()
425 if (!strcmp(mapping, "jeida-18")) in drm_of_lvds_get_data_mapping()
427 if (!strcmp(mapping, "jeida-24")) in drm_of_lvds_get_data_mapping()
429 if (!strcmp(mapping, "vesa-24")) in drm_of_lvds_get_data_mapping()
432 return -EINVAL; in drm_of_lvds_get_data_mapping()
437 * drm_of_get_data_lanes_count - Get DSI/(e)DP data lane count
438 * @endpoint: DT endpoint node of the DSI/(e)DP source or sink
442 * Count DT "data-lanes" property elements and check for validity.
445 * * min..max - positive integer count of "data-lanes" elements
446 * * -ve - the "data-lanes" property is missing or invalid
447 * * -EINVAL - the "data-lanes" property is unsupported
449 int drm_of_get_data_lanes_count(const struct device_node *endpoint, in drm_of_get_data_lanes_count() argument
454 ret = of_property_count_u32_elems(endpoint, "data-lanes"); in drm_of_get_data_lanes_count()
459 return -EINVAL; in drm_of_get_data_lanes_count()
466 * drm_of_get_data_lanes_count_ep - Get DSI/(e)DP data lane count by endpoint
469 * @reg: identifier (value of reg property) of the endpoint node
473 * Count DT "data-lanes" property elements and check for validity.
474 * This variant uses endpoint specifier.
477 * * min..max - positive integer count of "data-lanes" elements
478 * * -EINVAL - the "data-mapping" property is unsupported
479 * * -ENODEV - the "data-mapping" property is missing
486 struct device_node *endpoint; in drm_of_get_data_lanes_count_ep() local
489 endpoint = of_graph_get_endpoint_by_regs(port, port_reg, reg); in drm_of_get_data_lanes_count_ep()
490 ret = drm_of_get_data_lanes_count(endpoint, min, max); in drm_of_get_data_lanes_count_ep()
491 of_node_put(endpoint); in drm_of_get_data_lanes_count_ep()