From 244b2c5ca8b14627e4a17755e5922221e121c771 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 09 Oct 2024 06:15:07 +0000
Subject: [PATCH] change system file
---
kernel/drivers/gpu/drm/drm_of.c | 83 ++++++++++++++++-------------------------
1 files changed, 33 insertions(+), 50 deletions(-)
diff --git a/kernel/drivers/gpu/drm/drm_of.c b/kernel/drivers/gpu/drm/drm_of.c
index f7d4cd2..997b882 100644
--- a/kernel/drivers/gpu/drm/drm_of.c
+++ b/kernel/drivers/gpu/drm/drm_of.c
@@ -1,13 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-only
#include <linux/component.h>
#include <linux/export.h>
#include <linux/list.h>
#include <linux/of_graph.h>
-#include <drm/drmP.h>
+
#include <drm/drm_bridge.h>
#include <drm/drm_crtc.h>
+#include <drm/drm_device.h>
#include <drm/drm_encoder.h>
-#include <drm/drm_panel.h>
#include <drm/drm_of.h>
+#include <drm/drm_panel.h>
/**
* DOC: overview
@@ -64,11 +66,6 @@
uint32_t possible_crtcs = 0;
for_each_endpoint_of_node(port, ep) {
- if (!of_device_is_available(ep)) {
- of_node_put(ep);
- continue;
- }
-
remote_port = of_graph_get_remote_port(ep);
if (!remote_port) {
of_node_put(ep);
@@ -222,9 +219,11 @@
}
EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
-/*
+/**
* drm_of_find_panel_or_bridge - return connected panel or bridge device
* @np: device tree node containing encoder output ports
+ * @port: port in the device tree node
+ * @endpoint: endpoint in the device tree node
* @panel: pointer to hold returned drm_panel
* @bridge: pointer to hold returned drm_bridge
*
@@ -247,14 +246,18 @@
if (panel)
*panel = NULL;
+ /*
+ * of_graph_get_remote_node() produces a noisy error message if port
+ * node isn't found and the absence of the port is a legit case here,
+ * so at first we silently check whether graph presents in the
+ * device-tree node.
+ */
+ if (!of_graph_is_present(np))
+ return -ENODEV;
+
remote = of_graph_get_remote_node(np, port, endpoint);
if (!remote)
return -ENODEV;
-
- if (!of_device_is_available(remote)) {
- of_node_put(remote);
- return -ENODEV;
- }
if (panel) {
*panel = of_drm_find_panel(remote);
@@ -284,8 +287,6 @@
enum drm_of_lvds_pixels {
DRM_OF_LVDS_EVEN = BIT(0),
DRM_OF_LVDS_ODD = BIT(1),
- DRM_OF_LVDS_LEFT = BIT(2),
- DRM_OF_LVDS_RIGHT = BIT(3),
};
static int drm_of_lvds_get_port_pixels_type(struct device_node *port_node)
@@ -294,15 +295,9 @@
of_property_read_bool(port_node, "dual-lvds-even-pixels");
bool odd_pixels =
of_property_read_bool(port_node, "dual-lvds-odd-pixels");
- bool left_pixels =
- of_property_read_bool(port_node, "dual-lvds-left-pixels");
- bool right_pixels =
- of_property_read_bool(port_node, "dual-lvds-right-pixels");
return (even_pixels ? DRM_OF_LVDS_EVEN : 0) |
- (odd_pixels ? DRM_OF_LVDS_ODD : 0) |
- (left_pixels ? DRM_OF_LVDS_LEFT : 0) |
- (right_pixels ? DRM_OF_LVDS_RIGHT : 0);
+ (odd_pixels ? DRM_OF_LVDS_ODD : 0);
}
static int drm_of_lvds_get_remote_pixels_type(
@@ -320,7 +315,7 @@
remote_port = of_graph_get_remote_port(endpoint);
if (!remote_port) {
- of_node_put(remote_port);
+ of_node_put(endpoint);
return -EPIPE;
}
@@ -336,8 +331,10 @@
* configurations by passing the endpoints explicitly to
* drm_of_lvds_get_dual_link_pixel_order().
*/
- if (!current_pt || pixels_type != current_pt)
+ if (!current_pt || pixels_type != current_pt) {
+ of_node_put(endpoint);
return -EINVAL;
+ }
}
return pixels_type;
@@ -348,15 +345,13 @@
* @port1: First DT port node of the Dual-link LVDS source
* @port2: Second DT port node of the Dual-link LVDS source
*
- * An LVDS dual-link connection is made of two links, the two link can transmit
- * odd pixels and even pixels independently, or the two link can also transmit
- * left pixels and right pixels independently. This function returns for two
- * ports of an LVDS dual-link source, based on the requirements of the connected
- * sink.
+ * An LVDS dual-link connection is made of two links, with even pixels
+ * transitting on one link, and odd pixels on the other link. This function
+ * returns, for two ports of an LVDS dual-link source, which port shall transmit
+ * the even and odd pixels, based on the requirements of the connected sink.
*
- * The pixel order is determined from the dual-lvds-even-pixels +
- * dual-lvds-odd-pixels or dual-lvds-left-pixels + dual-lvds-right-pixels
- * properties in the sink's DT port nodes. If those
+ * The pixel order is determined from the dual-lvds-even-pixels and
+ * dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
* properties are not present, or if their usage is not valid, this function
* returns -EINVAL.
*
@@ -371,11 +366,6 @@
* carries odd pixels
* * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 carries odd pixels and @port2
* carries even pixels
- * * DRM_LVDS_DUAL_LINK_LEFT_RIGHT_PIXELS - @port1 carries left pixels and
- * @port2 carries right pixels
- * * DRM_LVDS_DUAL_LINK_RIGHT_LEFT_PIXELS - @port1 carries right pixels and
- * @port2 carries left pixels
-
* * -EINVAL - @port1 and @port2 are not connected to a dual-link LVDS sink, or
* the sink configuration is invalid
* * -EPIPE - when @port1 or @port2 are not connected
@@ -398,21 +388,14 @@
/*
* A valid dual-lVDS bus is found when one remote port is marked with
- * "dual-lvds-even-pixels" or "dual-lvds-left-pixels", and the other
- * remote port is marked with "dual-lvds-odd-pixels"or
- * "dual-lvds-right-pixels", bail out if the markers are not right.
+ * "dual-lvds-even-pixels", and the other remote port is marked with
+ * "dual-lvds-odd-pixels", bail out if the markers are not right.
*/
- if ((remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD) &&
- (remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_LEFT + DRM_OF_LVDS_RIGHT))
+ if (remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD)
return -EINVAL;
- if (remote_p1_pt == DRM_OF_LVDS_EVEN)
- return DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS;
- else if (remote_p1_pt == DRM_OF_LVDS_ODD)
- return DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS;
- else if (remote_p1_pt == DRM_OF_LVDS_LEFT)
- return DRM_LVDS_DUAL_LINK_LEFT_RIGHT_PIXELS;
- else
- return DRM_LVDS_DUAL_LINK_RIGHT_LEFT_PIXELS;
+ return remote_p1_pt == DRM_OF_LVDS_EVEN ?
+ DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS :
+ DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS;
}
EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order);
--
Gitblit v1.6.2